@govuk-react/primitives 0.2.0 → 0.3.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 (267) hide show
  1. package/README.md +100 -25
  2. package/dist/{accordion-element.d.ts → accordion/element.d.ts} +5 -5
  3. package/dist/accordion/element.js +302 -0
  4. package/dist/accordion/element.js.map +1 -0
  5. package/dist/accordion/index.d.ts +70 -0
  6. package/dist/accordion/index.js +140 -0
  7. package/dist/accordion/index.js.map +1 -0
  8. package/dist/auto-focus/element.d.ts +1 -0
  9. package/dist/auto-focus/element.js +75 -0
  10. package/dist/auto-focus/element.js.map +1 -0
  11. package/dist/auto-focus/index.d.ts +15 -0
  12. package/dist/auto-focus/index.js +39 -0
  13. package/dist/auto-focus/index.js.map +1 -0
  14. package/dist/{autocomplete-element.d.ts → autocomplete/element.d.ts} +11 -11
  15. package/dist/autocomplete/element.js +597 -0
  16. package/dist/autocomplete/element.js.map +1 -0
  17. package/dist/{index-D7lMYMUR.d.ts → autocomplete/index.d.ts} +39 -62
  18. package/dist/autocomplete/index.js +100 -0
  19. package/dist/autocomplete/index.js.map +1 -0
  20. package/dist/button/element.d.ts +1 -0
  21. package/dist/button/element.js +59 -0
  22. package/dist/button/element.js.map +1 -0
  23. package/dist/button/index.d.ts +10 -0
  24. package/dist/button/index.js +9 -0
  25. package/dist/button/index.js.map +1 -0
  26. package/dist/character-count/element.d.ts +12 -0
  27. package/dist/character-count/element.js +287 -0
  28. package/dist/character-count/element.js.map +1 -0
  29. package/dist/character-count/index.d.ts +57 -0
  30. package/dist/character-count/index.js +79 -0
  31. package/dist/character-count/index.js.map +1 -0
  32. package/dist/character-count/messages.d.ts +20 -0
  33. package/dist/character-count/messages.js +54 -0
  34. package/dist/character-count/messages.js.map +1 -0
  35. package/dist/choices/element.d.ts +10 -0
  36. package/dist/choices/element.js +177 -0
  37. package/dist/choices/element.js.map +1 -0
  38. package/dist/{index-WuGvkTxu.d.ts → choices/index.d.ts} +30 -44
  39. package/dist/choices/index.js +37 -0
  40. package/dist/choices/index.js.map +1 -0
  41. package/dist/{disclosure-element.d.ts → disclosure/element.d.ts} +5 -5
  42. package/dist/disclosure/element.js +132 -0
  43. package/dist/disclosure/element.js.map +1 -0
  44. package/dist/{index-D4Gzyvfu.d.ts → disclosure/index.d.ts} +43 -56
  45. package/dist/disclosure/index.js +76 -0
  46. package/dist/disclosure/index.js.map +1 -0
  47. package/dist/exit-this-page/element.d.ts +19 -0
  48. package/dist/exit-this-page/element.js +200 -0
  49. package/dist/exit-this-page/element.js.map +1 -0
  50. package/dist/{index-qF0jIQCW.d.ts → exit-this-page/index.d.ts} +44 -68
  51. package/dist/exit-this-page/index.js +54 -0
  52. package/dist/exit-this-page/index.js.map +1 -0
  53. package/dist/file-upload/element.d.ts +28 -0
  54. package/dist/file-upload/element.js +270 -0
  55. package/dist/file-upload/element.js.map +1 -0
  56. package/dist/file-upload/index.d.ts +46 -0
  57. package/dist/file-upload/index.js +65 -0
  58. package/dist/file-upload/index.js.map +1 -0
  59. package/dist/focus-links/element.d.ts +1 -0
  60. package/dist/focus-links/element.js +90 -0
  61. package/dist/focus-links/element.js.map +1 -0
  62. package/dist/{index-BR3MAGF8.d.ts → focus-links/index.d.ts} +24 -35
  63. package/dist/focus-links/index.js +7 -0
  64. package/dist/focus-links/index.js.map +1 -0
  65. package/dist/index.d.ts +13 -17
  66. package/dist/index.js +13 -72
  67. package/dist/index.js.map +1 -1
  68. package/dist/inline/accordion-element.js +1 -1
  69. package/dist/inline/auto-focus-element.js +1 -1
  70. package/dist/inline/autocomplete-element.js +1 -1
  71. package/dist/inline/character-count-element.js +1 -1
  72. package/dist/inline/choices-element.js +1 -1
  73. package/dist/inline/disclosure-element.js +1 -1
  74. package/dist/inline/exit-this-page-element.js +1 -1
  75. package/dist/inline/file-upload-element.js +1 -1
  76. package/dist/inline/focus-links-element.js +1 -1
  77. package/dist/inline/modal-element.js +1 -1
  78. package/dist/inline/password-input-element.js +1 -1
  79. package/dist/inline/tabs-element.js +1 -1
  80. package/dist/inline-script/index.d.ts +26 -0
  81. package/dist/inline-script/index.js +31 -0
  82. package/dist/inline-script/index.js.map +1 -0
  83. package/dist/{modal-element.d.ts → modal/element.d.ts} +2 -4
  84. package/dist/modal/element.js +229 -0
  85. package/dist/modal/element.js.map +1 -0
  86. package/dist/modal/index.d.ts +41 -0
  87. package/dist/modal/index.js +145 -0
  88. package/dist/modal/index.js.map +1 -0
  89. package/dist/password-input/element.d.ts +1 -0
  90. package/dist/password-input/element.js +150 -0
  91. package/dist/password-input/element.js.map +1 -0
  92. package/dist/{index-sEHnx4-M.d.ts → password-input/index.d.ts} +33 -49
  93. package/dist/password-input/index.js +37 -0
  94. package/dist/password-input/index.js.map +1 -0
  95. package/dist/styles.css +11 -0
  96. package/dist/{tabs-element.d.ts → tabs/element.d.ts} +5 -5
  97. package/dist/tabs/element.js +423 -0
  98. package/dist/tabs/element.js.map +1 -0
  99. package/dist/tabs/index.d.ts +74 -0
  100. package/dist/tabs/index.js +142 -0
  101. package/dist/tabs/index.js.map +1 -0
  102. package/dist/utils/change-details.d.ts +11 -0
  103. package/dist/utils/change-details.js +3 -0
  104. package/dist/utils/change-details.js.map +1 -0
  105. package/dist/utils/dom.d.ts +9 -0
  106. package/dist/utils/dom.js +27 -0
  107. package/dist/utils/dom.js.map +1 -0
  108. package/dist/utils/on-property-change.d.ts +7 -0
  109. package/dist/utils/on-property-change.js +19 -0
  110. package/dist/utils/on-property-change.js.map +1 -0
  111. package/dist/utils/set-focus.d.ts +11 -0
  112. package/dist/utils/set-focus.js +38 -0
  113. package/dist/utils/set-focus.js.map +1 -0
  114. package/dist/utils/set-up-when-ready.d.ts +6 -0
  115. package/dist/utils/set-up-when-ready.js +16 -0
  116. package/dist/utils/set-up-when-ready.js.map +1 -0
  117. package/dist/utils/slot.d.ts +15 -0
  118. package/dist/utils/slot.js +62 -0
  119. package/dist/utils/slot.js.map +1 -0
  120. package/dist/utils/translation.d.ts +13 -0
  121. package/dist/utils/translation.js +57 -0
  122. package/dist/utils/translation.js.map +1 -0
  123. package/package.json +17 -4
  124. package/dist/accordion-element.js +0 -9
  125. package/dist/accordion-element.js.map +0 -1
  126. package/dist/accordion.d.ts +0 -2
  127. package/dist/accordion.js +0 -34
  128. package/dist/accordion.js.map +0 -1
  129. package/dist/auto-focus-element.d.ts +0 -3
  130. package/dist/auto-focus-element.js +0 -10
  131. package/dist/auto-focus-element.js.map +0 -1
  132. package/dist/auto-focus.d.ts +0 -2
  133. package/dist/auto-focus.js +0 -15
  134. package/dist/auto-focus.js.map +0 -1
  135. package/dist/autocomplete-element.js +0 -12
  136. package/dist/autocomplete-element.js.map +0 -1
  137. package/dist/autocomplete.d.ts +0 -4
  138. package/dist/autocomplete.js +0 -25
  139. package/dist/autocomplete.js.map +0 -1
  140. package/dist/button-element.d.ts +0 -2
  141. package/dist/button-element.js +0 -3
  142. package/dist/button-element.js.map +0 -1
  143. package/dist/button.d.ts +0 -2
  144. package/dist/button.js +0 -12
  145. package/dist/button.js.map +0 -1
  146. package/dist/character-count-element.d.ts +0 -10
  147. package/dist/character-count-element.js +0 -10
  148. package/dist/character-count-element.js.map +0 -1
  149. package/dist/character-count.d.ts +0 -3
  150. package/dist/character-count.js +0 -26
  151. package/dist/character-count.js.map +0 -1
  152. package/dist/choices-element.d.ts +0 -8
  153. package/dist/choices-element.js +0 -9
  154. package/dist/choices-element.js.map +0 -1
  155. package/dist/choices.d.ts +0 -2
  156. package/dist/choices.js +0 -16
  157. package/dist/choices.js.map +0 -1
  158. package/dist/chunk-2IHAQAYF.js +0 -23
  159. package/dist/chunk-2IHAQAYF.js.map +0 -1
  160. package/dist/chunk-2ZJVSNC2.js +0 -31
  161. package/dist/chunk-2ZJVSNC2.js.map +0 -1
  162. package/dist/chunk-47NMY4SS.js +0 -108
  163. package/dist/chunk-47NMY4SS.js.map +0 -1
  164. package/dist/chunk-4XAR4FFG.js +0 -83
  165. package/dist/chunk-4XAR4FFG.js.map +0 -1
  166. package/dist/chunk-5HWRMQK2.js +0 -91
  167. package/dist/chunk-5HWRMQK2.js.map +0 -1
  168. package/dist/chunk-6ZFU4VYW.js +0 -41
  169. package/dist/chunk-6ZFU4VYW.js.map +0 -1
  170. package/dist/chunk-B2I4J5NL.js +0 -264
  171. package/dist/chunk-B2I4J5NL.js.map +0 -1
  172. package/dist/chunk-DPERPCUH.js +0 -188
  173. package/dist/chunk-DPERPCUH.js.map +0 -1
  174. package/dist/chunk-ECYGKE4D.js +0 -168
  175. package/dist/chunk-ECYGKE4D.js.map +0 -1
  176. package/dist/chunk-ESBMTI25.js +0 -11
  177. package/dist/chunk-ESBMTI25.js.map +0 -1
  178. package/dist/chunk-ET7DCQM7.js +0 -133
  179. package/dist/chunk-ET7DCQM7.js.map +0 -1
  180. package/dist/chunk-F5XFC4QJ.js +0 -177
  181. package/dist/chunk-F5XFC4QJ.js.map +0 -1
  182. package/dist/chunk-GVGBDSDN.js +0 -78
  183. package/dist/chunk-GVGBDSDN.js.map +0 -1
  184. package/dist/chunk-IZQ2C4BC.js +0 -351
  185. package/dist/chunk-IZQ2C4BC.js.map +0 -1
  186. package/dist/chunk-L7E6GN2D.js +0 -87
  187. package/dist/chunk-L7E6GN2D.js.map +0 -1
  188. package/dist/chunk-LWIA644X.js +0 -34
  189. package/dist/chunk-LWIA644X.js.map +0 -1
  190. package/dist/chunk-NX4B3NKM.js +0 -35
  191. package/dist/chunk-NX4B3NKM.js.map +0 -1
  192. package/dist/chunk-PNWPGD7B.js +0 -68
  193. package/dist/chunk-PNWPGD7B.js.map +0 -1
  194. package/dist/chunk-QLQ6O7OW.js +0 -111
  195. package/dist/chunk-QLQ6O7OW.js.map +0 -1
  196. package/dist/chunk-RDUPELOK.js +0 -55
  197. package/dist/chunk-RDUPELOK.js.map +0 -1
  198. package/dist/chunk-RPMHI67T.js +0 -104
  199. package/dist/chunk-RPMHI67T.js.map +0 -1
  200. package/dist/chunk-TE4RUYVK.js +0 -97
  201. package/dist/chunk-TE4RUYVK.js.map +0 -1
  202. package/dist/chunk-TJVBFRIE.js +0 -60
  203. package/dist/chunk-TJVBFRIE.js.map +0 -1
  204. package/dist/chunk-U5OKNKYC.js +0 -510
  205. package/dist/chunk-U5OKNKYC.js.map +0 -1
  206. package/dist/chunk-UXJO4AJP.js +0 -290
  207. package/dist/chunk-UXJO4AJP.js.map +0 -1
  208. package/dist/chunk-VNXXENCU.js +0 -39
  209. package/dist/chunk-VNXXENCU.js.map +0 -1
  210. package/dist/chunk-XGK73UCD.js +0 -62
  211. package/dist/chunk-XGK73UCD.js.map +0 -1
  212. package/dist/chunk-XJYLFTYE.js +0 -157
  213. package/dist/chunk-XJYLFTYE.js.map +0 -1
  214. package/dist/chunk-YCESNTXQ.js +0 -241
  215. package/dist/chunk-YCESNTXQ.js.map +0 -1
  216. package/dist/chunk-ZTJLVNR4.js +0 -62
  217. package/dist/chunk-ZTJLVNR4.js.map +0 -1
  218. package/dist/disclosure-element.js +0 -9
  219. package/dist/disclosure-element.js.map +0 -1
  220. package/dist/disclosure.d.ts +0 -2
  221. package/dist/disclosure.js +0 -16
  222. package/dist/disclosure.js.map +0 -1
  223. package/dist/exit-this-page-element.d.ts +0 -22
  224. package/dist/exit-this-page-element.js +0 -13
  225. package/dist/exit-this-page-element.js.map +0 -1
  226. package/dist/exit-this-page.d.ts +0 -3
  227. package/dist/exit-this-page.js +0 -25
  228. package/dist/exit-this-page.js.map +0 -1
  229. package/dist/file-upload-element.d.ts +0 -27
  230. package/dist/file-upload-element.js +0 -14
  231. package/dist/file-upload-element.js.map +0 -1
  232. package/dist/file-upload.d.ts +0 -3
  233. package/dist/file-upload.js +0 -25
  234. package/dist/file-upload.js.map +0 -1
  235. package/dist/focus-links-element.d.ts +0 -3
  236. package/dist/focus-links-element.js +0 -10
  237. package/dist/focus-links-element.js.map +0 -1
  238. package/dist/focus-links.d.ts +0 -2
  239. package/dist/focus-links.js +0 -12
  240. package/dist/focus-links.js.map +0 -1
  241. package/dist/index--FxJgSOS.d.ts +0 -108
  242. package/dist/index-Bul0NJh_.d.ts +0 -310
  243. package/dist/index-CikOyFud.d.ts +0 -54
  244. package/dist/index-D8N5vxTL.d.ts +0 -90
  245. package/dist/index-DMWpkC_d.d.ts +0 -105
  246. package/dist/index-DN7fGMc3.d.ts +0 -20
  247. package/dist/index-DPXR1Yua.d.ts +0 -69
  248. package/dist/inline-script.d.ts +0 -29
  249. package/dist/inline-script.js +0 -63
  250. package/dist/inline-script.js.map +0 -1
  251. package/dist/modal-element.js +0 -11
  252. package/dist/modal-element.js.map +0 -1
  253. package/dist/modal.d.ts +0 -2
  254. package/dist/modal.js +0 -20
  255. package/dist/modal.js.map +0 -1
  256. package/dist/password-input-element.d.ts +0 -3
  257. package/dist/password-input-element.js +0 -9
  258. package/dist/password-input-element.js.map +0 -1
  259. package/dist/password-input.d.ts +0 -2
  260. package/dist/password-input.js +0 -18
  261. package/dist/password-input.js.map +0 -1
  262. package/dist/tabs-element.js +0 -9
  263. package/dist/tabs-element.js.map +0 -1
  264. package/dist/tabs.d.ts +0 -2
  265. package/dist/tabs.js +0 -28
  266. package/dist/tabs.js.map +0 -1
  267. package/dist/translation-BnpO2mN2.d.ts +0 -4
@@ -1,105 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps } from 'react';
3
-
4
- /**
5
- * Hides the parts the element hides, over styles that set their `display`. Root renders it
6
- * inline; under a strict CSP, add it to a stylesheet instead.
7
- */
8
- declare const accordionCss = "govuk-react-accordion :is([data-accordion-fallback],[data-accordion-trigger],[data-accordion-controls])[hidden]{display:none!important}";
9
- type RootProps = Omit<React.HTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange'> & {
10
- /** The open sections' values, to control them once hydrated. */
11
- value?: string[];
12
- /** The sections open at first. */
13
- defaultValue?: string[];
14
- /** Called with the open sections' values when the user opens or closes a section. */
15
- onValueChange?: (value: string[]) => void;
16
- /** Whether to remember the open sections for the rest of the session, keyed by content id. Defaults to `true`, as in govuk-frontend. */
17
- rememberExpanded?: boolean;
18
- /** Each button's text while its section is closed. Defaults to "Show". */
19
- showSectionText?: string;
20
- /** Each button's text while its section is open. Defaults to "Hide". */
21
- hideSectionText?: string;
22
- /** The end of each button's accessible name while its section is closed. Defaults to "Show this section". */
23
- showSectionLabel?: string;
24
- /** The end of each button's accessible name while its section is open. Defaults to "Hide this section". */
25
- hideSectionLabel?: string;
26
- /** The "show all" button's text while a section is closed. Defaults to "Show all sections". */
27
- showAllSectionsText?: string;
28
- /** The "show all" button's text while every section is open. Defaults to "Hide all sections". */
29
- hideAllSectionsText?: string;
30
- /** Classes added to the element when it upgrades. */
31
- upgradedClass?: string;
32
- /** Classes added to open sections. */
33
- expandedSectionClass?: string;
34
- /** Classes added to the icons of closed sections, and the "show all" icon while a section is closed. */
35
- collapsedIconClass?: string;
36
- };
37
- declare function Root({ value, defaultValue, onValueChange, rememberExpanded, showSectionText, hideSectionText, showSectionLabel, hideSectionLabel, showAllSectionsText, hideAllSectionsText, upgradedClass, expandedSectionClass, collapsedIconClass, children, ...props }: RootProps): React.JSX.Element;
38
- type PartProps<E extends keyof React.JSX.IntrinsicElements> = ComponentProps<E> & {
39
- /** Render the only child instead, with this part's props merged onto it. */
40
- asChild?: boolean;
41
- };
42
- type ControlsProps = PartProps<'div'>;
43
- /** Holds the "show all" button. Hidden until the element upgrades. */
44
- declare function Controls({ asChild, ...props }: ControlsProps): React.JSX.Element;
45
- type ShowAllProps = PartProps<'button'>;
46
- /** Shows every section, or hides every section when all are open. */
47
- declare function ShowAll({ asChild, ...props }: ShowAllProps): React.JSX.Element;
48
- type ShowAllTextProps = PartProps<'span'>;
49
- /** The "show all" button's text, which the element sets. */
50
- declare function ShowAllText({ asChild, children, ...props }: ShowAllTextProps): React.JSX.Element;
51
- type SectionProps = PartProps<'div'> & {
52
- value: string;
53
- /** Whether it's open at first. Defaults to whether Root's value includes it. */
54
- defaultExpanded?: boolean;
55
- };
56
- declare function Section({ asChild, value, defaultExpanded, ...props }: SectionProps): React.JSX.Element;
57
- type FallbackProps = PartProps<'span'>;
58
- /** What shows without JavaScript in place of the trigger, such as the plain heading. Hidden on upgrade. */
59
- declare function Fallback({ asChild, ...props }: FallbackProps): React.JSX.Element;
60
- type TriggerProps = PartProps<'button'>;
61
- /** The button that shows and hides its section. Hidden until the element upgrades. */
62
- declare function Trigger({ asChild, ...props }: TriggerProps): React.JSX.Element;
63
- type LabelProps = PartProps<'span'>;
64
- /** Text in the trigger that names it, such as the heading or summary. */
65
- declare function Label({ asChild, ...props }: LabelProps): React.JSX.Element;
66
- type ToggleTextProps = PartProps<'span'>;
67
- /** The trigger's show or hide text, which the element sets. */
68
- declare function ToggleText({ asChild, children, ...props }: ToggleTextProps): React.JSX.Element;
69
- type IconProps = PartProps<'span'>;
70
- /** An icon in a trigger or the "show all" button, given `collapsedIconClass` while closed. */
71
- declare function Icon({ asChild, ...props }: IconProps): React.JSX.Element;
72
- type ContentProps = PartProps<'div'>;
73
- /** The section's content. Give it an id, which the trigger's `aria-controls` names. */
74
- declare function Content({ asChild, ...props }: ContentProps): React.JSX.Element;
75
-
76
- declare const index_Content: typeof Content;
77
- type index_ContentProps = ContentProps;
78
- declare const index_Controls: typeof Controls;
79
- type index_ControlsProps = ControlsProps;
80
- declare const index_Fallback: typeof Fallback;
81
- type index_FallbackProps = FallbackProps;
82
- declare const index_Icon: typeof Icon;
83
- type index_IconProps = IconProps;
84
- declare const index_Label: typeof Label;
85
- type index_LabelProps = LabelProps;
86
- declare const index_Root: typeof Root;
87
- type index_RootProps = RootProps;
88
- declare const index_Section: typeof Section;
89
- type index_SectionProps = SectionProps;
90
- declare const index_ShowAll: typeof ShowAll;
91
- type index_ShowAllProps = ShowAllProps;
92
- declare const index_ShowAllText: typeof ShowAllText;
93
- type index_ShowAllTextProps = ShowAllTextProps;
94
- declare const index_ToggleText: typeof ToggleText;
95
- type index_ToggleTextProps = ToggleTextProps;
96
- declare const index_Trigger: typeof Trigger;
97
- type index_TriggerProps = TriggerProps;
98
- declare const index_accordionCss: typeof accordionCss;
99
- declare namespace index {
100
- export { index_Content as Content, index_Controls as Controls, index_Fallback as Fallback, index_Icon as Icon, index_Label as Label, index_Root as Root, index_Section as Section, index_ShowAll as ShowAll, index_ShowAllText as ShowAllText, index_ToggleText as ToggleText, index_Trigger as Trigger, index_accordionCss as accordionCss };
101
- export type { index_ContentProps as ContentProps, index_ControlsProps as ControlsProps, index_FallbackProps as FallbackProps, index_IconProps as IconProps, index_LabelProps as LabelProps, index_RootProps as RootProps, index_SectionProps as SectionProps, index_ShowAllProps as ShowAllProps, index_ShowAllTextProps as ShowAllTextProps, index_ToggleTextProps as ToggleTextProps, index_TriggerProps as TriggerProps };
102
- }
103
-
104
- export { Content as C, Fallback as F, Icon as I, Label as L, Root as R, Section as S, ToggleText as T, Controls as b, index as i, ShowAll as j, ShowAllText as l, Trigger as o, accordionCss as q };
105
- export type { ContentProps as a, ControlsProps as c, FallbackProps as d, IconProps as e, LabelProps as f, RootProps as g, SectionProps as h, ShowAllProps as k, ShowAllTextProps as m, ToggleTextProps as n, TriggerProps as p };
@@ -1,20 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps } from 'react';
3
-
4
- type RootProps = ComponentProps<'button'> & {
5
- /** Render the only child instead, such as a link with `role="button"`, with this part's props merged onto it. */
6
- asChild?: boolean;
7
- /** Cancel a second click within a second of the first, so a form isn't submitted twice. */
8
- preventDoubleClick?: boolean;
9
- };
10
- declare function Root({ asChild, preventDoubleClick, ...props }: RootProps): React.JSX.Element;
11
-
12
- declare const index_Root: typeof Root;
13
- type index_RootProps = RootProps;
14
- declare namespace index {
15
- export { index_Root as Root };
16
- export type { index_RootProps as RootProps };
17
- }
18
-
19
- export { Root as R, index as i };
20
- export type { RootProps as a };
@@ -1,69 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps } from 'react';
3
- import { T as Translation } from './translation-BnpO2mN2.js';
4
-
5
- type RootProps = React.HTMLAttributes<HTMLElement> & {
6
- /** Shown while no file is chosen. Defaults to "No file chosen". */
7
- noFileChosen?: string;
8
- /** Shown when more than one file is chosen. `%{count}` is the number. Defaults to "%{count} files chosen". */
9
- multipleFilesChosen?: Translation;
10
- /** Announced when the user drags files into the drop zone. Defaults to "Entered drop zone". */
11
- enteredDropZone?: string;
12
- /** Announced when the user drags files out of the drop zone. Defaults to "Left drop zone". */
13
- leftDropZone?: string;
14
- /** Classes for the button while no file is chosen. */
15
- emptyClass?: string;
16
- /** Classes for the button while files are dragged over the drop zone. */
17
- draggingClass?: string;
18
- /** Classes for the drop zone while the input is disabled. */
19
- disabledClass?: string;
20
- };
21
- declare function Root({ noFileChosen, multipleFilesChosen, enteredDropZone, leftDropZone, emptyClass, draggingClass, disabledClass, ...props }: RootProps): React.JSX.Element;
22
- type PartProps<E extends keyof React.JSX.IntrinsicElements> = ComponentProps<E> & {
23
- /** Render the only child instead, with this part's props merged onto it. */
24
- asChild?: boolean;
25
- };
26
- type DropZoneProps = PartProps<'div'>;
27
- /** The area that shows files are being dragged over it. Holds the button and the input. */
28
- declare function DropZone({ asChild, ...props }: DropZoneProps): React.JSX.Element;
29
- type InputProps = Omit<PartProps<'input'>, 'type'>;
30
- /** The file input, with an `id` and a `label`. Shown without JavaScript, and hidden on upgrade. */
31
- declare function Input({ asChild, ...props }: InputProps): React.JSX.Element;
32
- type ButtonProps = PartProps<'button'>;
33
- /**
34
- * Opens the file picker, and takes dropped files. Hidden until the element upgrades, when it
35
- * takes the input's id, so the input's label names it. Holds `Status`.
36
- */
37
- declare function Button({ asChild, ...props }: ButtonProps): React.JSX.Element;
38
- type StatusProps = PartProps<'span'>;
39
- /** Which files are chosen: "No file chosen", the file's name, or how many files. In `Button`. */
40
- declare function Status({ asChild, children, ...props }: StatusProps): React.JSX.Element;
41
- type SeparatorProps = PartProps<'span'>;
42
- /** Between the label and the button's text in the button's accessible name. Defaults to ", ". In `Button`. */
43
- declare function Separator({ asChild, children, ...props }: SeparatorProps): React.JSX.Element;
44
- type AnnouncementsProps = PartProps<'span'>;
45
- /** Announces entering and leaving the drop zone. Make it visually hidden. */
46
- declare function Announcements({ asChild, ...props }: AnnouncementsProps): React.JSX.Element;
47
-
48
- declare const index_Announcements: typeof Announcements;
49
- type index_AnnouncementsProps = AnnouncementsProps;
50
- declare const index_Button: typeof Button;
51
- type index_ButtonProps = ButtonProps;
52
- declare const index_DropZone: typeof DropZone;
53
- type index_DropZoneProps = DropZoneProps;
54
- declare const index_Input: typeof Input;
55
- type index_InputProps = InputProps;
56
- declare const index_Root: typeof Root;
57
- type index_RootProps = RootProps;
58
- declare const index_Separator: typeof Separator;
59
- type index_SeparatorProps = SeparatorProps;
60
- declare const index_Status: typeof Status;
61
- type index_StatusProps = StatusProps;
62
- declare const index_Translation: typeof Translation;
63
- declare namespace index {
64
- export { index_Announcements as Announcements, index_Button as Button, index_DropZone as DropZone, index_Input as Input, index_Root as Root, index_Separator as Separator, index_Status as Status, index_Translation as Translation };
65
- export type { index_AnnouncementsProps as AnnouncementsProps, index_ButtonProps as ButtonProps, index_DropZoneProps as DropZoneProps, index_InputProps as InputProps, index_RootProps as RootProps, index_SeparatorProps as SeparatorProps, index_StatusProps as StatusProps };
66
- }
67
-
68
- export { Announcements as A, Button as B, DropZone as D, Input as I, Root as R, Separator as S, Status as g, index as i };
69
- export type { AnnouncementsProps as a, ButtonProps as b, DropZoneProps as c, InputProps as d, RootProps as e, SeparatorProps as f, StatusProps as h };
@@ -1,29 +0,0 @@
1
- import * as React from 'react';
2
- import { ComponentProps } from 'react';
3
- export { default as accordion } from 'inline:accordion';
4
- export { default as autocomplete } from 'inline:autocomplete';
5
- export { default as autoFocus } from 'inline:auto-focus';
6
- export { default as button } from 'inline:button';
7
- export { default as characterCount } from 'inline:character-count';
8
- export { default as choices } from 'inline:choices';
9
- export { default as disclosure } from 'inline:disclosure';
10
- export { default as exitThisPage } from 'inline:exit-this-page';
11
- export { default as fileUpload } from 'inline:file-upload';
12
- export { default as focusLinks } from 'inline:focus-links';
13
- export { default as modal } from 'inline:modal';
14
- export { default as passwordInput } from 'inline:password-input';
15
- export { default as tabs } from 'inline:tabs';
16
-
17
- type InlineScriptProps = Omit<ComponentProps<'script'>, 'children' | 'dangerouslySetInnerHTML' | 'src'> & {
18
- /** One of this module's scripts, such as `tabs`. */
19
- script: string;
20
- };
21
- /**
22
- * Renders an element's script inline, such as `<InlineScript script={tabs} />` in the page's
23
- * `head`. Pass `nonce` for a Content Security Policy. Rendered on the server: a script that React
24
- * adds in the browser doesn't run, and isn't needed, since React's parts define their elements.
25
- */
26
- declare function InlineScript({ script, ...props }: InlineScriptProps): React.JSX.Element;
27
-
28
- export { InlineScript };
29
- export type { InlineScriptProps };
@@ -1,63 +0,0 @@
1
- // src/inline-script/index.tsx
2
- import * as React from "react";
3
-
4
- // inline:accordion
5
- var accordion_default = '"use strict";(()=>{var u="govuk-react-accordion",m={"show-section-text":"Show","hide-section-text":"Hide","show-section-label":"Show this section","hide-section-label":"Hide this section","show-all-sections-text":"Show all sections","hide-all-sections-text":"Hide all sections"},c=a=>a?.split(/\\s+/).filter(Boolean),g=(a,d)=>{a.textContent!==d&&(a.textContent=d)},f=a=>a?.split(/\\s+/).filter(Boolean)??[];if(typeof HTMLElement<"u"&&typeof customElements<"u"){class a extends HTMLElement{constructor(){super(...arguments);this.open=new Set;this.upgraded=!1;this.controlled=!1;this.prepared=new WeakSet;this.onClick=e=>{let t=e.target instanceof Element?e.target:null,s=t?.closest("button[data-accordion-trigger]");if(s&&this.ownsElement(s)){let n=this.sectionOf(s)?.dataset.value;if(n===void 0)return;let r=new Set(this.open);r.has(n)?r.delete(n):r.add(n),this.change(r);return}let i=t?.closest("button[data-accordion-show-all]");if(i&&this.ownsElement(i)){let n=this.sections.map(r=>r.dataset.value??"");this.change(new Set(this.allOpen?[]:n))}};this.onBeforeMatch=e=>{let s=(e.target instanceof Element?this.sectionOf(e.target):void 0)?.dataset.value;s===void 0||this.open.has(s)||this.change(new Set([...this.open,s]),!0)}}static get observedAttributes(){return["value"]}get openValues(){return this.upgraded?[...this.open]:void 0}get pickedValue(){return this.picked}connectedCallback(){this.observer=new MutationObserver(e=>{if(!this.upgraded){this.setup();return}e.some(t=>t.type==="childList")&&this.sections.forEach(t=>this.prepare(t)),this.render()}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),this.upgraded?(this.listen(),this.render()):this.setup()}disconnectedCallback(){this.observer?.disconnect(),this.removeEventListener("click",this.onClick),this.removeEventListener("beforematch",this.onBeforeMatch,!0)}attributeChangedCallback(){let e=c(this.getAttribute("value"));this.controlled=e!==void 0,e&&(this.open=new Set(e),this.render())}get sections(){return this.own("[data-accordion-section]")}get allOpen(){return this.sections.every(e=>this.open.has(e.dataset.value??""))}own(e){return Array.from(this.querySelectorAll(e)).filter(t=>this.ownsElement(t))}ownsElement(e){return e.closest(u)===this}sectionOf(e){let t=e.closest("[data-accordion-section]");return t&&this.ownsElement(t)?t:void 0}find(e,t){return Array.from(e.querySelectorAll(t)).find(s=>this.sectionOf(s)===e)}text(e){return this.getAttribute(e)??m[e]}get remember(){return this.getAttribute("remember-expanded")!=="false"}setup(){let e=this.sections;if(!e.some(i=>this.find(i,"button[data-accordion-trigger]")))return;this.upgraded=!0;let t=c(this.getAttribute("value"));this.controlled=t!==void 0,this.open=new Set(t??c(this.getAttribute("default-value"))),this.dataset.upgraded="";let s=f(this.getAttribute("upgraded-class"));s.length&&this.classList.add(...s),this.own("[data-accordion-controls]").forEach(i=>{i.hidden=!1}),e.forEach(i=>this.prepare(i)),this.listen(),this.render()}listen(){this.addEventListener("click",this.onClick),this.addEventListener("beforematch",this.onBeforeMatch,!0)}prepare(e){let t=this.find(e,"button[data-accordion-trigger]");if(!t||this.prepared.has(e))return;this.prepared.add(e);let s=e.dataset.value??"";if(!this.controlled){let n=c(this.getAttribute("default-value"));(n?n.includes(s):e.hasAttribute("data-expanded"))&&this.open.add(s),this.restore(e)}Array.from(e.querySelectorAll("[data-accordion-fallback]")).filter(n=>this.sectionOf(n)===e).forEach(n=>{n.hidden=!0}),t.hidden=!1;let i=this.find(e,"[data-accordion-content]");i?.id&&t.setAttribute("aria-controls",i.id)}restore(e){let t=this.find(e,"[data-accordion-content]")?.id,s=e.dataset.value;if(!(!this.remember||!t||s===void 0))try{let i=window.sessionStorage.getItem(t);i==="true"?this.open.add(s):i==="false"&&this.open.delete(s)}catch{}}store(e){this.remember&&this.sections.forEach(t=>{let s=t.dataset.value??"",i=this.find(t,"[data-accordion-content]")?.id;if(!(!i||e.has(s)===this.open.has(s)))try{window.sessionStorage.setItem(i,String(this.open.has(s)))}catch{}})}change(e,t=!1){let s=this.sections.map(i=>i.dataset.value??"").filter(i=>e.has(i));if(!this.controlled||t){let i=this.open;this.open=new Set(s),this.controlled||(this.picked=s,this.store(i)),this.render()}this.dispatchEvent(new CustomEvent("govuk-react-accordion:change",{detail:{value:s},bubbles:!0}))}render(){if(!this.upgraded)return;let e=f(this.getAttribute("expanded-section-class")),t=f(this.getAttribute("collapsed-icon-class")),s=(n,r)=>{Array.from(n.querySelectorAll("[data-accordion-icon]")).forEach(o=>{t.forEach(l=>o.classList.toggle(l,!r))})};this.sections.forEach(n=>{let r=this.open.has(n.dataset.value??""),o=this.find(n,"button[data-accordion-trigger]"),l=this.find(n,"[data-accordion-content]");if(n.dataset.state=r?"open":"closed",e.forEach(h=>n.classList.toggle(h,r)),l&&(r?l.removeAttribute("hidden"):l.setAttribute("hidden","until-found")),!o)return;o.setAttribute("aria-expanded",String(r));let v=Array.from(o.querySelectorAll("[data-accordion-label]")).map(h=>h.textContent?.trim()??"");o.setAttribute("aria-label",[...v,this.text(r?"hide-section-label":"show-section-label")].join(" , "));let p=o.querySelector("[data-accordion-toggle-text]");p&&g(p,this.text(r?"hide-section-text":"show-section-text")),s(o,r)});let i=this.allOpen;this.own("button[data-accordion-show-all]").forEach(n=>{n.setAttribute("aria-expanded",String(i));let r=n.querySelector("[data-accordion-show-all-text]");r&&g(r,this.text(i?"hide-all-sections-text":"show-all-sections-text")),s(n,i)})}}customElements.get(u)||customElements.define(u,a)}})();';
6
-
7
- // inline:autocomplete
8
- var autocomplete_default = '"use strict";(()=>{var O=["zero","one","two","few","many","other"];var E=s=>[s,...O.map(o=>`${s}-${o}`)];function L(s,o){let l=s.getAttribute(o);if(l!==null)return l;let t=O.flatMap(e=>{let n=s.getAttribute(`${o}-${e}`);return n===null?[]:[[e,n]]});return t.length?Object.fromEntries(t):void 0}function A(s){try{return s(void 0)}catch{return s("en")}}function v(s,o){try{return o(s)}catch{return A(o)}}function p(s,o,l){let t;if(typeof s=="string")t=s;else{let n=v(l,i=>new Intl.PluralRules(i)).select(o);t=s[n]??s.other}let e=v(l,n=>new Intl.NumberFormat(n)).format(o);return(t??"").replaceAll("%{count}",e)}var g="govuk-react-autocomplete",w={"status-query-too-short":"Type in %{count} or more characters for results","status-no-results":"No search results","status-selected-option":"%{option} %{position} of %{count} is highlighted","status-results":{one:"%{count} result is available.",other:"%{count} results are available."}},I=1400,k=100,b=()=>typeof navigator<"u"&&/(iPod|iPhone|iPad)/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent),u=(s,o,l)=>{l===null?s.removeAttribute(o):s.getAttribute(o)!==l&&s.setAttribute(o,l)},M=(s,o)=>{s.textContent!==o&&(s.textContent=o)},C=typeof HTMLInputElement>"u"?void 0:Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;if(typeof HTMLElement<"u"&&typeof customElements<"u"){class s extends HTMLElement{constructor(){super(...arguments);this.focused=null;this.hovered=null;this.menuOpen=!1;this.options=[];this.currentQuery="";this.validChoiceMade=!1;this.selected=null;this.ariaHint=!0;this.lastFocused=null;this.settingValue=!1;this.bump=!1;this.generatedIds=0;this.onPoll=()=>{this.input&&this.input.value!==this.currentQuery&&this.handleInputChange(this.input.value)};this.onInput=()=>{this.input&&!this.settingValue&&this.handleInputChange(this.input.value)};this.onInputFocus=()=>{let t=!this.validChoiceMade&&this.queryLongEnough&&this.options.length>0;this.focused=-1,t&&(this.menuOpen=!0,this.selected=-1),this.render()};this.onFocusOut=t=>{let{target:e,relatedTarget:n}=t;if(e===this.input){if(this.focused!==-1)return;let m=b();this.handleComponentBlur({menuOpen:this.menuOpen&&m,query:m?this.currentQuery:this.valueOf(this.selectedOption)});return}if(!(e instanceof HTMLElement)||!e.isConnected)return;let i=this.options.indexOf(e);if(i===-1)return;let r=n===null,h=n===this.input,d=this.focused!==i&&this.focused!==-1;(!d&&r||!(d||h))&&this.handleComponentBlur({menuOpen:this.menuOpen&&b(),query:this.valueOf(this.selectedOption)})};this.onKeyDown=t=>{let{target:e}=t,n=e===this.input,i=e instanceof HTMLElement&&this.options.includes(e);if(!n&&!i)return;let r=this.selected??-1;switch(t.key){case"ArrowUp":t.preventDefault(),this.menuOpen&&r!==-1&&this.focusOption(r-1);break;case"ArrowDown":t.preventDefault(),this.menuOpen&&r!==this.options.length-1&&this.focusOption(r+1);break;case" ":this.focused!==null&&this.focused!==-1&&(t.preventDefault(),this.confirm(this.focused));break;case"Enter":if(!this.menuOpen)break;r>=0?(t.preventDefault(),this.confirm(r)):this.submitOnConfirm||t.preventDefault();break;case"Escape":i&&this.input?.focus(),this.handleComponentBlur({menuOpen:!1,query:this.currentQuery});break;default:i&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(t.key.length===1||t.key==="Backspace")&&this.input?.focus()}};this.onOptionMouseDown=t=>{this.optionOf(t.target)!==-1&&t.preventDefault()};this.onOptionClick=t=>{let e=this.optionOf(t.target);e!==-1&&this.confirm(e)};this.onOptionMouseOver=t=>{let e=this.optionOf(t.target);e===-1||e===this.hovered||b()||(this.hovered=e,this.render())};this.onListMouseLeave=()=>{this.hovered!==null&&(this.hovered=null,this.render())}}static get observedAttributes(){return["min-length","filter","confirm-on-blur","submit-on-confirm",...Object.keys(w).flatMap(E)]}get query(){return this.input?this.currentQuery:void 0}connectedCallback(){this.observer=new MutationObserver(t=>this.onMutation(t)),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["aria-describedby","data-value"]}),this.setup()}disconnectedCallback(){this.observer?.disconnect(),this.unbind()}attributeChangedCallback(){this.isConnected&&(this.input?this.render():this.setup())}own(t){return this.ownAll(t)[0]}ownAll(t){return Array.from(this.querySelectorAll(t)).filter(e=>e.closest(g)===this)}get allOptions(){return this.ownAll("[data-autocomplete-option]")}get minLength(){let t=Number(this.getAttribute("min-length"));return Number.isFinite(t)&&t>0?t:0}get filterType(){let t=this.getAttribute("filter");return t==="starts-with"||t==="none"?t:"contains"}get confirmOnBlur(){return this.getAttribute("confirm-on-blur")!=="false"}get submitOnConfirm(){return this.hasAttribute("submit-on-confirm")}get locale(){return(this.input??this).closest("[lang]")?.getAttribute("lang")||"en"}setup(){let t=this.own("[data-autocomplete-input]"),e=this.own("[data-autocomplete-listbox]");if(!(t instanceof HTMLInputElement)||!t.id||!e){this.unbind(),delete this.dataset.upgraded;return}if(t===this.input&&e===this.listbox){this.render();return}this.unbind(),this.input=t,this.listbox=e,t.addEventListener("input",this.onInput),t.addEventListener("click",this.onInput),t.addEventListener("focus",this.onInputFocus),this.addEventListener("keydown",this.onKeyDown),this.addEventListener("focusout",this.onFocusOut),e.addEventListener("mousedown",this.onOptionMouseDown),e.addEventListener("click",this.onOptionClick),e.addEventListener("mouseover",this.onOptionMouseOver),e.addEventListener("mouseleave",this.onListMouseLeave),this.poll=window.setInterval(this.onPoll,k),this.currentQuery=t.value,this.ariaHint=t.value==="",this.options=this.queryLongEnough?this.matchingOptions():[],this.focused=document.activeElement===t?-1:null,this.lastFocused=this.focused,this.selected=null,this.menuOpen=!1,this.validChoiceMade=!1,this.dataset.upgraded="",this.render()}unbind(){let{input:t,listbox:e}=this;window.clearInterval(this.poll),window.clearTimeout(this.statusTimer),!(!t||!e)&&(t.removeEventListener("input",this.onInput),t.removeEventListener("click",this.onInput),t.removeEventListener("focus",this.onInputFocus),this.removeEventListener("keydown",this.onKeyDown),this.removeEventListener("focusout",this.onFocusOut),e.removeEventListener("mousedown",this.onOptionMouseDown),e.removeEventListener("click",this.onOptionClick),e.removeEventListener("mouseover",this.onOptionMouseOver),e.removeEventListener("mouseleave",this.onListMouseLeave),this.input=void 0,this.listbox=void 0)}onMutation(t){let e=this.own("[data-autocomplete-status]"),n=t.filter(i=>!(e?.contains(i.target)??!1)&&!(i.type==="attributes"&&i.target===this.input&&this.describedByIsCurrent()));if(n.length){if(!this.input?.isConnected||!this.listbox?.isConnected||!this.contains(this.input)){this.setup();return}n.some(i=>this.listbox?.contains(i.target))&&this.updateOptions(),this.render()}}updateOptions(){let t=this.selectedOption;if(!this.queryLongEnough||this.currentQuery===""){this.options=[];return}if(this.options=this.matchingOptions(),this.focused===null||this.validChoiceMade)return;this.menuOpen=this.options.length>0;let e=t?this.options.indexOf(t):-1;this.selected=e,this.focused>=0&&(this.focused=e)}get queryLongEnough(){return this.currentQuery.length>=this.minLength}valueOf(t){if(t)return t.dataset.value??t.textContent?.trim()??""}matchingOptions(){let t=this.currentQuery.toLowerCase(),e=this.filterType;return this.allOptions.filter(n=>{if(e==="none")return!0;let i=(this.valueOf(n)??"").toLowerCase();return e==="starts-with"?i.startsWith(t):i.includes(t)})}isQueryAnOption(t){return this.options.some(e=>this.valueOf(e)?.toLowerCase()===t.toLowerCase())}handleInputChange(t){let e=this.currentQuery!==t;this.currentQuery=t,this.ariaHint=t==="",t!==""&&e&&this.queryLongEnough?(this.dispatchEvent(new CustomEvent("govuk-react-autocomplete:query",{bubbles:!0,detail:{query:t}})),this.options=this.matchingOptions(),this.menuOpen=this.options.length>0,this.selected=-1,this.validChoiceMade=!1):(t===""||!this.queryLongEnough)&&(this.menuOpen=!1,this.options=[]),this.render()}get selectedOption(){return this.selected===null||this.selected<0?void 0:this.options[this.selected]}handleComponentBlur({menuOpen:t,query:e}){let n=this.currentQuery,i=this.selectedOption;this.confirmOnBlur&&(n=e||this.currentQuery,i&&this.confirmEvent(this.valueOf(i)??"")),this.focused=null,this.menuOpen=t,this.selected=null,this.validChoiceMade=this.isQueryAnOption(n),this.setQuery(n),this.render()}setQuery(t){this.currentQuery=t;let{input:e}=this;!e||e.value===t||(this.settingValue=!0,C?C.call(e,t):e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),this.settingValue=!1)}confirmEvent(t){return this.dispatchEvent(new CustomEvent("govuk-react-autocomplete:confirm",{bubbles:!0,cancelable:!0,detail:{value:t}}))}confirm(t){let e=this.options[t];if(!e)return;let n=this.valueOf(e)??"";this.focused=-1,this.hovered=null,this.menuOpen=!1,this.selected=-1,this.validChoiceMade=!0,this.setQuery(n),this.render();let i=this.confirmEvent(n),r=this.input?.form;i&&this.submitOnConfirm&&r&&window.setTimeout(()=>r.requestSubmit())}focusOption(t){this.focused=t,this.hovered=null,this.selected=t,this.render()}optionOf(t){if(!(t instanceof Element))return-1;let e=t.closest("[data-autocomplete-option]");return e?this.options.indexOf(e):-1}ensureId(t,e){return t.id||(this.generatedIds+=1,t.id=`${this.input?.id}__${e}${e.endsWith("--")?this.generatedIds:""}`),t.id}get hint(){return this.own("[data-autocomplete-hint]")}describedBy(){let{input:t}=this;if(!t)return null;let e=this.hint,n=e?this.ensureId(e,"assistiveHint"):void 0,i=(t.getAttribute("aria-describedby")??"").split(/\\s+/).filter(r=>r&&r!==n);return this.ariaHint&&n&&i.push(n),i.length?i.join(" "):null}describedByIsCurrent(){return(this.input?.getAttribute("aria-describedby")??null)===this.describedBy()}render(){let{input:t,listbox:e}=this;if(!t||!e)return;let{focused:n,hovered:i,menuOpen:r,options:h,selected:d}=this,y=n===-1&&h.length===0&&this.currentQuery!==""&&this.queryLongEnough,T=n!==null&&n!==-1,x=this.ensureId(e,"listbox");u(e,"role","listbox"),e.hasAttribute("aria-labelledby")||e.setAttribute("aria-labelledby",t.id),e.hidden=!(r||y),this.allOptions.forEach(a=>{let c=h.indexOf(a);this.ensureId(a,"option--"),a.hidden=c===-1,u(a,"role","option"),u(a,"tabindex","-1"),u(a,"aria-selected",n===c&&c!==-1?"true":"false"),u(a,"aria-posinset",c===-1?null:String(c+1)),u(a,"aria-setsize",c===-1?null:String(h.length)),u(a,"data-focused",c!==-1&&(n===-1?d===c:n===c)&&i===null?"":null)});let f=this.own("[data-autocomplete-no-results]");if(f&&(f.hidden=!y,u(f,"role","option"),u(f,"aria-disabled","true")),u(t,"role","combobox"),u(t,"autocomplete","off"),u(t,"aria-autocomplete","list"),u(t,"aria-controls",x),u(t,"aria-expanded",r?"true":"false"),u(t,"aria-activedescendant",T?h[n]?.id??null:null),u(t,"aria-describedby",this.describedBy()),u(this,"data-focused",n===null?null:""),n!==this.lastFocused&&n!==null){let a=n===-1?t:h[n];a&&document.activeElement!==a&&a.focus(),n===-1&&this.lastFocused===null&&t.selectionStart!==null&&t.setSelectionRange(0,t.value.length)}this.lastFocused=n,this.scheduleStatus()}message(t){return L(this,t)??w[t]}statusText(){let{locale:t,options:e}=this;if(!this.queryLongEnough)return p(this.message("status-query-too-short"),this.minLength,t);if(e.length===0)return p(this.message("status-no-results"),0,t);let n=p(this.message("status-results"),e.length,t),i=this.valueOf(this.selectedOption);if(i===void 0||this.selected===null)return n;let r=v(t,d=>new Intl.NumberFormat(d)).format(this.selected+1),h=p(this.message("status-selected-option"),e.length,t).replaceAll("%{option}",()=>i).replaceAll("%{position}",()=>r);return`${n} ${h}`}scheduleStatus(){let t=this.ownAll("[data-autocomplete-status-region]");t.length&&(t.forEach(e=>M(e,"")),window.clearTimeout(this.statusTimer),this.statusTimer=window.setTimeout(()=>{this.bump=!this.bump;let n=this.focused===null||this.validChoiceMade?"":this.statusText();t.forEach((i,r)=>M(i,r===0===this.bump?n:""))},I))}}customElements.get(g)||customElements.define(g,s)}})();\n/*! Based on accessible-autocomplete, Copyright (c) 2017 Crown Copyright (Government Digital Service), MIT licence: licences/accessible-autocomplete.txt */';
9
-
10
- // inline:auto-focus
11
- var auto_focus_default = '"use strict";(()=>{function o(t,i,s){s.forEach(e=>t.classList.remove(e)),i&&t.removeAttribute("tabindex"),t.removeAttribute("data-focus-tabindex"),t.removeAttribute("autofocus")}var c=t=>!t.hasAttribute("tabindex")||t.hasAttribute("data-focus-tabindex")&&t.getAttribute("tabindex")==="-1";function n(t){o(t,t.hasAttribute("tabindex")&&c(t),[])}function u(t,{focusedClasses:i=[],preventScroll:s=!1}={}){let e=c(t);return t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),document.activeElement!==t&&(i.forEach(r=>t.classList.add(r)),t.focus({preventScroll:s})),document.activeElement!==t?(o(t,e,i),!1):(i.forEach(r=>t.classList.add(r)),t.addEventListener("blur",()=>o(t,e,i),{once:!0}),!0)}var a="govuk-react-auto-focus";if(typeof HTMLElement<"u"&&typeof customElements<"u"){class t extends HTMLElement{constructor(){super(...arguments);this.focused=!1}connectedCallback(){this.focusTarget()||(this.observer=new MutationObserver(()=>{this.focusTarget()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.observer?.disconnect()}get target(){let e=Array.from(this.querySelectorAll("[data-auto-focus]")).find(r=>r.closest(a)===this)??this.firstElementChild;return e instanceof HTMLElement?e:void 0}focusTarget(){if(this.focused)return!0;let{target:e}=this;if(!e)return!1;if(this.focused=!0,this.hasAttribute("disabled"))return!0;if(e.hasAttribute("autofocus")){let r=document.activeElement;if(r===e)return u(e,{preventScroll:!0}),!0;if(r&&r!==document.body)return n(e),!0}return queueMicrotask(()=>{(!e.isConnected||!u(e))&&(this.focused=!1)}),!0}}customElements.get(a)||customElements.define(a,t)}})();';
12
-
13
- // inline:button
14
- var button_default = '"use strict";(()=>{var o=Symbol.for("govuk-react-button"),u=new WeakMap,r=t=>{for(let e of t.composedPath())if(e instanceof HTMLElement&&e.hasAttribute("data-button"))return e;return null};function i(t){let e=r(t);if(!e||e.getAttribute("data-prevent-double-click")!=="true")return;let n=u.get(e);if(n!==void 0&&t.timeStamp-n<1e3){t.preventDefault(),t.stopImmediatePropagation();return}u.set(e,t.timeStamp)}function a(t){if(t.key!==" "||t.repeat||t.defaultPrevented)return;let e=r(t);!e||e!==t.composedPath()[0]||e.getAttribute("role")!=="button"||e instanceof HTMLButtonElement||(t.preventDefault(),e.click())}typeof document<"u"&&(Reflect.get(globalThis,o)||(Reflect.set(globalThis,o,!0),document.addEventListener("click",i,!0),document.addEventListener("keydown",a)));})();';
15
-
16
- // inline:character-count
17
- var character_count_default = '"use strict";(()=>{var f=["zero","one","two","few","many","other"];var v=e=>[e,...f.map(s=>`${e}-${s}`)];function b(e,s){let a=e.getAttribute(s);if(a!==null)return a;let t=f.flatMap(n=>{let r=e.getAttribute(`${s}-${n}`);return r===null?[]:[[n,r]]});return t.length?Object.fromEntries(t):void 0}function L(e){try{return e(void 0)}catch{return e("en")}}function h(e,s){try{return s(e)}catch{return L(s)}}function w(e,s,a){let t;if(typeof e=="string")t=e;else{let r=h(a,i=>new Intl.PluralRules(i)).select(s);t=e[r]??e.other}let n=h(a,r=>new Intl.NumberFormat(r)).format(s);return(t??"").replaceAll("%{count}",n)}var p=["characters-under-limit","characters-at-limit","characters-over-limit","words-under-limit","words-at-limit","words-over-limit"],C={"characters-under-limit":{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},"characters-at-limit":"You have 0 characters remaining","characters-over-limit":{one:"You have %{count} character too many",other:"You have %{count} characters too many"},"words-under-limit":{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},"words-at-limit":"You have 0 words remaining","words-over-limit":{one:"You have %{count} word too many",other:"You have %{count} words too many"}};var y=(e,s)=>b(e,s);function A(e,s,a){if(s==="length")return e.length;if(typeof Intl.Segmenter!="function")return s==="words"?e.match(/\\S+/g)?.length??0:Array.from(e).length;let t=h(a,r=>new Intl.Segmenter(r,{granularity:s==="words"?"word":"grapheme"})),n=Array.from(t.segment(e));return s==="words"?n.filter(r=>r.isWordLike).length:n.length}function T(e,s,a,t){let n=e<0?"over":e===0?"at":"under",r=`${s==="words"?"words":"characters"}-${n}-limit`,i=a[r]??C[r];return{state:n,text:w(i,Math.abs(e),t)}}var m="govuk-react-character-count",E={position:"absolute",width:"1px",height:"1px",margin:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(50%)",border:"0","white-space":"nowrap"},c=e=>e?.split(/\\s+/).filter(Boolean)??[],x=(e,s)=>{if(e.textContent===s)return;let{firstChild:a}=e;a instanceof Text&&e.childNodes.length===1?a.nodeValue=s:e.textContent=s},I=e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement;if(typeof HTMLElement<"u"&&typeof customElements<"u"){class e extends HTMLElement{constructor(){super(...arguments);this.currentCount=0;this.onInput=()=>{this.update(),this.lastInputTime=Date.now()};this.onFocus=()=>{window.clearInterval(this.checker),this.checker=window.setInterval(()=>{(!this.lastInputTime||Date.now()-500>=this.lastInputTime)&&this.announceIfChanged()},1e3)};this.onBlur=()=>window.clearInterval(this.checker);this.onPageShow=()=>{this.input&&(this.update(),this.announceIfChanged())}}static get observedAttributes(){return["maxlength","count-type","threshold","within-limit-class","over-limit-class","below-threshold-class","input-over-limit-class",...p.flatMap(v)]}get count(){return this.input?this.currentCount:void 0}connectedCallback(){this.observer=new MutationObserver(t=>{t.some(n=>n.type==="childList")?this.setup():this.update()}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","maxlength"]}),window.addEventListener("pageshow",this.onPageShow),this.setup()}disconnectedCallback(){this.observer?.disconnect(),window.removeEventListener("pageshow",this.onPageShow),window.clearInterval(this.checker),this.unbind()}attributeChangedCallback(){if(this.isConnected){if(!this.input){this.setup();return}if(this.maxLength===void 0){this.downgrade();return}this.lastAnnouncedValue=void 0,this.update()}}own(t){return Array.from(this.querySelectorAll(t)).find(n=>n.closest(m)===this)}get maxLength(){let t=Number(this.getAttribute("maxlength"));return this.hasAttribute("maxlength")&&Number.isFinite(t)?t:void 0}get countType(){let t=this.getAttribute("count-type");return t==="characters"||t==="words"?t:"length"}get locale(){return(this.input??this).closest("[lang]")?.getAttribute("lang")||"en"}setup(){let t=this.own("[data-character-count-input]");if(!I(t)||this.maxLength===void 0)return;let n=t!==this.input;n&&(this.unbind(),this.input=t,t.addEventListener("input",this.onInput),t.addEventListener("focus",this.onFocus),t.addEventListener("blur",this.onBlur),t.removeAttribute("maxlength"),this.lastAnnouncedValue=void 0),this.dataset.upgraded="";let r=this.own("[data-character-count-description]");r&&!this.hasAttribute("hidden-description-class")&&Object.entries(E).forEach(([i,l])=>r.style.setProperty(i,l)),[this.own("[data-character-count-status]"),this.own("[data-character-count-sr-status]")].forEach(i=>{i&&(i.hidden=!1)}),this.update(),n&&this.announceIfChanged()}unbind(){let{input:t}=this;t&&(t.removeEventListener("input",this.onInput),t.removeEventListener("focus",this.onFocus),t.removeEventListener("blur",this.onBlur),window.clearInterval(this.checker),this.input=void 0)}downgrade(){let{input:t}=this;if(!t)return;c(this.getAttribute("input-over-limit-class")).forEach(r=>t.classList.toggle(r,!1)),this.unbind(),delete this.dataset.upgraded;let n=this.own("[data-character-count-description]");n&&(this.hasAttribute("hidden-description-class")?c(this.getAttribute("hidden-description-class")).forEach(r=>n.classList.toggle(r,!1)):Object.keys(E).forEach(r=>n.style.removeProperty(r))),[this.own("[data-character-count-status]"),this.own("[data-character-count-sr-status]")].forEach(r=>{r&&(r.hidden=!0)})}update(){this.input&&(this.input.removeAttribute("maxlength"),this.currentCount=A(this.input.value,this.countType,this.locale),this.render())}message(){let t=Object.fromEntries(p.map(n=>[n,y(this,n)]));return T((this.maxLength??1/0)-this.currentCount,this.countType,t,this.locale)}get belowThreshold(){let t=Number(this.getAttribute("threshold"));return t?this.currentCount<(this.maxLength??1/0)*t/100:!1}render(){let{input:t}=this;if(!t)return;let{state:n,text:r}=this.message(),i=n==="over",l=this.own("[data-character-count-description]");c(this.getAttribute("hidden-description-class")).forEach(o=>l?.classList.toggle(o,!0)),c(this.getAttribute("input-over-limit-class")).forEach(o=>t.classList.toggle(o,i));let d=this.belowThreshold,g=this.own("[data-character-count-sr-status]");d?g?.setAttribute("aria-hidden","true"):g?.removeAttribute("aria-hidden");let u=this.own("[data-character-count-status]");u&&(u.dataset.state=n,u.toggleAttribute("data-below-threshold",d),c(this.getAttribute("below-threshold-class")).forEach(o=>u.classList.toggle(o,d)),c(this.getAttribute("within-limit-class")).forEach(o=>u.classList.toggle(o,!i)),c(this.getAttribute("over-limit-class")).forEach(o=>u.classList.toggle(o,i)),x(u,r))}announceIfChanged(){let{input:t}=this,n=this.own("[data-character-count-sr-status]");if(!t||!n||t.value===this.lastAnnouncedValue)return;this.lastAnnouncedValue=t.value;let{state:r,text:i}=this.message();n.dataset.state=r,x(n,i)}}customElements.get(m)||customElements.define(m,e)}})();';
18
-
19
- // inline:choices
20
- var choices_default = '"use strict";(()=>{var o="govuk-react-choices",a=i=>i?.split(/\\s+/).filter(Boolean)??[],c=i=>i instanceof HTMLInputElement&&(i.type==="radio"||i.type==="checkbox");if(typeof HTMLElement<"u"&&typeof customElements<"u"){class i extends HTMLElement{constructor(){super(...arguments);this.upgraded=!1;this.onClick=e=>{let t=e.target;if(!c(t)||!this.owns(t))return;if(t.type==="radio"){this.syncAll();return}if(this.syncInput(t),!t.checked)return;let n=t.hasAttribute("data-choices-exclusive"),r=this.inputsNamed(t).filter(s=>s!==t&&s.type==="checkbox"&&s.checked&&(n||s.hasAttribute("data-choices-exclusive")));window.setTimeout(()=>{r.filter(s=>s.checked).forEach(s=>{s.disabled?s.checked=!1:s.click()}),this.syncAll()})};this.onReset=e=>{e.target instanceof HTMLFormElement&&this.choices().some(t=>t.form===e.target)&&window.setTimeout(()=>this.sync())};this.onChange=e=>{c(e.target)&&this.owns(e.target)&&this.sync()};this.onPageShow=()=>this.sync()}connectedCallback(){this.observer=new MutationObserver(e=>{e.some(t=>t.type==="childList")?this.setup():(this.upgraded&&this.addUpgradedClasses(),this.sync())}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),this.addEventListener("click",this.onClick),this.addEventListener("change",this.onChange),window.addEventListener("pageshow",this.onPageShow),document.addEventListener("reset",this.onReset,!0),this.setup()}disconnectedCallback(){this.observer?.disconnect(),this.removeEventListener("click",this.onClick),this.removeEventListener("change",this.onChange),window.removeEventListener("pageshow",this.onPageShow),document.removeEventListener("reset",this.onReset,!0)}get root(){let e=this.getRootNode();return e instanceof Document||e instanceof ShadowRoot?e:document}inputsNamed(e){return Array.from(this.root.querySelectorAll("input")).filter(t=>t.type===e.type&&t.name===e.name&&t.form===e.form)}syncAll(){Array.from(this.root.querySelectorAll(o)).forEach(e=>{e instanceof i&&e.sync()})}owns(e){return e.closest(o)===this}choices(){return Array.from(this.querySelectorAll("input")).filter(e=>c(e)&&this.owns(e))}target(e){let t=e.getAttribute("data-choices-controls");if(!t)return;let n=this.getRootNode(),r=n instanceof Document||n instanceof ShadowRoot?n.getElementById(t):null;return r instanceof HTMLElement&&r.hasAttribute("data-choices-conditional")?r:void 0}setup(){this.choices().length&&(this.upgraded||(this.upgraded=!0,this.dataset.upgraded="",this.addUpgradedClasses()),this.sync())}addUpgradedClasses(){a(this.getAttribute("upgraded-class")).forEach(e=>this.classList.toggle(e,!0))}sync(){this.upgraded&&this.choices().forEach(e=>this.syncInput(e))}syncInput(e){let t=this.target(e);if(!t)return;e.setAttribute("aria-controls",t.id),e.setAttribute("aria-expanded",String(e.checked));let n=a(this.getAttribute("hidden-conditional-class"));n.length?n.forEach(r=>t.classList.toggle(r,!e.checked)):t.hidden=!e.checked}}customElements.get(o)||customElements.define(o,i)}})();';
21
-
22
- // inline:disclosure
23
- var disclosure_default = '"use strict";(()=>{var s="govuk-react-disclosure";if(typeof HTMLElement<"u"&&typeof customElements<"u"){class r extends HTMLElement{constructor(){super(...arguments);this.isOpen=!1;this.controlled=!1;this.onClick=()=>{let e=!this.isOpen;this.hasAttribute("open")||(this.apply(e),this.controlled||(this.picked=e)),this.dispatchEvent(new CustomEvent("govuk-react-disclosure:change",{detail:{open:e},bubbles:!0}))};this.onModeChange=()=>this.render()}static get observedAttributes(){return["open"]}get expanded(){return this.toggle?this.isOpen:void 0}get pickedOpen(){return this.picked}connectedCallback(){this.setup()||(this.observer=new MutationObserver(()=>{this.setup()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.observer?.disconnect(),this.toggle?.removeEventListener("click",this.onClick),this.mql?.removeEventListener("change",this.onModeChange),this.toggle=void 0,this.content=void 0,this.mql=void 0}attributeChangedCallback(){let e=this.getAttribute("open");e!==null&&(this.controlled=!0,this.apply(e==="true"))}own(e,t){let n=Array.from(this.querySelectorAll(e)).find(i=>i.closest(s)===this);return n instanceof t?n:void 0}setup(){if(this.toggle)return!0;let e=this.own("[data-disclosure-toggle]",HTMLButtonElement),t=this.own("[data-disclosure-content]",HTMLElement);if(!e||!t)return!1;this.toggle=e,this.content=t;let n=this.getAttribute("open");this.isOpen=n===null?this.hasAttribute("default-open"):n==="true";let i=this.getAttribute("media");return i&&(this.mql=window.matchMedia(i),this.mql.addEventListener("change",this.onModeChange)),e.addEventListener("click",this.onClick),this.render(),!0}apply(e){e!==this.isOpen&&(this.isOpen=e,this.render())}render(){let{toggle:e,content:t}=this;if(!(!e||!t)){if(this.mql?.matches){t.hidden=!1,e.hidden=!0,e.setAttribute("aria-hidden","true"),e.removeAttribute("aria-expanded");return}e.hidden=!1,e.removeAttribute("aria-hidden"),e.setAttribute("aria-expanded",String(this.isOpen)),t.id&&e.setAttribute("aria-controls",t.id),t.hidden=!this.isOpen}}}customElements.get(s)||customElements.define(s,r)}})();';
24
-
25
- // inline:exit-this-page
26
- var exit_this_page_default = '"use strict";(()=>{var n="govuk-react-exit-this-page",g=["activated","timed-out","press-two-more-times","press-one-more-time"],c={activated:"Loading.","timed-out":"Exit this page expired.","press-two-more-times":"Shift, press 2 more times to exit.","press-one-more-time":"Shift, press 1 more time to exit."},u=5e3,r=d=>(d??"").split(/\\s+/).filter(Boolean),h={position:"fixed",inset:"0","z-index":"2147483647",background:"white"};if(typeof HTMLElement<"u"&&typeof customElements<"u"){class d extends HTMLElement{constructor(){super(...arguments);this.presses=0;this.lastKeyWasModified=!1;this.onClick=e=>{if(e.defaultPrevented||e.button!==0)return;let t=e.target instanceof Element?e.target.closest("a"):null;if(!t)return;let s=t.matches("[data-exit-this-page-button]")&&t.closest(n)===this,i=t.matches("[data-exit-this-page-skiplink]")&&this.listening;!s&&!i||(e.preventDefault(),this.exit())};this.onKeyup=e=>{this.listening&&(e.key==="Shift"&&!this.lastKeyWasModified?(this.presses+=1,this.updateIndicator(),window.clearTimeout(this.messageTimeout),this.presses>=3?(this.presses=0,window.clearTimeout(this.pressTimeout),this.pressTimeout=void 0,this.exit()):(this.setStatus(this.message(this.presses===1?"press-two-more-times":"press-one-more-time")),window.clearTimeout(this.pressTimeout),this.pressTimeout=window.setTimeout(this.timeOut,u))):this.pressTimeout!==void 0&&this.timeOut(),this.lastKeyWasModified=e.shiftKey)};this.timeOut=()=>{window.clearTimeout(this.pressTimeout),this.pressTimeout=void 0,this.presses=0,this.setStatus(this.message("timed-out")),this.messageTimeout=window.setTimeout(()=>this.setStatus(""),u),this.updateIndicator()};this.reset=e=>{e.persisted&&(r(this.getAttribute("hide-content-class")).forEach(t=>document.body.classList.remove(t)),this.overlay?.remove(),this.overlay=void 0,this.presses=0,this.setStatus(""),this.updateIndicator(),this.clearTimers())}}connectedCallback(){this.dataset.upgraded="",document.addEventListener("keyup",this.onKeyup,!0),document.addEventListener("click",this.onClick),window.addEventListener("pageshow",this.reset)}disconnectedCallback(){document.removeEventListener("keyup",this.onKeyup,!0),document.removeEventListener("click",this.onClick),window.removeEventListener("pageshow",this.reset),this.clearTimers(),this.presses=0,this.setStatus(""),this.updateIndicator()}exit(){let e=this.own("[data-exit-this-page-button]"),t=e instanceof HTMLAnchorElement?e.href:void 0,s=t!==void 0&&this.dispatchEvent(new CustomEvent("govuk-react-exit-this-page:exit",{detail:{href:t},bubbles:!0,cancelable:!0}));if(!t||!s){this.setStatus(""),this.updateIndicator();return}this.setStatus(""),r(this.getAttribute("hide-content-class")).forEach(a=>document.body.classList.add(a)),this.overlay?.remove();let i=document.createElement("div");i.setAttribute("role","alert");let o=r(this.getAttribute("overlay-class"));o.length?i.classList.add(...o):Object.entries(h).forEach(([a,l])=>i.style.setProperty(a,l)),document.body.appendChild(i),i.textContent=this.message("activated"),this.overlay=i,window.location.href=t}get listening(){return document.querySelector(n)===this}own(e){return Array.from(this.querySelectorAll(e)).find(t=>t.closest(n)===this)}message(e){return this.getAttribute(e)??c[e]}setStatus(e){let t=this.own("[data-exit-this-page-status]");if(!t||t.textContent===e)return;let{firstChild:s}=t;s instanceof Text&&t.childNodes.length===1?s.nodeValue=e:t.textContent=e}clearTimers(){window.clearTimeout(this.pressTimeout),window.clearTimeout(this.messageTimeout),this.pressTimeout=void 0,this.messageTimeout=void 0}updateIndicator(){let e=this.own("[data-exit-this-page-indicator]");if(!e)return;let t=this.presses>0;e.toggleAttribute("data-visible",t),r(this.getAttribute("indicator-visible-class")).forEach(s=>e.classList.toggle(s,t)),e.querySelectorAll("[data-exit-this-page-light]").forEach((s,i)=>{let o=i<this.presses;s.toggleAttribute("data-on",o),r(this.getAttribute("light-on-class")).forEach(a=>s.classList.toggle(a,o))})}}customElements.get(n)||customElements.define(n,d)}})();';
27
-
28
- // inline:file-upload
29
- var file_upload_default = '"use strict";(()=>{var m=["zero","one","two","few","many","other"];var b=n=>[n,...m.map(i=>`${n}-${i}`)];function v(n,i){let s=n.getAttribute(i);if(s!==null)return s;let t=m.flatMap(e=>{let r=n.getAttribute(`${i}-${e}`);return r===null?[]:[[e,r]]});return t.length?Object.fromEntries(t):void 0}function E(n){try{return n(void 0)}catch{return n("en")}}function p(n,i){try{return i(n)}catch{return E(i)}}function u(n,i,s){let t;if(typeof n=="string")t=n;else{let r=p(s,a=>new Intl.PluralRules(a)).select(i);t=n[r]??n.other}let e=p(s,r=>new Intl.NumberFormat(r)).format(i);return(t??"").replaceAll("%{count}",e)}var f="govuk-react-file-upload",c={"no-file-chosen":"No file chosen","multiple-files-chosen":{one:"%{count} file chosen",other:"%{count} files chosen"},"entered-drop-zone":"Entered drop zone","left-drop-zone":"Left drop zone"};function y(n,i,s){return n.length===0?u(i["no-file-chosen"]??c["no-file-chosen"],0,s):n.length===1?n[0].name:u(i["multiple-files-chosen"]??c["multiple-files-chosen"],n.length,s)}var g=n=>n?.split(/\\s+/).filter(Boolean)??[],L=(n,i)=>{if(n.textContent===i)return;let{firstChild:s}=n;s instanceof Text&&n.childNodes.length===1?s.nodeValue=i:n.textContent=i},o=(n,i,s)=>{s===null?n.removeAttribute(i):n.getAttribute(i)!==s&&n.setAttribute(i,s)},D=n=>Array.from(n).filter(i=>i.kind==="file").length;if(typeof HTMLElement<"u"&&typeof customElements<"u"){class n extends HTMLElement{constructor(){super(...arguments);this.fieldId="";this.dragging=!1;this.enteredAnotherElement=!1;this.onChange=()=>this.update();this.onReset=()=>window.setTimeout(()=>this.update());this.onClick=()=>this.input?.click();this.onDragOver=t=>t.preventDefault();this.onDrop=t=>{t.preventDefault();let{input:e}=this,r=t.dataTransfer?.files;!e||!r||!this.matchesCapacity(r.length)||(e.files=r,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),this.setDragging(!1))};this.onDocumentDragEnter=t=>{this.enteredAnotherElement=!0,!(!this.button||this.button.disabled||!(t.target instanceof Node))&&(this.dropZone.contains(t.target)?t.dataTransfer&&this.canDrop(t.dataTransfer)&&!this.dragging&&(this.setDragging(!0),this.announce("entered-drop-zone")):this.dragging&&(this.setDragging(!1),this.announce("left-drop-zone")))};this.onDocumentDragLeave=()=>{!this.enteredAnotherElement&&this.dragging&&!this.button?.disabled&&(this.setDragging(!1),this.announce("left-drop-zone")),this.enteredAnotherElement=!1}}static get observedAttributes(){return["empty-class","dragging-class","disabled-class",...Object.keys(c).flatMap(b)]}connectedCallback(){this.observer=new MutationObserver(()=>this.setup()),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","disabled","id","aria-describedby"]}),document.addEventListener("dragenter",this.onDocumentDragEnter),document.addEventListener("dragleave",this.onDocumentDragLeave),this.setup()}disconnectedCallback(){this.observer?.disconnect(),document.removeEventListener("dragenter",this.onDocumentDragEnter),document.removeEventListener("dragleave",this.onDocumentDragLeave),this.unbind()}attributeChangedCallback(){this.isConnected&&this.update()}own(t){return Array.from(this.querySelectorAll(t)).find(e=>e.closest(f)===this)}get dropZone(){return this.own("[data-file-upload-drop-zone]")??this}get locale(){return this.closest("[lang]")?.getAttribute("lang")||"en"}message(t){return v(this,t)??c[t]}setup(){let t=this.own(\'input[type="file"]\'),e=this.own("button[data-file-upload-button]");!t||!e||(t.id!==`${this.fieldId}-input`&&(this.fieldId=t.id),this.fieldId&&((t!==this.input||e!==this.button)&&(this.unbind(),this.input=t,this.button=e,this.form=t.form,t.addEventListener("change",this.onChange),this.form?.addEventListener("reset",this.onReset),e.addEventListener("click",this.onClick),e.addEventListener("dragover",this.onDragOver),e.addEventListener("drop",this.onDrop)),this.upgrade(t,e),this.update()))}unbind(){this.input?.removeEventListener("change",this.onChange),this.form?.removeEventListener("reset",this.onReset),this.button?.removeEventListener("click",this.onClick),this.button?.removeEventListener("dragover",this.onDragOver),this.button?.removeEventListener("drop",this.onDrop),this.input=void 0,this.button=void 0,this.form=void 0}upgrade(t,e){let r=this.fieldId,a=this.getRootNode(),l=a instanceof Document||a instanceof ShadowRoot?a.querySelector(`label[for="${CSS.escape(r)}"]`):null;l&&!l.id&&(l.id=`${r}-label`),o(t,"id",`${r}-input`),o(e,"id",r);let d=e.querySelector("[data-file-upload-separator]");d&&o(d,"id",`${r}-comma`),l&&o(e,"aria-labelledby",[l.id,d?.id,r].filter(Boolean).join(" ")),o(e,"aria-describedby",t.getAttribute("aria-describedby")),o(t,"hidden","hidden"),e.hidden&&(e.hidden=!1),this.dataset.upgraded=""}update(){let{input:t,button:e}=this;if(!t||!e)return;let{files:r}=t,a=!r?.length,l=e.querySelector("[data-file-upload-status]");l&&L(l,y(r??[],{"no-file-chosen":this.message("no-file-chosen"),"multiple-files-chosen":this.message("multiple-files-chosen")},this.locale)),o(e,"data-empty",a?"":null),g(this.getAttribute("empty-class")).forEach(h=>e.classList.toggle(h,a)),e.disabled!==t.disabled&&(e.disabled=t.disabled);let d=this.dropZone;o(d,"data-disabled",t.disabled?"":null),g(this.getAttribute("disabled-class")).forEach(h=>d.classList.toggle(h,t.disabled)),t.disabled?this.setDragging(!1):this.renderDragging()}setDragging(t){this.dragging=t,this.renderDragging()}renderDragging(){let{button:t,dragging:e}=this;t&&(o(t,"data-dragging",e?"":null),g(this.getAttribute("dragging-class")).forEach(r=>t.classList.toggle(r,e)))}announce(t){let e=this.own("[data-file-upload-announcements]");e&&(e.textContent=u(this.message(t),0,this.locale))}canDrop(t){return t.items.length?this.matchesCapacity(D(t.items)):t.types.length?t.types.includes("Files"):!0}matchesCapacity(t){return this.input?.multiple?t>0:t===1}}customElements.get(f)||customElements.define(f,n)}})();';
30
-
31
- // inline:focus-links
32
- var focus_links_default = '"use strict";(()=>{function r(t,n,o){o.forEach(e=>t.classList.remove(e)),n&&t.removeAttribute("tabindex"),t.removeAttribute("data-focus-tabindex"),t.removeAttribute("autofocus")}var d=t=>!t.hasAttribute("tabindex")||t.hasAttribute("data-focus-tabindex")&&t.getAttribute("tabindex")==="-1";function u(t,{focusedClasses:n=[],preventScroll:o=!1}={}){let e=d(t);return t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),document.activeElement!==t&&(n.forEach(i=>t.classList.add(i)),t.focus({preventScroll:o})),document.activeElement!==t?(r(t,e,n),!1):(n.forEach(i=>t.classList.add(i)),t.addEventListener("blur",()=>r(t,e,n),{once:!0}),!0)}var l="govuk-react-focus-links",f=t=>t?.split(/\\s+/).filter(Boolean)??[],h=t=>t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLButtonElement;function g(t){let n=t.closest("fieldset")?.getElementsByTagName("legend")[0];if(n){if(t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"))return n;let o=n.getBoundingClientRect().top,e=t.getBoundingClientRect();if(e.height&&window.innerHeight&&e.top+e.height-o<window.innerHeight/2)return n}return document.querySelector(`label[for="${CSS.escape(t.id)}"]`)??t.closest("label")}if(typeof HTMLElement<"u"&&typeof customElements<"u"){class t extends HTMLElement{constructor(){super(...arguments);this.onClick=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey)return;let i=e.target instanceof Element?e.target.closest("a[href]"):null;if(!(i instanceof HTMLAnchorElement)||!this.contains(i)||!(i.getAttribute("href")?.startsWith("#")||i.origin===window.location.origin&&i.pathname===window.location.pathname&&i.search===window.location.search))return;let c=i.hash.slice(1);try{c=decodeURIComponent(c)}catch{}let s=c?document.getElementById(c):null;if(s){if(h(s)){let a=g(s);if(!a)return;e.preventDefault(),a.scrollIntoView(),s.focus({preventScroll:!0});return}u(s,{focusedClasses:f(this.getAttribute("focused-class"))})}}}connectedCallback(){this.addEventListener("click",this.onClick)}disconnectedCallback(){this.removeEventListener("click",this.onClick)}}customElements.get(l)||customElements.define(l,t)}})();';
33
-
34
- // inline:modal
35
- var modal_default = '"use strict";(()=>{var o="govuk-react-modal",r=()=>typeof HTMLButtonElement<"u"&&"command"in HTMLButtonElement.prototype;if(typeof HTMLElement<"u"&&typeof customElements<"u"){class l extends HTMLElement{constructor(){super(...arguments);this.wasOpen=!1;this.onClick=e=>{let n=e.target instanceof Element?e.target.closest("button[commandfor]"):null;if(!(n instanceof HTMLButtonElement)||n.closest(o)!==this)return;let t=document.getElementById(n.getAttribute("commandfor")??"");if(!(t instanceof HTMLDialogElement))return;let s=n.getAttribute("command");if(s==="show-modal"&&!t.open)t.showModal();else if(s==="close"&&t.open)t.close();else if(s==="request-close"&&t.open){let i=Reflect.get(t,"requestClose");typeof i=="function"?i.call(t):t.close()}};this.onToggle=()=>{let{dialog:e}=this;!e||e.open===this.wasOpen||(this.wasOpen=e.open,this.dispatchEvent(new CustomEvent("govuk-react-modal:change",{detail:{open:e.open},bubbles:!0})))}}static get observedAttributes(){return["open"]}connectedCallback(){r()||this.addEventListener("click",this.onClick),!this.setup()&&(this.observer=new MutationObserver(()=>{this.setup()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.removeEventListener("click",this.onClick),this.observer?.disconnect(),this.dialog?.removeEventListener("close",this.onToggle),this.dialog?.removeEventListener("toggle",this.onToggle),this.dialog=void 0}attributeChangedCallback(){this.sync()}setup(){if(this.dialog)return!0;let e=Array.from(this.querySelectorAll("dialog")).find(n=>n.closest(o)===this);return e?(this.dialog=e,this.wasOpen=e.open,e.addEventListener("toggle",this.onToggle),e.addEventListener("close",this.onToggle),this.sync(),!0):!1}sync(){let{dialog:e}=this,n=this.getAttribute("open");if(!e||n===null)return;let t=n==="true";t!==e.open&&(this.wasOpen=t,t&&e.isConnected?e.showModal():t||e.close())}}customElements.get(o)||customElements.define(o,l)}})();';
36
-
37
- // inline:password-input
38
- var password_input_default = '"use strict";(()=>{var i="govuk-react-password-input",o={"show-text":"Show","hide-text":"Hide","show-label":"Show password","hide-label":"Hide password","shown-announcement":"Your password is visible","hidden-announcement":"Your password is hidden"},a="position:absolute;width:1px;height:1px;margin:0;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);border:0;white-space:nowrap";if(typeof HTMLElement<"u"&&typeof customElements<"u"){class n extends HTMLElement{constructor(){super(...arguments);this.onToggle=t=>{t.preventDefault(),this.input&&this.setVisible(this.input.type==="password")};this.onSubmit=()=>this.setVisible(!1);this.onPageShow=t=>{t.persisted&&this.setVisible(!1)}}connectedCallback(){this.setup()||(this.observer=new MutationObserver(()=>{this.setup()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.observer?.disconnect(),this.toggle?.removeEventListener("click",this.onToggle),this.form?.removeEventListener("submit",this.onSubmit),window.removeEventListener("pageshow",this.onPageShow),this.input=void 0,this.toggle=void 0,this.form=void 0}text(t){return this.getAttribute(t)??o[t]}own(t,e){let s=this.querySelector(t);return s instanceof e&&s.closest(i)===this?s:void 0}setup(){if(this.input)return!0;let t=this.own("[data-password-input]",HTMLInputElement),e=this.own("[data-password-toggle]",HTMLButtonElement);return!t||!e?!1:(this.input=t,this.toggle=e,this.status=this.own("[data-password-status]",HTMLElement),this.status||(this.status=document.createElement("div"),this.status.dataset.passwordStatus="",this.status.setAttribute("aria-live","polite"),this.status.setAttribute("style",a),t.insertAdjacentElement("afterend",this.status)),e.hidden=!1,e.addEventListener("click",this.onToggle),this.form=t.form,this.form?.addEventListener("submit",this.onSubmit),window.addEventListener("pageshow",this.onPageShow),t.type="password",this.label(!1),!0)}setVisible(t){let{input:e}=this;!e||t===(e.type==="text")||(e.type=t?"text":"password",this.label(t),this.status&&(this.status.textContent=this.text(t?"shown-announcement":"hidden-announcement")))}label(t){this.toggle&&(this.toggle.textContent=this.text(t?"hide-text":"show-text"),this.toggle.setAttribute("aria-label",this.text(t?"hide-label":"show-label")))}}customElements.get(i)||customElements.define(i,n)}})();';
39
-
40
- // inline:tabs
41
- var tabs_default = '"use strict";(()=>{var c="govuk-react-tabs",r=n=>n instanceof HTMLElement?n.dataset.value:void 0,l=n=>n?.split(/\\s+/).filter(Boolean)??[],v=(n,f)=>{let u=f.filter(e=>!n.classList.contains(e));u.length&&n.classList.add(...u)};if(typeof HTMLElement<"u"&&typeof customElements<"u"){class n extends HTMLElement{constructor(){super(...arguments);this.started=!1;this.active=!1;this.provisional=!1;this.onModeChange=()=>this.checkMode();this.onReady=()=>this.start();this.onHashChange=()=>{let e=this.triggerForHash();e&&this.choose(e)};this.onClick=e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=this.ownTrigger(e.target);!t||this.radiosFallback||(e.preventDefault(),this.choose(t))};this.onKeydown=e=>{if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=this.ownTrigger(e.target);if(!t)return;let i=this.triggers,s=i.indexOf(t),a=i.length-1,o=this.getAttribute("orientation")==="vertical",d={[o?"ArrowDown":"ArrowRight"]:s===a?0:s+1,[o?"ArrowUp":"ArrowLeft"]:s===0?a:s-1,Home:0,End:a}[e.key];d!==void 0&&(e.preventDefault(),this.choose(i[d]),i[d].focus())};this.onChange=e=>{let t=e.target;if(!(t instanceof HTMLInputElement)||!t.checked)return;let i=t.parentElement;if(!i?.matches("[data-tabs-content]")||i.closest(c)!==this||this.radioOf(i)!==t)return;let s=r(i);if(!(s===void 0||s===this.dataset.value)){if(this.picked=s,this.provisional=!1,this.hasAttribute("value"))queueMicrotask(()=>this.restoreRadio(t));else if(!this.active)this.dataset.value=s;else{this.show(this.triggerFor(s));let a=i.id;!this.radiosFallback&&this.active&&a&&window.location.hash!==`#${a}`&&window.history.pushState(window.history.state,"",`#${a}`)}this.dispatchEvent(new CustomEvent("govuk-react-tabs:change",{detail:{value:s},bubbles:!0}))}}}static get observedAttributes(){return["value"]}get value(){return this.getAttribute("value")}set value(e){e==null?this.removeAttribute("value"):this.setAttribute("value",e)}get selectedValue(){return this.dataset.value}get pickedValue(){return this.picked!==void 0&&this.picked!==this.defaultSelection()?this.picked:void 0}select(e){let t=this.triggerFor(e);t&&(this.provisional=!1,this.active?this.show(t):(this.dataset.value=e,this.checkRadio(e)))}connectedCallback(){this.addEventListener("change",this.onChange),this.observer=new MutationObserver(e=>{if(this.started){if(!this.active){(!this.mql||this.mql.matches)&&this.setup();return}e.some(t=>t.type==="childList")&&(this.wire(),this.provisional&&this.show(this.initialTrigger())),this.show(this.triggerFor(this.dataset.value)??this.triggers[0]),v(this,l(this.getAttribute("upgraded-class")))}}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.onReady):this.start()}disconnectedCallback(){this.removeEventListener("change",this.onChange),this.observer?.disconnect(),document.removeEventListener("DOMContentLoaded",this.onReady),this.mql?.removeEventListener("change",this.onModeChange),this.mql=void 0,this.started=!1,this.teardown()}attributeChangedCallback(e,t,i){this.started&&i!=null&&t!==i&&i!==this.dataset.value&&this.select(i)}get radiosFallback(){return this.getAttribute("fallback")==="radios"}get triggers(){return this.own("[data-tabs-trigger]")}own(e){return Array.from(this.querySelectorAll(e)).filter(t=>t.closest(c)===this)}ownTrigger(e){let t=e instanceof Element?e.closest("[data-tabs-trigger]"):null;return this.triggers.find(i=>i===t)}triggerFor(e){return e==null?void 0:this.triggers.find(t=>r(t)===e)}triggerForHash(){if(this.radiosFallback)return;let e=decodeURIComponent(window.location.hash.slice(1));return e?this.triggers.find(t=>this.parts(r(t)).content?.id===e):void 0}parts(e){let t=i=>r(i)===e;return{item:this.own("[data-tabs-item]").find(t),content:this.own("[data-tabs-content]").find(t)}}radioOf(e){let t=e?.firstElementChild;return t instanceof HTMLInputElement&&t.type==="radio"?t:void 0}checkRadio(e){let t=this.own("[data-tabs-content]").map(i=>({radio:this.radioOf(i),selected:r(i)===e}));t.some(({radio:i,selected:s})=>i&&s)&&(t.forEach(({radio:i,selected:s})=>{i&&!s&&(i.checked=!1)}),t.forEach(({radio:i,selected:s})=>{i&&s&&(i.checked=!0)}))}restoreRadio(e){r(e.parentElement)!==this.dataset.value&&this.checkRadio(this.dataset.value)}defaultSelection(){return r(this.triggerFor(this.getAttribute("value")))??r(this.triggerFor(this.getAttribute("default-value")))??r(this.triggers[0])}start(){if(document.removeEventListener("DOMContentLoaded",this.onReady),this.started)return;this.started=!0;let e=this.getAttribute("media");e&&(this.mql=window.matchMedia(e),this.mql.addEventListener("change",this.onModeChange)),this.checkMode()}checkMode(){!this.mql||this.mql.matches?this.setup():this.teardown()}pickedTrigger(){let e=this.triggerForHash();if(e)return e;let t=this.own("[data-tabs-content]").find(i=>this.radioOf(i)?.checked);return this.triggerFor(r(t))}initialTrigger(){let e=this.triggerFor(this.getAttribute("value")),t=this.triggerFor(this.dataset.value),i=this.pickedTrigger(),s=this.triggerFor(this.getAttribute("default-value")),a=(this.hasAttribute("prefer-pick")&&!t?i:void 0)??e??t??i??s;return this.provisional=!a,a??this.triggers[0]}setup(){this.active||!this.triggers.length||(this.active=!0,this.dataset.upgraded="",v(this,l(this.getAttribute("upgraded-class"))),this.wire(),this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeydown),this.radiosFallback||window.addEventListener("hashchange",this.onHashChange),this.picked===void 0&&!this.dataset.value&&(this.picked=r(this.pickedTrigger())),this.show(this.initialTrigger()))}wire(){let e=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal";this.own("[data-tabs-list]").forEach(t=>{t.setAttribute("role","tablist"),t.setAttribute("aria-orientation",e)}),this.own("[data-tabs-item]").forEach(t=>t.setAttribute("role","presentation")),this.triggers.forEach(t=>{let{content:i}=this.parts(r(t));t.setAttribute("role","tab"),i&&(i.id||(i.id=`${r(t)}-panel`,i.dataset.tabsGeneratedId=""),t.id||(t.id=`${i.id}-tab`,t.dataset.tabsGeneratedId=""),t.setAttribute("aria-controls",i.id),i.setAttribute("role","tabpanel"),i.setAttribute("aria-labelledby",t.id))})}teardown(){if(!this.active)return;this.active=!1,delete this.dataset.upgraded,this.removeEventListener("click",this.onClick),this.removeEventListener("keydown",this.onKeydown),window.removeEventListener("hashchange",this.onHashChange),this.radiosFallback||this.classList.remove(...l(this.getAttribute("upgraded-class"))),this.own("[data-tabs-list]").forEach(t=>{t.removeAttribute("role"),t.removeAttribute("aria-orientation")});let e=t=>{t.dataset.tabsGeneratedId!==void 0&&(t.removeAttribute("id"),delete t.dataset.tabsGeneratedId)};this.own("[data-tabs-item]").forEach(t=>{["role","data-state"].forEach(i=>t.removeAttribute(i)),t.classList.remove(...l(this.getAttribute("active-item-class")))}),this.triggers.forEach(t=>{e(t),["role","aria-controls","aria-selected","tabindex","data-state"].forEach(i=>t.removeAttribute(i))}),this.own("[data-tabs-content]").forEach(t=>{e(t),["role","aria-labelledby","tabindex","hidden","data-state"].forEach(i=>t.removeAttribute(i)),t.classList.remove(...l(this.getAttribute("hidden-content-class")))})}choose(e){this.radioOf(this.parts(r(e)).content)?.click()}show(e){if(!e)return;let t=l(this.getAttribute("active-item-class")),i=l(this.getAttribute("hidden-content-class"));this.triggers.forEach(s=>{let a=s===e,o=a?"active":"inactive",{item:d,content:h}=this.parts(r(s));s.dataset.state!==o&&(s.dataset.state=o),s.setAttribute("aria-selected",String(a)),s.setAttribute("tabindex",a?"0":"-1"),d&&(d.dataset.state!==o&&(d.dataset.state=o),t.forEach(g=>d.classList.toggle(g,a))),h&&(h.dataset.state!==o&&(h.dataset.state=o),h.hidden=!a,i.forEach(g=>h.classList.toggle(g,!a)),a?h.setAttribute("tabindex","0"):h.removeAttribute("tabindex"))}),this.dataset.value=r(e),this.checkRadio(this.dataset.value)}}customElements.get(c)||customElements.define(c,n)}})();';
42
-
43
- // src/inline-script/index.tsx
44
- function InlineScript({ script, ...props }) {
45
- return /* @__PURE__ */ React.createElement("script", { ...props, dangerouslySetInnerHTML: { __html: script } });
46
- }
47
- export {
48
- InlineScript,
49
- accordion_default as accordion,
50
- auto_focus_default as autoFocus,
51
- autocomplete_default as autocomplete,
52
- button_default as button,
53
- character_count_default as characterCount,
54
- choices_default as choices,
55
- disclosure_default as disclosure,
56
- exit_this_page_default as exitThisPage,
57
- file_upload_default as fileUpload,
58
- focus_links_default as focusLinks,
59
- modal_default as modal,
60
- password_input_default as passwordInput,
61
- tabs_default as tabs
62
- };
63
- //# sourceMappingURL=inline-script.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/inline-script/index.tsx","inline:accordion","inline:autocomplete","inline:auto-focus","inline:button","inline:character-count","inline:choices","inline:disclosure","inline:exit-this-page","inline:file-upload","inline:focus-links","inline:modal","inline:password-input","inline:tabs"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentProps } from 'react';\nimport accordion from 'inline:accordion';\nimport autocomplete from 'inline:autocomplete';\nimport autoFocus from 'inline:auto-focus';\nimport button from 'inline:button';\nimport characterCount from 'inline:character-count';\nimport choices from 'inline:choices';\nimport disclosure from 'inline:disclosure';\nimport exitThisPage from 'inline:exit-this-page';\nimport fileUpload from 'inline:file-upload';\nimport focusLinks from 'inline:focus-links';\nimport modal from 'inline:modal';\nimport passwordInput from 'inline:password-input';\nimport tabs from 'inline:tabs';\n\n/*\n * The elements' scripts, to inline in the page, so the markup is interactive as soon as it loads,\n * before React. Once React loads, its parts pick up where the elements are, and each element is\n * defined only once, whichever script runs first.\n *\n * Each script is a string, so a bundler includes only the ones you import.\n */\n\nexport {\n accordion,\n autocomplete,\n autoFocus,\n button,\n characterCount,\n choices,\n disclosure,\n exitThisPage,\n fileUpload,\n focusLinks,\n modal,\n passwordInput,\n tabs,\n};\n\nexport type InlineScriptProps = Omit<ComponentProps<'script'>, 'children' | 'dangerouslySetInnerHTML' | 'src'> & {\n /** One of this module's scripts, such as `tabs`. */\n script: string;\n};\n\n/**\n * Renders an element's script inline, such as `<InlineScript script={tabs} />` in the page's\n * `head`. Pass `nonce` for a Content Security Policy. Rendered on the server: a script that React\n * adds in the browser doesn't run, and isn't needed, since React's parts define their elements.\n */\nexport function InlineScript({ script, ...props }: InlineScriptProps) {\n return <script {...props} dangerouslySetInnerHTML={{ __html: script }} />;\n}\n","\"use strict\";(()=>{var u=\"govuk-react-accordion\",m={\"show-section-text\":\"Show\",\"hide-section-text\":\"Hide\",\"show-section-label\":\"Show this section\",\"hide-section-label\":\"Hide this section\",\"show-all-sections-text\":\"Show all sections\",\"hide-all-sections-text\":\"Hide all sections\"},c=a=>a?.split(/\\s+/).filter(Boolean),g=(a,d)=>{a.textContent!==d&&(a.textContent=d)},f=a=>a?.split(/\\s+/).filter(Boolean)??[];if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class a extends HTMLElement{constructor(){super(...arguments);this.open=new Set;this.upgraded=!1;this.controlled=!1;this.prepared=new WeakSet;this.onClick=e=>{let t=e.target instanceof Element?e.target:null,s=t?.closest(\"button[data-accordion-trigger]\");if(s&&this.ownsElement(s)){let n=this.sectionOf(s)?.dataset.value;if(n===void 0)return;let r=new Set(this.open);r.has(n)?r.delete(n):r.add(n),this.change(r);return}let i=t?.closest(\"button[data-accordion-show-all]\");if(i&&this.ownsElement(i)){let n=this.sections.map(r=>r.dataset.value??\"\");this.change(new Set(this.allOpen?[]:n))}};this.onBeforeMatch=e=>{let s=(e.target instanceof Element?this.sectionOf(e.target):void 0)?.dataset.value;s===void 0||this.open.has(s)||this.change(new Set([...this.open,s]),!0)}}static get observedAttributes(){return[\"value\"]}get openValues(){return this.upgraded?[...this.open]:void 0}get pickedValue(){return this.picked}connectedCallback(){this.observer=new MutationObserver(e=>{if(!this.upgraded){this.setup();return}e.some(t=>t.type===\"childList\")&&this.sections.forEach(t=>this.prepare(t)),this.render()}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"class\"]}),this.upgraded?(this.listen(),this.render()):this.setup()}disconnectedCallback(){this.observer?.disconnect(),this.removeEventListener(\"click\",this.onClick),this.removeEventListener(\"beforematch\",this.onBeforeMatch,!0)}attributeChangedCallback(){let e=c(this.getAttribute(\"value\"));this.controlled=e!==void 0,e&&(this.open=new Set(e),this.render())}get sections(){return this.own(\"[data-accordion-section]\")}get allOpen(){return this.sections.every(e=>this.open.has(e.dataset.value??\"\"))}own(e){return Array.from(this.querySelectorAll(e)).filter(t=>this.ownsElement(t))}ownsElement(e){return e.closest(u)===this}sectionOf(e){let t=e.closest(\"[data-accordion-section]\");return t&&this.ownsElement(t)?t:void 0}find(e,t){return Array.from(e.querySelectorAll(t)).find(s=>this.sectionOf(s)===e)}text(e){return this.getAttribute(e)??m[e]}get remember(){return this.getAttribute(\"remember-expanded\")!==\"false\"}setup(){let e=this.sections;if(!e.some(i=>this.find(i,\"button[data-accordion-trigger]\")))return;this.upgraded=!0;let t=c(this.getAttribute(\"value\"));this.controlled=t!==void 0,this.open=new Set(t??c(this.getAttribute(\"default-value\"))),this.dataset.upgraded=\"\";let s=f(this.getAttribute(\"upgraded-class\"));s.length&&this.classList.add(...s),this.own(\"[data-accordion-controls]\").forEach(i=>{i.hidden=!1}),e.forEach(i=>this.prepare(i)),this.listen(),this.render()}listen(){this.addEventListener(\"click\",this.onClick),this.addEventListener(\"beforematch\",this.onBeforeMatch,!0)}prepare(e){let t=this.find(e,\"button[data-accordion-trigger]\");if(!t||this.prepared.has(e))return;this.prepared.add(e);let s=e.dataset.value??\"\";if(!this.controlled){let n=c(this.getAttribute(\"default-value\"));(n?n.includes(s):e.hasAttribute(\"data-expanded\"))&&this.open.add(s),this.restore(e)}Array.from(e.querySelectorAll(\"[data-accordion-fallback]\")).filter(n=>this.sectionOf(n)===e).forEach(n=>{n.hidden=!0}),t.hidden=!1;let i=this.find(e,\"[data-accordion-content]\");i?.id&&t.setAttribute(\"aria-controls\",i.id)}restore(e){let t=this.find(e,\"[data-accordion-content]\")?.id,s=e.dataset.value;if(!(!this.remember||!t||s===void 0))try{let i=window.sessionStorage.getItem(t);i===\"true\"?this.open.add(s):i===\"false\"&&this.open.delete(s)}catch{}}store(e){this.remember&&this.sections.forEach(t=>{let s=t.dataset.value??\"\",i=this.find(t,\"[data-accordion-content]\")?.id;if(!(!i||e.has(s)===this.open.has(s)))try{window.sessionStorage.setItem(i,String(this.open.has(s)))}catch{}})}change(e,t=!1){let s=this.sections.map(i=>i.dataset.value??\"\").filter(i=>e.has(i));if(!this.controlled||t){let i=this.open;this.open=new Set(s),this.controlled||(this.picked=s,this.store(i)),this.render()}this.dispatchEvent(new CustomEvent(\"govuk-react-accordion:change\",{detail:{value:s},bubbles:!0}))}render(){if(!this.upgraded)return;let e=f(this.getAttribute(\"expanded-section-class\")),t=f(this.getAttribute(\"collapsed-icon-class\")),s=(n,r)=>{Array.from(n.querySelectorAll(\"[data-accordion-icon]\")).forEach(o=>{t.forEach(l=>o.classList.toggle(l,!r))})};this.sections.forEach(n=>{let r=this.open.has(n.dataset.value??\"\"),o=this.find(n,\"button[data-accordion-trigger]\"),l=this.find(n,\"[data-accordion-content]\");if(n.dataset.state=r?\"open\":\"closed\",e.forEach(h=>n.classList.toggle(h,r)),l&&(r?l.removeAttribute(\"hidden\"):l.setAttribute(\"hidden\",\"until-found\")),!o)return;o.setAttribute(\"aria-expanded\",String(r));let v=Array.from(o.querySelectorAll(\"[data-accordion-label]\")).map(h=>h.textContent?.trim()??\"\");o.setAttribute(\"aria-label\",[...v,this.text(r?\"hide-section-label\":\"show-section-label\")].join(\" , \"));let p=o.querySelector(\"[data-accordion-toggle-text]\");p&&g(p,this.text(r?\"hide-section-text\":\"show-section-text\")),s(o,r)});let i=this.allOpen;this.own(\"button[data-accordion-show-all]\").forEach(n=>{n.setAttribute(\"aria-expanded\",String(i));let r=n.querySelector(\"[data-accordion-show-all-text]\");r&&g(r,this.text(i?\"hide-all-sections-text\":\"show-all-sections-text\")),s(n,i)})}}customElements.get(u)||customElements.define(u,a)}})();","\"use strict\";(()=>{var O=[\"zero\",\"one\",\"two\",\"few\",\"many\",\"other\"];var E=s=>[s,...O.map(o=>`${s}-${o}`)];function L(s,o){let l=s.getAttribute(o);if(l!==null)return l;let t=O.flatMap(e=>{let n=s.getAttribute(`${o}-${e}`);return n===null?[]:[[e,n]]});return t.length?Object.fromEntries(t):void 0}function A(s){try{return s(void 0)}catch{return s(\"en\")}}function v(s,o){try{return o(s)}catch{return A(o)}}function p(s,o,l){let t;if(typeof s==\"string\")t=s;else{let n=v(l,i=>new Intl.PluralRules(i)).select(o);t=s[n]??s.other}let e=v(l,n=>new Intl.NumberFormat(n)).format(o);return(t??\"\").replaceAll(\"%{count}\",e)}var g=\"govuk-react-autocomplete\",w={\"status-query-too-short\":\"Type in %{count} or more characters for results\",\"status-no-results\":\"No search results\",\"status-selected-option\":\"%{option} %{position} of %{count} is highlighted\",\"status-results\":{one:\"%{count} result is available.\",other:\"%{count} results are available.\"}},I=1400,k=100,b=()=>typeof navigator<\"u\"&&/(iPod|iPhone|iPad)/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent),u=(s,o,l)=>{l===null?s.removeAttribute(o):s.getAttribute(o)!==l&&s.setAttribute(o,l)},M=(s,o)=>{s.textContent!==o&&(s.textContent=o)},C=typeof HTMLInputElement>\"u\"?void 0:Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,\"value\")?.set;if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class s extends HTMLElement{constructor(){super(...arguments);this.focused=null;this.hovered=null;this.menuOpen=!1;this.options=[];this.currentQuery=\"\";this.validChoiceMade=!1;this.selected=null;this.ariaHint=!0;this.lastFocused=null;this.settingValue=!1;this.bump=!1;this.generatedIds=0;this.onPoll=()=>{this.input&&this.input.value!==this.currentQuery&&this.handleInputChange(this.input.value)};this.onInput=()=>{this.input&&!this.settingValue&&this.handleInputChange(this.input.value)};this.onInputFocus=()=>{let t=!this.validChoiceMade&&this.queryLongEnough&&this.options.length>0;this.focused=-1,t&&(this.menuOpen=!0,this.selected=-1),this.render()};this.onFocusOut=t=>{let{target:e,relatedTarget:n}=t;if(e===this.input){if(this.focused!==-1)return;let m=b();this.handleComponentBlur({menuOpen:this.menuOpen&&m,query:m?this.currentQuery:this.valueOf(this.selectedOption)});return}if(!(e instanceof HTMLElement)||!e.isConnected)return;let i=this.options.indexOf(e);if(i===-1)return;let r=n===null,h=n===this.input,d=this.focused!==i&&this.focused!==-1;(!d&&r||!(d||h))&&this.handleComponentBlur({menuOpen:this.menuOpen&&b(),query:this.valueOf(this.selectedOption)})};this.onKeyDown=t=>{let{target:e}=t,n=e===this.input,i=e instanceof HTMLElement&&this.options.includes(e);if(!n&&!i)return;let r=this.selected??-1;switch(t.key){case\"ArrowUp\":t.preventDefault(),this.menuOpen&&r!==-1&&this.focusOption(r-1);break;case\"ArrowDown\":t.preventDefault(),this.menuOpen&&r!==this.options.length-1&&this.focusOption(r+1);break;case\" \":this.focused!==null&&this.focused!==-1&&(t.preventDefault(),this.confirm(this.focused));break;case\"Enter\":if(!this.menuOpen)break;r>=0?(t.preventDefault(),this.confirm(r)):this.submitOnConfirm||t.preventDefault();break;case\"Escape\":i&&this.input?.focus(),this.handleComponentBlur({menuOpen:!1,query:this.currentQuery});break;default:i&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&(t.key.length===1||t.key===\"Backspace\")&&this.input?.focus()}};this.onOptionMouseDown=t=>{this.optionOf(t.target)!==-1&&t.preventDefault()};this.onOptionClick=t=>{let e=this.optionOf(t.target);e!==-1&&this.confirm(e)};this.onOptionMouseOver=t=>{let e=this.optionOf(t.target);e===-1||e===this.hovered||b()||(this.hovered=e,this.render())};this.onListMouseLeave=()=>{this.hovered!==null&&(this.hovered=null,this.render())}}static get observedAttributes(){return[\"min-length\",\"filter\",\"confirm-on-blur\",\"submit-on-confirm\",...Object.keys(w).flatMap(E)]}get query(){return this.input?this.currentQuery:void 0}connectedCallback(){this.observer=new MutationObserver(t=>this.onMutation(t)),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:[\"aria-describedby\",\"data-value\"]}),this.setup()}disconnectedCallback(){this.observer?.disconnect(),this.unbind()}attributeChangedCallback(){this.isConnected&&(this.input?this.render():this.setup())}own(t){return this.ownAll(t)[0]}ownAll(t){return Array.from(this.querySelectorAll(t)).filter(e=>e.closest(g)===this)}get allOptions(){return this.ownAll(\"[data-autocomplete-option]\")}get minLength(){let t=Number(this.getAttribute(\"min-length\"));return Number.isFinite(t)&&t>0?t:0}get filterType(){let t=this.getAttribute(\"filter\");return t===\"starts-with\"||t===\"none\"?t:\"contains\"}get confirmOnBlur(){return this.getAttribute(\"confirm-on-blur\")!==\"false\"}get submitOnConfirm(){return this.hasAttribute(\"submit-on-confirm\")}get locale(){return(this.input??this).closest(\"[lang]\")?.getAttribute(\"lang\")||\"en\"}setup(){let t=this.own(\"[data-autocomplete-input]\"),e=this.own(\"[data-autocomplete-listbox]\");if(!(t instanceof HTMLInputElement)||!t.id||!e){this.unbind(),delete this.dataset.upgraded;return}if(t===this.input&&e===this.listbox){this.render();return}this.unbind(),this.input=t,this.listbox=e,t.addEventListener(\"input\",this.onInput),t.addEventListener(\"click\",this.onInput),t.addEventListener(\"focus\",this.onInputFocus),this.addEventListener(\"keydown\",this.onKeyDown),this.addEventListener(\"focusout\",this.onFocusOut),e.addEventListener(\"mousedown\",this.onOptionMouseDown),e.addEventListener(\"click\",this.onOptionClick),e.addEventListener(\"mouseover\",this.onOptionMouseOver),e.addEventListener(\"mouseleave\",this.onListMouseLeave),this.poll=window.setInterval(this.onPoll,k),this.currentQuery=t.value,this.ariaHint=t.value===\"\",this.options=this.queryLongEnough?this.matchingOptions():[],this.focused=document.activeElement===t?-1:null,this.lastFocused=this.focused,this.selected=null,this.menuOpen=!1,this.validChoiceMade=!1,this.dataset.upgraded=\"\",this.render()}unbind(){let{input:t,listbox:e}=this;window.clearInterval(this.poll),window.clearTimeout(this.statusTimer),!(!t||!e)&&(t.removeEventListener(\"input\",this.onInput),t.removeEventListener(\"click\",this.onInput),t.removeEventListener(\"focus\",this.onInputFocus),this.removeEventListener(\"keydown\",this.onKeyDown),this.removeEventListener(\"focusout\",this.onFocusOut),e.removeEventListener(\"mousedown\",this.onOptionMouseDown),e.removeEventListener(\"click\",this.onOptionClick),e.removeEventListener(\"mouseover\",this.onOptionMouseOver),e.removeEventListener(\"mouseleave\",this.onListMouseLeave),this.input=void 0,this.listbox=void 0)}onMutation(t){let e=this.own(\"[data-autocomplete-status]\"),n=t.filter(i=>!(e?.contains(i.target)??!1)&&!(i.type===\"attributes\"&&i.target===this.input&&this.describedByIsCurrent()));if(n.length){if(!this.input?.isConnected||!this.listbox?.isConnected||!this.contains(this.input)){this.setup();return}n.some(i=>this.listbox?.contains(i.target))&&this.updateOptions(),this.render()}}updateOptions(){let t=this.selectedOption;if(!this.queryLongEnough||this.currentQuery===\"\"){this.options=[];return}if(this.options=this.matchingOptions(),this.focused===null||this.validChoiceMade)return;this.menuOpen=this.options.length>0;let e=t?this.options.indexOf(t):-1;this.selected=e,this.focused>=0&&(this.focused=e)}get queryLongEnough(){return this.currentQuery.length>=this.minLength}valueOf(t){if(t)return t.dataset.value??t.textContent?.trim()??\"\"}matchingOptions(){let t=this.currentQuery.toLowerCase(),e=this.filterType;return this.allOptions.filter(n=>{if(e===\"none\")return!0;let i=(this.valueOf(n)??\"\").toLowerCase();return e===\"starts-with\"?i.startsWith(t):i.includes(t)})}isQueryAnOption(t){return this.options.some(e=>this.valueOf(e)?.toLowerCase()===t.toLowerCase())}handleInputChange(t){let e=this.currentQuery!==t;this.currentQuery=t,this.ariaHint=t===\"\",t!==\"\"&&e&&this.queryLongEnough?(this.dispatchEvent(new CustomEvent(\"govuk-react-autocomplete:query\",{bubbles:!0,detail:{query:t}})),this.options=this.matchingOptions(),this.menuOpen=this.options.length>0,this.selected=-1,this.validChoiceMade=!1):(t===\"\"||!this.queryLongEnough)&&(this.menuOpen=!1,this.options=[]),this.render()}get selectedOption(){return this.selected===null||this.selected<0?void 0:this.options[this.selected]}handleComponentBlur({menuOpen:t,query:e}){let n=this.currentQuery,i=this.selectedOption;this.confirmOnBlur&&(n=e||this.currentQuery,i&&this.confirmEvent(this.valueOf(i)??\"\")),this.focused=null,this.menuOpen=t,this.selected=null,this.validChoiceMade=this.isQueryAnOption(n),this.setQuery(n),this.render()}setQuery(t){this.currentQuery=t;let{input:e}=this;!e||e.value===t||(this.settingValue=!0,C?C.call(e,t):e.value=t,e.dispatchEvent(new Event(\"input\",{bubbles:!0})),this.settingValue=!1)}confirmEvent(t){return this.dispatchEvent(new CustomEvent(\"govuk-react-autocomplete:confirm\",{bubbles:!0,cancelable:!0,detail:{value:t}}))}confirm(t){let e=this.options[t];if(!e)return;let n=this.valueOf(e)??\"\";this.focused=-1,this.hovered=null,this.menuOpen=!1,this.selected=-1,this.validChoiceMade=!0,this.setQuery(n),this.render();let i=this.confirmEvent(n),r=this.input?.form;i&&this.submitOnConfirm&&r&&window.setTimeout(()=>r.requestSubmit())}focusOption(t){this.focused=t,this.hovered=null,this.selected=t,this.render()}optionOf(t){if(!(t instanceof Element))return-1;let e=t.closest(\"[data-autocomplete-option]\");return e?this.options.indexOf(e):-1}ensureId(t,e){return t.id||(this.generatedIds+=1,t.id=`${this.input?.id}__${e}${e.endsWith(\"--\")?this.generatedIds:\"\"}`),t.id}get hint(){return this.own(\"[data-autocomplete-hint]\")}describedBy(){let{input:t}=this;if(!t)return null;let e=this.hint,n=e?this.ensureId(e,\"assistiveHint\"):void 0,i=(t.getAttribute(\"aria-describedby\")??\"\").split(/\\s+/).filter(r=>r&&r!==n);return this.ariaHint&&n&&i.push(n),i.length?i.join(\" \"):null}describedByIsCurrent(){return(this.input?.getAttribute(\"aria-describedby\")??null)===this.describedBy()}render(){let{input:t,listbox:e}=this;if(!t||!e)return;let{focused:n,hovered:i,menuOpen:r,options:h,selected:d}=this,y=n===-1&&h.length===0&&this.currentQuery!==\"\"&&this.queryLongEnough,T=n!==null&&n!==-1,x=this.ensureId(e,\"listbox\");u(e,\"role\",\"listbox\"),e.hasAttribute(\"aria-labelledby\")||e.setAttribute(\"aria-labelledby\",t.id),e.hidden=!(r||y),this.allOptions.forEach(a=>{let c=h.indexOf(a);this.ensureId(a,\"option--\"),a.hidden=c===-1,u(a,\"role\",\"option\"),u(a,\"tabindex\",\"-1\"),u(a,\"aria-selected\",n===c&&c!==-1?\"true\":\"false\"),u(a,\"aria-posinset\",c===-1?null:String(c+1)),u(a,\"aria-setsize\",c===-1?null:String(h.length)),u(a,\"data-focused\",c!==-1&&(n===-1?d===c:n===c)&&i===null?\"\":null)});let f=this.own(\"[data-autocomplete-no-results]\");if(f&&(f.hidden=!y,u(f,\"role\",\"option\"),u(f,\"aria-disabled\",\"true\")),u(t,\"role\",\"combobox\"),u(t,\"autocomplete\",\"off\"),u(t,\"aria-autocomplete\",\"list\"),u(t,\"aria-controls\",x),u(t,\"aria-expanded\",r?\"true\":\"false\"),u(t,\"aria-activedescendant\",T?h[n]?.id??null:null),u(t,\"aria-describedby\",this.describedBy()),u(this,\"data-focused\",n===null?null:\"\"),n!==this.lastFocused&&n!==null){let a=n===-1?t:h[n];a&&document.activeElement!==a&&a.focus(),n===-1&&this.lastFocused===null&&t.selectionStart!==null&&t.setSelectionRange(0,t.value.length)}this.lastFocused=n,this.scheduleStatus()}message(t){return L(this,t)??w[t]}statusText(){let{locale:t,options:e}=this;if(!this.queryLongEnough)return p(this.message(\"status-query-too-short\"),this.minLength,t);if(e.length===0)return p(this.message(\"status-no-results\"),0,t);let n=p(this.message(\"status-results\"),e.length,t),i=this.valueOf(this.selectedOption);if(i===void 0||this.selected===null)return n;let r=v(t,d=>new Intl.NumberFormat(d)).format(this.selected+1),h=p(this.message(\"status-selected-option\"),e.length,t).replaceAll(\"%{option}\",()=>i).replaceAll(\"%{position}\",()=>r);return`${n} ${h}`}scheduleStatus(){let t=this.ownAll(\"[data-autocomplete-status-region]\");t.length&&(t.forEach(e=>M(e,\"\")),window.clearTimeout(this.statusTimer),this.statusTimer=window.setTimeout(()=>{this.bump=!this.bump;let n=this.focused===null||this.validChoiceMade?\"\":this.statusText();t.forEach((i,r)=>M(i,r===0===this.bump?n:\"\"))},I))}}customElements.get(g)||customElements.define(g,s)}})();\n/*! Based on accessible-autocomplete, Copyright (c) 2017 Crown Copyright (Government Digital Service), MIT licence: licences/accessible-autocomplete.txt */","\"use strict\";(()=>{function o(t,i,s){s.forEach(e=>t.classList.remove(e)),i&&t.removeAttribute(\"tabindex\"),t.removeAttribute(\"data-focus-tabindex\"),t.removeAttribute(\"autofocus\")}var c=t=>!t.hasAttribute(\"tabindex\")||t.hasAttribute(\"data-focus-tabindex\")&&t.getAttribute(\"tabindex\")===\"-1\";function n(t){o(t,t.hasAttribute(\"tabindex\")&&c(t),[])}function u(t,{focusedClasses:i=[],preventScroll:s=!1}={}){let e=c(t);return t.hasAttribute(\"tabindex\")||t.setAttribute(\"tabindex\",\"-1\"),document.activeElement!==t&&(i.forEach(r=>t.classList.add(r)),t.focus({preventScroll:s})),document.activeElement!==t?(o(t,e,i),!1):(i.forEach(r=>t.classList.add(r)),t.addEventListener(\"blur\",()=>o(t,e,i),{once:!0}),!0)}var a=\"govuk-react-auto-focus\";if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class t extends HTMLElement{constructor(){super(...arguments);this.focused=!1}connectedCallback(){this.focusTarget()||(this.observer=new MutationObserver(()=>{this.focusTarget()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.observer?.disconnect()}get target(){let e=Array.from(this.querySelectorAll(\"[data-auto-focus]\")).find(r=>r.closest(a)===this)??this.firstElementChild;return e instanceof HTMLElement?e:void 0}focusTarget(){if(this.focused)return!0;let{target:e}=this;if(!e)return!1;if(this.focused=!0,this.hasAttribute(\"disabled\"))return!0;if(e.hasAttribute(\"autofocus\")){let r=document.activeElement;if(r===e)return u(e,{preventScroll:!0}),!0;if(r&&r!==document.body)return n(e),!0}return queueMicrotask(()=>{(!e.isConnected||!u(e))&&(this.focused=!1)}),!0}}customElements.get(a)||customElements.define(a,t)}})();","\"use strict\";(()=>{var o=Symbol.for(\"govuk-react-button\"),u=new WeakMap,r=t=>{for(let e of t.composedPath())if(e instanceof HTMLElement&&e.hasAttribute(\"data-button\"))return e;return null};function i(t){let e=r(t);if(!e||e.getAttribute(\"data-prevent-double-click\")!==\"true\")return;let n=u.get(e);if(n!==void 0&&t.timeStamp-n<1e3){t.preventDefault(),t.stopImmediatePropagation();return}u.set(e,t.timeStamp)}function a(t){if(t.key!==\" \"||t.repeat||t.defaultPrevented)return;let e=r(t);!e||e!==t.composedPath()[0]||e.getAttribute(\"role\")!==\"button\"||e instanceof HTMLButtonElement||(t.preventDefault(),e.click())}typeof document<\"u\"&&(Reflect.get(globalThis,o)||(Reflect.set(globalThis,o,!0),document.addEventListener(\"click\",i,!0),document.addEventListener(\"keydown\",a)));})();","\"use strict\";(()=>{var f=[\"zero\",\"one\",\"two\",\"few\",\"many\",\"other\"];var v=e=>[e,...f.map(s=>`${e}-${s}`)];function b(e,s){let a=e.getAttribute(s);if(a!==null)return a;let t=f.flatMap(n=>{let r=e.getAttribute(`${s}-${n}`);return r===null?[]:[[n,r]]});return t.length?Object.fromEntries(t):void 0}function L(e){try{return e(void 0)}catch{return e(\"en\")}}function h(e,s){try{return s(e)}catch{return L(s)}}function w(e,s,a){let t;if(typeof e==\"string\")t=e;else{let r=h(a,i=>new Intl.PluralRules(i)).select(s);t=e[r]??e.other}let n=h(a,r=>new Intl.NumberFormat(r)).format(s);return(t??\"\").replaceAll(\"%{count}\",n)}var p=[\"characters-under-limit\",\"characters-at-limit\",\"characters-over-limit\",\"words-under-limit\",\"words-at-limit\",\"words-over-limit\"],C={\"characters-under-limit\":{one:\"You have %{count} character remaining\",other:\"You have %{count} characters remaining\"},\"characters-at-limit\":\"You have 0 characters remaining\",\"characters-over-limit\":{one:\"You have %{count} character too many\",other:\"You have %{count} characters too many\"},\"words-under-limit\":{one:\"You have %{count} word remaining\",other:\"You have %{count} words remaining\"},\"words-at-limit\":\"You have 0 words remaining\",\"words-over-limit\":{one:\"You have %{count} word too many\",other:\"You have %{count} words too many\"}};var y=(e,s)=>b(e,s);function A(e,s,a){if(s===\"length\")return e.length;if(typeof Intl.Segmenter!=\"function\")return s===\"words\"?e.match(/\\S+/g)?.length??0:Array.from(e).length;let t=h(a,r=>new Intl.Segmenter(r,{granularity:s===\"words\"?\"word\":\"grapheme\"})),n=Array.from(t.segment(e));return s===\"words\"?n.filter(r=>r.isWordLike).length:n.length}function T(e,s,a,t){let n=e<0?\"over\":e===0?\"at\":\"under\",r=`${s===\"words\"?\"words\":\"characters\"}-${n}-limit`,i=a[r]??C[r];return{state:n,text:w(i,Math.abs(e),t)}}var m=\"govuk-react-character-count\",E={position:\"absolute\",width:\"1px\",height:\"1px\",margin:\"0\",padding:\"0\",overflow:\"hidden\",clip:\"rect(0 0 0 0)\",\"clip-path\":\"inset(50%)\",border:\"0\",\"white-space\":\"nowrap\"},c=e=>e?.split(/\\s+/).filter(Boolean)??[],x=(e,s)=>{if(e.textContent===s)return;let{firstChild:a}=e;a instanceof Text&&e.childNodes.length===1?a.nodeValue=s:e.textContent=s},I=e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement;if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class e extends HTMLElement{constructor(){super(...arguments);this.currentCount=0;this.onInput=()=>{this.update(),this.lastInputTime=Date.now()};this.onFocus=()=>{window.clearInterval(this.checker),this.checker=window.setInterval(()=>{(!this.lastInputTime||Date.now()-500>=this.lastInputTime)&&this.announceIfChanged()},1e3)};this.onBlur=()=>window.clearInterval(this.checker);this.onPageShow=()=>{this.input&&(this.update(),this.announceIfChanged())}}static get observedAttributes(){return[\"maxlength\",\"count-type\",\"threshold\",\"within-limit-class\",\"over-limit-class\",\"below-threshold-class\",\"input-over-limit-class\",...p.flatMap(v)]}get count(){return this.input?this.currentCount:void 0}connectedCallback(){this.observer=new MutationObserver(t=>{t.some(n=>n.type===\"childList\")?this.setup():this.update()}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"class\",\"maxlength\"]}),window.addEventListener(\"pageshow\",this.onPageShow),this.setup()}disconnectedCallback(){this.observer?.disconnect(),window.removeEventListener(\"pageshow\",this.onPageShow),window.clearInterval(this.checker),this.unbind()}attributeChangedCallback(){if(this.isConnected){if(!this.input){this.setup();return}if(this.maxLength===void 0){this.downgrade();return}this.lastAnnouncedValue=void 0,this.update()}}own(t){return Array.from(this.querySelectorAll(t)).find(n=>n.closest(m)===this)}get maxLength(){let t=Number(this.getAttribute(\"maxlength\"));return this.hasAttribute(\"maxlength\")&&Number.isFinite(t)?t:void 0}get countType(){let t=this.getAttribute(\"count-type\");return t===\"characters\"||t===\"words\"?t:\"length\"}get locale(){return(this.input??this).closest(\"[lang]\")?.getAttribute(\"lang\")||\"en\"}setup(){let t=this.own(\"[data-character-count-input]\");if(!I(t)||this.maxLength===void 0)return;let n=t!==this.input;n&&(this.unbind(),this.input=t,t.addEventListener(\"input\",this.onInput),t.addEventListener(\"focus\",this.onFocus),t.addEventListener(\"blur\",this.onBlur),t.removeAttribute(\"maxlength\"),this.lastAnnouncedValue=void 0),this.dataset.upgraded=\"\";let r=this.own(\"[data-character-count-description]\");r&&!this.hasAttribute(\"hidden-description-class\")&&Object.entries(E).forEach(([i,l])=>r.style.setProperty(i,l)),[this.own(\"[data-character-count-status]\"),this.own(\"[data-character-count-sr-status]\")].forEach(i=>{i&&(i.hidden=!1)}),this.update(),n&&this.announceIfChanged()}unbind(){let{input:t}=this;t&&(t.removeEventListener(\"input\",this.onInput),t.removeEventListener(\"focus\",this.onFocus),t.removeEventListener(\"blur\",this.onBlur),window.clearInterval(this.checker),this.input=void 0)}downgrade(){let{input:t}=this;if(!t)return;c(this.getAttribute(\"input-over-limit-class\")).forEach(r=>t.classList.toggle(r,!1)),this.unbind(),delete this.dataset.upgraded;let n=this.own(\"[data-character-count-description]\");n&&(this.hasAttribute(\"hidden-description-class\")?c(this.getAttribute(\"hidden-description-class\")).forEach(r=>n.classList.toggle(r,!1)):Object.keys(E).forEach(r=>n.style.removeProperty(r))),[this.own(\"[data-character-count-status]\"),this.own(\"[data-character-count-sr-status]\")].forEach(r=>{r&&(r.hidden=!0)})}update(){this.input&&(this.input.removeAttribute(\"maxlength\"),this.currentCount=A(this.input.value,this.countType,this.locale),this.render())}message(){let t=Object.fromEntries(p.map(n=>[n,y(this,n)]));return T((this.maxLength??1/0)-this.currentCount,this.countType,t,this.locale)}get belowThreshold(){let t=Number(this.getAttribute(\"threshold\"));return t?this.currentCount<(this.maxLength??1/0)*t/100:!1}render(){let{input:t}=this;if(!t)return;let{state:n,text:r}=this.message(),i=n===\"over\",l=this.own(\"[data-character-count-description]\");c(this.getAttribute(\"hidden-description-class\")).forEach(o=>l?.classList.toggle(o,!0)),c(this.getAttribute(\"input-over-limit-class\")).forEach(o=>t.classList.toggle(o,i));let d=this.belowThreshold,g=this.own(\"[data-character-count-sr-status]\");d?g?.setAttribute(\"aria-hidden\",\"true\"):g?.removeAttribute(\"aria-hidden\");let u=this.own(\"[data-character-count-status]\");u&&(u.dataset.state=n,u.toggleAttribute(\"data-below-threshold\",d),c(this.getAttribute(\"below-threshold-class\")).forEach(o=>u.classList.toggle(o,d)),c(this.getAttribute(\"within-limit-class\")).forEach(o=>u.classList.toggle(o,!i)),c(this.getAttribute(\"over-limit-class\")).forEach(o=>u.classList.toggle(o,i)),x(u,r))}announceIfChanged(){let{input:t}=this,n=this.own(\"[data-character-count-sr-status]\");if(!t||!n||t.value===this.lastAnnouncedValue)return;this.lastAnnouncedValue=t.value;let{state:r,text:i}=this.message();n.dataset.state=r,x(n,i)}}customElements.get(m)||customElements.define(m,e)}})();","\"use strict\";(()=>{var o=\"govuk-react-choices\",a=i=>i?.split(/\\s+/).filter(Boolean)??[],c=i=>i instanceof HTMLInputElement&&(i.type===\"radio\"||i.type===\"checkbox\");if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class i extends HTMLElement{constructor(){super(...arguments);this.upgraded=!1;this.onClick=e=>{let t=e.target;if(!c(t)||!this.owns(t))return;if(t.type===\"radio\"){this.syncAll();return}if(this.syncInput(t),!t.checked)return;let n=t.hasAttribute(\"data-choices-exclusive\"),r=this.inputsNamed(t).filter(s=>s!==t&&s.type===\"checkbox\"&&s.checked&&(n||s.hasAttribute(\"data-choices-exclusive\")));window.setTimeout(()=>{r.filter(s=>s.checked).forEach(s=>{s.disabled?s.checked=!1:s.click()}),this.syncAll()})};this.onReset=e=>{e.target instanceof HTMLFormElement&&this.choices().some(t=>t.form===e.target)&&window.setTimeout(()=>this.sync())};this.onChange=e=>{c(e.target)&&this.owns(e.target)&&this.sync()};this.onPageShow=()=>this.sync()}connectedCallback(){this.observer=new MutationObserver(e=>{e.some(t=>t.type===\"childList\")?this.setup():(this.upgraded&&this.addUpgradedClasses(),this.sync())}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"class\"]}),this.addEventListener(\"click\",this.onClick),this.addEventListener(\"change\",this.onChange),window.addEventListener(\"pageshow\",this.onPageShow),document.addEventListener(\"reset\",this.onReset,!0),this.setup()}disconnectedCallback(){this.observer?.disconnect(),this.removeEventListener(\"click\",this.onClick),this.removeEventListener(\"change\",this.onChange),window.removeEventListener(\"pageshow\",this.onPageShow),document.removeEventListener(\"reset\",this.onReset,!0)}get root(){let e=this.getRootNode();return e instanceof Document||e instanceof ShadowRoot?e:document}inputsNamed(e){return Array.from(this.root.querySelectorAll(\"input\")).filter(t=>t.type===e.type&&t.name===e.name&&t.form===e.form)}syncAll(){Array.from(this.root.querySelectorAll(o)).forEach(e=>{e instanceof i&&e.sync()})}owns(e){return e.closest(o)===this}choices(){return Array.from(this.querySelectorAll(\"input\")).filter(e=>c(e)&&this.owns(e))}target(e){let t=e.getAttribute(\"data-choices-controls\");if(!t)return;let n=this.getRootNode(),r=n instanceof Document||n instanceof ShadowRoot?n.getElementById(t):null;return r instanceof HTMLElement&&r.hasAttribute(\"data-choices-conditional\")?r:void 0}setup(){this.choices().length&&(this.upgraded||(this.upgraded=!0,this.dataset.upgraded=\"\",this.addUpgradedClasses()),this.sync())}addUpgradedClasses(){a(this.getAttribute(\"upgraded-class\")).forEach(e=>this.classList.toggle(e,!0))}sync(){this.upgraded&&this.choices().forEach(e=>this.syncInput(e))}syncInput(e){let t=this.target(e);if(!t)return;e.setAttribute(\"aria-controls\",t.id),e.setAttribute(\"aria-expanded\",String(e.checked));let n=a(this.getAttribute(\"hidden-conditional-class\"));n.length?n.forEach(r=>t.classList.toggle(r,!e.checked)):t.hidden=!e.checked}}customElements.get(o)||customElements.define(o,i)}})();","\"use strict\";(()=>{var s=\"govuk-react-disclosure\";if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class r extends HTMLElement{constructor(){super(...arguments);this.isOpen=!1;this.controlled=!1;this.onClick=()=>{let e=!this.isOpen;this.hasAttribute(\"open\")||(this.apply(e),this.controlled||(this.picked=e)),this.dispatchEvent(new CustomEvent(\"govuk-react-disclosure:change\",{detail:{open:e},bubbles:!0}))};this.onModeChange=()=>this.render()}static get observedAttributes(){return[\"open\"]}get expanded(){return this.toggle?this.isOpen:void 0}get pickedOpen(){return this.picked}connectedCallback(){this.setup()||(this.observer=new MutationObserver(()=>{this.setup()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.observer?.disconnect(),this.toggle?.removeEventListener(\"click\",this.onClick),this.mql?.removeEventListener(\"change\",this.onModeChange),this.toggle=void 0,this.content=void 0,this.mql=void 0}attributeChangedCallback(){let e=this.getAttribute(\"open\");e!==null&&(this.controlled=!0,this.apply(e===\"true\"))}own(e,t){let n=Array.from(this.querySelectorAll(e)).find(i=>i.closest(s)===this);return n instanceof t?n:void 0}setup(){if(this.toggle)return!0;let e=this.own(\"[data-disclosure-toggle]\",HTMLButtonElement),t=this.own(\"[data-disclosure-content]\",HTMLElement);if(!e||!t)return!1;this.toggle=e,this.content=t;let n=this.getAttribute(\"open\");this.isOpen=n===null?this.hasAttribute(\"default-open\"):n===\"true\";let i=this.getAttribute(\"media\");return i&&(this.mql=window.matchMedia(i),this.mql.addEventListener(\"change\",this.onModeChange)),e.addEventListener(\"click\",this.onClick),this.render(),!0}apply(e){e!==this.isOpen&&(this.isOpen=e,this.render())}render(){let{toggle:e,content:t}=this;if(!(!e||!t)){if(this.mql?.matches){t.hidden=!1,e.hidden=!0,e.setAttribute(\"aria-hidden\",\"true\"),e.removeAttribute(\"aria-expanded\");return}e.hidden=!1,e.removeAttribute(\"aria-hidden\"),e.setAttribute(\"aria-expanded\",String(this.isOpen)),t.id&&e.setAttribute(\"aria-controls\",t.id),t.hidden=!this.isOpen}}}customElements.get(s)||customElements.define(s,r)}})();","\"use strict\";(()=>{var n=\"govuk-react-exit-this-page\",g=[\"activated\",\"timed-out\",\"press-two-more-times\",\"press-one-more-time\"],c={activated:\"Loading.\",\"timed-out\":\"Exit this page expired.\",\"press-two-more-times\":\"Shift, press 2 more times to exit.\",\"press-one-more-time\":\"Shift, press 1 more time to exit.\"},u=5e3,r=d=>(d??\"\").split(/\\s+/).filter(Boolean),h={position:\"fixed\",inset:\"0\",\"z-index\":\"2147483647\",background:\"white\"};if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class d extends HTMLElement{constructor(){super(...arguments);this.presses=0;this.lastKeyWasModified=!1;this.onClick=e=>{if(e.defaultPrevented||e.button!==0)return;let t=e.target instanceof Element?e.target.closest(\"a\"):null;if(!t)return;let s=t.matches(\"[data-exit-this-page-button]\")&&t.closest(n)===this,i=t.matches(\"[data-exit-this-page-skiplink]\")&&this.listening;!s&&!i||(e.preventDefault(),this.exit())};this.onKeyup=e=>{this.listening&&(e.key===\"Shift\"&&!this.lastKeyWasModified?(this.presses+=1,this.updateIndicator(),window.clearTimeout(this.messageTimeout),this.presses>=3?(this.presses=0,window.clearTimeout(this.pressTimeout),this.pressTimeout=void 0,this.exit()):(this.setStatus(this.message(this.presses===1?\"press-two-more-times\":\"press-one-more-time\")),window.clearTimeout(this.pressTimeout),this.pressTimeout=window.setTimeout(this.timeOut,u))):this.pressTimeout!==void 0&&this.timeOut(),this.lastKeyWasModified=e.shiftKey)};this.timeOut=()=>{window.clearTimeout(this.pressTimeout),this.pressTimeout=void 0,this.presses=0,this.setStatus(this.message(\"timed-out\")),this.messageTimeout=window.setTimeout(()=>this.setStatus(\"\"),u),this.updateIndicator()};this.reset=e=>{e.persisted&&(r(this.getAttribute(\"hide-content-class\")).forEach(t=>document.body.classList.remove(t)),this.overlay?.remove(),this.overlay=void 0,this.presses=0,this.setStatus(\"\"),this.updateIndicator(),this.clearTimers())}}connectedCallback(){this.dataset.upgraded=\"\",document.addEventListener(\"keyup\",this.onKeyup,!0),document.addEventListener(\"click\",this.onClick),window.addEventListener(\"pageshow\",this.reset)}disconnectedCallback(){document.removeEventListener(\"keyup\",this.onKeyup,!0),document.removeEventListener(\"click\",this.onClick),window.removeEventListener(\"pageshow\",this.reset),this.clearTimers(),this.presses=0,this.setStatus(\"\"),this.updateIndicator()}exit(){let e=this.own(\"[data-exit-this-page-button]\"),t=e instanceof HTMLAnchorElement?e.href:void 0,s=t!==void 0&&this.dispatchEvent(new CustomEvent(\"govuk-react-exit-this-page:exit\",{detail:{href:t},bubbles:!0,cancelable:!0}));if(!t||!s){this.setStatus(\"\"),this.updateIndicator();return}this.setStatus(\"\"),r(this.getAttribute(\"hide-content-class\")).forEach(a=>document.body.classList.add(a)),this.overlay?.remove();let i=document.createElement(\"div\");i.setAttribute(\"role\",\"alert\");let o=r(this.getAttribute(\"overlay-class\"));o.length?i.classList.add(...o):Object.entries(h).forEach(([a,l])=>i.style.setProperty(a,l)),document.body.appendChild(i),i.textContent=this.message(\"activated\"),this.overlay=i,window.location.href=t}get listening(){return document.querySelector(n)===this}own(e){return Array.from(this.querySelectorAll(e)).find(t=>t.closest(n)===this)}message(e){return this.getAttribute(e)??c[e]}setStatus(e){let t=this.own(\"[data-exit-this-page-status]\");if(!t||t.textContent===e)return;let{firstChild:s}=t;s instanceof Text&&t.childNodes.length===1?s.nodeValue=e:t.textContent=e}clearTimers(){window.clearTimeout(this.pressTimeout),window.clearTimeout(this.messageTimeout),this.pressTimeout=void 0,this.messageTimeout=void 0}updateIndicator(){let e=this.own(\"[data-exit-this-page-indicator]\");if(!e)return;let t=this.presses>0;e.toggleAttribute(\"data-visible\",t),r(this.getAttribute(\"indicator-visible-class\")).forEach(s=>e.classList.toggle(s,t)),e.querySelectorAll(\"[data-exit-this-page-light]\").forEach((s,i)=>{let o=i<this.presses;s.toggleAttribute(\"data-on\",o),r(this.getAttribute(\"light-on-class\")).forEach(a=>s.classList.toggle(a,o))})}}customElements.get(n)||customElements.define(n,d)}})();","\"use strict\";(()=>{var m=[\"zero\",\"one\",\"two\",\"few\",\"many\",\"other\"];var b=n=>[n,...m.map(i=>`${n}-${i}`)];function v(n,i){let s=n.getAttribute(i);if(s!==null)return s;let t=m.flatMap(e=>{let r=n.getAttribute(`${i}-${e}`);return r===null?[]:[[e,r]]});return t.length?Object.fromEntries(t):void 0}function E(n){try{return n(void 0)}catch{return n(\"en\")}}function p(n,i){try{return i(n)}catch{return E(i)}}function u(n,i,s){let t;if(typeof n==\"string\")t=n;else{let r=p(s,a=>new Intl.PluralRules(a)).select(i);t=n[r]??n.other}let e=p(s,r=>new Intl.NumberFormat(r)).format(i);return(t??\"\").replaceAll(\"%{count}\",e)}var f=\"govuk-react-file-upload\",c={\"no-file-chosen\":\"No file chosen\",\"multiple-files-chosen\":{one:\"%{count} file chosen\",other:\"%{count} files chosen\"},\"entered-drop-zone\":\"Entered drop zone\",\"left-drop-zone\":\"Left drop zone\"};function y(n,i,s){return n.length===0?u(i[\"no-file-chosen\"]??c[\"no-file-chosen\"],0,s):n.length===1?n[0].name:u(i[\"multiple-files-chosen\"]??c[\"multiple-files-chosen\"],n.length,s)}var g=n=>n?.split(/\\s+/).filter(Boolean)??[],L=(n,i)=>{if(n.textContent===i)return;let{firstChild:s}=n;s instanceof Text&&n.childNodes.length===1?s.nodeValue=i:n.textContent=i},o=(n,i,s)=>{s===null?n.removeAttribute(i):n.getAttribute(i)!==s&&n.setAttribute(i,s)},D=n=>Array.from(n).filter(i=>i.kind===\"file\").length;if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class n extends HTMLElement{constructor(){super(...arguments);this.fieldId=\"\";this.dragging=!1;this.enteredAnotherElement=!1;this.onChange=()=>this.update();this.onReset=()=>window.setTimeout(()=>this.update());this.onClick=()=>this.input?.click();this.onDragOver=t=>t.preventDefault();this.onDrop=t=>{t.preventDefault();let{input:e}=this,r=t.dataTransfer?.files;!e||!r||!this.matchesCapacity(r.length)||(e.files=r,e.dispatchEvent(new Event(\"input\",{bubbles:!0})),e.dispatchEvent(new Event(\"change\",{bubbles:!0})),this.setDragging(!1))};this.onDocumentDragEnter=t=>{this.enteredAnotherElement=!0,!(!this.button||this.button.disabled||!(t.target instanceof Node))&&(this.dropZone.contains(t.target)?t.dataTransfer&&this.canDrop(t.dataTransfer)&&!this.dragging&&(this.setDragging(!0),this.announce(\"entered-drop-zone\")):this.dragging&&(this.setDragging(!1),this.announce(\"left-drop-zone\")))};this.onDocumentDragLeave=()=>{!this.enteredAnotherElement&&this.dragging&&!this.button?.disabled&&(this.setDragging(!1),this.announce(\"left-drop-zone\")),this.enteredAnotherElement=!1}}static get observedAttributes(){return[\"empty-class\",\"dragging-class\",\"disabled-class\",...Object.keys(c).flatMap(b)]}connectedCallback(){this.observer=new MutationObserver(()=>this.setup()),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"class\",\"disabled\",\"id\",\"aria-describedby\"]}),document.addEventListener(\"dragenter\",this.onDocumentDragEnter),document.addEventListener(\"dragleave\",this.onDocumentDragLeave),this.setup()}disconnectedCallback(){this.observer?.disconnect(),document.removeEventListener(\"dragenter\",this.onDocumentDragEnter),document.removeEventListener(\"dragleave\",this.onDocumentDragLeave),this.unbind()}attributeChangedCallback(){this.isConnected&&this.update()}own(t){return Array.from(this.querySelectorAll(t)).find(e=>e.closest(f)===this)}get dropZone(){return this.own(\"[data-file-upload-drop-zone]\")??this}get locale(){return this.closest(\"[lang]\")?.getAttribute(\"lang\")||\"en\"}message(t){return v(this,t)??c[t]}setup(){let t=this.own('input[type=\"file\"]'),e=this.own(\"button[data-file-upload-button]\");!t||!e||(t.id!==`${this.fieldId}-input`&&(this.fieldId=t.id),this.fieldId&&((t!==this.input||e!==this.button)&&(this.unbind(),this.input=t,this.button=e,this.form=t.form,t.addEventListener(\"change\",this.onChange),this.form?.addEventListener(\"reset\",this.onReset),e.addEventListener(\"click\",this.onClick),e.addEventListener(\"dragover\",this.onDragOver),e.addEventListener(\"drop\",this.onDrop)),this.upgrade(t,e),this.update()))}unbind(){this.input?.removeEventListener(\"change\",this.onChange),this.form?.removeEventListener(\"reset\",this.onReset),this.button?.removeEventListener(\"click\",this.onClick),this.button?.removeEventListener(\"dragover\",this.onDragOver),this.button?.removeEventListener(\"drop\",this.onDrop),this.input=void 0,this.button=void 0,this.form=void 0}upgrade(t,e){let r=this.fieldId,a=this.getRootNode(),l=a instanceof Document||a instanceof ShadowRoot?a.querySelector(`label[for=\"${CSS.escape(r)}\"]`):null;l&&!l.id&&(l.id=`${r}-label`),o(t,\"id\",`${r}-input`),o(e,\"id\",r);let d=e.querySelector(\"[data-file-upload-separator]\");d&&o(d,\"id\",`${r}-comma`),l&&o(e,\"aria-labelledby\",[l.id,d?.id,r].filter(Boolean).join(\" \")),o(e,\"aria-describedby\",t.getAttribute(\"aria-describedby\")),o(t,\"hidden\",\"hidden\"),e.hidden&&(e.hidden=!1),this.dataset.upgraded=\"\"}update(){let{input:t,button:e}=this;if(!t||!e)return;let{files:r}=t,a=!r?.length,l=e.querySelector(\"[data-file-upload-status]\");l&&L(l,y(r??[],{\"no-file-chosen\":this.message(\"no-file-chosen\"),\"multiple-files-chosen\":this.message(\"multiple-files-chosen\")},this.locale)),o(e,\"data-empty\",a?\"\":null),g(this.getAttribute(\"empty-class\")).forEach(h=>e.classList.toggle(h,a)),e.disabled!==t.disabled&&(e.disabled=t.disabled);let d=this.dropZone;o(d,\"data-disabled\",t.disabled?\"\":null),g(this.getAttribute(\"disabled-class\")).forEach(h=>d.classList.toggle(h,t.disabled)),t.disabled?this.setDragging(!1):this.renderDragging()}setDragging(t){this.dragging=t,this.renderDragging()}renderDragging(){let{button:t,dragging:e}=this;t&&(o(t,\"data-dragging\",e?\"\":null),g(this.getAttribute(\"dragging-class\")).forEach(r=>t.classList.toggle(r,e)))}announce(t){let e=this.own(\"[data-file-upload-announcements]\");e&&(e.textContent=u(this.message(t),0,this.locale))}canDrop(t){return t.items.length?this.matchesCapacity(D(t.items)):t.types.length?t.types.includes(\"Files\"):!0}matchesCapacity(t){return this.input?.multiple?t>0:t===1}}customElements.get(f)||customElements.define(f,n)}})();","\"use strict\";(()=>{function r(t,n,o){o.forEach(e=>t.classList.remove(e)),n&&t.removeAttribute(\"tabindex\"),t.removeAttribute(\"data-focus-tabindex\"),t.removeAttribute(\"autofocus\")}var d=t=>!t.hasAttribute(\"tabindex\")||t.hasAttribute(\"data-focus-tabindex\")&&t.getAttribute(\"tabindex\")===\"-1\";function u(t,{focusedClasses:n=[],preventScroll:o=!1}={}){let e=d(t);return t.hasAttribute(\"tabindex\")||t.setAttribute(\"tabindex\",\"-1\"),document.activeElement!==t&&(n.forEach(i=>t.classList.add(i)),t.focus({preventScroll:o})),document.activeElement!==t?(r(t,e,n),!1):(n.forEach(i=>t.classList.add(i)),t.addEventListener(\"blur\",()=>r(t,e,n),{once:!0}),!0)}var l=\"govuk-react-focus-links\",f=t=>t?.split(/\\s+/).filter(Boolean)??[],h=t=>t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLButtonElement;function g(t){let n=t.closest(\"fieldset\")?.getElementsByTagName(\"legend\")[0];if(n){if(t instanceof HTMLInputElement&&(t.type===\"checkbox\"||t.type===\"radio\"))return n;let o=n.getBoundingClientRect().top,e=t.getBoundingClientRect();if(e.height&&window.innerHeight&&e.top+e.height-o<window.innerHeight/2)return n}return document.querySelector(`label[for=\"${CSS.escape(t.id)}\"]`)??t.closest(\"label\")}if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class t extends HTMLElement{constructor(){super(...arguments);this.onClick=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey)return;let i=e.target instanceof Element?e.target.closest(\"a[href]\"):null;if(!(i instanceof HTMLAnchorElement)||!this.contains(i)||!(i.getAttribute(\"href\")?.startsWith(\"#\")||i.origin===window.location.origin&&i.pathname===window.location.pathname&&i.search===window.location.search))return;let c=i.hash.slice(1);try{c=decodeURIComponent(c)}catch{}let s=c?document.getElementById(c):null;if(s){if(h(s)){let a=g(s);if(!a)return;e.preventDefault(),a.scrollIntoView(),s.focus({preventScroll:!0});return}u(s,{focusedClasses:f(this.getAttribute(\"focused-class\"))})}}}connectedCallback(){this.addEventListener(\"click\",this.onClick)}disconnectedCallback(){this.removeEventListener(\"click\",this.onClick)}}customElements.get(l)||customElements.define(l,t)}})();","\"use strict\";(()=>{var o=\"govuk-react-modal\",r=()=>typeof HTMLButtonElement<\"u\"&&\"command\"in HTMLButtonElement.prototype;if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class l extends HTMLElement{constructor(){super(...arguments);this.wasOpen=!1;this.onClick=e=>{let n=e.target instanceof Element?e.target.closest(\"button[commandfor]\"):null;if(!(n instanceof HTMLButtonElement)||n.closest(o)!==this)return;let t=document.getElementById(n.getAttribute(\"commandfor\")??\"\");if(!(t instanceof HTMLDialogElement))return;let s=n.getAttribute(\"command\");if(s===\"show-modal\"&&!t.open)t.showModal();else if(s===\"close\"&&t.open)t.close();else if(s===\"request-close\"&&t.open){let i=Reflect.get(t,\"requestClose\");typeof i==\"function\"?i.call(t):t.close()}};this.onToggle=()=>{let{dialog:e}=this;!e||e.open===this.wasOpen||(this.wasOpen=e.open,this.dispatchEvent(new CustomEvent(\"govuk-react-modal:change\",{detail:{open:e.open},bubbles:!0})))}}static get observedAttributes(){return[\"open\"]}connectedCallback(){r()||this.addEventListener(\"click\",this.onClick),!this.setup()&&(this.observer=new MutationObserver(()=>{this.setup()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.removeEventListener(\"click\",this.onClick),this.observer?.disconnect(),this.dialog?.removeEventListener(\"close\",this.onToggle),this.dialog?.removeEventListener(\"toggle\",this.onToggle),this.dialog=void 0}attributeChangedCallback(){this.sync()}setup(){if(this.dialog)return!0;let e=Array.from(this.querySelectorAll(\"dialog\")).find(n=>n.closest(o)===this);return e?(this.dialog=e,this.wasOpen=e.open,e.addEventListener(\"toggle\",this.onToggle),e.addEventListener(\"close\",this.onToggle),this.sync(),!0):!1}sync(){let{dialog:e}=this,n=this.getAttribute(\"open\");if(!e||n===null)return;let t=n===\"true\";t!==e.open&&(this.wasOpen=t,t&&e.isConnected?e.showModal():t||e.close())}}customElements.get(o)||customElements.define(o,l)}})();","\"use strict\";(()=>{var i=\"govuk-react-password-input\",o={\"show-text\":\"Show\",\"hide-text\":\"Hide\",\"show-label\":\"Show password\",\"hide-label\":\"Hide password\",\"shown-announcement\":\"Your password is visible\",\"hidden-announcement\":\"Your password is hidden\"},a=\"position:absolute;width:1px;height:1px;margin:0;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);border:0;white-space:nowrap\";if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class n extends HTMLElement{constructor(){super(...arguments);this.onToggle=t=>{t.preventDefault(),this.input&&this.setVisible(this.input.type===\"password\")};this.onSubmit=()=>this.setVisible(!1);this.onPageShow=t=>{t.persisted&&this.setVisible(!1)}}connectedCallback(){this.setup()||(this.observer=new MutationObserver(()=>{this.setup()&&this.observer?.disconnect()}),this.observer.observe(this,{childList:!0,subtree:!0}))}disconnectedCallback(){this.observer?.disconnect(),this.toggle?.removeEventListener(\"click\",this.onToggle),this.form?.removeEventListener(\"submit\",this.onSubmit),window.removeEventListener(\"pageshow\",this.onPageShow),this.input=void 0,this.toggle=void 0,this.form=void 0}text(t){return this.getAttribute(t)??o[t]}own(t,e){let s=this.querySelector(t);return s instanceof e&&s.closest(i)===this?s:void 0}setup(){if(this.input)return!0;let t=this.own(\"[data-password-input]\",HTMLInputElement),e=this.own(\"[data-password-toggle]\",HTMLButtonElement);return!t||!e?!1:(this.input=t,this.toggle=e,this.status=this.own(\"[data-password-status]\",HTMLElement),this.status||(this.status=document.createElement(\"div\"),this.status.dataset.passwordStatus=\"\",this.status.setAttribute(\"aria-live\",\"polite\"),this.status.setAttribute(\"style\",a),t.insertAdjacentElement(\"afterend\",this.status)),e.hidden=!1,e.addEventListener(\"click\",this.onToggle),this.form=t.form,this.form?.addEventListener(\"submit\",this.onSubmit),window.addEventListener(\"pageshow\",this.onPageShow),t.type=\"password\",this.label(!1),!0)}setVisible(t){let{input:e}=this;!e||t===(e.type===\"text\")||(e.type=t?\"text\":\"password\",this.label(t),this.status&&(this.status.textContent=this.text(t?\"shown-announcement\":\"hidden-announcement\")))}label(t){this.toggle&&(this.toggle.textContent=this.text(t?\"hide-text\":\"show-text\"),this.toggle.setAttribute(\"aria-label\",this.text(t?\"hide-label\":\"show-label\")))}}customElements.get(i)||customElements.define(i,n)}})();","\"use strict\";(()=>{var c=\"govuk-react-tabs\",r=n=>n instanceof HTMLElement?n.dataset.value:void 0,l=n=>n?.split(/\\s+/).filter(Boolean)??[],v=(n,f)=>{let u=f.filter(e=>!n.classList.contains(e));u.length&&n.classList.add(...u)};if(typeof HTMLElement<\"u\"&&typeof customElements<\"u\"){class n extends HTMLElement{constructor(){super(...arguments);this.started=!1;this.active=!1;this.provisional=!1;this.onModeChange=()=>this.checkMode();this.onReady=()=>this.start();this.onHashChange=()=>{let e=this.triggerForHash();e&&this.choose(e)};this.onClick=e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=this.ownTrigger(e.target);!t||this.radiosFallback||(e.preventDefault(),this.choose(t))};this.onKeydown=e=>{if(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=this.ownTrigger(e.target);if(!t)return;let i=this.triggers,s=i.indexOf(t),a=i.length-1,o=this.getAttribute(\"orientation\")===\"vertical\",d={[o?\"ArrowDown\":\"ArrowRight\"]:s===a?0:s+1,[o?\"ArrowUp\":\"ArrowLeft\"]:s===0?a:s-1,Home:0,End:a}[e.key];d!==void 0&&(e.preventDefault(),this.choose(i[d]),i[d].focus())};this.onChange=e=>{let t=e.target;if(!(t instanceof HTMLInputElement)||!t.checked)return;let i=t.parentElement;if(!i?.matches(\"[data-tabs-content]\")||i.closest(c)!==this||this.radioOf(i)!==t)return;let s=r(i);if(!(s===void 0||s===this.dataset.value)){if(this.picked=s,this.provisional=!1,this.hasAttribute(\"value\"))queueMicrotask(()=>this.restoreRadio(t));else if(!this.active)this.dataset.value=s;else{this.show(this.triggerFor(s));let a=i.id;!this.radiosFallback&&this.active&&a&&window.location.hash!==`#${a}`&&window.history.pushState(window.history.state,\"\",`#${a}`)}this.dispatchEvent(new CustomEvent(\"govuk-react-tabs:change\",{detail:{value:s},bubbles:!0}))}}}static get observedAttributes(){return[\"value\"]}get value(){return this.getAttribute(\"value\")}set value(e){e==null?this.removeAttribute(\"value\"):this.setAttribute(\"value\",e)}get selectedValue(){return this.dataset.value}get pickedValue(){return this.picked!==void 0&&this.picked!==this.defaultSelection()?this.picked:void 0}select(e){let t=this.triggerFor(e);t&&(this.provisional=!1,this.active?this.show(t):(this.dataset.value=e,this.checkRadio(e)))}connectedCallback(){this.addEventListener(\"change\",this.onChange),this.observer=new MutationObserver(e=>{if(this.started){if(!this.active){(!this.mql||this.mql.matches)&&this.setup();return}e.some(t=>t.type===\"childList\")&&(this.wire(),this.provisional&&this.show(this.initialTrigger())),this.show(this.triggerFor(this.dataset.value)??this.triggers[0]),v(this,l(this.getAttribute(\"upgraded-class\")))}}),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[\"class\"]}),document.readyState===\"loading\"?document.addEventListener(\"DOMContentLoaded\",this.onReady):this.start()}disconnectedCallback(){this.removeEventListener(\"change\",this.onChange),this.observer?.disconnect(),document.removeEventListener(\"DOMContentLoaded\",this.onReady),this.mql?.removeEventListener(\"change\",this.onModeChange),this.mql=void 0,this.started=!1,this.teardown()}attributeChangedCallback(e,t,i){this.started&&i!=null&&t!==i&&i!==this.dataset.value&&this.select(i)}get radiosFallback(){return this.getAttribute(\"fallback\")===\"radios\"}get triggers(){return this.own(\"[data-tabs-trigger]\")}own(e){return Array.from(this.querySelectorAll(e)).filter(t=>t.closest(c)===this)}ownTrigger(e){let t=e instanceof Element?e.closest(\"[data-tabs-trigger]\"):null;return this.triggers.find(i=>i===t)}triggerFor(e){return e==null?void 0:this.triggers.find(t=>r(t)===e)}triggerForHash(){if(this.radiosFallback)return;let e=decodeURIComponent(window.location.hash.slice(1));return e?this.triggers.find(t=>this.parts(r(t)).content?.id===e):void 0}parts(e){let t=i=>r(i)===e;return{item:this.own(\"[data-tabs-item]\").find(t),content:this.own(\"[data-tabs-content]\").find(t)}}radioOf(e){let t=e?.firstElementChild;return t instanceof HTMLInputElement&&t.type===\"radio\"?t:void 0}checkRadio(e){let t=this.own(\"[data-tabs-content]\").map(i=>({radio:this.radioOf(i),selected:r(i)===e}));t.some(({radio:i,selected:s})=>i&&s)&&(t.forEach(({radio:i,selected:s})=>{i&&!s&&(i.checked=!1)}),t.forEach(({radio:i,selected:s})=>{i&&s&&(i.checked=!0)}))}restoreRadio(e){r(e.parentElement)!==this.dataset.value&&this.checkRadio(this.dataset.value)}defaultSelection(){return r(this.triggerFor(this.getAttribute(\"value\")))??r(this.triggerFor(this.getAttribute(\"default-value\")))??r(this.triggers[0])}start(){if(document.removeEventListener(\"DOMContentLoaded\",this.onReady),this.started)return;this.started=!0;let e=this.getAttribute(\"media\");e&&(this.mql=window.matchMedia(e),this.mql.addEventListener(\"change\",this.onModeChange)),this.checkMode()}checkMode(){!this.mql||this.mql.matches?this.setup():this.teardown()}pickedTrigger(){let e=this.triggerForHash();if(e)return e;let t=this.own(\"[data-tabs-content]\").find(i=>this.radioOf(i)?.checked);return this.triggerFor(r(t))}initialTrigger(){let e=this.triggerFor(this.getAttribute(\"value\")),t=this.triggerFor(this.dataset.value),i=this.pickedTrigger(),s=this.triggerFor(this.getAttribute(\"default-value\")),a=(this.hasAttribute(\"prefer-pick\")&&!t?i:void 0)??e??t??i??s;return this.provisional=!a,a??this.triggers[0]}setup(){this.active||!this.triggers.length||(this.active=!0,this.dataset.upgraded=\"\",v(this,l(this.getAttribute(\"upgraded-class\"))),this.wire(),this.addEventListener(\"click\",this.onClick),this.addEventListener(\"keydown\",this.onKeydown),this.radiosFallback||window.addEventListener(\"hashchange\",this.onHashChange),this.picked===void 0&&!this.dataset.value&&(this.picked=r(this.pickedTrigger())),this.show(this.initialTrigger()))}wire(){let e=this.getAttribute(\"orientation\")===\"vertical\"?\"vertical\":\"horizontal\";this.own(\"[data-tabs-list]\").forEach(t=>{t.setAttribute(\"role\",\"tablist\"),t.setAttribute(\"aria-orientation\",e)}),this.own(\"[data-tabs-item]\").forEach(t=>t.setAttribute(\"role\",\"presentation\")),this.triggers.forEach(t=>{let{content:i}=this.parts(r(t));t.setAttribute(\"role\",\"tab\"),i&&(i.id||(i.id=`${r(t)}-panel`,i.dataset.tabsGeneratedId=\"\"),t.id||(t.id=`${i.id}-tab`,t.dataset.tabsGeneratedId=\"\"),t.setAttribute(\"aria-controls\",i.id),i.setAttribute(\"role\",\"tabpanel\"),i.setAttribute(\"aria-labelledby\",t.id))})}teardown(){if(!this.active)return;this.active=!1,delete this.dataset.upgraded,this.removeEventListener(\"click\",this.onClick),this.removeEventListener(\"keydown\",this.onKeydown),window.removeEventListener(\"hashchange\",this.onHashChange),this.radiosFallback||this.classList.remove(...l(this.getAttribute(\"upgraded-class\"))),this.own(\"[data-tabs-list]\").forEach(t=>{t.removeAttribute(\"role\"),t.removeAttribute(\"aria-orientation\")});let e=t=>{t.dataset.tabsGeneratedId!==void 0&&(t.removeAttribute(\"id\"),delete t.dataset.tabsGeneratedId)};this.own(\"[data-tabs-item]\").forEach(t=>{[\"role\",\"data-state\"].forEach(i=>t.removeAttribute(i)),t.classList.remove(...l(this.getAttribute(\"active-item-class\")))}),this.triggers.forEach(t=>{e(t),[\"role\",\"aria-controls\",\"aria-selected\",\"tabindex\",\"data-state\"].forEach(i=>t.removeAttribute(i))}),this.own(\"[data-tabs-content]\").forEach(t=>{e(t),[\"role\",\"aria-labelledby\",\"tabindex\",\"hidden\",\"data-state\"].forEach(i=>t.removeAttribute(i)),t.classList.remove(...l(this.getAttribute(\"hidden-content-class\")))})}choose(e){this.radioOf(this.parts(r(e)).content)?.click()}show(e){if(!e)return;let t=l(this.getAttribute(\"active-item-class\")),i=l(this.getAttribute(\"hidden-content-class\"));this.triggers.forEach(s=>{let a=s===e,o=a?\"active\":\"inactive\",{item:d,content:h}=this.parts(r(s));s.dataset.state!==o&&(s.dataset.state=o),s.setAttribute(\"aria-selected\",String(a)),s.setAttribute(\"tabindex\",a?\"0\":\"-1\"),d&&(d.dataset.state!==o&&(d.dataset.state=o),t.forEach(g=>d.classList.toggle(g,a))),h&&(h.dataset.state!==o&&(h.dataset.state=o),h.hidden=!a,i.forEach(g=>h.classList.toggle(g,!a)),a?h.setAttribute(\"tabindex\",\"0\"):h.removeAttribute(\"tabindex\"))}),this.dataset.value=r(e),this.checkRadio(this.dataset.value)}}customElements.get(c)||customElements.define(c,n)}})();"],"mappings":";AAAA,YAAY,WAAW;;;ACAvB;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;ACAA;;;AbkDO,SAAS,aAAa,EAAE,QAAQ,GAAG,MAAM,GAAsB;AACpE,SAAO,oCAAC,YAAQ,GAAG,OAAO,yBAAyB,EAAE,QAAQ,OAAO,GAAG;AACzE;","names":[]}
@@ -1,11 +0,0 @@
1
- 'use client';
2
- import {
3
- supportsCommands,
4
- tagName
5
- } from "./chunk-L7E6GN2D.js";
6
- import "./chunk-ESBMTI25.js";
7
- export {
8
- supportsCommands,
9
- tagName
10
- };
11
- //# sourceMappingURL=modal-element.js.map