@govtechsg/sgds-web-component 3.3.0 → 3.3.1

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 (588) hide show
  1. package/base/card-element.d.ts +19 -0
  2. package/base/card-element.js +43 -2
  3. package/base/card-element.js.map +1 -1
  4. package/base/card.js +1 -1
  5. package/{src/base → base}/dropdown-element.d.ts +3 -1
  6. package/base/dropdown-element.js +2 -1
  7. package/base/dropdown-element.js.map +1 -1
  8. package/base/select-element.js +3 -1
  9. package/base/select-element.js.map +1 -1
  10. package/components/Breadcrumb/index.umd.js +3 -2
  11. package/components/Breadcrumb/index.umd.js.map +1 -1
  12. package/{src/components → components}/Breadcrumb/sgds-breadcrumb.d.ts +1 -1
  13. package/components/Breadcrumb/sgds-breadcrumb.js +1 -1
  14. package/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
  15. package/components/Card/card.js +1 -1
  16. package/components/Card/index.umd.js +83 -82
  17. package/components/Card/index.umd.js.map +1 -1
  18. package/{src/components → components}/Card/sgds-card.d.ts +4 -15
  19. package/components/Card/sgds-card.js +16 -56
  20. package/components/Card/sgds-card.js.map +1 -1
  21. package/components/Card/types.d.ts +3 -0
  22. package/components/ComboBox/combo-box.js +1 -1
  23. package/components/ComboBox/index.umd.js +18 -3
  24. package/components/ComboBox/index.umd.js.map +1 -1
  25. package/components/Datepicker/index.umd.js +17 -12
  26. package/components/Datepicker/index.umd.js.map +1 -1
  27. package/{src/components → components}/Datepicker/sgds-datepicker.d.ts +3 -2
  28. package/components/Datepicker/sgds-datepicker.js +15 -11
  29. package/components/Datepicker/sgds-datepicker.js.map +1 -1
  30. package/components/Dropdown/dropdown.js +1 -1
  31. package/components/Dropdown/index.umd.js +3 -2
  32. package/components/Dropdown/index.umd.js.map +1 -1
  33. package/components/IconCard/icon-card.js +6 -0
  34. package/components/IconCard/icon-card.js.map +1 -0
  35. package/components/IconCard/index.d.ts +6 -0
  36. package/components/IconCard/index.js +4 -0
  37. package/components/IconCard/index.js.map +1 -0
  38. package/components/IconCard/index.umd.js +4750 -0
  39. package/components/IconCard/index.umd.js.map +1 -0
  40. package/components/IconCard/sgds-icon-card.d.ts +24 -0
  41. package/components/IconCard/sgds-icon-card.js +83 -0
  42. package/components/IconCard/sgds-icon-card.js.map +1 -0
  43. package/components/ImageCard/image-card.js +6 -0
  44. package/components/ImageCard/image-card.js.map +1 -0
  45. package/components/ImageCard/index.d.ts +6 -0
  46. package/components/ImageCard/index.js +4 -0
  47. package/components/ImageCard/index.js.map +1 -0
  48. package/components/ImageCard/index.umd.js +4764 -0
  49. package/components/ImageCard/index.umd.js.map +1 -0
  50. package/components/ImageCard/sgds-image-card.d.ts +30 -0
  51. package/components/ImageCard/sgds-image-card.js +97 -0
  52. package/components/ImageCard/sgds-image-card.js.map +1 -0
  53. package/components/Mainnav/index.umd.js +5 -4
  54. package/components/Mainnav/index.umd.js.map +1 -1
  55. package/components/Mainnav/mainnav.js +1 -1
  56. package/components/Mainnav/sgds-mainnav-dropdown.js +1 -1
  57. package/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
  58. package/components/Modal/index.umd.js +1 -1
  59. package/components/Modal/modal.js +1 -1
  60. package/components/OverflowMenu/index.js +5 -0
  61. package/components/OverflowMenu/index.js.map +1 -0
  62. package/components/OverflowMenu/index.umd.js +11130 -0
  63. package/components/OverflowMenu/index.umd.js.map +1 -0
  64. package/{src/internals → components}/OverflowMenu/sgds-overflow-menu.d.ts +3 -3
  65. package/{internals → components}/OverflowMenu/sgds-overflow-menu.js +3 -3
  66. package/components/OverflowMenu/sgds-overflow-menu.js.map +1 -0
  67. package/components/Select/index.umd.js +18 -3
  68. package/components/Select/index.umd.js.map +1 -1
  69. package/components/Select/select.js +1 -1
  70. package/components/ThumbnailCard/index.d.ts +6 -0
  71. package/components/ThumbnailCard/index.js +4 -0
  72. package/components/ThumbnailCard/index.js.map +1 -0
  73. package/components/ThumbnailCard/index.umd.js +4754 -0
  74. package/components/ThumbnailCard/index.umd.js.map +1 -0
  75. package/components/ThumbnailCard/sgds-thumbnail-card.d.ts +24 -0
  76. package/components/ThumbnailCard/sgds-thumbnail-card.js +87 -0
  77. package/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -0
  78. package/components/ThumbnailCard/thumbnail-card.js +6 -0
  79. package/components/ThumbnailCard/thumbnail-card.js.map +1 -0
  80. package/{src/components → components}/index.d.ts +4 -0
  81. package/components/index.js +4 -0
  82. package/components/index.js.map +1 -1
  83. package/components/index.umd.js +475 -208
  84. package/components/index.umd.js.map +1 -1
  85. package/{src/index.d.ts → index.d.ts} +4 -0
  86. package/index.js +4 -0
  87. package/index.js.map +1 -1
  88. package/index.umd.js +493 -222
  89. package/index.umd.js.map +1 -1
  90. package/package.json +1 -1
  91. package/react/base/card-element.cjs.js +42 -1
  92. package/react/base/card-element.cjs.js.map +1 -1
  93. package/react/base/card-element.js +43 -2
  94. package/react/base/card-element.js.map +1 -1
  95. package/react/base/card.cjs.js +1 -1
  96. package/react/base/card.js +1 -1
  97. package/react/base/dropdown-element.cjs.js +2 -1
  98. package/react/base/dropdown-element.cjs.js.map +1 -1
  99. package/react/base/dropdown-element.js +2 -1
  100. package/react/base/dropdown-element.js.map +1 -1
  101. package/react/base/select-element.cjs.js +3 -1
  102. package/react/base/select-element.cjs.js.map +1 -1
  103. package/react/base/select-element.js +3 -1
  104. package/react/base/select-element.js.map +1 -1
  105. package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js +1 -1
  106. package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js.map +1 -1
  107. package/react/components/Breadcrumb/sgds-breadcrumb.js +1 -1
  108. package/react/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
  109. package/react/components/Card/card.cjs.js +1 -1
  110. package/react/components/Card/card.js +1 -1
  111. package/react/components/Card/sgds-card.cjs.js +15 -55
  112. package/react/components/Card/sgds-card.cjs.js.map +1 -1
  113. package/react/components/Card/sgds-card.js +16 -56
  114. package/react/components/Card/sgds-card.js.map +1 -1
  115. package/react/components/ComboBox/combo-box.cjs.js +1 -1
  116. package/react/components/ComboBox/combo-box.js +1 -1
  117. package/react/components/Datepicker/sgds-datepicker.cjs.js +15 -11
  118. package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
  119. package/react/components/Datepicker/sgds-datepicker.js +15 -11
  120. package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
  121. package/react/components/Dropdown/dropdown.cjs.js +1 -1
  122. package/react/components/Dropdown/dropdown.js +1 -1
  123. package/react/components/IconCard/icon-card.cjs.js +11 -0
  124. package/react/components/IconCard/icon-card.cjs.js.map +1 -0
  125. package/react/components/IconCard/icon-card.js +7 -0
  126. package/react/components/IconCard/icon-card.js.map +1 -0
  127. package/react/components/IconCard/sgds-icon-card.cjs.js +89 -0
  128. package/react/components/IconCard/sgds-icon-card.cjs.js.map +1 -0
  129. package/react/components/IconCard/sgds-icon-card.js +84 -0
  130. package/react/components/IconCard/sgds-icon-card.js.map +1 -0
  131. package/react/components/ImageCard/image-card.cjs.js +11 -0
  132. package/react/components/ImageCard/image-card.cjs.js.map +1 -0
  133. package/react/components/ImageCard/image-card.js +7 -0
  134. package/react/components/ImageCard/image-card.js.map +1 -0
  135. package/react/components/ImageCard/sgds-image-card.cjs.js +103 -0
  136. package/react/components/ImageCard/sgds-image-card.cjs.js.map +1 -0
  137. package/react/components/ImageCard/sgds-image-card.js +98 -0
  138. package/react/components/ImageCard/sgds-image-card.js.map +1 -0
  139. package/react/components/Mainnav/mainnav.cjs.js +1 -1
  140. package/react/components/Mainnav/mainnav.js +1 -1
  141. package/react/components/Mainnav/sgds-mainnav-dropdown.cjs.js +1 -1
  142. package/react/components/Mainnav/sgds-mainnav-dropdown.cjs.js.map +1 -1
  143. package/react/components/Mainnav/sgds-mainnav-dropdown.js +1 -1
  144. package/react/components/Mainnav/sgds-mainnav-dropdown.js.map +1 -1
  145. package/react/components/Modal/modal.cjs.js +1 -1
  146. package/react/components/Modal/modal.js +1 -1
  147. package/react/{internals → components}/OverflowMenu/sgds-overflow-menu.cjs.js +3 -3
  148. package/react/components/OverflowMenu/sgds-overflow-menu.cjs.js.map +1 -0
  149. package/react/{internals → components}/OverflowMenu/sgds-overflow-menu.js +3 -3
  150. package/react/components/OverflowMenu/sgds-overflow-menu.js.map +1 -0
  151. package/react/components/Select/select.cjs.js +1 -1
  152. package/react/components/Select/select.js +1 -1
  153. package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js +93 -0
  154. package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js.map +1 -0
  155. package/react/components/ThumbnailCard/sgds-thumbnail-card.js +88 -0
  156. package/react/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -0
  157. package/react/components/ThumbnailCard/thumbnail-card.cjs.js +11 -0
  158. package/react/components/ThumbnailCard/thumbnail-card.cjs.js.map +1 -0
  159. package/react/components/ThumbnailCard/thumbnail-card.js +7 -0
  160. package/react/components/ThumbnailCard/thumbnail-card.js.map +1 -0
  161. package/react/icon-card/index.cjs.js +40 -0
  162. package/react/icon-card/index.cjs.js.map +1 -0
  163. package/react/icon-card/index.js +16 -0
  164. package/react/icon-card/index.js.map +1 -0
  165. package/react/image-card/index.cjs.js +40 -0
  166. package/react/image-card/index.cjs.js.map +1 -0
  167. package/react/image-card/index.js +16 -0
  168. package/react/image-card/index.js.map +1 -0
  169. package/react/index.cjs.js +78 -70
  170. package/react/index.cjs.js.map +1 -1
  171. package/{src/react → react}/index.d.ts +4 -0
  172. package/react/index.js +4 -0
  173. package/react/index.js.map +1 -1
  174. package/react/overflow-menu/index.cjs.js +40 -0
  175. package/react/overflow-menu/index.cjs.js.map +1 -0
  176. package/react/overflow-menu/index.js +16 -0
  177. package/react/overflow-menu/index.js.map +1 -0
  178. package/react/thumbnail-card/index.cjs.js +40 -0
  179. package/react/thumbnail-card/index.cjs.js.map +1 -0
  180. package/react/thumbnail-card/index.d.ts +2 -0
  181. package/react/thumbnail-card/index.js +16 -0
  182. package/react/thumbnail-card/index.js.map +1 -0
  183. package/react/toast/index.d.ts +2 -0
  184. package/react/toast-container/index.d.ts +2 -0
  185. package/react/tooltip/index.d.ts +2 -0
  186. package/react/utils/popper.cjs.js +20 -0
  187. package/react/utils/popper.cjs.js.map +1 -0
  188. package/react/utils/popper.js +16 -0
  189. package/react/utils/popper.js.map +1 -0
  190. package/utils/popper.d.ts +5 -0
  191. package/utils/popper.js +15 -0
  192. package/utils/popper.js.map +1 -0
  193. package/internals/OverflowMenu/sgds-overflow-menu.js.map +0 -1
  194. package/react/internals/OverflowMenu/sgds-overflow-menu.cjs.js.map +0 -1
  195. package/react/internals/OverflowMenu/sgds-overflow-menu.js.map +0 -1
  196. package/scripts/figma/sync-figma-to-tokens/__tests__/write-tokens-to-css-var.test.d.ts +0 -0
  197. package/scripts/figma/sync-figma-to-tokens/color.d.ts +0 -8
  198. package/scripts/figma/sync-figma-to-tokens/figma_api.d.ts +0 -8
  199. package/scripts/figma/sync-figma-to-tokens/sync-figma-to-tokens.d.ts +0 -1
  200. package/scripts/figma/sync-figma-to-tokens/token_export.d.ts +0 -5
  201. package/scripts/figma/sync-figma-to-tokens/token_types.d.ts +0 -52
  202. package/scripts/figma/sync-figma-to-tokens/utils.d.ts +0 -3
  203. package/scripts/figma/sync-figma-to-tokens/write-tokens-to-css-var.d.ts +0 -8
  204. package/src/base/card-element.d.ts +0 -8
  205. /package/{src/base → base}/button-element.d.ts +0 -0
  206. /package/{src/base → base}/dropdown-list-element.d.ts +0 -0
  207. /package/{src/base → base}/form-control-element.d.ts +0 -0
  208. /package/{src/base → base}/link-element.d.ts +0 -0
  209. /package/{src/base → base}/select-element.d.ts +0 -0
  210. /package/{src/base → base}/sgds-element.d.ts +0 -0
  211. /package/{src/components → components}/Accordion/index.d.ts +0 -0
  212. /package/{src/components → components}/Accordion/sgds-accordion-item.d.ts +0 -0
  213. /package/{src/components → components}/Accordion/sgds-accordion.d.ts +0 -0
  214. /package/{src/components → components}/Alert/index.d.ts +0 -0
  215. /package/{src/components → components}/Alert/sgds-alert-link.d.ts +0 -0
  216. /package/{src/components → components}/Alert/sgds-alert.d.ts +0 -0
  217. /package/{src/components → components}/Badge/index.d.ts +0 -0
  218. /package/{src/components → components}/Badge/sgds-badge.d.ts +0 -0
  219. /package/{src/components → components}/Breadcrumb/index.d.ts +0 -0
  220. /package/{src/components → components}/Breadcrumb/sgds-breadcrumb-item.d.ts +0 -0
  221. /package/{src/components → components}/Button/index.d.ts +0 -0
  222. /package/{src/components → components}/Button/sgds-button.d.ts +0 -0
  223. /package/{src/components → components}/Card/index.d.ts +0 -0
  224. /package/{src/components → components}/Checkbox/index.d.ts +0 -0
  225. /package/{src/components → components}/Checkbox/sgds-checkbox-group.d.ts +0 -0
  226. /package/{src/components → components}/Checkbox/sgds-checkbox.d.ts +0 -0
  227. /package/{src/components → components}/ComboBox/combo-box-item.d.ts +0 -0
  228. /package/{src/components → components}/ComboBox/index.d.ts +0 -0
  229. /package/{src/components → components}/ComboBox/sgds-combo-box.d.ts +0 -0
  230. /package/{src/components → components}/Datepicker/datepicker-calendar.d.ts +0 -0
  231. /package/{src/components → components}/Datepicker/datepicker-header.d.ts +0 -0
  232. /package/{src/components → components}/Datepicker/datepicker-input.d.ts +0 -0
  233. /package/{src/components → components}/Datepicker/index.d.ts +0 -0
  234. /package/{src/components → components}/Datepicker/types.d.ts +0 -0
  235. /package/{src/components → components}/DescriptionList/index.d.ts +0 -0
  236. /package/{src/components → components}/DescriptionList/sgds-description-list-group.d.ts +0 -0
  237. /package/{src/components → components}/DescriptionList/sgds-description-list.d.ts +0 -0
  238. /package/{src/components → components}/Divider/index.d.ts +0 -0
  239. /package/{src/components → components}/Divider/sgds-divider.d.ts +0 -0
  240. /package/{src/components → components}/Drawer/index.d.ts +0 -0
  241. /package/{src/components → components}/Drawer/sgds-drawer.d.ts +0 -0
  242. /package/{src/components → components}/Dropdown/index.d.ts +0 -0
  243. /package/{src/components → components}/Dropdown/sgds-dropdown-item.d.ts +0 -0
  244. /package/{src/components → components}/Dropdown/sgds-dropdown.d.ts +0 -0
  245. /package/{src/components → components}/FileUpload/index.d.ts +0 -0
  246. /package/{src/components → components}/FileUpload/sgds-file-upload.d.ts +0 -0
  247. /package/{src/components → components}/Footer/index.d.ts +0 -0
  248. /package/{src/components → components}/Footer/sgds-footer-item.d.ts +0 -0
  249. /package/{src/components → components}/Footer/sgds-footer.d.ts +0 -0
  250. /package/{src/components → components}/Icon/icon-registry.d.ts +0 -0
  251. /package/{src/components → components}/Icon/icons/archive.d.ts +0 -0
  252. /package/{src/components → components}/Icon/icons/arrow-bar-down.d.ts +0 -0
  253. /package/{src/components → components}/Icon/icons/arrow-bar-left.d.ts +0 -0
  254. /package/{src/components → components}/Icon/icons/arrow-bar-right.d.ts +0 -0
  255. /package/{src/components → components}/Icon/icons/arrow-bar-up.d.ts +0 -0
  256. /package/{src/components → components}/Icon/icons/arrow-circle-down.d.ts +0 -0
  257. /package/{src/components → components}/Icon/icons/arrow-circle-left.d.ts +0 -0
  258. /package/{src/components → components}/Icon/icons/arrow-circle-right.d.ts +0 -0
  259. /package/{src/components → components}/Icon/icons/arrow-circle-up.d.ts +0 -0
  260. /package/{src/components → components}/Icon/icons/arrow-clockwise.d.ts +0 -0
  261. /package/{src/components → components}/Icon/icons/arrow-down.d.ts +0 -0
  262. /package/{src/components → components}/Icon/icons/arrow-left.d.ts +0 -0
  263. /package/{src/components → components}/Icon/icons/arrow-repeat.d.ts +0 -0
  264. /package/{src/components → components}/Icon/icons/arrow-right.d.ts +0 -0
  265. /package/{src/components → components}/Icon/icons/arrow-square-down.d.ts +0 -0
  266. /package/{src/components → components}/Icon/icons/arrow-square-left.d.ts +0 -0
  267. /package/{src/components → components}/Icon/icons/arrow-square-right.d.ts +0 -0
  268. /package/{src/components → components}/Icon/icons/arrow-square-up.d.ts +0 -0
  269. /package/{src/components → components}/Icon/icons/arrow-up.d.ts +0 -0
  270. /package/{src/components → components}/Icon/icons/bank-fill.d.ts +0 -0
  271. /package/{src/components → components}/Icon/icons/bell-slash.d.ts +0 -0
  272. /package/{src/components → components}/Icon/icons/bell.d.ts +0 -0
  273. /package/{src/components → components}/Icon/icons/bi-funnel.d.ts +0 -0
  274. /package/{src/components → components}/Icon/icons/bookmark-fill.d.ts +0 -0
  275. /package/{src/components → components}/Icon/icons/bookmark.d.ts +0 -0
  276. /package/{src/components → components}/Icon/icons/box-arrow-up-right.d.ts +0 -0
  277. /package/{src/components → components}/Icon/icons/box-seam.d.ts +0 -0
  278. /package/{src/components → components}/Icon/icons/building.d.ts +0 -0
  279. /package/{src/components → components}/Icon/icons/bus.d.ts +0 -0
  280. /package/{src/components → components}/Icon/icons/calculator.d.ts +0 -0
  281. /package/{src/components → components}/Icon/icons/calendar-check.d.ts +0 -0
  282. /package/{src/components → components}/Icon/icons/calendar-x.d.ts +0 -0
  283. /package/{src/components → components}/Icon/icons/calendar.d.ts +0 -0
  284. /package/{src/components → components}/Icon/icons/camera.d.ts +0 -0
  285. /package/{src/components → components}/Icon/icons/car.d.ts +0 -0
  286. /package/{src/components → components}/Icon/icons/chat-dots.d.ts +0 -0
  287. /package/{src/components → components}/Icon/icons/chat-left-text.d.ts +0 -0
  288. /package/{src/components → components}/Icon/icons/chat.d.ts +0 -0
  289. /package/{src/components → components}/Icon/icons/check-circle-fill.d.ts +0 -0
  290. /package/{src/components → components}/Icon/icons/check-circle.d.ts +0 -0
  291. /package/{src/components → components}/Icon/icons/check.d.ts +0 -0
  292. /package/{src/components → components}/Icon/icons/chevron-down.d.ts +0 -0
  293. /package/{src/components → components}/Icon/icons/chevron-left.d.ts +0 -0
  294. /package/{src/components → components}/Icon/icons/chevron-right.d.ts +0 -0
  295. /package/{src/components → components}/Icon/icons/chevron-selector-vertical.d.ts +0 -0
  296. /package/{src/components → components}/Icon/icons/chevron-up.d.ts +0 -0
  297. /package/{src/components → components}/Icon/icons/clock.d.ts +0 -0
  298. /package/{src/components → components}/Icon/icons/cloud-check.d.ts +0 -0
  299. /package/{src/components → components}/Icon/icons/cloud-download.d.ts +0 -0
  300. /package/{src/components → components}/Icon/icons/cloud-upload.d.ts +0 -0
  301. /package/{src/components → components}/Icon/icons/cloud.d.ts +0 -0
  302. /package/{src/components → components}/Icon/icons/compass.d.ts +0 -0
  303. /package/{src/components → components}/Icon/icons/cross.d.ts +0 -0
  304. /package/{src/components → components}/Icon/icons/cursor-fill.d.ts +0 -0
  305. /package/{src/components → components}/Icon/icons/cursor.d.ts +0 -0
  306. /package/{src/components → components}/Icon/icons/dash-circle.d.ts +0 -0
  307. /package/{src/components → components}/Icon/icons/dash-square.d.ts +0 -0
  308. /package/{src/components → components}/Icon/icons/dash.d.ts +0 -0
  309. /package/{src/components → components}/Icon/icons/download.d.ts +0 -0
  310. /package/{src/components → components}/Icon/icons/edit.d.ts +0 -0
  311. /package/{src/components → components}/Icon/icons/exclamation-circle-fill.d.ts +0 -0
  312. /package/{src/components → components}/Icon/icons/exclamation-circle.d.ts +0 -0
  313. /package/{src/components → components}/Icon/icons/exclamation-triangle-fill.d.ts +0 -0
  314. /package/{src/components → components}/Icon/icons/exclamation-triangle.d.ts +0 -0
  315. /package/{src/components → components}/Icon/icons/exclamation.d.ts +0 -0
  316. /package/{src/components → components}/Icon/icons/eye-fill.d.ts +0 -0
  317. /package/{src/components → components}/Icon/icons/eye-slash-fill.d.ts +0 -0
  318. /package/{src/components → components}/Icon/icons/eye-slash.d.ts +0 -0
  319. /package/{src/components → components}/Icon/icons/eye.d.ts +0 -0
  320. /package/{src/components → components}/Icon/icons/facebook.d.ts +0 -0
  321. /package/{src/components → components}/Icon/icons/file-earmark-text.d.ts +0 -0
  322. /package/{src/components → components}/Icon/icons/file-pdf.d.ts +0 -0
  323. /package/{src/components → components}/Icon/icons/file-plus.d.ts +0 -0
  324. /package/{src/components → components}/Icon/icons/file-text.d.ts +0 -0
  325. /package/{src/components → components}/Icon/icons/file.d.ts +0 -0
  326. /package/{src/components → components}/Icon/icons/files.d.ts +0 -0
  327. /package/{src/components → components}/Icon/icons/folder-check.d.ts +0 -0
  328. /package/{src/components → components}/Icon/icons/folder-minus.d.ts +0 -0
  329. /package/{src/components → components}/Icon/icons/folder-plus.d.ts +0 -0
  330. /package/{src/components → components}/Icon/icons/folder.d.ts +0 -0
  331. /package/{src/components → components}/Icon/icons/gear.d.ts +0 -0
  332. /package/{src/components → components}/Icon/icons/geo-alt.d.ts +0 -0
  333. /package/{src/components → components}/Icon/icons/geo-fill.d.ts +0 -0
  334. /package/{src/components → components}/Icon/icons/geo.d.ts +0 -0
  335. /package/{src/components → components}/Icon/icons/globe-alt.d.ts +0 -0
  336. /package/{src/components → components}/Icon/icons/globe.d.ts +0 -0
  337. /package/{src/components → components}/Icon/icons/google.d.ts +0 -0
  338. /package/{src/components → components}/Icon/icons/grid-fill.d.ts +0 -0
  339. /package/{src/components → components}/Icon/icons/hand-thumbs-down.d.ts +0 -0
  340. /package/{src/components → components}/Icon/icons/hand-thumbs-up.d.ts +0 -0
  341. /package/{src/components → components}/Icon/icons/hard-drive.d.ts +0 -0
  342. /package/{src/components → components}/Icon/icons/heart.d.ts +0 -0
  343. /package/{src/components → components}/Icon/icons/house-door.d.ts +0 -0
  344. /package/{src/components → components}/Icon/icons/house.d.ts +0 -0
  345. /package/{src/components → components}/Icon/icons/image.d.ts +0 -0
  346. /package/{src/components → components}/Icon/icons/in-box.d.ts +0 -0
  347. /package/{src/components → components}/Icon/icons/info-circle-fill.d.ts +0 -0
  348. /package/{src/components → components}/Icon/icons/info-circle.d.ts +0 -0
  349. /package/{src/components → components}/Icon/icons/instagram.d.ts +0 -0
  350. /package/{src/components → components}/Icon/icons/laptop.d.ts +0 -0
  351. /package/{src/components → components}/Icon/icons/layers.d.ts +0 -0
  352. /package/{src/components → components}/Icon/icons/layout-text-window-reverse.d.ts +0 -0
  353. /package/{src/components → components}/Icon/icons/layout-text-window.d.ts +0 -0
  354. /package/{src/components → components}/Icon/icons/layout.d.ts +0 -0
  355. /package/{src/components → components}/Icon/icons/lightbulb.d.ts +0 -0
  356. /package/{src/components → components}/Icon/icons/link.d.ts +0 -0
  357. /package/{src/components → components}/Icon/icons/linkedin.d.ts +0 -0
  358. /package/{src/components → components}/Icon/icons/list.d.ts +0 -0
  359. /package/{src/components → components}/Icon/icons/lock-fill.d.ts +0 -0
  360. /package/{src/components → components}/Icon/icons/lock.d.ts +0 -0
  361. /package/{src/components → components}/Icon/icons/login.d.ts +0 -0
  362. /package/{src/components → components}/Icon/icons/logout.d.ts +0 -0
  363. /package/{src/components → components}/Icon/icons/luggage.d.ts +0 -0
  364. /package/{src/components → components}/Icon/icons/mail.d.ts +0 -0
  365. /package/{src/components → components}/Icon/icons/map.d.ts +0 -0
  366. /package/{src/components → components}/Icon/icons/menu.d.ts +0 -0
  367. /package/{src/components → components}/Icon/icons/microphone.d.ts +0 -0
  368. /package/{src/components → components}/Icon/icons/monitor.d.ts +0 -0
  369. /package/{src/components → components}/Icon/icons/paperclip.d.ts +0 -0
  370. /package/{src/components → components}/Icon/icons/passport.d.ts +0 -0
  371. /package/{src/components → components}/Icon/icons/pencil.d.ts +0 -0
  372. /package/{src/components → components}/Icon/icons/pending-circle.d.ts +0 -0
  373. /package/{src/components → components}/Icon/icons/person-dash.d.ts +0 -0
  374. /package/{src/components → components}/Icon/icons/person-plus.d.ts +0 -0
  375. /package/{src/components → components}/Icon/icons/person-x.d.ts +0 -0
  376. /package/{src/components → components}/Icon/icons/person.d.ts +0 -0
  377. /package/{src/components → components}/Icon/icons/phone.d.ts +0 -0
  378. /package/{src/components → components}/Icon/icons/pin-map-fill.d.ts +0 -0
  379. /package/{src/components → components}/Icon/icons/pin.d.ts +0 -0
  380. /package/{src/components → components}/Icon/icons/placeholder.d.ts +0 -0
  381. /package/{src/components → components}/Icon/icons/plane.d.ts +0 -0
  382. /package/{src/components → components}/Icon/icons/plus-circle.d.ts +0 -0
  383. /package/{src/components → components}/Icon/icons/plus-square.d.ts +0 -0
  384. /package/{src/components → components}/Icon/icons/plus.d.ts +0 -0
  385. /package/{src/components → components}/Icon/icons/printer.d.ts +0 -0
  386. /package/{src/components → components}/Icon/icons/question-circle.d.ts +0 -0
  387. /package/{src/components → components}/Icon/icons/rocket.d.ts +0 -0
  388. /package/{src/components → components}/Icon/icons/save.d.ts +0 -0
  389. /package/{src/components → components}/Icon/icons/search.d.ts +0 -0
  390. /package/{src/components → components}/Icon/icons/send.d.ts +0 -0
  391. /package/{src/components → components}/Icon/icons/sg-crest.d.ts +0 -0
  392. /package/{src/components → components}/Icon/icons/share.d.ts +0 -0
  393. /package/{src/components → components}/Icon/icons/slash-circle.d.ts +0 -0
  394. /package/{src/components → components}/Icon/icons/sliders.d.ts +0 -0
  395. /package/{src/components → components}/Icon/icons/speedometer.d.ts +0 -0
  396. /package/{src/components → components}/Icon/icons/star-fill.d.ts +0 -0
  397. /package/{src/components → components}/Icon/icons/star.d.ts +0 -0
  398. /package/{src/components → components}/Icon/icons/stoplights.d.ts +0 -0
  399. /package/{src/components → components}/Icon/icons/switch-horizontal.d.ts +0 -0
  400. /package/{src/components → components}/Icon/icons/switch-vertical.d.ts +0 -0
  401. /package/{src/components → components}/Icon/icons/tablet.d.ts +0 -0
  402. /package/{src/components → components}/Icon/icons/telephone.d.ts +0 -0
  403. /package/{src/components → components}/Icon/icons/three-dots-vertical.d.ts +0 -0
  404. /package/{src/components → components}/Icon/icons/three-dots.d.ts +0 -0
  405. /package/{src/components → components}/Icon/icons/ticket.d.ts +0 -0
  406. /package/{src/components → components}/Icon/icons/toggle-off.d.ts +0 -0
  407. /package/{src/components → components}/Icon/icons/toggle-on.d.ts +0 -0
  408. /package/{src/components → components}/Icon/icons/train.d.ts +0 -0
  409. /package/{src/components → components}/Icon/icons/translate.d.ts +0 -0
  410. /package/{src/components → components}/Icon/icons/trash.d.ts +0 -0
  411. /package/{src/components → components}/Icon/icons/truck.d.ts +0 -0
  412. /package/{src/components → components}/Icon/icons/twitter-x.d.ts +0 -0
  413. /package/{src/components → components}/Icon/icons/unlock.d.ts +0 -0
  414. /package/{src/components → components}/Icon/icons/upload.d.ts +0 -0
  415. /package/{src/components → components}/Icon/icons/user-circle.d.ts +0 -0
  416. /package/{src/components → components}/Icon/icons/user-square.d.ts +0 -0
  417. /package/{src/components → components}/Icon/icons/users.d.ts +0 -0
  418. /package/{src/components → components}/Icon/icons/video-recorder.d.ts +0 -0
  419. /package/{src/components → components}/Icon/icons/volume-max.d.ts +0 -0
  420. /package/{src/components → components}/Icon/icons/volume-x.d.ts +0 -0
  421. /package/{src/components → components}/Icon/icons/window-dash.d.ts +0 -0
  422. /package/{src/components → components}/Icon/icons/window-desktop.d.ts +0 -0
  423. /package/{src/components → components}/Icon/icons/window-dock.d.ts +0 -0
  424. /package/{src/components → components}/Icon/icons/window-fullscreen.d.ts +0 -0
  425. /package/{src/components → components}/Icon/icons/window-plus.d.ts +0 -0
  426. /package/{src/components → components}/Icon/icons/window-sidebar.d.ts +0 -0
  427. /package/{src/components → components}/Icon/icons/window-split.d.ts +0 -0
  428. /package/{src/components → components}/Icon/icons/window-stack.d.ts +0 -0
  429. /package/{src/components → components}/Icon/icons/window-x.d.ts +0 -0
  430. /package/{src/components → components}/Icon/icons/window.d.ts +0 -0
  431. /package/{src/components → components}/Icon/icons/xcircle-fill.d.ts +0 -0
  432. /package/{src/components → components}/Icon/icons/xcircle.d.ts +0 -0
  433. /package/{src/components → components}/Icon/icons/youtube.d.ts +0 -0
  434. /package/{src/components → components}/Icon/icons/zoom-in.d.ts +0 -0
  435. /package/{src/components → components}/Icon/icons/zoom-out.d.ts +0 -0
  436. /package/{src/components → components}/Icon/index.d.ts +0 -0
  437. /package/{src/components → components}/Icon/sgds-icon.d.ts +0 -0
  438. /package/{src/components → components}/IconButton/index.d.ts +0 -0
  439. /package/{src/components → components}/IconButton/sgds-icon-button.d.ts +0 -0
  440. /package/{src/components → components}/IconList/index.d.ts +0 -0
  441. /package/{src/components → components}/IconList/sgds-icon-list.d.ts +0 -0
  442. /package/{src/components → components}/Input/index.d.ts +0 -0
  443. /package/{src/components → components}/Input/sgds-input.d.ts +0 -0
  444. /package/{src/components → components}/Link/index.d.ts +0 -0
  445. /package/{src/components → components}/Link/sgds-link.d.ts +0 -0
  446. /package/{src/components → components}/Mainnav/index.d.ts +0 -0
  447. /package/{src/components → components}/Mainnav/mainnav-context.d.ts +0 -0
  448. /package/{src/components → components}/Mainnav/sgds-mainnav-dropdown.d.ts +0 -0
  449. /package/{src/components → components}/Mainnav/sgds-mainnav-item.d.ts +0 -0
  450. /package/{src/components → components}/Mainnav/sgds-mainnav.d.ts +0 -0
  451. /package/{src/components → components}/Masthead/index.d.ts +0 -0
  452. /package/{src/components → components}/Masthead/sgds-masthead.d.ts +0 -0
  453. /package/{src/components → components}/Modal/index.d.ts +0 -0
  454. /package/{src/components → components}/Modal/sgds-modal.d.ts +0 -0
  455. /package/{src/internals → components}/OverflowMenu/index.d.ts +0 -0
  456. /package/{internals → components}/OverflowMenu/overflow-menu.js +0 -0
  457. /package/{internals → components}/OverflowMenu/overflow-menu.js.map +0 -0
  458. /package/{src/components → components}/Pagination/index.d.ts +0 -0
  459. /package/{src/components → components}/Pagination/sgds-pagination.d.ts +0 -0
  460. /package/{src/components → components}/ProgressBar/index.d.ts +0 -0
  461. /package/{src/components → components}/ProgressBar/sgds-progress-bar.d.ts +0 -0
  462. /package/{src/components → components}/QuantityToggle/index.d.ts +0 -0
  463. /package/{src/components → components}/QuantityToggle/sgds-quantity-toggle.d.ts +0 -0
  464. /package/{src/components → components}/Radio/index.d.ts +0 -0
  465. /package/{src/components → components}/Radio/sgds-radio-group.d.ts +0 -0
  466. /package/{src/components → components}/Radio/sgds-radio.d.ts +0 -0
  467. /package/{src/components → components}/Select/index.d.ts +0 -0
  468. /package/{src/components → components}/Select/select-item.d.ts +0 -0
  469. /package/{src/components → components}/Select/sgds-select.d.ts +0 -0
  470. /package/{src/components → components}/Sidenav/index.d.ts +0 -0
  471. /package/{src/components → components}/Sidenav/sgds-sidenav-item.d.ts +0 -0
  472. /package/{src/components → components}/Sidenav/sgds-sidenav-link.d.ts +0 -0
  473. /package/{src/components → components}/Sidenav/sgds-sidenav.d.ts +0 -0
  474. /package/{src/components → components}/Skeleton/index.d.ts +0 -0
  475. /package/{src/components → components}/Skeleton/sgds-skeleton.d.ts +0 -0
  476. /package/{src/components → components}/Spinner/index.d.ts +0 -0
  477. /package/{src/components → components}/Spinner/sgds-spinner.d.ts +0 -0
  478. /package/{src/components → components}/Stepper/index.d.ts +0 -0
  479. /package/{src/components → components}/Stepper/sgds-stepper.d.ts +0 -0
  480. /package/{src/components → components}/Subnav/index.d.ts +0 -0
  481. /package/{src/components → components}/Subnav/sgds-subnav-item.d.ts +0 -0
  482. /package/{src/components → components}/Subnav/sgds-subnav.d.ts +0 -0
  483. /package/{src/components → components}/Switch/index.d.ts +0 -0
  484. /package/{src/components → components}/Switch/sgds-switch.d.ts +0 -0
  485. /package/{src/components → components}/Tab/index.d.ts +0 -0
  486. /package/{src/components → components}/Tab/sgds-tab-group.d.ts +0 -0
  487. /package/{src/components → components}/Tab/sgds-tab-panel.d.ts +0 -0
  488. /package/{src/components → components}/Tab/sgds-tab.d.ts +0 -0
  489. /package/{src/components → components}/Table/index.d.ts +0 -0
  490. /package/{src/components → components}/Table/sgds-table-cell.d.ts +0 -0
  491. /package/{src/components → components}/Table/sgds-table-head.d.ts +0 -0
  492. /package/{src/components → components}/Table/sgds-table-row.d.ts +0 -0
  493. /package/{src/components → components}/Table/sgds-table.d.ts +0 -0
  494. /package/{src/components → components}/TableOfContents/index.d.ts +0 -0
  495. /package/{src/components → components}/TableOfContents/sgds-table-of-contents.d.ts +0 -0
  496. /package/{src/components → components}/Textarea/index.d.ts +0 -0
  497. /package/{src/components → components}/Textarea/sgds-textarea.d.ts +0 -0
  498. /package/{src/components → components}/Toast/index.d.ts +0 -0
  499. /package/{src/components → components}/Toast/sgds-toast-container.d.ts +0 -0
  500. /package/{src/components → components}/Toast/sgds-toast.d.ts +0 -0
  501. /package/{src/components → components}/Tooltip/index.d.ts +0 -0
  502. /package/{src/components → components}/Tooltip/sgds-tooltip.d.ts +0 -0
  503. /package/{src/internals → internals}/CloseButton/index.d.ts +0 -0
  504. /package/{src/internals → internals}/CloseButton/sgds-close-button.d.ts +0 -0
  505. /package/{src/react → react}/accordion/index.d.ts +0 -0
  506. /package/{src/react → react}/accordion-item/index.d.ts +0 -0
  507. /package/{src/react → react}/alert/index.d.ts +0 -0
  508. /package/{src/react → react}/alert-link/index.d.ts +0 -0
  509. /package/{src/react → react}/badge/index.d.ts +0 -0
  510. /package/{src/react → react}/breadcrumb/index.d.ts +0 -0
  511. /package/{src/react → react}/breadcrumb-item/index.d.ts +0 -0
  512. /package/{src/react → react}/button/index.d.ts +0 -0
  513. /package/{src/react → react}/card/index.d.ts +0 -0
  514. /package/{src/react → react}/checkbox/index.d.ts +0 -0
  515. /package/{src/react → react}/checkbox-group/index.d.ts +0 -0
  516. /package/{src/react → react}/combo-box/index.d.ts +0 -0
  517. /package/react/{internals → components}/OverflowMenu/overflow-menu.cjs.js +0 -0
  518. /package/react/{internals → components}/OverflowMenu/overflow-menu.cjs.js.map +0 -0
  519. /package/react/{internals → components}/OverflowMenu/overflow-menu.js +0 -0
  520. /package/react/{internals → components}/OverflowMenu/overflow-menu.js.map +0 -0
  521. /package/{src/react → react}/datepicker/index.d.ts +0 -0
  522. /package/{src/react → react}/description-list/index.d.ts +0 -0
  523. /package/{src/react → react}/description-list-group/index.d.ts +0 -0
  524. /package/{src/react → react}/divider/index.d.ts +0 -0
  525. /package/{src/react → react}/drawer/index.d.ts +0 -0
  526. /package/{src/react → react}/dropdown/index.d.ts +0 -0
  527. /package/{src/react → react}/dropdown-item/index.d.ts +0 -0
  528. /package/{src/react → react}/file-upload/index.d.ts +0 -0
  529. /package/{src/react → react}/footer/index.d.ts +0 -0
  530. /package/{src/react → react}/footer-item/index.d.ts +0 -0
  531. /package/{src/react/input → react/icon}/index.d.ts +0 -0
  532. /package/{src/react → react}/icon-button/index.d.ts +0 -0
  533. /package/{src/react/icon-list → react/icon-card}/index.d.ts +0 -0
  534. /package/{src/react/icon → react/icon-list}/index.d.ts +0 -0
  535. /package/{src/react/link → react/image-card}/index.d.ts +0 -0
  536. /package/{src/react/mainnav-dropdown → react/input}/index.d.ts +0 -0
  537. /package/{src/react/mainnav-item → react/link}/index.d.ts +0 -0
  538. /package/{src/react/modal → react/mainnav}/index.d.ts +0 -0
  539. /package/{src/react/mainnav → react/mainnav-dropdown}/index.d.ts +0 -0
  540. /package/{src/react/masthead → react/mainnav-item}/index.d.ts +0 -0
  541. /package/{src/react/pagination → react/masthead}/index.d.ts +0 -0
  542. /package/{src/react/progress-bar → react/modal}/index.d.ts +0 -0
  543. /package/{src/react/quantity-toggle → react/overflow-menu}/index.d.ts +0 -0
  544. /package/{src/react/radio-group → react/pagination}/index.d.ts +0 -0
  545. /package/{src/react/radio → react/progress-bar}/index.d.ts +0 -0
  546. /package/{src/react/select → react/quantity-toggle}/index.d.ts +0 -0
  547. /package/{src/react/sidenav-link → react/radio}/index.d.ts +0 -0
  548. /package/{src/react/sidenav-item → react/radio-group}/index.d.ts +0 -0
  549. /package/{src/react/sidenav → react/select}/index.d.ts +0 -0
  550. /package/{src/react/stepper → react/sidenav}/index.d.ts +0 -0
  551. /package/{src/react/skeleton → react/sidenav-item}/index.d.ts +0 -0
  552. /package/{src/react/spinner → react/sidenav-link}/index.d.ts +0 -0
  553. /package/{src/react/subnav-item → react/skeleton}/index.d.ts +0 -0
  554. /package/{src/react/subnav → react/spinner}/index.d.ts +0 -0
  555. /package/{src/react/switch → react/stepper}/index.d.ts +0 -0
  556. /package/{src/react/tab-panel → react/subnav}/index.d.ts +0 -0
  557. /package/{src/react/tab-group → react/subnav-item}/index.d.ts +0 -0
  558. /package/{src/react/tab → react/switch}/index.d.ts +0 -0
  559. /package/{src/react/table-of-contents → react/tab}/index.d.ts +0 -0
  560. /package/{src/react/table-cell → react/tab-group}/index.d.ts +0 -0
  561. /package/{src/react/table-head → react/tab-panel}/index.d.ts +0 -0
  562. /package/{src/react/toast → react/table}/index.d.ts +0 -0
  563. /package/{src/react/table-row → react/table-cell}/index.d.ts +0 -0
  564. /package/{src/react/table → react/table-head}/index.d.ts +0 -0
  565. /package/{src/react/textarea → react/table-of-contents}/index.d.ts +0 -0
  566. /package/{src/react/toast-container → react/table-row}/index.d.ts +0 -0
  567. /package/{src/react/tooltip → react/textarea}/index.d.ts +0 -0
  568. /package/{src/utils → utils}/animate.d.ts +0 -0
  569. /package/{src/utils → utils}/animation-registry.d.ts +0 -0
  570. /package/{src/utils → utils}/breakpoints.d.ts +0 -0
  571. /package/{src/utils → utils}/ce-registry.d.ts +0 -0
  572. /package/{src/utils → utils}/defaultvalue.d.ts +0 -0
  573. /package/{src/utils → utils}/event.d.ts +0 -0
  574. /package/{src/utils → utils}/formSubmitController.d.ts +0 -0
  575. /package/{src/utils → utils}/generateCustomElementName.d.ts +0 -0
  576. /package/{src/utils → utils}/generateId.d.ts +0 -0
  577. /package/{src/utils → utils}/inputValidationController.d.ts +0 -0
  578. /package/{src/utils → utils}/mergeDeep.d.ts +0 -0
  579. /package/{src/utils → utils}/modal.d.ts +0 -0
  580. /package/{src/utils → utils}/object.d.ts +0 -0
  581. /package/{src/utils → utils}/offset.d.ts +0 -0
  582. /package/{src/utils → utils}/scroll.d.ts +0 -0
  583. /package/{src/utils → utils}/slot.d.ts +0 -0
  584. /package/{src/utils → utils}/tabbable.d.ts +0 -0
  585. /package/{src/utils → utils}/test.d.ts +0 -0
  586. /package/{src/utils → utils}/time.d.ts +0 -0
  587. /package/{src/utils → utils}/validatorMixin.d.ts +0 -0
  588. /package/{src/utils → utils}/watch.d.ts +0 -0
@@ -0,0 +1,4754 @@
1
+ (function (factory) {
2
+ typeof define === 'function' && define.amd ? define(factory) :
3
+ factory();
4
+ })((function () { 'use strict';
5
+
6
+ /******************************************************************************
7
+ Copyright (c) Microsoft Corporation.
8
+
9
+ Permission to use, copy, modify, and/or distribute this software for any
10
+ purpose with or without fee is hereby granted.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
+ PERFORMANCE OF THIS SOFTWARE.
19
+ ***************************************************************************** */
20
+
21
+ function __decorate(decorators, target, key, desc) {
22
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
24
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
25
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
26
+ }
27
+
28
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
29
+ var e = new Error(message);
30
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
31
+ };
32
+
33
+ /**
34
+ * @license
35
+ * Copyright 2019 Google LLC
36
+ * SPDX-License-Identifier: BSD-3-Clause
37
+ */
38
+ const NODE_MODE$1 = false;
39
+ // Allows minifiers to rename references to globalThis
40
+ const global$4 = globalThis;
41
+ /**
42
+ * Whether the current browser supports `adoptedStyleSheets`.
43
+ */
44
+ const supportsAdoptingStyleSheets$1 = global$4.ShadowRoot &&
45
+ (global$4.ShadyCSS === undefined || global$4.ShadyCSS.nativeShadow) &&
46
+ 'adoptedStyleSheets' in Document.prototype &&
47
+ 'replace' in CSSStyleSheet.prototype;
48
+ const constructionToken$1 = Symbol();
49
+ const cssTagCache$1 = new WeakMap();
50
+ /**
51
+ * A container for a string of CSS text, that may be used to create a CSSStyleSheet.
52
+ *
53
+ * CSSResult is the return value of `css`-tagged template literals and
54
+ * `unsafeCSS()`. In order to ensure that CSSResults are only created via the
55
+ * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.
56
+ */
57
+ class CSSResult$1 {
58
+ constructor(cssText, strings, safeToken) {
59
+ // This property needs to remain unminified.
60
+ this['_$cssResult$'] = true;
61
+ if (safeToken !== constructionToken$1) {
62
+ throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
63
+ }
64
+ this.cssText = cssText;
65
+ this._strings = strings;
66
+ }
67
+ // This is a getter so that it's lazy. In practice, this means stylesheets
68
+ // are not created until the first element instance is made.
69
+ get styleSheet() {
70
+ // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is
71
+ // constructable.
72
+ let styleSheet = this._styleSheet;
73
+ const strings = this._strings;
74
+ if (supportsAdoptingStyleSheets$1 && styleSheet === undefined) {
75
+ const cacheable = strings !== undefined && strings.length === 1;
76
+ if (cacheable) {
77
+ styleSheet = cssTagCache$1.get(strings);
78
+ }
79
+ if (styleSheet === undefined) {
80
+ (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
81
+ if (cacheable) {
82
+ cssTagCache$1.set(strings, styleSheet);
83
+ }
84
+ }
85
+ }
86
+ return styleSheet;
87
+ }
88
+ toString() {
89
+ return this.cssText;
90
+ }
91
+ }
92
+ /**
93
+ * Wrap a value for interpolation in a {@linkcode css} tagged template literal.
94
+ *
95
+ * This is unsafe because untrusted CSS text can be used to phone home
96
+ * or exfiltrate data to an attacker controlled site. Take care to only use
97
+ * this with trusted input.
98
+ */
99
+ const unsafeCSS$1 = (value) => new CSSResult$1(typeof value === 'string' ? value : String(value), undefined, constructionToken$1);
100
+ /**
101
+ * Applies the given styles to a `shadowRoot`. When Shadow DOM is
102
+ * available but `adoptedStyleSheets` is not, styles are appended to the
103
+ * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).
104
+ * Note, when shimming is used, any styles that are subsequently placed into
105
+ * the shadowRoot should be placed *before* any shimmed adopted styles. This
106
+ * will match spec behavior that gives adopted sheets precedence over styles in
107
+ * shadowRoot.
108
+ */
109
+ const adoptStyles$1 = (renderRoot, styles) => {
110
+ if (supportsAdoptingStyleSheets$1) {
111
+ renderRoot.adoptedStyleSheets = styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
112
+ }
113
+ else {
114
+ for (const s of styles) {
115
+ const style = document.createElement('style');
116
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
+ const nonce = global$4['litNonce'];
118
+ if (nonce !== undefined) {
119
+ style.setAttribute('nonce', nonce);
120
+ }
121
+ style.textContent = s.cssText;
122
+ renderRoot.appendChild(style);
123
+ }
124
+ }
125
+ };
126
+ const cssResultFromStyleSheet$1 = (sheet) => {
127
+ let cssText = '';
128
+ for (const rule of sheet.cssRules) {
129
+ cssText += rule.cssText;
130
+ }
131
+ return unsafeCSS$1(cssText);
132
+ };
133
+ const getCompatibleStyle$1 = supportsAdoptingStyleSheets$1 ||
134
+ (NODE_MODE$1 )
135
+ ? (s) => s
136
+ : (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet$1(s) : s;
137
+
138
+ /**
139
+ * @license
140
+ * Copyright 2017 Google LLC
141
+ * SPDX-License-Identifier: BSD-3-Clause
142
+ */
143
+ // TODO (justinfagnani): Add `hasOwn` here when we ship ES2022
144
+ const { is: is$1, defineProperty: defineProperty$1, getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, getOwnPropertyNames: getOwnPropertyNames$1, getOwnPropertySymbols: getOwnPropertySymbols$1, getPrototypeOf: getPrototypeOf$1, } = Object;
145
+ // Lets a minifier replace globalThis references with a minified name
146
+ const global$3 = globalThis;
147
+ let issueWarning$5;
148
+ const trustedTypes$2 = global$3
149
+ .trustedTypes;
150
+ // Temporary workaround for https://crbug.com/993268
151
+ // Currently, any attribute starting with "on" is considered to be a
152
+ // TrustedScript source. Such boolean attributes must be set to the equivalent
153
+ // trusted emptyScript value.
154
+ const emptyStringForBooleanAttribute$1 = trustedTypes$2
155
+ ? trustedTypes$2.emptyScript
156
+ : '';
157
+ const polyfillSupport$3 = global$3.reactiveElementPolyfillSupportDevMode
158
+ ;
159
+ {
160
+ // Ensure warnings are issued only 1x, even if multiple versions of Lit
161
+ // are loaded.
162
+ const issuedWarnings = (global$3.litIssuedWarnings ??=
163
+ new Set());
164
+ // Issue a warning, if we haven't already.
165
+ issueWarning$5 = (code, warning) => {
166
+ warning += ` See https://lit.dev/msg/${code} for more information.`;
167
+ if (!issuedWarnings.has(warning)) {
168
+ console.warn(warning);
169
+ issuedWarnings.add(warning);
170
+ }
171
+ };
172
+ issueWarning$5('dev-mode', `Lit is in dev mode. Not recommended for production!`);
173
+ // Issue polyfill support warning.
174
+ if (global$3.ShadyDOM?.inUse && polyfillSupport$3 === undefined) {
175
+ issueWarning$5('polyfill-support-missing', `Shadow DOM is being polyfilled via \`ShadyDOM\` but ` +
176
+ `the \`polyfill-support\` module has not been loaded.`);
177
+ }
178
+ }
179
+ /**
180
+ * Useful for visualizing and logging insights into what the Lit template system is doing.
181
+ *
182
+ * Compiled out of prod mode builds.
183
+ */
184
+ const debugLogEvent$2 = (event) => {
185
+ const shouldEmit = global$3
186
+ .emitLitDebugLogEvents;
187
+ if (!shouldEmit) {
188
+ return;
189
+ }
190
+ global$3.dispatchEvent(new CustomEvent('lit-debug', {
191
+ detail: event,
192
+ }));
193
+ }
194
+ ;
195
+ /*
196
+ * When using Closure Compiler, JSCompiler_renameProperty(property, object) is
197
+ * replaced at compile time by the munged name for object[property]. We cannot
198
+ * alias this function, so we have to use a small shim that has the same
199
+ * behavior when not compiling.
200
+ */
201
+ /*@__INLINE__*/
202
+ const JSCompiler_renameProperty$2 = (prop, _obj) => prop;
203
+ const defaultConverter$1 = {
204
+ toAttribute(value, type) {
205
+ switch (type) {
206
+ case Boolean:
207
+ value = value ? emptyStringForBooleanAttribute$1 : null;
208
+ break;
209
+ case Object:
210
+ case Array:
211
+ // if the value is `null` or `undefined` pass this through
212
+ // to allow removing/no change behavior.
213
+ value = value == null ? value : JSON.stringify(value);
214
+ break;
215
+ }
216
+ return value;
217
+ },
218
+ fromAttribute(value, type) {
219
+ let fromValue = value;
220
+ switch (type) {
221
+ case Boolean:
222
+ fromValue = value !== null;
223
+ break;
224
+ case Number:
225
+ fromValue = value === null ? null : Number(value);
226
+ break;
227
+ case Object:
228
+ case Array:
229
+ // Do *not* generate exception when invalid JSON is set as elements
230
+ // don't normally complain on being mis-configured.
231
+ // TODO(sorvell): Do generate exception in *dev mode*.
232
+ try {
233
+ // Assert to adhere to Bazel's "must type assert JSON parse" rule.
234
+ fromValue = JSON.parse(value);
235
+ }
236
+ catch (e) {
237
+ fromValue = null;
238
+ }
239
+ break;
240
+ }
241
+ return fromValue;
242
+ },
243
+ };
244
+ /**
245
+ * Change function that returns true if `value` is different from `oldValue`.
246
+ * This method is used as the default for a property's `hasChanged` function.
247
+ */
248
+ const notEqual$1 = (value, old) => !is$1(value, old);
249
+ const defaultPropertyDeclaration$2 = {
250
+ attribute: true,
251
+ type: String,
252
+ converter: defaultConverter$1,
253
+ reflect: false,
254
+ hasChanged: notEqual$1,
255
+ };
256
+ // Ensure metadata is enabled. TypeScript does not polyfill
257
+ // Symbol.metadata, so we must ensure that it exists.
258
+ Symbol.metadata ??= Symbol('metadata');
259
+ // Map from a class's metadata object to property options
260
+ // Note that we must use nullish-coalescing assignment so that we only use one
261
+ // map even if we load multiple version of this module.
262
+ global$3.litPropertyMetadata ??= new WeakMap();
263
+ /**
264
+ * Base element class which manages element properties and attributes. When
265
+ * properties change, the `update` method is asynchronously called. This method
266
+ * should be supplied by subclasses to render updates as desired.
267
+ * @noInheritDoc
268
+ */
269
+ class ReactiveElement$1
270
+ // In the Node build, this `extends` clause will be substituted with
271
+ // `(globalThis.HTMLElement ?? HTMLElement)`.
272
+ //
273
+ // This way, we will first prefer any global `HTMLElement` polyfill that the
274
+ // user has assigned, and then fall back to the `HTMLElement` shim which has
275
+ // been imported (see note at the top of this file about how this import is
276
+ // generated by Rollup). Note that the `HTMLElement` variable has been
277
+ // shadowed by this import, so it no longer refers to the global.
278
+ extends HTMLElement {
279
+ /**
280
+ * Adds an initializer function to the class that is called during instance
281
+ * construction.
282
+ *
283
+ * This is useful for code that runs against a `ReactiveElement`
284
+ * subclass, such as a decorator, that needs to do work for each
285
+ * instance, such as setting up a `ReactiveController`.
286
+ *
287
+ * ```ts
288
+ * const myDecorator = (target: typeof ReactiveElement, key: string) => {
289
+ * target.addInitializer((instance: ReactiveElement) => {
290
+ * // This is run during construction of the element
291
+ * new MyController(instance);
292
+ * });
293
+ * }
294
+ * ```
295
+ *
296
+ * Decorating a field will then cause each instance to run an initializer
297
+ * that adds a controller:
298
+ *
299
+ * ```ts
300
+ * class MyElement extends LitElement {
301
+ * @myDecorator foo;
302
+ * }
303
+ * ```
304
+ *
305
+ * Initializers are stored per-constructor. Adding an initializer to a
306
+ * subclass does not add it to a superclass. Since initializers are run in
307
+ * constructors, initializers will run in order of the class hierarchy,
308
+ * starting with superclasses and progressing to the instance's class.
309
+ *
310
+ * @nocollapse
311
+ */
312
+ static addInitializer(initializer) {
313
+ this.__prepare();
314
+ (this._initializers ??= []).push(initializer);
315
+ }
316
+ /**
317
+ * Returns a list of attributes corresponding to the registered properties.
318
+ * @nocollapse
319
+ * @category attributes
320
+ */
321
+ static get observedAttributes() {
322
+ // Ensure we've created all properties
323
+ this.finalize();
324
+ // this.__attributeToPropertyMap is only undefined after finalize() in
325
+ // ReactiveElement itself. ReactiveElement.observedAttributes is only
326
+ // accessed with ReactiveElement as the receiver when a subclass or mixin
327
+ // calls super.observedAttributes
328
+ return (this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]);
329
+ }
330
+ /**
331
+ * Creates a property accessor on the element prototype if one does not exist
332
+ * and stores a {@linkcode PropertyDeclaration} for the property with the
333
+ * given options. The property setter calls the property's `hasChanged`
334
+ * property option or uses a strict identity check to determine whether or not
335
+ * to request an update.
336
+ *
337
+ * This method may be overridden to customize properties; however,
338
+ * when doing so, it's important to call `super.createProperty` to ensure
339
+ * the property is setup correctly. This method calls
340
+ * `getPropertyDescriptor` internally to get a descriptor to install.
341
+ * To customize what properties do when they are get or set, override
342
+ * `getPropertyDescriptor`. To customize the options for a property,
343
+ * implement `createProperty` like this:
344
+ *
345
+ * ```ts
346
+ * static createProperty(name, options) {
347
+ * options = Object.assign(options, {myOption: true});
348
+ * super.createProperty(name, options);
349
+ * }
350
+ * ```
351
+ *
352
+ * @nocollapse
353
+ * @category properties
354
+ */
355
+ static createProperty(name, options = defaultPropertyDeclaration$2) {
356
+ // If this is a state property, force the attribute to false.
357
+ if (options.state) {
358
+ options.attribute = false;
359
+ }
360
+ this.__prepare();
361
+ this.elementProperties.set(name, options);
362
+ if (!options.noAccessor) {
363
+ const key = // Use Symbol.for in dev mode to make it easier to maintain state
364
+ // when doing HMR.
365
+ Symbol.for(`${String(name)} (@property() cache)`)
366
+ ;
367
+ const descriptor = this.getPropertyDescriptor(name, key, options);
368
+ if (descriptor !== undefined) {
369
+ defineProperty$1(this.prototype, name, descriptor);
370
+ }
371
+ }
372
+ }
373
+ /**
374
+ * Returns a property descriptor to be defined on the given named property.
375
+ * If no descriptor is returned, the property will not become an accessor.
376
+ * For example,
377
+ *
378
+ * ```ts
379
+ * class MyElement extends LitElement {
380
+ * static getPropertyDescriptor(name, key, options) {
381
+ * const defaultDescriptor =
382
+ * super.getPropertyDescriptor(name, key, options);
383
+ * const setter = defaultDescriptor.set;
384
+ * return {
385
+ * get: defaultDescriptor.get,
386
+ * set(value) {
387
+ * setter.call(this, value);
388
+ * // custom action.
389
+ * },
390
+ * configurable: true,
391
+ * enumerable: true
392
+ * }
393
+ * }
394
+ * }
395
+ * ```
396
+ *
397
+ * @nocollapse
398
+ * @category properties
399
+ */
400
+ static getPropertyDescriptor(name, key, options) {
401
+ const { get, set } = getOwnPropertyDescriptor$1(this.prototype, name) ?? {
402
+ get() {
403
+ return this[key];
404
+ },
405
+ set(v) {
406
+ this[key] = v;
407
+ },
408
+ };
409
+ if (get == null) {
410
+ if ('value' in (getOwnPropertyDescriptor$1(this.prototype, name) ?? {})) {
411
+ throw new Error(`Field ${JSON.stringify(String(name))} on ` +
412
+ `${this.name} was declared as a reactive property ` +
413
+ `but it's actually declared as a value on the prototype. ` +
414
+ `Usually this is due to using @property or @state on a method.`);
415
+ }
416
+ issueWarning$5('reactive-property-without-getter', `Field ${JSON.stringify(String(name))} on ` +
417
+ `${this.name} was declared as a reactive property ` +
418
+ `but it does not have a getter. This will be an error in a ` +
419
+ `future version of Lit.`);
420
+ }
421
+ return {
422
+ get() {
423
+ return get?.call(this);
424
+ },
425
+ set(value) {
426
+ const oldValue = get?.call(this);
427
+ set.call(this, value);
428
+ this.requestUpdate(name, oldValue, options);
429
+ },
430
+ configurable: true,
431
+ enumerable: true,
432
+ };
433
+ }
434
+ /**
435
+ * Returns the property options associated with the given property.
436
+ * These options are defined with a `PropertyDeclaration` via the `properties`
437
+ * object or the `@property` decorator and are registered in
438
+ * `createProperty(...)`.
439
+ *
440
+ * Note, this method should be considered "final" and not overridden. To
441
+ * customize the options for a given property, override
442
+ * {@linkcode createProperty}.
443
+ *
444
+ * @nocollapse
445
+ * @final
446
+ * @category properties
447
+ */
448
+ static getPropertyOptions(name) {
449
+ return this.elementProperties.get(name) ?? defaultPropertyDeclaration$2;
450
+ }
451
+ /**
452
+ * Initializes static own properties of the class used in bookkeeping
453
+ * for element properties, initializers, etc.
454
+ *
455
+ * Can be called multiple times by code that needs to ensure these
456
+ * properties exist before using them.
457
+ *
458
+ * This method ensures the superclass is finalized so that inherited
459
+ * property metadata can be copied down.
460
+ * @nocollapse
461
+ */
462
+ static __prepare() {
463
+ if (this.hasOwnProperty(JSCompiler_renameProperty$2('elementProperties'))) {
464
+ // Already prepared
465
+ return;
466
+ }
467
+ // Finalize any superclasses
468
+ const superCtor = getPrototypeOf$1(this);
469
+ superCtor.finalize();
470
+ // Create own set of initializers for this class if any exist on the
471
+ // superclass and copy them down. Note, for a small perf boost, avoid
472
+ // creating initializers unless needed.
473
+ if (superCtor._initializers !== undefined) {
474
+ this._initializers = [...superCtor._initializers];
475
+ }
476
+ // Initialize elementProperties from the superclass
477
+ this.elementProperties = new Map(superCtor.elementProperties);
478
+ }
479
+ /**
480
+ * Finishes setting up the class so that it's ready to be registered
481
+ * as a custom element and instantiated.
482
+ *
483
+ * This method is called by the ReactiveElement.observedAttributes getter.
484
+ * If you override the observedAttributes getter, you must either call
485
+ * super.observedAttributes to trigger finalization, or call finalize()
486
+ * yourself.
487
+ *
488
+ * @nocollapse
489
+ */
490
+ static finalize() {
491
+ if (this.hasOwnProperty(JSCompiler_renameProperty$2('finalized'))) {
492
+ return;
493
+ }
494
+ this.finalized = true;
495
+ this.__prepare();
496
+ // Create properties from the static properties block:
497
+ if (this.hasOwnProperty(JSCompiler_renameProperty$2('properties'))) {
498
+ const props = this.properties;
499
+ const propKeys = [
500
+ ...getOwnPropertyNames$1(props),
501
+ ...getOwnPropertySymbols$1(props),
502
+ ];
503
+ for (const p of propKeys) {
504
+ this.createProperty(p, props[p]);
505
+ }
506
+ }
507
+ // Create properties from standard decorator metadata:
508
+ const metadata = this[Symbol.metadata];
509
+ if (metadata !== null) {
510
+ const properties = litPropertyMetadata.get(metadata);
511
+ if (properties !== undefined) {
512
+ for (const [p, options] of properties) {
513
+ this.elementProperties.set(p, options);
514
+ }
515
+ }
516
+ }
517
+ // Create the attribute-to-property map
518
+ this.__attributeToPropertyMap = new Map();
519
+ for (const [p, options] of this.elementProperties) {
520
+ const attr = this.__attributeNameForProperty(p, options);
521
+ if (attr !== undefined) {
522
+ this.__attributeToPropertyMap.set(attr, p);
523
+ }
524
+ }
525
+ this.elementStyles = this.finalizeStyles(this.styles);
526
+ {
527
+ if (this.hasOwnProperty('createProperty')) {
528
+ issueWarning$5('no-override-create-property', 'Overriding ReactiveElement.createProperty() is deprecated. ' +
529
+ 'The override will not be called with standard decorators');
530
+ }
531
+ if (this.hasOwnProperty('getPropertyDescriptor')) {
532
+ issueWarning$5('no-override-get-property-descriptor', 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +
533
+ 'The override will not be called with standard decorators');
534
+ }
535
+ }
536
+ }
537
+ /**
538
+ * Takes the styles the user supplied via the `static styles` property and
539
+ * returns the array of styles to apply to the element.
540
+ * Override this method to integrate into a style management system.
541
+ *
542
+ * Styles are deduplicated preserving the _last_ instance in the list. This
543
+ * is a performance optimization to avoid duplicated styles that can occur
544
+ * especially when composing via subclassing. The last item is kept to try
545
+ * to preserve the cascade order with the assumption that it's most important
546
+ * that last added styles override previous styles.
547
+ *
548
+ * @nocollapse
549
+ * @category styles
550
+ */
551
+ static finalizeStyles(styles) {
552
+ const elementStyles = [];
553
+ if (Array.isArray(styles)) {
554
+ // Dedupe the flattened array in reverse order to preserve the last items.
555
+ // Casting to Array<unknown> works around TS error that
556
+ // appears to come from trying to flatten a type CSSResultArray.
557
+ const set = new Set(styles.flat(Infinity).reverse());
558
+ // Then preserve original order by adding the set items in reverse order.
559
+ for (const s of set) {
560
+ elementStyles.unshift(getCompatibleStyle$1(s));
561
+ }
562
+ }
563
+ else if (styles !== undefined) {
564
+ elementStyles.push(getCompatibleStyle$1(styles));
565
+ }
566
+ return elementStyles;
567
+ }
568
+ /**
569
+ * Returns the property name for the given attribute `name`.
570
+ * @nocollapse
571
+ */
572
+ static __attributeNameForProperty(name, options) {
573
+ const attribute = options.attribute;
574
+ return attribute === false
575
+ ? undefined
576
+ : typeof attribute === 'string'
577
+ ? attribute
578
+ : typeof name === 'string'
579
+ ? name.toLowerCase()
580
+ : undefined;
581
+ }
582
+ constructor() {
583
+ super();
584
+ this.__instanceProperties = undefined;
585
+ /**
586
+ * True if there is a pending update as a result of calling `requestUpdate()`.
587
+ * Should only be read.
588
+ * @category updates
589
+ */
590
+ this.isUpdatePending = false;
591
+ /**
592
+ * Is set to `true` after the first update. The element code cannot assume
593
+ * that `renderRoot` exists before the element `hasUpdated`.
594
+ * @category updates
595
+ */
596
+ this.hasUpdated = false;
597
+ /**
598
+ * Name of currently reflecting property
599
+ */
600
+ this.__reflectingProperty = null;
601
+ this.__initialize();
602
+ }
603
+ /**
604
+ * Internal only override point for customizing work done when elements
605
+ * are constructed.
606
+ */
607
+ __initialize() {
608
+ this.__updatePromise = new Promise((res) => (this.enableUpdating = res));
609
+ this._$changedProperties = new Map();
610
+ // This enqueues a microtask that ust run before the first update, so it
611
+ // must be called before requestUpdate()
612
+ this.__saveInstanceProperties();
613
+ // ensures first update will be caught by an early access of
614
+ // `updateComplete`
615
+ this.requestUpdate();
616
+ this.constructor._initializers?.forEach((i) => i(this));
617
+ }
618
+ /**
619
+ * Registers a `ReactiveController` to participate in the element's reactive
620
+ * update cycle. The element automatically calls into any registered
621
+ * controllers during its lifecycle callbacks.
622
+ *
623
+ * If the element is connected when `addController()` is called, the
624
+ * controller's `hostConnected()` callback will be immediately called.
625
+ * @category controllers
626
+ */
627
+ addController(controller) {
628
+ (this.__controllers ??= new Set()).add(controller);
629
+ // If a controller is added after the element has been connected,
630
+ // call hostConnected. Note, re-using existence of `renderRoot` here
631
+ // (which is set in connectedCallback) to avoid the need to track a
632
+ // first connected state.
633
+ if (this.renderRoot !== undefined && this.isConnected) {
634
+ controller.hostConnected?.();
635
+ }
636
+ }
637
+ /**
638
+ * Removes a `ReactiveController` from the element.
639
+ * @category controllers
640
+ */
641
+ removeController(controller) {
642
+ this.__controllers?.delete(controller);
643
+ }
644
+ /**
645
+ * Fixes any properties set on the instance before upgrade time.
646
+ * Otherwise these would shadow the accessor and break these properties.
647
+ * The properties are stored in a Map which is played back after the
648
+ * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
649
+ * (<=41), properties created for native platform properties like (`id` or
650
+ * `name`) may not have default values set in the element constructor. On
651
+ * these browsers native properties appear on instances and therefore their
652
+ * default value will overwrite any element default (e.g. if the element sets
653
+ * this.id = 'id' in the constructor, the 'id' will become '' since this is
654
+ * the native platform default).
655
+ */
656
+ __saveInstanceProperties() {
657
+ const instanceProperties = new Map();
658
+ const elementProperties = this.constructor
659
+ .elementProperties;
660
+ for (const p of elementProperties.keys()) {
661
+ if (this.hasOwnProperty(p)) {
662
+ instanceProperties.set(p, this[p]);
663
+ delete this[p];
664
+ }
665
+ }
666
+ if (instanceProperties.size > 0) {
667
+ this.__instanceProperties = instanceProperties;
668
+ }
669
+ }
670
+ /**
671
+ * Returns the node into which the element should render and by default
672
+ * creates and returns an open shadowRoot. Implement to customize where the
673
+ * element's DOM is rendered. For example, to render into the element's
674
+ * childNodes, return `this`.
675
+ *
676
+ * @return Returns a node into which to render.
677
+ * @category rendering
678
+ */
679
+ createRenderRoot() {
680
+ const renderRoot = this.shadowRoot ??
681
+ this.attachShadow(this.constructor.shadowRootOptions);
682
+ adoptStyles$1(renderRoot, this.constructor.elementStyles);
683
+ return renderRoot;
684
+ }
685
+ /**
686
+ * On first connection, creates the element's renderRoot, sets up
687
+ * element styling, and enables updating.
688
+ * @category lifecycle
689
+ */
690
+ connectedCallback() {
691
+ // Create renderRoot before controllers `hostConnected`
692
+ this.renderRoot ??=
693
+ this.createRenderRoot();
694
+ this.enableUpdating(true);
695
+ this.__controllers?.forEach((c) => c.hostConnected?.());
696
+ }
697
+ /**
698
+ * Note, this method should be considered final and not overridden. It is
699
+ * overridden on the element instance with a function that triggers the first
700
+ * update.
701
+ * @category updates
702
+ */
703
+ enableUpdating(_requestedUpdate) { }
704
+ /**
705
+ * Allows for `super.disconnectedCallback()` in extensions while
706
+ * reserving the possibility of making non-breaking feature additions
707
+ * when disconnecting at some point in the future.
708
+ * @category lifecycle
709
+ */
710
+ disconnectedCallback() {
711
+ this.__controllers?.forEach((c) => c.hostDisconnected?.());
712
+ }
713
+ /**
714
+ * Synchronizes property values when attributes change.
715
+ *
716
+ * Specifically, when an attribute is set, the corresponding property is set.
717
+ * You should rarely need to implement this callback. If this method is
718
+ * overridden, `super.attributeChangedCallback(name, _old, value)` must be
719
+ * called.
720
+ *
721
+ * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)
722
+ * on MDN for more information about the `attributeChangedCallback`.
723
+ * @category attributes
724
+ */
725
+ attributeChangedCallback(name, _old, value) {
726
+ this._$attributeToProperty(name, value);
727
+ }
728
+ __propertyToAttribute(name, value) {
729
+ const elemProperties = this.constructor.elementProperties;
730
+ const options = elemProperties.get(name);
731
+ const attr = this.constructor.__attributeNameForProperty(name, options);
732
+ if (attr !== undefined && options.reflect === true) {
733
+ const converter = options.converter?.toAttribute !==
734
+ undefined
735
+ ? options.converter
736
+ : defaultConverter$1;
737
+ const attrValue = converter.toAttribute(value, options.type);
738
+ if (this.constructor.enabledWarnings.includes('migration') &&
739
+ attrValue === undefined) {
740
+ issueWarning$5('undefined-attribute-value', `The attribute value for the ${name} property is ` +
741
+ `undefined on element ${this.localName}. The attribute will be ` +
742
+ `removed, but in the previous version of \`ReactiveElement\`, ` +
743
+ `the attribute would not have changed.`);
744
+ }
745
+ // Track if the property is being reflected to avoid
746
+ // setting the property again via `attributeChangedCallback`. Note:
747
+ // 1. this takes advantage of the fact that the callback is synchronous.
748
+ // 2. will behave incorrectly if multiple attributes are in the reaction
749
+ // stack at time of calling. However, since we process attributes
750
+ // in `update` this should not be possible (or an extreme corner case
751
+ // that we'd like to discover).
752
+ // mark state reflecting
753
+ this.__reflectingProperty = name;
754
+ if (attrValue == null) {
755
+ this.removeAttribute(attr);
756
+ }
757
+ else {
758
+ this.setAttribute(attr, attrValue);
759
+ }
760
+ // mark state not reflecting
761
+ this.__reflectingProperty = null;
762
+ }
763
+ }
764
+ /** @internal */
765
+ _$attributeToProperty(name, value) {
766
+ const ctor = this.constructor;
767
+ // Note, hint this as an `AttributeMap` so closure clearly understands
768
+ // the type; it has issues with tracking types through statics
769
+ const propName = ctor.__attributeToPropertyMap.get(name);
770
+ // Use tracking info to avoid reflecting a property value to an attribute
771
+ // if it was just set because the attribute changed.
772
+ if (propName !== undefined && this.__reflectingProperty !== propName) {
773
+ const options = ctor.getPropertyOptions(propName);
774
+ const converter = typeof options.converter === 'function'
775
+ ? { fromAttribute: options.converter }
776
+ : options.converter?.fromAttribute !== undefined
777
+ ? options.converter
778
+ : defaultConverter$1;
779
+ // mark state reflecting
780
+ this.__reflectingProperty = propName;
781
+ this[propName] = converter.fromAttribute(value, options.type
782
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
783
+ );
784
+ // mark state not reflecting
785
+ this.__reflectingProperty = null;
786
+ }
787
+ }
788
+ /**
789
+ * Requests an update which is processed asynchronously. This should be called
790
+ * when an element should update based on some state not triggered by setting
791
+ * a reactive property. In this case, pass no arguments. It should also be
792
+ * called when manually implementing a property setter. In this case, pass the
793
+ * property `name` and `oldValue` to ensure that any configured property
794
+ * options are honored.
795
+ *
796
+ * @param name name of requesting property
797
+ * @param oldValue old value of requesting property
798
+ * @param options property options to use instead of the previously
799
+ * configured options
800
+ * @category updates
801
+ */
802
+ requestUpdate(name, oldValue, options) {
803
+ // If we have a property key, perform property update steps.
804
+ if (name !== undefined) {
805
+ if (name instanceof Event) {
806
+ issueWarning$5(``, `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`);
807
+ }
808
+ options ??= this.constructor.getPropertyOptions(name);
809
+ const hasChanged = options.hasChanged ?? notEqual$1;
810
+ const newValue = this[name];
811
+ if (hasChanged(newValue, oldValue)) {
812
+ this._$changeProperty(name, oldValue, options);
813
+ }
814
+ else {
815
+ // Abort the request if the property should not be considered changed.
816
+ return;
817
+ }
818
+ }
819
+ if (this.isUpdatePending === false) {
820
+ this.__updatePromise = this.__enqueueUpdate();
821
+ }
822
+ }
823
+ /**
824
+ * @internal
825
+ */
826
+ _$changeProperty(name, oldValue, options) {
827
+ // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(
828
+ // vs just Map.set()
829
+ if (!this._$changedProperties.has(name)) {
830
+ this._$changedProperties.set(name, oldValue);
831
+ }
832
+ // Add to reflecting properties set.
833
+ // Note, it's important that every change has a chance to add the
834
+ // property to `__reflectingProperties`. This ensures setting
835
+ // attribute + property reflects correctly.
836
+ if (options.reflect === true && this.__reflectingProperty !== name) {
837
+ (this.__reflectingProperties ??= new Set()).add(name);
838
+ }
839
+ }
840
+ /**
841
+ * Sets up the element to asynchronously update.
842
+ */
843
+ async __enqueueUpdate() {
844
+ this.isUpdatePending = true;
845
+ try {
846
+ // Ensure any previous update has resolved before updating.
847
+ // This `await` also ensures that property changes are batched.
848
+ await this.__updatePromise;
849
+ }
850
+ catch (e) {
851
+ // Refire any previous errors async so they do not disrupt the update
852
+ // cycle. Errors are refired so developers have a chance to observe
853
+ // them, and this can be done by implementing
854
+ // `window.onunhandledrejection`.
855
+ Promise.reject(e);
856
+ }
857
+ const result = this.scheduleUpdate();
858
+ // If `scheduleUpdate` returns a Promise, we await it. This is done to
859
+ // enable coordinating updates with a scheduler. Note, the result is
860
+ // checked to avoid delaying an additional microtask unless we need to.
861
+ if (result != null) {
862
+ await result;
863
+ }
864
+ return !this.isUpdatePending;
865
+ }
866
+ /**
867
+ * Schedules an element update. You can override this method to change the
868
+ * timing of updates by returning a Promise. The update will await the
869
+ * returned Promise, and you should resolve the Promise to allow the update
870
+ * to proceed. If this method is overridden, `super.scheduleUpdate()`
871
+ * must be called.
872
+ *
873
+ * For instance, to schedule updates to occur just before the next frame:
874
+ *
875
+ * ```ts
876
+ * override protected async scheduleUpdate(): Promise<unknown> {
877
+ * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
878
+ * super.scheduleUpdate();
879
+ * }
880
+ * ```
881
+ * @category updates
882
+ */
883
+ scheduleUpdate() {
884
+ const result = this.performUpdate();
885
+ if (this.constructor.enabledWarnings.includes('async-perform-update') &&
886
+ typeof result?.then ===
887
+ 'function') {
888
+ issueWarning$5('async-perform-update', `Element ${this.localName} returned a Promise from performUpdate(). ` +
889
+ `This behavior is deprecated and will be removed in a future ` +
890
+ `version of ReactiveElement.`);
891
+ }
892
+ return result;
893
+ }
894
+ /**
895
+ * Performs an element update. Note, if an exception is thrown during the
896
+ * update, `firstUpdated` and `updated` will not be called.
897
+ *
898
+ * Call `performUpdate()` to immediately process a pending update. This should
899
+ * generally not be needed, but it can be done in rare cases when you need to
900
+ * update synchronously.
901
+ *
902
+ * @category updates
903
+ */
904
+ performUpdate() {
905
+ // Abort any update if one is not pending when this is called.
906
+ // This can happen if `performUpdate` is called early to "flush"
907
+ // the update.
908
+ if (!this.isUpdatePending) {
909
+ return;
910
+ }
911
+ debugLogEvent$2?.({ kind: 'update' });
912
+ if (!this.hasUpdated) {
913
+ // Create renderRoot before first update. This occurs in `connectedCallback`
914
+ // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.
915
+ this.renderRoot ??=
916
+ this.createRenderRoot();
917
+ {
918
+ // Produce warning if any reactive properties on the prototype are
919
+ // shadowed by class fields. Instance fields set before upgrade are
920
+ // deleted by this point, so any own property is caused by class field
921
+ // initialization in the constructor.
922
+ const ctor = this.constructor;
923
+ const shadowedProperties = [...ctor.elementProperties.keys()].filter((p) => this.hasOwnProperty(p) && p in getPrototypeOf$1(this));
924
+ if (shadowedProperties.length) {
925
+ throw new Error(`The following properties on element ${this.localName} will not ` +
926
+ `trigger updates as expected because they are set using class ` +
927
+ `fields: ${shadowedProperties.join(', ')}. ` +
928
+ `Native class fields and some compiled output will overwrite ` +
929
+ `accessors used for detecting changes. See ` +
930
+ `https://lit.dev/msg/class-field-shadowing ` +
931
+ `for more information.`);
932
+ }
933
+ }
934
+ // Mixin instance properties once, if they exist.
935
+ if (this.__instanceProperties) {
936
+ // TODO (justinfagnani): should we use the stored value? Could a new value
937
+ // have been set since we stored the own property value?
938
+ for (const [p, value] of this.__instanceProperties) {
939
+ this[p] = value;
940
+ }
941
+ this.__instanceProperties = undefined;
942
+ }
943
+ // Trigger initial value reflection and populate the initial
944
+ // changedProperties map, but only for the case of experimental
945
+ // decorators on accessors, which will not have already populated the
946
+ // changedProperties map. We can't know if these accessors had
947
+ // initializers, so we just set them anyway - a difference from
948
+ // experimental decorators on fields and standard decorators on
949
+ // auto-accessors.
950
+ // For context why experimentalDecorators with auto accessors are handled
951
+ // specifically also see:
952
+ // https://github.com/lit/lit/pull/4183#issuecomment-1711959635
953
+ const elementProperties = this.constructor
954
+ .elementProperties;
955
+ if (elementProperties.size > 0) {
956
+ for (const [p, options] of elementProperties) {
957
+ if (options.wrapped === true &&
958
+ !this._$changedProperties.has(p) &&
959
+ this[p] !== undefined) {
960
+ this._$changeProperty(p, this[p], options);
961
+ }
962
+ }
963
+ }
964
+ }
965
+ let shouldUpdate = false;
966
+ const changedProperties = this._$changedProperties;
967
+ try {
968
+ shouldUpdate = this.shouldUpdate(changedProperties);
969
+ if (shouldUpdate) {
970
+ this.willUpdate(changedProperties);
971
+ this.__controllers?.forEach((c) => c.hostUpdate?.());
972
+ this.update(changedProperties);
973
+ }
974
+ else {
975
+ this.__markUpdated();
976
+ }
977
+ }
978
+ catch (e) {
979
+ // Prevent `firstUpdated` and `updated` from running when there's an
980
+ // update exception.
981
+ shouldUpdate = false;
982
+ // Ensure element can accept additional updates after an exception.
983
+ this.__markUpdated();
984
+ throw e;
985
+ }
986
+ // The update is no longer considered pending and further updates are now allowed.
987
+ if (shouldUpdate) {
988
+ this._$didUpdate(changedProperties);
989
+ }
990
+ }
991
+ /**
992
+ * Invoked before `update()` to compute values needed during the update.
993
+ *
994
+ * Implement `willUpdate` to compute property values that depend on other
995
+ * properties and are used in the rest of the update process.
996
+ *
997
+ * ```ts
998
+ * willUpdate(changedProperties) {
999
+ * // only need to check changed properties for an expensive computation.
1000
+ * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {
1001
+ * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
1002
+ * }
1003
+ * }
1004
+ *
1005
+ * render() {
1006
+ * return html`SHA: ${this.sha}`;
1007
+ * }
1008
+ * ```
1009
+ *
1010
+ * @category updates
1011
+ */
1012
+ willUpdate(_changedProperties) { }
1013
+ // Note, this is an override point for polyfill-support.
1014
+ // @internal
1015
+ _$didUpdate(changedProperties) {
1016
+ this.__controllers?.forEach((c) => c.hostUpdated?.());
1017
+ if (!this.hasUpdated) {
1018
+ this.hasUpdated = true;
1019
+ this.firstUpdated(changedProperties);
1020
+ }
1021
+ this.updated(changedProperties);
1022
+ if (this.isUpdatePending &&
1023
+ this.constructor.enabledWarnings.includes('change-in-update')) {
1024
+ issueWarning$5('change-in-update', `Element ${this.localName} scheduled an update ` +
1025
+ `(generally because a property was set) ` +
1026
+ `after an update completed, causing a new update to be scheduled. ` +
1027
+ `This is inefficient and should be avoided unless the next update ` +
1028
+ `can only be scheduled as a side effect of the previous update.`);
1029
+ }
1030
+ }
1031
+ __markUpdated() {
1032
+ this._$changedProperties = new Map();
1033
+ this.isUpdatePending = false;
1034
+ }
1035
+ /**
1036
+ * Returns a Promise that resolves when the element has completed updating.
1037
+ * The Promise value is a boolean that is `true` if the element completed the
1038
+ * update without triggering another update. The Promise result is `false` if
1039
+ * a property was set inside `updated()`. If the Promise is rejected, an
1040
+ * exception was thrown during the update.
1041
+ *
1042
+ * To await additional asynchronous work, override the `getUpdateComplete`
1043
+ * method. For example, it is sometimes useful to await a rendered element
1044
+ * before fulfilling this Promise. To do this, first await
1045
+ * `super.getUpdateComplete()`, then any subsequent state.
1046
+ *
1047
+ * @return A promise of a boolean that resolves to true if the update completed
1048
+ * without triggering another update.
1049
+ * @category updates
1050
+ */
1051
+ get updateComplete() {
1052
+ return this.getUpdateComplete();
1053
+ }
1054
+ /**
1055
+ * Override point for the `updateComplete` promise.
1056
+ *
1057
+ * It is not safe to override the `updateComplete` getter directly due to a
1058
+ * limitation in TypeScript which means it is not possible to call a
1059
+ * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
1060
+ * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
1061
+ * This method should be overridden instead. For example:
1062
+ *
1063
+ * ```ts
1064
+ * class MyElement extends LitElement {
1065
+ * override async getUpdateComplete() {
1066
+ * const result = await super.getUpdateComplete();
1067
+ * await this._myChild.updateComplete;
1068
+ * return result;
1069
+ * }
1070
+ * }
1071
+ * ```
1072
+ *
1073
+ * @return A promise of a boolean that resolves to true if the update completed
1074
+ * without triggering another update.
1075
+ * @category updates
1076
+ */
1077
+ getUpdateComplete() {
1078
+ return this.__updatePromise;
1079
+ }
1080
+ /**
1081
+ * Controls whether or not `update()` should be called when the element requests
1082
+ * an update. By default, this method always returns `true`, but this can be
1083
+ * customized to control when to update.
1084
+ *
1085
+ * @param _changedProperties Map of changed properties with old values
1086
+ * @category updates
1087
+ */
1088
+ shouldUpdate(_changedProperties) {
1089
+ return true;
1090
+ }
1091
+ /**
1092
+ * Updates the element. This method reflects property values to attributes.
1093
+ * It can be overridden to render and keep updated element DOM.
1094
+ * Setting properties inside this method will *not* trigger
1095
+ * another update.
1096
+ *
1097
+ * @param _changedProperties Map of changed properties with old values
1098
+ * @category updates
1099
+ */
1100
+ update(_changedProperties) {
1101
+ // The forEach() expression will only run when when __reflectingProperties is
1102
+ // defined, and it returns undefined, setting __reflectingProperties to
1103
+ // undefined
1104
+ this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) => this.__propertyToAttribute(p, this[p]));
1105
+ this.__markUpdated();
1106
+ }
1107
+ /**
1108
+ * Invoked whenever the element is updated. Implement to perform
1109
+ * post-updating tasks via DOM APIs, for example, focusing an element.
1110
+ *
1111
+ * Setting properties inside this method will trigger the element to update
1112
+ * again after this update cycle completes.
1113
+ *
1114
+ * @param _changedProperties Map of changed properties with old values
1115
+ * @category updates
1116
+ */
1117
+ updated(_changedProperties) { }
1118
+ /**
1119
+ * Invoked when the element is first updated. Implement to perform one time
1120
+ * work on the element after update.
1121
+ *
1122
+ * ```ts
1123
+ * firstUpdated() {
1124
+ * this.renderRoot.getElementById('my-text-area').focus();
1125
+ * }
1126
+ * ```
1127
+ *
1128
+ * Setting properties inside this method will trigger the element to update
1129
+ * again after this update cycle completes.
1130
+ *
1131
+ * @param _changedProperties Map of changed properties with old values
1132
+ * @category updates
1133
+ */
1134
+ firstUpdated(_changedProperties) { }
1135
+ }
1136
+ /**
1137
+ * Memoized list of all element styles.
1138
+ * Created lazily on user subclasses when finalizing the class.
1139
+ * @nocollapse
1140
+ * @category styles
1141
+ */
1142
+ ReactiveElement$1.elementStyles = [];
1143
+ /**
1144
+ * Options used when calling `attachShadow`. Set this property to customize
1145
+ * the options for the shadowRoot; for example, to create a closed
1146
+ * shadowRoot: `{mode: 'closed'}`.
1147
+ *
1148
+ * Note, these options are used in `createRenderRoot`. If this method
1149
+ * is customized, options should be respected if possible.
1150
+ * @nocollapse
1151
+ * @category rendering
1152
+ */
1153
+ ReactiveElement$1.shadowRootOptions = { mode: 'open' };
1154
+ // Assigned here to work around a jscompiler bug with static fields
1155
+ // when compiling to ES5.
1156
+ // https://github.com/google/closure-compiler/issues/3177
1157
+ ReactiveElement$1[JSCompiler_renameProperty$2('elementProperties')] = new Map();
1158
+ ReactiveElement$1[JSCompiler_renameProperty$2('finalized')] = new Map();
1159
+ // Apply polyfills if available
1160
+ polyfillSupport$3?.({ ReactiveElement: ReactiveElement$1 });
1161
+ // Dev mode warnings...
1162
+ {
1163
+ // Default warning set.
1164
+ ReactiveElement$1.enabledWarnings = [
1165
+ 'change-in-update',
1166
+ 'async-perform-update',
1167
+ ];
1168
+ const ensureOwnWarnings = function (ctor) {
1169
+ if (!ctor.hasOwnProperty(JSCompiler_renameProperty$2('enabledWarnings'))) {
1170
+ ctor.enabledWarnings = ctor.enabledWarnings.slice();
1171
+ }
1172
+ };
1173
+ ReactiveElement$1.enableWarning = function (warning) {
1174
+ ensureOwnWarnings(this);
1175
+ if (!this.enabledWarnings.includes(warning)) {
1176
+ this.enabledWarnings.push(warning);
1177
+ }
1178
+ };
1179
+ ReactiveElement$1.disableWarning = function (warning) {
1180
+ ensureOwnWarnings(this);
1181
+ const i = this.enabledWarnings.indexOf(warning);
1182
+ if (i >= 0) {
1183
+ this.enabledWarnings.splice(i, 1);
1184
+ }
1185
+ };
1186
+ }
1187
+ // IMPORTANT: do not change the property name or the assignment expression.
1188
+ // This line will be used in regexes to search for ReactiveElement usage.
1189
+ (global$3.reactiveElementVersions ??= []).push('2.0.4');
1190
+ if (global$3.reactiveElementVersions.length > 1) {
1191
+ issueWarning$5('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` +
1192
+ `is not recommended.`);
1193
+ }
1194
+
1195
+ /**
1196
+ * @license
1197
+ * Copyright 2017 Google LLC
1198
+ * SPDX-License-Identifier: BSD-3-Clause
1199
+ */
1200
+ // Allows minifiers to rename references to globalThis
1201
+ const global$2 = globalThis;
1202
+ /**
1203
+ * Useful for visualizing and logging insights into what the Lit template system is doing.
1204
+ *
1205
+ * Compiled out of prod mode builds.
1206
+ */
1207
+ const debugLogEvent$1 = (event) => {
1208
+ const shouldEmit = global$2
1209
+ .emitLitDebugLogEvents;
1210
+ if (!shouldEmit) {
1211
+ return;
1212
+ }
1213
+ global$2.dispatchEvent(new CustomEvent('lit-debug', {
1214
+ detail: event,
1215
+ }));
1216
+ }
1217
+ ;
1218
+ // Used for connecting beginRender and endRender events when there are nested
1219
+ // renders when errors are thrown preventing an endRender event from being
1220
+ // called.
1221
+ let debugLogRenderId = 0;
1222
+ let issueWarning$4;
1223
+ {
1224
+ global$2.litIssuedWarnings ??= new Set();
1225
+ // Issue a warning, if we haven't already.
1226
+ issueWarning$4 = (code, warning) => {
1227
+ warning += code
1228
+ ? ` See https://lit.dev/msg/${code} for more information.`
1229
+ : '';
1230
+ if (!global$2.litIssuedWarnings.has(warning)) {
1231
+ console.warn(warning);
1232
+ global$2.litIssuedWarnings.add(warning);
1233
+ }
1234
+ };
1235
+ issueWarning$4('dev-mode', `Lit is in dev mode. Not recommended for production!`);
1236
+ }
1237
+ const wrap = global$2.ShadyDOM?.inUse &&
1238
+ global$2.ShadyDOM?.noPatch === true
1239
+ ? global$2.ShadyDOM.wrap
1240
+ : (node) => node;
1241
+ const trustedTypes$1 = global$2.trustedTypes;
1242
+ /**
1243
+ * Our TrustedTypePolicy for HTML which is declared using the html template
1244
+ * tag function.
1245
+ *
1246
+ * That HTML is a developer-authored constant, and is parsed with innerHTML
1247
+ * before any untrusted expressions have been mixed in. Therefor it is
1248
+ * considered safe by construction.
1249
+ */
1250
+ const policy = trustedTypes$1
1251
+ ? trustedTypes$1.createPolicy('lit-html', {
1252
+ createHTML: (s) => s,
1253
+ })
1254
+ : undefined;
1255
+ const identityFunction = (value) => value;
1256
+ const noopSanitizer = (_node, _name, _type) => identityFunction;
1257
+ /** Sets the global sanitizer factory. */
1258
+ const setSanitizer = (newSanitizer) => {
1259
+ if (sanitizerFactoryInternal !== noopSanitizer) {
1260
+ throw new Error(`Attempted to overwrite existing lit-html security policy.` +
1261
+ ` setSanitizeDOMValueFactory should be called at most once.`);
1262
+ }
1263
+ sanitizerFactoryInternal = newSanitizer;
1264
+ };
1265
+ /**
1266
+ * Only used in internal tests, not a part of the public API.
1267
+ */
1268
+ const _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {
1269
+ sanitizerFactoryInternal = noopSanitizer;
1270
+ };
1271
+ const createSanitizer = (node, name, type) => {
1272
+ return sanitizerFactoryInternal(node, name, type);
1273
+ };
1274
+ // Added to an attribute name to mark the attribute as bound so we can find
1275
+ // it easily.
1276
+ const boundAttributeSuffix = '$lit$';
1277
+ // This marker is used in many syntactic positions in HTML, so it must be
1278
+ // a valid element name and attribute name. We don't support dynamic names (yet)
1279
+ // but this at least ensures that the parse tree is closer to the template
1280
+ // intention.
1281
+ const marker = `lit$${Math.random().toFixed(9).slice(2)}$`;
1282
+ // String used to tell if a comment is a marker comment
1283
+ const markerMatch = '?' + marker;
1284
+ // Text used to insert a comment marker node. We use processing instruction
1285
+ // syntax because it's slightly smaller, but parses as a comment node.
1286
+ const nodeMarker = `<${markerMatch}>`;
1287
+ const d = document;
1288
+ // Creates a dynamic marker. We never have to search for these in the DOM.
1289
+ const createMarker = () => d.createComment('');
1290
+ const isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');
1291
+ const isArray = Array.isArray;
1292
+ const isIterable = (value) => isArray(value) ||
1293
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1294
+ typeof value?.[Symbol.iterator] === 'function';
1295
+ const SPACE_CHAR = `[ \t\n\f\r]`;
1296
+ const ATTR_VALUE_CHAR = `[^ \t\n\f\r"'\`<>=]`;
1297
+ const NAME_CHAR = `[^\\s"'>=/]`;
1298
+ // These regexes represent the five parsing states that we care about in the
1299
+ // Template's HTML scanner. They match the *end* of the state they're named
1300
+ // after.
1301
+ // Depending on the match, we transition to a new state. If there's no match,
1302
+ // we stay in the same state.
1303
+ // Note that the regexes are stateful. We utilize lastIndex and sync it
1304
+ // across the multiple regexes used. In addition to the five regexes below
1305
+ // we also dynamically create a regex to find the matching end tags for raw
1306
+ // text elements.
1307
+ /**
1308
+ * End of text is: `<` followed by:
1309
+ * (comment start) or (tag) or (dynamic tag binding)
1310
+ */
1311
+ const textEndRegex = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
1312
+ const COMMENT_START = 1;
1313
+ const TAG_NAME = 2;
1314
+ const DYNAMIC_TAG_NAME = 3;
1315
+ const commentEndRegex = /-->/g;
1316
+ /**
1317
+ * Comments not started with <!--, like </{, can be ended by a single `>`
1318
+ */
1319
+ const comment2EndRegex = />/g;
1320
+ /**
1321
+ * The tagEnd regex matches the end of the "inside an opening" tag syntax
1322
+ * position. It either matches a `>`, an attribute-like sequence, or the end
1323
+ * of the string after a space (attribute-name position ending).
1324
+ *
1325
+ * See attributes in the HTML spec:
1326
+ * https://www.w3.org/TR/html5/syntax.html#elements-attributes
1327
+ *
1328
+ * " \t\n\f\r" are HTML space characters:
1329
+ * https://infra.spec.whatwg.org/#ascii-whitespace
1330
+ *
1331
+ * So an attribute is:
1332
+ * * The name: any character except a whitespace character, ("), ('), ">",
1333
+ * "=", or "/". Note: this is different from the HTML spec which also excludes control characters.
1334
+ * * Followed by zero or more space characters
1335
+ * * Followed by "="
1336
+ * * Followed by zero or more space characters
1337
+ * * Followed by:
1338
+ * * Any character except space, ('), ("), "<", ">", "=", (`), or
1339
+ * * (") then any non-("), or
1340
+ * * (') then any non-(')
1341
+ */
1342
+ const tagEndRegex = new RegExp(`>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|("|')|))|$)`, 'g');
1343
+ const ENTIRE_MATCH = 0;
1344
+ const ATTRIBUTE_NAME = 1;
1345
+ const SPACES_AND_EQUALS = 2;
1346
+ const QUOTE_CHAR = 3;
1347
+ const singleQuoteAttrEndRegex = /'/g;
1348
+ const doubleQuoteAttrEndRegex = /"/g;
1349
+ /**
1350
+ * Matches the raw text elements.
1351
+ *
1352
+ * Comments are not parsed within raw text elements, so we need to search their
1353
+ * text content for marker strings.
1354
+ */
1355
+ const rawTextElement = /^(?:script|style|textarea|title)$/i;
1356
+ /** TemplateResult types */
1357
+ const HTML_RESULT = 1;
1358
+ const SVG_RESULT = 2;
1359
+ const MATHML_RESULT = 3;
1360
+ // TemplatePart types
1361
+ // IMPORTANT: these must match the values in PartType
1362
+ const ATTRIBUTE_PART = 1;
1363
+ const CHILD_PART = 2;
1364
+ const PROPERTY_PART = 3;
1365
+ const BOOLEAN_ATTRIBUTE_PART = 4;
1366
+ const EVENT_PART = 5;
1367
+ const ELEMENT_PART = 6;
1368
+ const COMMENT_PART = 7;
1369
+ /**
1370
+ * Generates a template literal tag function that returns a TemplateResult with
1371
+ * the given result type.
1372
+ */
1373
+ const tag = (type) => (strings, ...values) => {
1374
+ // Warn against templates octal escape sequences
1375
+ // We do this here rather than in render so that the warning is closer to the
1376
+ // template definition.
1377
+ if (strings.some((s) => s === undefined)) {
1378
+ console.warn('Some template strings are undefined.\n' +
1379
+ 'This is probably caused by illegal octal escape sequences.');
1380
+ }
1381
+ {
1382
+ // Import static-html.js results in a circular dependency which g3 doesn't
1383
+ // handle. Instead we know that static values must have the field
1384
+ // `_$litStatic$`.
1385
+ if (values.some((val) => val?.['_$litStatic$'])) {
1386
+ issueWarning$4('', `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\n` +
1387
+ `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);
1388
+ }
1389
+ }
1390
+ return {
1391
+ // This property needs to remain unminified.
1392
+ ['_$litType$']: type,
1393
+ strings,
1394
+ values,
1395
+ };
1396
+ };
1397
+ /**
1398
+ * Interprets a template literal as an HTML template that can efficiently
1399
+ * render to and update a container.
1400
+ *
1401
+ * ```ts
1402
+ * const header = (title: string) => html`<h1>${title}</h1>`;
1403
+ * ```
1404
+ *
1405
+ * The `html` tag returns a description of the DOM to render as a value. It is
1406
+ * lazy, meaning no work is done until the template is rendered. When rendering,
1407
+ * if a template comes from the same expression as a previously rendered result,
1408
+ * it's efficiently updated instead of replaced.
1409
+ */
1410
+ const html$1 = tag(HTML_RESULT);
1411
+ /**
1412
+ * A sentinel value that signals that a value was handled by a directive and
1413
+ * should not be written to the DOM.
1414
+ */
1415
+ const noChange = Symbol.for('lit-noChange');
1416
+ /**
1417
+ * A sentinel value that signals a ChildPart to fully clear its content.
1418
+ *
1419
+ * ```ts
1420
+ * const button = html`${
1421
+ * user.isAdmin
1422
+ * ? html`<button>DELETE</button>`
1423
+ * : nothing
1424
+ * }`;
1425
+ * ```
1426
+ *
1427
+ * Prefer using `nothing` over other falsy values as it provides a consistent
1428
+ * behavior between various expression binding contexts.
1429
+ *
1430
+ * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the
1431
+ * same and render no nodes. In attribute expressions, `nothing` _removes_ the
1432
+ * attribute, while `undefined` and `null` will render an empty string. In
1433
+ * property expressions `nothing` becomes `undefined`.
1434
+ */
1435
+ const nothing = Symbol.for('lit-nothing');
1436
+ /**
1437
+ * The cache of prepared templates, keyed by the tagged TemplateStringsArray
1438
+ * and _not_ accounting for the specific template tag used. This means that
1439
+ * template tags cannot be dynamic - they must statically be one of html, svg,
1440
+ * or attr. This restriction simplifies the cache lookup, which is on the hot
1441
+ * path for rendering.
1442
+ */
1443
+ const templateCache = new WeakMap();
1444
+ const walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */);
1445
+ let sanitizerFactoryInternal = noopSanitizer;
1446
+ function trustFromTemplateString(tsa, stringFromTSA) {
1447
+ // A security check to prevent spoofing of Lit template results.
1448
+ // In the future, we may be able to replace this with Array.isTemplateObject,
1449
+ // though we might need to make that check inside of the html and svg
1450
+ // functions, because precompiled templates don't come in as
1451
+ // TemplateStringArray objects.
1452
+ if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {
1453
+ let message = 'invalid template strings array';
1454
+ {
1455
+ message = `
1456
+ Internal Error: expected template strings to be an array
1457
+ with a 'raw' field. Faking a template strings array by
1458
+ calling html or svg like an ordinary function is effectively
1459
+ the same as calling unsafeHtml and can lead to major security
1460
+ issues, e.g. opening your code up to XSS attacks.
1461
+ If you're using the html or svg tagged template functions normally
1462
+ and still seeing this error, please file a bug at
1463
+ https://github.com/lit/lit/issues/new?template=bug_report.md
1464
+ and include information about your build tooling, if any.
1465
+ `
1466
+ .trim()
1467
+ .replace(/\n */g, '\n');
1468
+ }
1469
+ throw new Error(message);
1470
+ }
1471
+ return policy !== undefined
1472
+ ? policy.createHTML(stringFromTSA)
1473
+ : stringFromTSA;
1474
+ }
1475
+ /**
1476
+ * Returns an HTML string for the given TemplateStringsArray and result type
1477
+ * (HTML or SVG), along with the case-sensitive bound attribute names in
1478
+ * template order. The HTML contains comment markers denoting the `ChildPart`s
1479
+ * and suffixes on bound attributes denoting the `AttributeParts`.
1480
+ *
1481
+ * @param strings template strings array
1482
+ * @param type HTML or SVG
1483
+ * @return Array containing `[html, attrNames]` (array returned for terseness,
1484
+ * to avoid object fields since this code is shared with non-minified SSR
1485
+ * code)
1486
+ */
1487
+ const getTemplateHtml = (strings, type) => {
1488
+ // Insert makers into the template HTML to represent the position of
1489
+ // bindings. The following code scans the template strings to determine the
1490
+ // syntactic position of the bindings. They can be in text position, where
1491
+ // we insert an HTML comment, attribute value position, where we insert a
1492
+ // sentinel string and re-write the attribute name, or inside a tag where
1493
+ // we insert the sentinel string.
1494
+ const l = strings.length - 1;
1495
+ // Stores the case-sensitive bound attribute names in the order of their
1496
+ // parts. ElementParts are also reflected in this array as undefined
1497
+ // rather than a string, to disambiguate from attribute bindings.
1498
+ const attrNames = [];
1499
+ let html = type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';
1500
+ // When we're inside a raw text tag (not it's text content), the regex
1501
+ // will still be tagRegex so we can find attributes, but will switch to
1502
+ // this regex when the tag ends.
1503
+ let rawTextEndRegex;
1504
+ // The current parsing state, represented as a reference to one of the
1505
+ // regexes
1506
+ let regex = textEndRegex;
1507
+ for (let i = 0; i < l; i++) {
1508
+ const s = strings[i];
1509
+ // The index of the end of the last attribute name. When this is
1510
+ // positive at end of a string, it means we're in an attribute value
1511
+ // position and need to rewrite the attribute name.
1512
+ // We also use a special value of -2 to indicate that we encountered
1513
+ // the end of a string in attribute name position.
1514
+ let attrNameEndIndex = -1;
1515
+ let attrName;
1516
+ let lastIndex = 0;
1517
+ let match;
1518
+ // The conditions in this loop handle the current parse state, and the
1519
+ // assignments to the `regex` variable are the state transitions.
1520
+ while (lastIndex < s.length) {
1521
+ // Make sure we start searching from where we previously left off
1522
+ regex.lastIndex = lastIndex;
1523
+ match = regex.exec(s);
1524
+ if (match === null) {
1525
+ break;
1526
+ }
1527
+ lastIndex = regex.lastIndex;
1528
+ if (regex === textEndRegex) {
1529
+ if (match[COMMENT_START] === '!--') {
1530
+ regex = commentEndRegex;
1531
+ }
1532
+ else if (match[COMMENT_START] !== undefined) {
1533
+ // We started a weird comment, like </{
1534
+ regex = comment2EndRegex;
1535
+ }
1536
+ else if (match[TAG_NAME] !== undefined) {
1537
+ if (rawTextElement.test(match[TAG_NAME])) {
1538
+ // Record if we encounter a raw-text element. We'll switch to
1539
+ // this regex at the end of the tag.
1540
+ rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');
1541
+ }
1542
+ regex = tagEndRegex;
1543
+ }
1544
+ else if (match[DYNAMIC_TAG_NAME] !== undefined) {
1545
+ {
1546
+ throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' +
1547
+ 'See https://lit.dev/docs/templates/expressions/#static-expressions');
1548
+ }
1549
+ }
1550
+ }
1551
+ else if (regex === tagEndRegex) {
1552
+ if (match[ENTIRE_MATCH] === '>') {
1553
+ // End of a tag. If we had started a raw-text element, use that
1554
+ // regex
1555
+ regex = rawTextEndRegex ?? textEndRegex;
1556
+ // We may be ending an unquoted attribute value, so make sure we
1557
+ // clear any pending attrNameEndIndex
1558
+ attrNameEndIndex = -1;
1559
+ }
1560
+ else if (match[ATTRIBUTE_NAME] === undefined) {
1561
+ // Attribute name position
1562
+ attrNameEndIndex = -2;
1563
+ }
1564
+ else {
1565
+ attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;
1566
+ attrName = match[ATTRIBUTE_NAME];
1567
+ regex =
1568
+ match[QUOTE_CHAR] === undefined
1569
+ ? tagEndRegex
1570
+ : match[QUOTE_CHAR] === '"'
1571
+ ? doubleQuoteAttrEndRegex
1572
+ : singleQuoteAttrEndRegex;
1573
+ }
1574
+ }
1575
+ else if (regex === doubleQuoteAttrEndRegex ||
1576
+ regex === singleQuoteAttrEndRegex) {
1577
+ regex = tagEndRegex;
1578
+ }
1579
+ else if (regex === commentEndRegex || regex === comment2EndRegex) {
1580
+ regex = textEndRegex;
1581
+ }
1582
+ else {
1583
+ // Not one of the five state regexes, so it must be the dynamically
1584
+ // created raw text regex and we're at the close of that element.
1585
+ regex = tagEndRegex;
1586
+ rawTextEndRegex = undefined;
1587
+ }
1588
+ }
1589
+ {
1590
+ // If we have a attrNameEndIndex, which indicates that we should
1591
+ // rewrite the attribute name, assert that we're in a valid attribute
1592
+ // position - either in a tag, or a quoted attribute value.
1593
+ console.assert(attrNameEndIndex === -1 ||
1594
+ regex === tagEndRegex ||
1595
+ regex === singleQuoteAttrEndRegex ||
1596
+ regex === doubleQuoteAttrEndRegex, 'unexpected parse state B');
1597
+ }
1598
+ // We have four cases:
1599
+ // 1. We're in text position, and not in a raw text element
1600
+ // (regex === textEndRegex): insert a comment marker.
1601
+ // 2. We have a non-negative attrNameEndIndex which means we need to
1602
+ // rewrite the attribute name to add a bound attribute suffix.
1603
+ // 3. We're at the non-first binding in a multi-binding attribute, use a
1604
+ // plain marker.
1605
+ // 4. We're somewhere else inside the tag. If we're in attribute name
1606
+ // position (attrNameEndIndex === -2), add a sequential suffix to
1607
+ // generate a unique attribute name.
1608
+ // Detect a binding next to self-closing tag end and insert a space to
1609
+ // separate the marker from the tag end:
1610
+ const end = regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';
1611
+ html +=
1612
+ regex === textEndRegex
1613
+ ? s + nodeMarker
1614
+ : attrNameEndIndex >= 0
1615
+ ? (attrNames.push(attrName),
1616
+ s.slice(0, attrNameEndIndex) +
1617
+ boundAttributeSuffix +
1618
+ s.slice(attrNameEndIndex)) +
1619
+ marker +
1620
+ end
1621
+ : s + marker + (attrNameEndIndex === -2 ? i : end);
1622
+ }
1623
+ const htmlResult = html +
1624
+ (strings[l] || '<?>') +
1625
+ (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');
1626
+ // Returned as an array for terseness
1627
+ return [trustFromTemplateString(strings, htmlResult), attrNames];
1628
+ };
1629
+ class Template {
1630
+ constructor(
1631
+ // This property needs to remain unminified.
1632
+ { strings, ['_$litType$']: type }, options) {
1633
+ this.parts = [];
1634
+ let node;
1635
+ let nodeIndex = 0;
1636
+ let attrNameIndex = 0;
1637
+ const partCount = strings.length - 1;
1638
+ const parts = this.parts;
1639
+ // Create template element
1640
+ const [html, attrNames] = getTemplateHtml(strings, type);
1641
+ this.el = Template.createElement(html, options);
1642
+ walker.currentNode = this.el.content;
1643
+ // Re-parent SVG or MathML nodes into template root
1644
+ if (type === SVG_RESULT || type === MATHML_RESULT) {
1645
+ const wrapper = this.el.content.firstChild;
1646
+ wrapper.replaceWith(...wrapper.childNodes);
1647
+ }
1648
+ // Walk the template to find binding markers and create TemplateParts
1649
+ while ((node = walker.nextNode()) !== null && parts.length < partCount) {
1650
+ if (node.nodeType === 1) {
1651
+ {
1652
+ const tag = node.localName;
1653
+ // Warn if `textarea` includes an expression and throw if `template`
1654
+ // does since these are not supported. We do this by checking
1655
+ // innerHTML for anything that looks like a marker. This catches
1656
+ // cases like bindings in textarea there markers turn into text nodes.
1657
+ if (/^(?:textarea|template)$/i.test(tag) &&
1658
+ node.innerHTML.includes(marker)) {
1659
+ const m = `Expressions are not supported inside \`${tag}\` ` +
1660
+ `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +
1661
+ `information.`;
1662
+ if (tag === 'template') {
1663
+ throw new Error(m);
1664
+ }
1665
+ else
1666
+ issueWarning$4('', m);
1667
+ }
1668
+ }
1669
+ // TODO (justinfagnani): for attempted dynamic tag names, we don't
1670
+ // increment the bindingIndex, and it'll be off by 1 in the element
1671
+ // and off by two after it.
1672
+ if (node.hasAttributes()) {
1673
+ for (const name of node.getAttributeNames()) {
1674
+ if (name.endsWith(boundAttributeSuffix)) {
1675
+ const realName = attrNames[attrNameIndex++];
1676
+ const value = node.getAttribute(name);
1677
+ const statics = value.split(marker);
1678
+ const m = /([.?@])?(.*)/.exec(realName);
1679
+ parts.push({
1680
+ type: ATTRIBUTE_PART,
1681
+ index: nodeIndex,
1682
+ name: m[2],
1683
+ strings: statics,
1684
+ ctor: m[1] === '.'
1685
+ ? PropertyPart
1686
+ : m[1] === '?'
1687
+ ? BooleanAttributePart
1688
+ : m[1] === '@'
1689
+ ? EventPart
1690
+ : AttributePart,
1691
+ });
1692
+ node.removeAttribute(name);
1693
+ }
1694
+ else if (name.startsWith(marker)) {
1695
+ parts.push({
1696
+ type: ELEMENT_PART,
1697
+ index: nodeIndex,
1698
+ });
1699
+ node.removeAttribute(name);
1700
+ }
1701
+ }
1702
+ }
1703
+ // TODO (justinfagnani): benchmark the regex against testing for each
1704
+ // of the 3 raw text element names.
1705
+ if (rawTextElement.test(node.tagName)) {
1706
+ // For raw text elements we need to split the text content on
1707
+ // markers, create a Text node for each segment, and create
1708
+ // a TemplatePart for each marker.
1709
+ const strings = node.textContent.split(marker);
1710
+ const lastIndex = strings.length - 1;
1711
+ if (lastIndex > 0) {
1712
+ node.textContent = trustedTypes$1
1713
+ ? trustedTypes$1.emptyScript
1714
+ : '';
1715
+ // Generate a new text node for each literal section
1716
+ // These nodes are also used as the markers for node parts
1717
+ // We can't use empty text nodes as markers because they're
1718
+ // normalized when cloning in IE (could simplify when
1719
+ // IE is no longer supported)
1720
+ for (let i = 0; i < lastIndex; i++) {
1721
+ node.append(strings[i], createMarker());
1722
+ // Walk past the marker node we just added
1723
+ walker.nextNode();
1724
+ parts.push({ type: CHILD_PART, index: ++nodeIndex });
1725
+ }
1726
+ // Note because this marker is added after the walker's current
1727
+ // node, it will be walked to in the outer loop (and ignored), so
1728
+ // we don't need to adjust nodeIndex here
1729
+ node.append(strings[lastIndex], createMarker());
1730
+ }
1731
+ }
1732
+ }
1733
+ else if (node.nodeType === 8) {
1734
+ const data = node.data;
1735
+ if (data === markerMatch) {
1736
+ parts.push({ type: CHILD_PART, index: nodeIndex });
1737
+ }
1738
+ else {
1739
+ let i = -1;
1740
+ while ((i = node.data.indexOf(marker, i + 1)) !== -1) {
1741
+ // Comment node has a binding marker inside, make an inactive part
1742
+ // The binding won't work, but subsequent bindings will
1743
+ parts.push({ type: COMMENT_PART, index: nodeIndex });
1744
+ // Move to the end of the match
1745
+ i += marker.length - 1;
1746
+ }
1747
+ }
1748
+ }
1749
+ nodeIndex++;
1750
+ }
1751
+ {
1752
+ // If there was a duplicate attribute on a tag, then when the tag is
1753
+ // parsed into an element the attribute gets de-duplicated. We can detect
1754
+ // this mismatch if we haven't precisely consumed every attribute name
1755
+ // when preparing the template. This works because `attrNames` is built
1756
+ // from the template string and `attrNameIndex` comes from processing the
1757
+ // resulting DOM.
1758
+ if (attrNames.length !== attrNameIndex) {
1759
+ throw new Error(`Detected duplicate attribute bindings. This occurs if your template ` +
1760
+ `has duplicate attributes on an element tag. For example ` +
1761
+ `"<input ?disabled=\${true} ?disabled=\${false}>" contains a ` +
1762
+ `duplicate "disabled" attribute. The error was detected in ` +
1763
+ `the following template: \n` +
1764
+ '`' +
1765
+ strings.join('${...}') +
1766
+ '`');
1767
+ }
1768
+ }
1769
+ // We could set walker.currentNode to another node here to prevent a memory
1770
+ // leak, but every time we prepare a template, we immediately render it
1771
+ // and re-use the walker in new TemplateInstance._clone().
1772
+ debugLogEvent$1 &&
1773
+ debugLogEvent$1({
1774
+ kind: 'template prep',
1775
+ template: this,
1776
+ clonableTemplate: this.el,
1777
+ parts: this.parts,
1778
+ strings,
1779
+ });
1780
+ }
1781
+ // Overridden via `litHtmlPolyfillSupport` to provide platform support.
1782
+ /** @nocollapse */
1783
+ static createElement(html, _options) {
1784
+ const el = d.createElement('template');
1785
+ el.innerHTML = html;
1786
+ return el;
1787
+ }
1788
+ }
1789
+ function resolveDirective(part, value, parent = part, attributeIndex) {
1790
+ // Bail early if the value is explicitly noChange. Note, this means any
1791
+ // nested directive is still attached and is not run.
1792
+ if (value === noChange) {
1793
+ return value;
1794
+ }
1795
+ let currentDirective = attributeIndex !== undefined
1796
+ ? parent.__directives?.[attributeIndex]
1797
+ : parent.__directive;
1798
+ const nextDirectiveConstructor = isPrimitive(value)
1799
+ ? undefined
1800
+ : // This property needs to remain unminified.
1801
+ value['_$litDirective$'];
1802
+ if (currentDirective?.constructor !== nextDirectiveConstructor) {
1803
+ // This property needs to remain unminified.
1804
+ currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);
1805
+ if (nextDirectiveConstructor === undefined) {
1806
+ currentDirective = undefined;
1807
+ }
1808
+ else {
1809
+ currentDirective = new nextDirectiveConstructor(part);
1810
+ currentDirective._$initialize(part, parent, attributeIndex);
1811
+ }
1812
+ if (attributeIndex !== undefined) {
1813
+ (parent.__directives ??= [])[attributeIndex] =
1814
+ currentDirective;
1815
+ }
1816
+ else {
1817
+ parent.__directive = currentDirective;
1818
+ }
1819
+ }
1820
+ if (currentDirective !== undefined) {
1821
+ value = resolveDirective(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);
1822
+ }
1823
+ return value;
1824
+ }
1825
+ /**
1826
+ * An updateable instance of a Template. Holds references to the Parts used to
1827
+ * update the template instance.
1828
+ */
1829
+ class TemplateInstance {
1830
+ constructor(template, parent) {
1831
+ this._$parts = [];
1832
+ /** @internal */
1833
+ this._$disconnectableChildren = undefined;
1834
+ this._$template = template;
1835
+ this._$parent = parent;
1836
+ }
1837
+ // Called by ChildPart parentNode getter
1838
+ get parentNode() {
1839
+ return this._$parent.parentNode;
1840
+ }
1841
+ // See comment in Disconnectable interface for why this is a getter
1842
+ get _$isConnected() {
1843
+ return this._$parent._$isConnected;
1844
+ }
1845
+ // This method is separate from the constructor because we need to return a
1846
+ // DocumentFragment and we don't want to hold onto it with an instance field.
1847
+ _clone(options) {
1848
+ const { el: { content }, parts: parts, } = this._$template;
1849
+ const fragment = (options?.creationScope ?? d).importNode(content, true);
1850
+ walker.currentNode = fragment;
1851
+ let node = walker.nextNode();
1852
+ let nodeIndex = 0;
1853
+ let partIndex = 0;
1854
+ let templatePart = parts[0];
1855
+ while (templatePart !== undefined) {
1856
+ if (nodeIndex === templatePart.index) {
1857
+ let part;
1858
+ if (templatePart.type === CHILD_PART) {
1859
+ part = new ChildPart(node, node.nextSibling, this, options);
1860
+ }
1861
+ else if (templatePart.type === ATTRIBUTE_PART) {
1862
+ part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);
1863
+ }
1864
+ else if (templatePart.type === ELEMENT_PART) {
1865
+ part = new ElementPart(node, this, options);
1866
+ }
1867
+ this._$parts.push(part);
1868
+ templatePart = parts[++partIndex];
1869
+ }
1870
+ if (nodeIndex !== templatePart?.index) {
1871
+ node = walker.nextNode();
1872
+ nodeIndex++;
1873
+ }
1874
+ }
1875
+ // We need to set the currentNode away from the cloned tree so that we
1876
+ // don't hold onto the tree even if the tree is detached and should be
1877
+ // freed.
1878
+ walker.currentNode = d;
1879
+ return fragment;
1880
+ }
1881
+ _update(values) {
1882
+ let i = 0;
1883
+ for (const part of this._$parts) {
1884
+ if (part !== undefined) {
1885
+ debugLogEvent$1 &&
1886
+ debugLogEvent$1({
1887
+ kind: 'set part',
1888
+ part,
1889
+ value: values[i],
1890
+ valueIndex: i,
1891
+ values,
1892
+ templateInstance: this,
1893
+ });
1894
+ if (part.strings !== undefined) {
1895
+ part._$setValue(values, part, i);
1896
+ // The number of values the part consumes is part.strings.length - 1
1897
+ // since values are in between template spans. We increment i by 1
1898
+ // later in the loop, so increment it by part.strings.length - 2 here
1899
+ i += part.strings.length - 2;
1900
+ }
1901
+ else {
1902
+ part._$setValue(values[i]);
1903
+ }
1904
+ }
1905
+ i++;
1906
+ }
1907
+ }
1908
+ }
1909
+ class ChildPart {
1910
+ // See comment in Disconnectable interface for why this is a getter
1911
+ get _$isConnected() {
1912
+ // ChildParts that are not at the root should always be created with a
1913
+ // parent; only RootChildNode's won't, so they return the local isConnected
1914
+ // state
1915
+ return this._$parent?._$isConnected ?? this.__isConnected;
1916
+ }
1917
+ constructor(startNode, endNode, parent, options) {
1918
+ this.type = CHILD_PART;
1919
+ this._$committedValue = nothing;
1920
+ // The following fields will be patched onto ChildParts when required by
1921
+ // AsyncDirective
1922
+ /** @internal */
1923
+ this._$disconnectableChildren = undefined;
1924
+ this._$startNode = startNode;
1925
+ this._$endNode = endNode;
1926
+ this._$parent = parent;
1927
+ this.options = options;
1928
+ // Note __isConnected is only ever accessed on RootParts (i.e. when there is
1929
+ // no _$parent); the value on a non-root-part is "don't care", but checking
1930
+ // for parent would be more code
1931
+ this.__isConnected = options?.isConnected ?? true;
1932
+ {
1933
+ // Explicitly initialize for consistent class shape.
1934
+ this._textSanitizer = undefined;
1935
+ }
1936
+ }
1937
+ /**
1938
+ * The parent node into which the part renders its content.
1939
+ *
1940
+ * A ChildPart's content consists of a range of adjacent child nodes of
1941
+ * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and
1942
+ * `.endNode`).
1943
+ *
1944
+ * - If both `.startNode` and `.endNode` are non-null, then the part's content
1945
+ * consists of all siblings between `.startNode` and `.endNode`, exclusively.
1946
+ *
1947
+ * - If `.startNode` is non-null but `.endNode` is null, then the part's
1948
+ * content consists of all siblings following `.startNode`, up to and
1949
+ * including the last child of `.parentNode`. If `.endNode` is non-null, then
1950
+ * `.startNode` will always be non-null.
1951
+ *
1952
+ * - If both `.endNode` and `.startNode` are null, then the part's content
1953
+ * consists of all child nodes of `.parentNode`.
1954
+ */
1955
+ get parentNode() {
1956
+ let parentNode = wrap(this._$startNode).parentNode;
1957
+ const parent = this._$parent;
1958
+ if (parent !== undefined &&
1959
+ parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */) {
1960
+ // If the parentNode is a DocumentFragment, it may be because the DOM is
1961
+ // still in the cloned fragment during initial render; if so, get the real
1962
+ // parentNode the part will be committed into by asking the parent.
1963
+ parentNode = parent.parentNode;
1964
+ }
1965
+ return parentNode;
1966
+ }
1967
+ /**
1968
+ * The part's leading marker node, if any. See `.parentNode` for more
1969
+ * information.
1970
+ */
1971
+ get startNode() {
1972
+ return this._$startNode;
1973
+ }
1974
+ /**
1975
+ * The part's trailing marker node, if any. See `.parentNode` for more
1976
+ * information.
1977
+ */
1978
+ get endNode() {
1979
+ return this._$endNode;
1980
+ }
1981
+ _$setValue(value, directiveParent = this) {
1982
+ if (this.parentNode === null) {
1983
+ throw new Error(`This \`ChildPart\` has no \`parentNode\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \`innerHTML\` or \`textContent\` can do this.`);
1984
+ }
1985
+ value = resolveDirective(this, value, directiveParent);
1986
+ if (isPrimitive(value)) {
1987
+ // Non-rendering child values. It's important that these do not render
1988
+ // empty text nodes to avoid issues with preventing default <slot>
1989
+ // fallback content.
1990
+ if (value === nothing || value == null || value === '') {
1991
+ if (this._$committedValue !== nothing) {
1992
+ debugLogEvent$1 &&
1993
+ debugLogEvent$1({
1994
+ kind: 'commit nothing to child',
1995
+ start: this._$startNode,
1996
+ end: this._$endNode,
1997
+ parent: this._$parent,
1998
+ options: this.options,
1999
+ });
2000
+ this._$clear();
2001
+ }
2002
+ this._$committedValue = nothing;
2003
+ }
2004
+ else if (value !== this._$committedValue && value !== noChange) {
2005
+ this._commitText(value);
2006
+ }
2007
+ // This property needs to remain unminified.
2008
+ }
2009
+ else if (value['_$litType$'] !== undefined) {
2010
+ this._commitTemplateResult(value);
2011
+ }
2012
+ else if (value.nodeType !== undefined) {
2013
+ if (this.options?.host === value) {
2014
+ this._commitText(`[probable mistake: rendered a template's host in itself ` +
2015
+ `(commonly caused by writing \${this} in a template]`);
2016
+ console.warn(`Attempted to render the template host`, value, `inside itself. This is almost always a mistake, and in dev mode `, `we render some warning text. In production however, we'll `, `render it, which will usually result in an error, and sometimes `, `in the element disappearing from the DOM.`);
2017
+ return;
2018
+ }
2019
+ this._commitNode(value);
2020
+ }
2021
+ else if (isIterable(value)) {
2022
+ this._commitIterable(value);
2023
+ }
2024
+ else {
2025
+ // Fallback, will render the string representation
2026
+ this._commitText(value);
2027
+ }
2028
+ }
2029
+ _insert(node) {
2030
+ return wrap(wrap(this._$startNode).parentNode).insertBefore(node, this._$endNode);
2031
+ }
2032
+ _commitNode(value) {
2033
+ if (this._$committedValue !== value) {
2034
+ this._$clear();
2035
+ if (sanitizerFactoryInternal !== noopSanitizer) {
2036
+ const parentNodeName = this._$startNode.parentNode?.nodeName;
2037
+ if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {
2038
+ let message = 'Forbidden';
2039
+ {
2040
+ if (parentNodeName === 'STYLE') {
2041
+ message =
2042
+ `Lit does not support binding inside style nodes. ` +
2043
+ `This is a security risk, as style injection attacks can ` +
2044
+ `exfiltrate data and spoof UIs. ` +
2045
+ `Consider instead using css\`...\` literals ` +
2046
+ `to compose styles, and do dynamic styling with ` +
2047
+ `css custom properties, ::parts, <slot>s, ` +
2048
+ `and by mutating the DOM rather than stylesheets.`;
2049
+ }
2050
+ else {
2051
+ message =
2052
+ `Lit does not support binding inside script nodes. ` +
2053
+ `This is a security risk, as it could allow arbitrary ` +
2054
+ `code execution.`;
2055
+ }
2056
+ }
2057
+ throw new Error(message);
2058
+ }
2059
+ }
2060
+ debugLogEvent$1 &&
2061
+ debugLogEvent$1({
2062
+ kind: 'commit node',
2063
+ start: this._$startNode,
2064
+ parent: this._$parent,
2065
+ value: value,
2066
+ options: this.options,
2067
+ });
2068
+ this._$committedValue = this._insert(value);
2069
+ }
2070
+ }
2071
+ _commitText(value) {
2072
+ // If the committed value is a primitive it means we called _commitText on
2073
+ // the previous render, and we know that this._$startNode.nextSibling is a
2074
+ // Text node. We can now just replace the text content (.data) of the node.
2075
+ if (this._$committedValue !== nothing &&
2076
+ isPrimitive(this._$committedValue)) {
2077
+ const node = wrap(this._$startNode).nextSibling;
2078
+ {
2079
+ if (this._textSanitizer === undefined) {
2080
+ this._textSanitizer = createSanitizer(node, 'data', 'property');
2081
+ }
2082
+ value = this._textSanitizer(value);
2083
+ }
2084
+ debugLogEvent$1 &&
2085
+ debugLogEvent$1({
2086
+ kind: 'commit text',
2087
+ node,
2088
+ value,
2089
+ options: this.options,
2090
+ });
2091
+ node.data = value;
2092
+ }
2093
+ else {
2094
+ {
2095
+ const textNode = d.createTextNode('');
2096
+ this._commitNode(textNode);
2097
+ // When setting text content, for security purposes it matters a lot
2098
+ // what the parent is. For example, <style> and <script> need to be
2099
+ // handled with care, while <span> does not. So first we need to put a
2100
+ // text node into the document, then we can sanitize its content.
2101
+ if (this._textSanitizer === undefined) {
2102
+ this._textSanitizer = createSanitizer(textNode, 'data', 'property');
2103
+ }
2104
+ value = this._textSanitizer(value);
2105
+ debugLogEvent$1 &&
2106
+ debugLogEvent$1({
2107
+ kind: 'commit text',
2108
+ node: textNode,
2109
+ value,
2110
+ options: this.options,
2111
+ });
2112
+ textNode.data = value;
2113
+ }
2114
+ }
2115
+ this._$committedValue = value;
2116
+ }
2117
+ _commitTemplateResult(result) {
2118
+ // This property needs to remain unminified.
2119
+ const { values, ['_$litType$']: type } = result;
2120
+ // If $litType$ is a number, result is a plain TemplateResult and we get
2121
+ // the template from the template cache. If not, result is a
2122
+ // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need
2123
+ // to create the <template> element the first time we see it.
2124
+ const template = typeof type === 'number'
2125
+ ? this._$getTemplate(result)
2126
+ : (type.el === undefined &&
2127
+ (type.el = Template.createElement(trustFromTemplateString(type.h, type.h[0]), this.options)),
2128
+ type);
2129
+ if (this._$committedValue?._$template === template) {
2130
+ debugLogEvent$1 &&
2131
+ debugLogEvent$1({
2132
+ kind: 'template updating',
2133
+ template,
2134
+ instance: this._$committedValue,
2135
+ parts: this._$committedValue._$parts,
2136
+ options: this.options,
2137
+ values,
2138
+ });
2139
+ this._$committedValue._update(values);
2140
+ }
2141
+ else {
2142
+ const instance = new TemplateInstance(template, this);
2143
+ const fragment = instance._clone(this.options);
2144
+ debugLogEvent$1 &&
2145
+ debugLogEvent$1({
2146
+ kind: 'template instantiated',
2147
+ template,
2148
+ instance,
2149
+ parts: instance._$parts,
2150
+ options: this.options,
2151
+ fragment,
2152
+ values,
2153
+ });
2154
+ instance._update(values);
2155
+ debugLogEvent$1 &&
2156
+ debugLogEvent$1({
2157
+ kind: 'template instantiated and updated',
2158
+ template,
2159
+ instance,
2160
+ parts: instance._$parts,
2161
+ options: this.options,
2162
+ fragment,
2163
+ values,
2164
+ });
2165
+ this._commitNode(fragment);
2166
+ this._$committedValue = instance;
2167
+ }
2168
+ }
2169
+ // Overridden via `litHtmlPolyfillSupport` to provide platform support.
2170
+ /** @internal */
2171
+ _$getTemplate(result) {
2172
+ let template = templateCache.get(result.strings);
2173
+ if (template === undefined) {
2174
+ templateCache.set(result.strings, (template = new Template(result)));
2175
+ }
2176
+ return template;
2177
+ }
2178
+ _commitIterable(value) {
2179
+ // For an Iterable, we create a new InstancePart per item, then set its
2180
+ // value to the item. This is a little bit of overhead for every item in
2181
+ // an Iterable, but it lets us recurse easily and efficiently update Arrays
2182
+ // of TemplateResults that will be commonly returned from expressions like:
2183
+ // array.map((i) => html`${i}`), by reusing existing TemplateInstances.
2184
+ // If value is an array, then the previous render was of an
2185
+ // iterable and value will contain the ChildParts from the previous
2186
+ // render. If value is not an array, clear this part and make a new
2187
+ // array for ChildParts.
2188
+ if (!isArray(this._$committedValue)) {
2189
+ this._$committedValue = [];
2190
+ this._$clear();
2191
+ }
2192
+ // Lets us keep track of how many items we stamped so we can clear leftover
2193
+ // items from a previous render
2194
+ const itemParts = this._$committedValue;
2195
+ let partIndex = 0;
2196
+ let itemPart;
2197
+ for (const item of value) {
2198
+ if (partIndex === itemParts.length) {
2199
+ // If no existing part, create a new one
2200
+ // TODO (justinfagnani): test perf impact of always creating two parts
2201
+ // instead of sharing parts between nodes
2202
+ // https://github.com/lit/lit/issues/1266
2203
+ itemParts.push((itemPart = new ChildPart(this._insert(createMarker()), this._insert(createMarker()), this, this.options)));
2204
+ }
2205
+ else {
2206
+ // Reuse an existing part
2207
+ itemPart = itemParts[partIndex];
2208
+ }
2209
+ itemPart._$setValue(item);
2210
+ partIndex++;
2211
+ }
2212
+ if (partIndex < itemParts.length) {
2213
+ // itemParts always have end nodes
2214
+ this._$clear(itemPart && wrap(itemPart._$endNode).nextSibling, partIndex);
2215
+ // Truncate the parts array so _value reflects the current state
2216
+ itemParts.length = partIndex;
2217
+ }
2218
+ }
2219
+ /**
2220
+ * Removes the nodes contained within this Part from the DOM.
2221
+ *
2222
+ * @param start Start node to clear from, for clearing a subset of the part's
2223
+ * DOM (used when truncating iterables)
2224
+ * @param from When `start` is specified, the index within the iterable from
2225
+ * which ChildParts are being removed, used for disconnecting directives in
2226
+ * those Parts.
2227
+ *
2228
+ * @internal
2229
+ */
2230
+ _$clear(start = wrap(this._$startNode).nextSibling, from) {
2231
+ this._$notifyConnectionChanged?.(false, true, from);
2232
+ while (start && start !== this._$endNode) {
2233
+ const n = wrap(start).nextSibling;
2234
+ wrap(start).remove();
2235
+ start = n;
2236
+ }
2237
+ }
2238
+ /**
2239
+ * Implementation of RootPart's `isConnected`. Note that this method
2240
+ * should only be called on `RootPart`s (the `ChildPart` returned from a
2241
+ * top-level `render()` call). It has no effect on non-root ChildParts.
2242
+ * @param isConnected Whether to set
2243
+ * @internal
2244
+ */
2245
+ setConnected(isConnected) {
2246
+ if (this._$parent === undefined) {
2247
+ this.__isConnected = isConnected;
2248
+ this._$notifyConnectionChanged?.(isConnected);
2249
+ }
2250
+ else {
2251
+ throw new Error('part.setConnected() may only be called on a ' +
2252
+ 'RootPart returned from render().');
2253
+ }
2254
+ }
2255
+ }
2256
+ class AttributePart {
2257
+ get tagName() {
2258
+ return this.element.tagName;
2259
+ }
2260
+ // See comment in Disconnectable interface for why this is a getter
2261
+ get _$isConnected() {
2262
+ return this._$parent._$isConnected;
2263
+ }
2264
+ constructor(element, name, strings, parent, options) {
2265
+ this.type = ATTRIBUTE_PART;
2266
+ /** @internal */
2267
+ this._$committedValue = nothing;
2268
+ /** @internal */
2269
+ this._$disconnectableChildren = undefined;
2270
+ this.element = element;
2271
+ this.name = name;
2272
+ this._$parent = parent;
2273
+ this.options = options;
2274
+ if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {
2275
+ this._$committedValue = new Array(strings.length - 1).fill(new String());
2276
+ this.strings = strings;
2277
+ }
2278
+ else {
2279
+ this._$committedValue = nothing;
2280
+ }
2281
+ {
2282
+ this._sanitizer = undefined;
2283
+ }
2284
+ }
2285
+ /**
2286
+ * Sets the value of this part by resolving the value from possibly multiple
2287
+ * values and static strings and committing it to the DOM.
2288
+ * If this part is single-valued, `this._strings` will be undefined, and the
2289
+ * method will be called with a single value argument. If this part is
2290
+ * multi-value, `this._strings` will be defined, and the method is called
2291
+ * with the value array of the part's owning TemplateInstance, and an offset
2292
+ * into the value array from which the values should be read.
2293
+ * This method is overloaded this way to eliminate short-lived array slices
2294
+ * of the template instance values, and allow a fast-path for single-valued
2295
+ * parts.
2296
+ *
2297
+ * @param value The part value, or an array of values for multi-valued parts
2298
+ * @param valueIndex the index to start reading values from. `undefined` for
2299
+ * single-valued parts
2300
+ * @param noCommit causes the part to not commit its value to the DOM. Used
2301
+ * in hydration to prime attribute parts with their first-rendered value,
2302
+ * but not set the attribute, and in SSR to no-op the DOM operation and
2303
+ * capture the value for serialization.
2304
+ *
2305
+ * @internal
2306
+ */
2307
+ _$setValue(value, directiveParent = this, valueIndex, noCommit) {
2308
+ const strings = this.strings;
2309
+ // Whether any of the values has changed, for dirty-checking
2310
+ let change = false;
2311
+ if (strings === undefined) {
2312
+ // Single-value binding case
2313
+ value = resolveDirective(this, value, directiveParent, 0);
2314
+ change =
2315
+ !isPrimitive(value) ||
2316
+ (value !== this._$committedValue && value !== noChange);
2317
+ if (change) {
2318
+ this._$committedValue = value;
2319
+ }
2320
+ }
2321
+ else {
2322
+ // Interpolation case
2323
+ const values = value;
2324
+ value = strings[0];
2325
+ let i, v;
2326
+ for (i = 0; i < strings.length - 1; i++) {
2327
+ v = resolveDirective(this, values[valueIndex + i], directiveParent, i);
2328
+ if (v === noChange) {
2329
+ // If the user-provided value is `noChange`, use the previous value
2330
+ v = this._$committedValue[i];
2331
+ }
2332
+ change ||=
2333
+ !isPrimitive(v) || v !== this._$committedValue[i];
2334
+ if (v === nothing) {
2335
+ value = nothing;
2336
+ }
2337
+ else if (value !== nothing) {
2338
+ value += (v ?? '') + strings[i + 1];
2339
+ }
2340
+ // We always record each value, even if one is `nothing`, for future
2341
+ // change detection.
2342
+ this._$committedValue[i] = v;
2343
+ }
2344
+ }
2345
+ if (change && !noCommit) {
2346
+ this._commitValue(value);
2347
+ }
2348
+ }
2349
+ /** @internal */
2350
+ _commitValue(value) {
2351
+ if (value === nothing) {
2352
+ wrap(this.element).removeAttribute(this.name);
2353
+ }
2354
+ else {
2355
+ {
2356
+ if (this._sanitizer === undefined) {
2357
+ this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'attribute');
2358
+ }
2359
+ value = this._sanitizer(value ?? '');
2360
+ }
2361
+ debugLogEvent$1 &&
2362
+ debugLogEvent$1({
2363
+ kind: 'commit attribute',
2364
+ element: this.element,
2365
+ name: this.name,
2366
+ value,
2367
+ options: this.options,
2368
+ });
2369
+ wrap(this.element).setAttribute(this.name, (value ?? ''));
2370
+ }
2371
+ }
2372
+ }
2373
+ class PropertyPart extends AttributePart {
2374
+ constructor() {
2375
+ super(...arguments);
2376
+ this.type = PROPERTY_PART;
2377
+ }
2378
+ /** @internal */
2379
+ _commitValue(value) {
2380
+ {
2381
+ if (this._sanitizer === undefined) {
2382
+ this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'property');
2383
+ }
2384
+ value = this._sanitizer(value);
2385
+ }
2386
+ debugLogEvent$1 &&
2387
+ debugLogEvent$1({
2388
+ kind: 'commit property',
2389
+ element: this.element,
2390
+ name: this.name,
2391
+ value,
2392
+ options: this.options,
2393
+ });
2394
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2395
+ this.element[this.name] = value === nothing ? undefined : value;
2396
+ }
2397
+ }
2398
+ class BooleanAttributePart extends AttributePart {
2399
+ constructor() {
2400
+ super(...arguments);
2401
+ this.type = BOOLEAN_ATTRIBUTE_PART;
2402
+ }
2403
+ /** @internal */
2404
+ _commitValue(value) {
2405
+ debugLogEvent$1 &&
2406
+ debugLogEvent$1({
2407
+ kind: 'commit boolean attribute',
2408
+ element: this.element,
2409
+ name: this.name,
2410
+ value: !!(value && value !== nothing),
2411
+ options: this.options,
2412
+ });
2413
+ wrap(this.element).toggleAttribute(this.name, !!value && value !== nothing);
2414
+ }
2415
+ }
2416
+ class EventPart extends AttributePart {
2417
+ constructor(element, name, strings, parent, options) {
2418
+ super(element, name, strings, parent, options);
2419
+ this.type = EVENT_PART;
2420
+ if (this.strings !== undefined) {
2421
+ throw new Error(`A \`<${element.localName}>\` has a \`@${name}=...\` listener with ` +
2422
+ 'invalid content. Event listeners in templates must have exactly ' +
2423
+ 'one expression and no surrounding text.');
2424
+ }
2425
+ }
2426
+ // EventPart does not use the base _$setValue/_resolveValue implementation
2427
+ // since the dirty checking is more complex
2428
+ /** @internal */
2429
+ _$setValue(newListener, directiveParent = this) {
2430
+ newListener =
2431
+ resolveDirective(this, newListener, directiveParent, 0) ?? nothing;
2432
+ if (newListener === noChange) {
2433
+ return;
2434
+ }
2435
+ const oldListener = this._$committedValue;
2436
+ // If the new value is nothing or any options change we have to remove the
2437
+ // part as a listener.
2438
+ const shouldRemoveListener = (newListener === nothing && oldListener !== nothing) ||
2439
+ newListener.capture !==
2440
+ oldListener.capture ||
2441
+ newListener.once !==
2442
+ oldListener.once ||
2443
+ newListener.passive !==
2444
+ oldListener.passive;
2445
+ // If the new value is not nothing and we removed the listener, we have
2446
+ // to add the part as a listener.
2447
+ const shouldAddListener = newListener !== nothing &&
2448
+ (oldListener === nothing || shouldRemoveListener);
2449
+ debugLogEvent$1 &&
2450
+ debugLogEvent$1({
2451
+ kind: 'commit event listener',
2452
+ element: this.element,
2453
+ name: this.name,
2454
+ value: newListener,
2455
+ options: this.options,
2456
+ removeListener: shouldRemoveListener,
2457
+ addListener: shouldAddListener,
2458
+ oldListener,
2459
+ });
2460
+ if (shouldRemoveListener) {
2461
+ this.element.removeEventListener(this.name, this, oldListener);
2462
+ }
2463
+ if (shouldAddListener) {
2464
+ // Beware: IE11 and Chrome 41 don't like using the listener as the
2465
+ // options object. Figure out how to deal w/ this in IE11 - maybe
2466
+ // patch addEventListener?
2467
+ this.element.addEventListener(this.name, this, newListener);
2468
+ }
2469
+ this._$committedValue = newListener;
2470
+ }
2471
+ handleEvent(event) {
2472
+ if (typeof this._$committedValue === 'function') {
2473
+ this._$committedValue.call(this.options?.host ?? this.element, event);
2474
+ }
2475
+ else {
2476
+ this._$committedValue.handleEvent(event);
2477
+ }
2478
+ }
2479
+ }
2480
+ class ElementPart {
2481
+ constructor(element, parent, options) {
2482
+ this.element = element;
2483
+ this.type = ELEMENT_PART;
2484
+ /** @internal */
2485
+ this._$disconnectableChildren = undefined;
2486
+ this._$parent = parent;
2487
+ this.options = options;
2488
+ }
2489
+ // See comment in Disconnectable interface for why this is a getter
2490
+ get _$isConnected() {
2491
+ return this._$parent._$isConnected;
2492
+ }
2493
+ _$setValue(value) {
2494
+ debugLogEvent$1 &&
2495
+ debugLogEvent$1({
2496
+ kind: 'commit to element binding',
2497
+ element: this.element,
2498
+ value,
2499
+ options: this.options,
2500
+ });
2501
+ resolveDirective(this, value);
2502
+ }
2503
+ }
2504
+ // Apply polyfills if available
2505
+ const polyfillSupport$2 = global$2.litHtmlPolyfillSupportDevMode
2506
+ ;
2507
+ polyfillSupport$2?.(Template, ChildPart);
2508
+ // IMPORTANT: do not change the property name or the assignment expression.
2509
+ // This line will be used in regexes to search for lit-html usage.
2510
+ (global$2.litHtmlVersions ??= []).push('3.2.0');
2511
+ if (global$2.litHtmlVersions.length > 1) {
2512
+ issueWarning$4('multiple-versions', `Multiple versions of Lit loaded. ` +
2513
+ `Loading multiple versions is not recommended.`);
2514
+ }
2515
+ /**
2516
+ * Renders a value, usually a lit-html TemplateResult, to the container.
2517
+ *
2518
+ * This example renders the text "Hello, Zoe!" inside a paragraph tag, appending
2519
+ * it to the container `document.body`.
2520
+ *
2521
+ * ```js
2522
+ * import {html, render} from 'lit';
2523
+ *
2524
+ * const name = "Zoe";
2525
+ * render(html`<p>Hello, ${name}!</p>`, document.body);
2526
+ * ```
2527
+ *
2528
+ * @param value Any [renderable
2529
+ * value](https://lit.dev/docs/templates/expressions/#child-expressions),
2530
+ * typically a {@linkcode TemplateResult} created by evaluating a template tag
2531
+ * like {@linkcode html} or {@linkcode svg}.
2532
+ * @param container A DOM container to render to. The first render will append
2533
+ * the rendered value to the container, and subsequent renders will
2534
+ * efficiently update the rendered value if the same result type was
2535
+ * previously rendered there.
2536
+ * @param options See {@linkcode RenderOptions} for options documentation.
2537
+ * @see
2538
+ * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}
2539
+ */
2540
+ const render = (value, container, options) => {
2541
+ if (container == null) {
2542
+ // Give a clearer error message than
2543
+ // Uncaught TypeError: Cannot read properties of null (reading
2544
+ // '_$litPart$')
2545
+ // which reads like an internal Lit error.
2546
+ throw new TypeError(`The container to render into may not be ${container}`);
2547
+ }
2548
+ const renderId = debugLogRenderId++ ;
2549
+ const partOwnerNode = options?.renderBefore ?? container;
2550
+ // This property needs to remain unminified.
2551
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2552
+ let part = partOwnerNode['_$litPart$'];
2553
+ debugLogEvent$1 &&
2554
+ debugLogEvent$1({
2555
+ kind: 'begin render',
2556
+ id: renderId,
2557
+ value,
2558
+ container,
2559
+ options,
2560
+ part,
2561
+ });
2562
+ if (part === undefined) {
2563
+ const endNode = options?.renderBefore ?? null;
2564
+ // This property needs to remain unminified.
2565
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2566
+ partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options ?? {});
2567
+ }
2568
+ part._$setValue(value);
2569
+ debugLogEvent$1 &&
2570
+ debugLogEvent$1({
2571
+ kind: 'end render',
2572
+ id: renderId,
2573
+ value,
2574
+ container,
2575
+ options,
2576
+ part,
2577
+ });
2578
+ return part;
2579
+ };
2580
+ {
2581
+ render.setSanitizer = setSanitizer;
2582
+ render.createSanitizer = createSanitizer;
2583
+ {
2584
+ render._testOnlyClearSanitizerFactoryDoNotCallOrElse =
2585
+ _testOnlyClearSanitizerFactoryDoNotCallOrElse;
2586
+ }
2587
+ }
2588
+
2589
+ /**
2590
+ * @license
2591
+ * Copyright 2019 Google LLC
2592
+ * SPDX-License-Identifier: BSD-3-Clause
2593
+ */
2594
+ const NODE_MODE = false;
2595
+ // Allows minifiers to rename references to globalThis
2596
+ const global$1 = globalThis;
2597
+ /**
2598
+ * Whether the current browser supports `adoptedStyleSheets`.
2599
+ */
2600
+ const supportsAdoptingStyleSheets = global$1.ShadowRoot &&
2601
+ (global$1.ShadyCSS === undefined || global$1.ShadyCSS.nativeShadow) &&
2602
+ 'adoptedStyleSheets' in Document.prototype &&
2603
+ 'replace' in CSSStyleSheet.prototype;
2604
+ const constructionToken = Symbol();
2605
+ const cssTagCache = new WeakMap();
2606
+ /**
2607
+ * A container for a string of CSS text, that may be used to create a CSSStyleSheet.
2608
+ *
2609
+ * CSSResult is the return value of `css`-tagged template literals and
2610
+ * `unsafeCSS()`. In order to ensure that CSSResults are only created via the
2611
+ * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly.
2612
+ */
2613
+ class CSSResult {
2614
+ constructor(cssText, strings, safeToken) {
2615
+ // This property needs to remain unminified.
2616
+ this['_$cssResult$'] = true;
2617
+ if (safeToken !== constructionToken) {
2618
+ throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');
2619
+ }
2620
+ this.cssText = cssText;
2621
+ this._strings = strings;
2622
+ }
2623
+ // This is a getter so that it's lazy. In practice, this means stylesheets
2624
+ // are not created until the first element instance is made.
2625
+ get styleSheet() {
2626
+ // If `supportsAdoptingStyleSheets` is true then we assume CSSStyleSheet is
2627
+ // constructable.
2628
+ let styleSheet = this._styleSheet;
2629
+ const strings = this._strings;
2630
+ if (supportsAdoptingStyleSheets && styleSheet === undefined) {
2631
+ const cacheable = strings !== undefined && strings.length === 1;
2632
+ if (cacheable) {
2633
+ styleSheet = cssTagCache.get(strings);
2634
+ }
2635
+ if (styleSheet === undefined) {
2636
+ (this._styleSheet = styleSheet = new CSSStyleSheet()).replaceSync(this.cssText);
2637
+ if (cacheable) {
2638
+ cssTagCache.set(strings, styleSheet);
2639
+ }
2640
+ }
2641
+ }
2642
+ return styleSheet;
2643
+ }
2644
+ toString() {
2645
+ return this.cssText;
2646
+ }
2647
+ }
2648
+ const textFromCSSResult = (value) => {
2649
+ // This property needs to remain unminified.
2650
+ if (value['_$cssResult$'] === true) {
2651
+ return value.cssText;
2652
+ }
2653
+ else if (typeof value === 'number') {
2654
+ return value;
2655
+ }
2656
+ else {
2657
+ throw new Error(`Value passed to 'css' function must be a 'css' function result: ` +
2658
+ `${value}. Use 'unsafeCSS' to pass non-literal values, but take care ` +
2659
+ `to ensure page security.`);
2660
+ }
2661
+ };
2662
+ /**
2663
+ * Wrap a value for interpolation in a {@linkcode css} tagged template literal.
2664
+ *
2665
+ * This is unsafe because untrusted CSS text can be used to phone home
2666
+ * or exfiltrate data to an attacker controlled site. Take care to only use
2667
+ * this with trusted input.
2668
+ */
2669
+ const unsafeCSS = (value) => new CSSResult(typeof value === 'string' ? value : String(value), undefined, constructionToken);
2670
+ /**
2671
+ * A template literal tag which can be used with LitElement's
2672
+ * {@linkcode LitElement.styles} property to set element styles.
2673
+ *
2674
+ * For security reasons, only literal string values and number may be used in
2675
+ * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS}
2676
+ * may be used inside an expression.
2677
+ */
2678
+ const css = (strings, ...values) => {
2679
+ const cssText = strings.length === 1
2680
+ ? strings[0]
2681
+ : values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]);
2682
+ return new CSSResult(cssText, strings, constructionToken);
2683
+ };
2684
+ /**
2685
+ * Applies the given styles to a `shadowRoot`. When Shadow DOM is
2686
+ * available but `adoptedStyleSheets` is not, styles are appended to the
2687
+ * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).
2688
+ * Note, when shimming is used, any styles that are subsequently placed into
2689
+ * the shadowRoot should be placed *before* any shimmed adopted styles. This
2690
+ * will match spec behavior that gives adopted sheets precedence over styles in
2691
+ * shadowRoot.
2692
+ */
2693
+ const adoptStyles = (renderRoot, styles) => {
2694
+ if (supportsAdoptingStyleSheets) {
2695
+ renderRoot.adoptedStyleSheets = styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet);
2696
+ }
2697
+ else {
2698
+ for (const s of styles) {
2699
+ const style = document.createElement('style');
2700
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2701
+ const nonce = global$1['litNonce'];
2702
+ if (nonce !== undefined) {
2703
+ style.setAttribute('nonce', nonce);
2704
+ }
2705
+ style.textContent = s.cssText;
2706
+ renderRoot.appendChild(style);
2707
+ }
2708
+ }
2709
+ };
2710
+ const cssResultFromStyleSheet = (sheet) => {
2711
+ let cssText = '';
2712
+ for (const rule of sheet.cssRules) {
2713
+ cssText += rule.cssText;
2714
+ }
2715
+ return unsafeCSS(cssText);
2716
+ };
2717
+ const getCompatibleStyle = supportsAdoptingStyleSheets ||
2718
+ (NODE_MODE )
2719
+ ? (s) => s
2720
+ : (s) => s instanceof CSSStyleSheet ? cssResultFromStyleSheet(s) : s;
2721
+
2722
+ /**
2723
+ * @license
2724
+ * Copyright 2017 Google LLC
2725
+ * SPDX-License-Identifier: BSD-3-Clause
2726
+ */
2727
+ // TODO (justinfagnani): Add `hasOwn` here when we ship ES2022
2728
+ const { is, defineProperty, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, } = Object;
2729
+ // Lets a minifier replace globalThis references with a minified name
2730
+ const global = globalThis;
2731
+ let issueWarning$3;
2732
+ const trustedTypes = global
2733
+ .trustedTypes;
2734
+ // Temporary workaround for https://crbug.com/993268
2735
+ // Currently, any attribute starting with "on" is considered to be a
2736
+ // TrustedScript source. Such boolean attributes must be set to the equivalent
2737
+ // trusted emptyScript value.
2738
+ const emptyStringForBooleanAttribute = trustedTypes
2739
+ ? trustedTypes.emptyScript
2740
+ : '';
2741
+ const polyfillSupport$1 = global.reactiveElementPolyfillSupportDevMode
2742
+ ;
2743
+ {
2744
+ // Ensure warnings are issued only 1x, even if multiple versions of Lit
2745
+ // are loaded.
2746
+ const issuedWarnings = (global.litIssuedWarnings ??=
2747
+ new Set());
2748
+ // Issue a warning, if we haven't already.
2749
+ issueWarning$3 = (code, warning) => {
2750
+ warning += ` See https://lit.dev/msg/${code} for more information.`;
2751
+ if (!issuedWarnings.has(warning)) {
2752
+ console.warn(warning);
2753
+ issuedWarnings.add(warning);
2754
+ }
2755
+ };
2756
+ issueWarning$3('dev-mode', `Lit is in dev mode. Not recommended for production!`);
2757
+ // Issue polyfill support warning.
2758
+ if (global.ShadyDOM?.inUse && polyfillSupport$1 === undefined) {
2759
+ issueWarning$3('polyfill-support-missing', `Shadow DOM is being polyfilled via \`ShadyDOM\` but ` +
2760
+ `the \`polyfill-support\` module has not been loaded.`);
2761
+ }
2762
+ }
2763
+ /**
2764
+ * Useful for visualizing and logging insights into what the Lit template system is doing.
2765
+ *
2766
+ * Compiled out of prod mode builds.
2767
+ */
2768
+ const debugLogEvent = (event) => {
2769
+ const shouldEmit = global
2770
+ .emitLitDebugLogEvents;
2771
+ if (!shouldEmit) {
2772
+ return;
2773
+ }
2774
+ global.dispatchEvent(new CustomEvent('lit-debug', {
2775
+ detail: event,
2776
+ }));
2777
+ }
2778
+ ;
2779
+ /*
2780
+ * When using Closure Compiler, JSCompiler_renameProperty(property, object) is
2781
+ * replaced at compile time by the munged name for object[property]. We cannot
2782
+ * alias this function, so we have to use a small shim that has the same
2783
+ * behavior when not compiling.
2784
+ */
2785
+ /*@__INLINE__*/
2786
+ const JSCompiler_renameProperty$1 = (prop, _obj) => prop;
2787
+ const defaultConverter = {
2788
+ toAttribute(value, type) {
2789
+ switch (type) {
2790
+ case Boolean:
2791
+ value = value ? emptyStringForBooleanAttribute : null;
2792
+ break;
2793
+ case Object:
2794
+ case Array:
2795
+ // if the value is `null` or `undefined` pass this through
2796
+ // to allow removing/no change behavior.
2797
+ value = value == null ? value : JSON.stringify(value);
2798
+ break;
2799
+ }
2800
+ return value;
2801
+ },
2802
+ fromAttribute(value, type) {
2803
+ let fromValue = value;
2804
+ switch (type) {
2805
+ case Boolean:
2806
+ fromValue = value !== null;
2807
+ break;
2808
+ case Number:
2809
+ fromValue = value === null ? null : Number(value);
2810
+ break;
2811
+ case Object:
2812
+ case Array:
2813
+ // Do *not* generate exception when invalid JSON is set as elements
2814
+ // don't normally complain on being mis-configured.
2815
+ // TODO(sorvell): Do generate exception in *dev mode*.
2816
+ try {
2817
+ // Assert to adhere to Bazel's "must type assert JSON parse" rule.
2818
+ fromValue = JSON.parse(value);
2819
+ }
2820
+ catch (e) {
2821
+ fromValue = null;
2822
+ }
2823
+ break;
2824
+ }
2825
+ return fromValue;
2826
+ },
2827
+ };
2828
+ /**
2829
+ * Change function that returns true if `value` is different from `oldValue`.
2830
+ * This method is used as the default for a property's `hasChanged` function.
2831
+ */
2832
+ const notEqual = (value, old) => !is(value, old);
2833
+ const defaultPropertyDeclaration$1 = {
2834
+ attribute: true,
2835
+ type: String,
2836
+ converter: defaultConverter,
2837
+ reflect: false,
2838
+ hasChanged: notEqual,
2839
+ };
2840
+ // Ensure metadata is enabled. TypeScript does not polyfill
2841
+ // Symbol.metadata, so we must ensure that it exists.
2842
+ Symbol.metadata ??= Symbol('metadata');
2843
+ // Map from a class's metadata object to property options
2844
+ // Note that we must use nullish-coalescing assignment so that we only use one
2845
+ // map even if we load multiple version of this module.
2846
+ global.litPropertyMetadata ??= new WeakMap();
2847
+ /**
2848
+ * Base element class which manages element properties and attributes. When
2849
+ * properties change, the `update` method is asynchronously called. This method
2850
+ * should be supplied by subclasses to render updates as desired.
2851
+ * @noInheritDoc
2852
+ */
2853
+ class ReactiveElement
2854
+ // In the Node build, this `extends` clause will be substituted with
2855
+ // `(globalThis.HTMLElement ?? HTMLElement)`.
2856
+ //
2857
+ // This way, we will first prefer any global `HTMLElement` polyfill that the
2858
+ // user has assigned, and then fall back to the `HTMLElement` shim which has
2859
+ // been imported (see note at the top of this file about how this import is
2860
+ // generated by Rollup). Note that the `HTMLElement` variable has been
2861
+ // shadowed by this import, so it no longer refers to the global.
2862
+ extends HTMLElement {
2863
+ /**
2864
+ * Adds an initializer function to the class that is called during instance
2865
+ * construction.
2866
+ *
2867
+ * This is useful for code that runs against a `ReactiveElement`
2868
+ * subclass, such as a decorator, that needs to do work for each
2869
+ * instance, such as setting up a `ReactiveController`.
2870
+ *
2871
+ * ```ts
2872
+ * const myDecorator = (target: typeof ReactiveElement, key: string) => {
2873
+ * target.addInitializer((instance: ReactiveElement) => {
2874
+ * // This is run during construction of the element
2875
+ * new MyController(instance);
2876
+ * });
2877
+ * }
2878
+ * ```
2879
+ *
2880
+ * Decorating a field will then cause each instance to run an initializer
2881
+ * that adds a controller:
2882
+ *
2883
+ * ```ts
2884
+ * class MyElement extends LitElement {
2885
+ * @myDecorator foo;
2886
+ * }
2887
+ * ```
2888
+ *
2889
+ * Initializers are stored per-constructor. Adding an initializer to a
2890
+ * subclass does not add it to a superclass. Since initializers are run in
2891
+ * constructors, initializers will run in order of the class hierarchy,
2892
+ * starting with superclasses and progressing to the instance's class.
2893
+ *
2894
+ * @nocollapse
2895
+ */
2896
+ static addInitializer(initializer) {
2897
+ this.__prepare();
2898
+ (this._initializers ??= []).push(initializer);
2899
+ }
2900
+ /**
2901
+ * Returns a list of attributes corresponding to the registered properties.
2902
+ * @nocollapse
2903
+ * @category attributes
2904
+ */
2905
+ static get observedAttributes() {
2906
+ // Ensure we've created all properties
2907
+ this.finalize();
2908
+ // this.__attributeToPropertyMap is only undefined after finalize() in
2909
+ // ReactiveElement itself. ReactiveElement.observedAttributes is only
2910
+ // accessed with ReactiveElement as the receiver when a subclass or mixin
2911
+ // calls super.observedAttributes
2912
+ return (this.__attributeToPropertyMap && [...this.__attributeToPropertyMap.keys()]);
2913
+ }
2914
+ /**
2915
+ * Creates a property accessor on the element prototype if one does not exist
2916
+ * and stores a {@linkcode PropertyDeclaration} for the property with the
2917
+ * given options. The property setter calls the property's `hasChanged`
2918
+ * property option or uses a strict identity check to determine whether or not
2919
+ * to request an update.
2920
+ *
2921
+ * This method may be overridden to customize properties; however,
2922
+ * when doing so, it's important to call `super.createProperty` to ensure
2923
+ * the property is setup correctly. This method calls
2924
+ * `getPropertyDescriptor` internally to get a descriptor to install.
2925
+ * To customize what properties do when they are get or set, override
2926
+ * `getPropertyDescriptor`. To customize the options for a property,
2927
+ * implement `createProperty` like this:
2928
+ *
2929
+ * ```ts
2930
+ * static createProperty(name, options) {
2931
+ * options = Object.assign(options, {myOption: true});
2932
+ * super.createProperty(name, options);
2933
+ * }
2934
+ * ```
2935
+ *
2936
+ * @nocollapse
2937
+ * @category properties
2938
+ */
2939
+ static createProperty(name, options = defaultPropertyDeclaration$1) {
2940
+ // If this is a state property, force the attribute to false.
2941
+ if (options.state) {
2942
+ options.attribute = false;
2943
+ }
2944
+ this.__prepare();
2945
+ this.elementProperties.set(name, options);
2946
+ if (!options.noAccessor) {
2947
+ const key = // Use Symbol.for in dev mode to make it easier to maintain state
2948
+ // when doing HMR.
2949
+ Symbol.for(`${String(name)} (@property() cache)`)
2950
+ ;
2951
+ const descriptor = this.getPropertyDescriptor(name, key, options);
2952
+ if (descriptor !== undefined) {
2953
+ defineProperty(this.prototype, name, descriptor);
2954
+ }
2955
+ }
2956
+ }
2957
+ /**
2958
+ * Returns a property descriptor to be defined on the given named property.
2959
+ * If no descriptor is returned, the property will not become an accessor.
2960
+ * For example,
2961
+ *
2962
+ * ```ts
2963
+ * class MyElement extends LitElement {
2964
+ * static getPropertyDescriptor(name, key, options) {
2965
+ * const defaultDescriptor =
2966
+ * super.getPropertyDescriptor(name, key, options);
2967
+ * const setter = defaultDescriptor.set;
2968
+ * return {
2969
+ * get: defaultDescriptor.get,
2970
+ * set(value) {
2971
+ * setter.call(this, value);
2972
+ * // custom action.
2973
+ * },
2974
+ * configurable: true,
2975
+ * enumerable: true
2976
+ * }
2977
+ * }
2978
+ * }
2979
+ * ```
2980
+ *
2981
+ * @nocollapse
2982
+ * @category properties
2983
+ */
2984
+ static getPropertyDescriptor(name, key, options) {
2985
+ const { get, set } = getOwnPropertyDescriptor(this.prototype, name) ?? {
2986
+ get() {
2987
+ return this[key];
2988
+ },
2989
+ set(v) {
2990
+ this[key] = v;
2991
+ },
2992
+ };
2993
+ if (get == null) {
2994
+ if ('value' in (getOwnPropertyDescriptor(this.prototype, name) ?? {})) {
2995
+ throw new Error(`Field ${JSON.stringify(String(name))} on ` +
2996
+ `${this.name} was declared as a reactive property ` +
2997
+ `but it's actually declared as a value on the prototype. ` +
2998
+ `Usually this is due to using @property or @state on a method.`);
2999
+ }
3000
+ issueWarning$3('reactive-property-without-getter', `Field ${JSON.stringify(String(name))} on ` +
3001
+ `${this.name} was declared as a reactive property ` +
3002
+ `but it does not have a getter. This will be an error in a ` +
3003
+ `future version of Lit.`);
3004
+ }
3005
+ return {
3006
+ get() {
3007
+ return get?.call(this);
3008
+ },
3009
+ set(value) {
3010
+ const oldValue = get?.call(this);
3011
+ set.call(this, value);
3012
+ this.requestUpdate(name, oldValue, options);
3013
+ },
3014
+ configurable: true,
3015
+ enumerable: true,
3016
+ };
3017
+ }
3018
+ /**
3019
+ * Returns the property options associated with the given property.
3020
+ * These options are defined with a `PropertyDeclaration` via the `properties`
3021
+ * object or the `@property` decorator and are registered in
3022
+ * `createProperty(...)`.
3023
+ *
3024
+ * Note, this method should be considered "final" and not overridden. To
3025
+ * customize the options for a given property, override
3026
+ * {@linkcode createProperty}.
3027
+ *
3028
+ * @nocollapse
3029
+ * @final
3030
+ * @category properties
3031
+ */
3032
+ static getPropertyOptions(name) {
3033
+ return this.elementProperties.get(name) ?? defaultPropertyDeclaration$1;
3034
+ }
3035
+ /**
3036
+ * Initializes static own properties of the class used in bookkeeping
3037
+ * for element properties, initializers, etc.
3038
+ *
3039
+ * Can be called multiple times by code that needs to ensure these
3040
+ * properties exist before using them.
3041
+ *
3042
+ * This method ensures the superclass is finalized so that inherited
3043
+ * property metadata can be copied down.
3044
+ * @nocollapse
3045
+ */
3046
+ static __prepare() {
3047
+ if (this.hasOwnProperty(JSCompiler_renameProperty$1('elementProperties'))) {
3048
+ // Already prepared
3049
+ return;
3050
+ }
3051
+ // Finalize any superclasses
3052
+ const superCtor = getPrototypeOf(this);
3053
+ superCtor.finalize();
3054
+ // Create own set of initializers for this class if any exist on the
3055
+ // superclass and copy them down. Note, for a small perf boost, avoid
3056
+ // creating initializers unless needed.
3057
+ if (superCtor._initializers !== undefined) {
3058
+ this._initializers = [...superCtor._initializers];
3059
+ }
3060
+ // Initialize elementProperties from the superclass
3061
+ this.elementProperties = new Map(superCtor.elementProperties);
3062
+ }
3063
+ /**
3064
+ * Finishes setting up the class so that it's ready to be registered
3065
+ * as a custom element and instantiated.
3066
+ *
3067
+ * This method is called by the ReactiveElement.observedAttributes getter.
3068
+ * If you override the observedAttributes getter, you must either call
3069
+ * super.observedAttributes to trigger finalization, or call finalize()
3070
+ * yourself.
3071
+ *
3072
+ * @nocollapse
3073
+ */
3074
+ static finalize() {
3075
+ if (this.hasOwnProperty(JSCompiler_renameProperty$1('finalized'))) {
3076
+ return;
3077
+ }
3078
+ this.finalized = true;
3079
+ this.__prepare();
3080
+ // Create properties from the static properties block:
3081
+ if (this.hasOwnProperty(JSCompiler_renameProperty$1('properties'))) {
3082
+ const props = this.properties;
3083
+ const propKeys = [
3084
+ ...getOwnPropertyNames(props),
3085
+ ...getOwnPropertySymbols(props),
3086
+ ];
3087
+ for (const p of propKeys) {
3088
+ this.createProperty(p, props[p]);
3089
+ }
3090
+ }
3091
+ // Create properties from standard decorator metadata:
3092
+ const metadata = this[Symbol.metadata];
3093
+ if (metadata !== null) {
3094
+ const properties = litPropertyMetadata.get(metadata);
3095
+ if (properties !== undefined) {
3096
+ for (const [p, options] of properties) {
3097
+ this.elementProperties.set(p, options);
3098
+ }
3099
+ }
3100
+ }
3101
+ // Create the attribute-to-property map
3102
+ this.__attributeToPropertyMap = new Map();
3103
+ for (const [p, options] of this.elementProperties) {
3104
+ const attr = this.__attributeNameForProperty(p, options);
3105
+ if (attr !== undefined) {
3106
+ this.__attributeToPropertyMap.set(attr, p);
3107
+ }
3108
+ }
3109
+ this.elementStyles = this.finalizeStyles(this.styles);
3110
+ {
3111
+ if (this.hasOwnProperty('createProperty')) {
3112
+ issueWarning$3('no-override-create-property', 'Overriding ReactiveElement.createProperty() is deprecated. ' +
3113
+ 'The override will not be called with standard decorators');
3114
+ }
3115
+ if (this.hasOwnProperty('getPropertyDescriptor')) {
3116
+ issueWarning$3('no-override-get-property-descriptor', 'Overriding ReactiveElement.getPropertyDescriptor() is deprecated. ' +
3117
+ 'The override will not be called with standard decorators');
3118
+ }
3119
+ }
3120
+ }
3121
+ /**
3122
+ * Takes the styles the user supplied via the `static styles` property and
3123
+ * returns the array of styles to apply to the element.
3124
+ * Override this method to integrate into a style management system.
3125
+ *
3126
+ * Styles are deduplicated preserving the _last_ instance in the list. This
3127
+ * is a performance optimization to avoid duplicated styles that can occur
3128
+ * especially when composing via subclassing. The last item is kept to try
3129
+ * to preserve the cascade order with the assumption that it's most important
3130
+ * that last added styles override previous styles.
3131
+ *
3132
+ * @nocollapse
3133
+ * @category styles
3134
+ */
3135
+ static finalizeStyles(styles) {
3136
+ const elementStyles = [];
3137
+ if (Array.isArray(styles)) {
3138
+ // Dedupe the flattened array in reverse order to preserve the last items.
3139
+ // Casting to Array<unknown> works around TS error that
3140
+ // appears to come from trying to flatten a type CSSResultArray.
3141
+ const set = new Set(styles.flat(Infinity).reverse());
3142
+ // Then preserve original order by adding the set items in reverse order.
3143
+ for (const s of set) {
3144
+ elementStyles.unshift(getCompatibleStyle(s));
3145
+ }
3146
+ }
3147
+ else if (styles !== undefined) {
3148
+ elementStyles.push(getCompatibleStyle(styles));
3149
+ }
3150
+ return elementStyles;
3151
+ }
3152
+ /**
3153
+ * Returns the property name for the given attribute `name`.
3154
+ * @nocollapse
3155
+ */
3156
+ static __attributeNameForProperty(name, options) {
3157
+ const attribute = options.attribute;
3158
+ return attribute === false
3159
+ ? undefined
3160
+ : typeof attribute === 'string'
3161
+ ? attribute
3162
+ : typeof name === 'string'
3163
+ ? name.toLowerCase()
3164
+ : undefined;
3165
+ }
3166
+ constructor() {
3167
+ super();
3168
+ this.__instanceProperties = undefined;
3169
+ /**
3170
+ * True if there is a pending update as a result of calling `requestUpdate()`.
3171
+ * Should only be read.
3172
+ * @category updates
3173
+ */
3174
+ this.isUpdatePending = false;
3175
+ /**
3176
+ * Is set to `true` after the first update. The element code cannot assume
3177
+ * that `renderRoot` exists before the element `hasUpdated`.
3178
+ * @category updates
3179
+ */
3180
+ this.hasUpdated = false;
3181
+ /**
3182
+ * Name of currently reflecting property
3183
+ */
3184
+ this.__reflectingProperty = null;
3185
+ this.__initialize();
3186
+ }
3187
+ /**
3188
+ * Internal only override point for customizing work done when elements
3189
+ * are constructed.
3190
+ */
3191
+ __initialize() {
3192
+ this.__updatePromise = new Promise((res) => (this.enableUpdating = res));
3193
+ this._$changedProperties = new Map();
3194
+ // This enqueues a microtask that ust run before the first update, so it
3195
+ // must be called before requestUpdate()
3196
+ this.__saveInstanceProperties();
3197
+ // ensures first update will be caught by an early access of
3198
+ // `updateComplete`
3199
+ this.requestUpdate();
3200
+ this.constructor._initializers?.forEach((i) => i(this));
3201
+ }
3202
+ /**
3203
+ * Registers a `ReactiveController` to participate in the element's reactive
3204
+ * update cycle. The element automatically calls into any registered
3205
+ * controllers during its lifecycle callbacks.
3206
+ *
3207
+ * If the element is connected when `addController()` is called, the
3208
+ * controller's `hostConnected()` callback will be immediately called.
3209
+ * @category controllers
3210
+ */
3211
+ addController(controller) {
3212
+ (this.__controllers ??= new Set()).add(controller);
3213
+ // If a controller is added after the element has been connected,
3214
+ // call hostConnected. Note, re-using existence of `renderRoot` here
3215
+ // (which is set in connectedCallback) to avoid the need to track a
3216
+ // first connected state.
3217
+ if (this.renderRoot !== undefined && this.isConnected) {
3218
+ controller.hostConnected?.();
3219
+ }
3220
+ }
3221
+ /**
3222
+ * Removes a `ReactiveController` from the element.
3223
+ * @category controllers
3224
+ */
3225
+ removeController(controller) {
3226
+ this.__controllers?.delete(controller);
3227
+ }
3228
+ /**
3229
+ * Fixes any properties set on the instance before upgrade time.
3230
+ * Otherwise these would shadow the accessor and break these properties.
3231
+ * The properties are stored in a Map which is played back after the
3232
+ * constructor runs. Note, on very old versions of Safari (<=9) or Chrome
3233
+ * (<=41), properties created for native platform properties like (`id` or
3234
+ * `name`) may not have default values set in the element constructor. On
3235
+ * these browsers native properties appear on instances and therefore their
3236
+ * default value will overwrite any element default (e.g. if the element sets
3237
+ * this.id = 'id' in the constructor, the 'id' will become '' since this is
3238
+ * the native platform default).
3239
+ */
3240
+ __saveInstanceProperties() {
3241
+ const instanceProperties = new Map();
3242
+ const elementProperties = this.constructor
3243
+ .elementProperties;
3244
+ for (const p of elementProperties.keys()) {
3245
+ if (this.hasOwnProperty(p)) {
3246
+ instanceProperties.set(p, this[p]);
3247
+ delete this[p];
3248
+ }
3249
+ }
3250
+ if (instanceProperties.size > 0) {
3251
+ this.__instanceProperties = instanceProperties;
3252
+ }
3253
+ }
3254
+ /**
3255
+ * Returns the node into which the element should render and by default
3256
+ * creates and returns an open shadowRoot. Implement to customize where the
3257
+ * element's DOM is rendered. For example, to render into the element's
3258
+ * childNodes, return `this`.
3259
+ *
3260
+ * @return Returns a node into which to render.
3261
+ * @category rendering
3262
+ */
3263
+ createRenderRoot() {
3264
+ const renderRoot = this.shadowRoot ??
3265
+ this.attachShadow(this.constructor.shadowRootOptions);
3266
+ adoptStyles(renderRoot, this.constructor.elementStyles);
3267
+ return renderRoot;
3268
+ }
3269
+ /**
3270
+ * On first connection, creates the element's renderRoot, sets up
3271
+ * element styling, and enables updating.
3272
+ * @category lifecycle
3273
+ */
3274
+ connectedCallback() {
3275
+ // Create renderRoot before controllers `hostConnected`
3276
+ this.renderRoot ??=
3277
+ this.createRenderRoot();
3278
+ this.enableUpdating(true);
3279
+ this.__controllers?.forEach((c) => c.hostConnected?.());
3280
+ }
3281
+ /**
3282
+ * Note, this method should be considered final and not overridden. It is
3283
+ * overridden on the element instance with a function that triggers the first
3284
+ * update.
3285
+ * @category updates
3286
+ */
3287
+ enableUpdating(_requestedUpdate) { }
3288
+ /**
3289
+ * Allows for `super.disconnectedCallback()` in extensions while
3290
+ * reserving the possibility of making non-breaking feature additions
3291
+ * when disconnecting at some point in the future.
3292
+ * @category lifecycle
3293
+ */
3294
+ disconnectedCallback() {
3295
+ this.__controllers?.forEach((c) => c.hostDisconnected?.());
3296
+ }
3297
+ /**
3298
+ * Synchronizes property values when attributes change.
3299
+ *
3300
+ * Specifically, when an attribute is set, the corresponding property is set.
3301
+ * You should rarely need to implement this callback. If this method is
3302
+ * overridden, `super.attributeChangedCallback(name, _old, value)` must be
3303
+ * called.
3304
+ *
3305
+ * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks)
3306
+ * on MDN for more information about the `attributeChangedCallback`.
3307
+ * @category attributes
3308
+ */
3309
+ attributeChangedCallback(name, _old, value) {
3310
+ this._$attributeToProperty(name, value);
3311
+ }
3312
+ __propertyToAttribute(name, value) {
3313
+ const elemProperties = this.constructor.elementProperties;
3314
+ const options = elemProperties.get(name);
3315
+ const attr = this.constructor.__attributeNameForProperty(name, options);
3316
+ if (attr !== undefined && options.reflect === true) {
3317
+ const converter = options.converter?.toAttribute !==
3318
+ undefined
3319
+ ? options.converter
3320
+ : defaultConverter;
3321
+ const attrValue = converter.toAttribute(value, options.type);
3322
+ if (this.constructor.enabledWarnings.includes('migration') &&
3323
+ attrValue === undefined) {
3324
+ issueWarning$3('undefined-attribute-value', `The attribute value for the ${name} property is ` +
3325
+ `undefined on element ${this.localName}. The attribute will be ` +
3326
+ `removed, but in the previous version of \`ReactiveElement\`, ` +
3327
+ `the attribute would not have changed.`);
3328
+ }
3329
+ // Track if the property is being reflected to avoid
3330
+ // setting the property again via `attributeChangedCallback`. Note:
3331
+ // 1. this takes advantage of the fact that the callback is synchronous.
3332
+ // 2. will behave incorrectly if multiple attributes are in the reaction
3333
+ // stack at time of calling. However, since we process attributes
3334
+ // in `update` this should not be possible (or an extreme corner case
3335
+ // that we'd like to discover).
3336
+ // mark state reflecting
3337
+ this.__reflectingProperty = name;
3338
+ if (attrValue == null) {
3339
+ this.removeAttribute(attr);
3340
+ }
3341
+ else {
3342
+ this.setAttribute(attr, attrValue);
3343
+ }
3344
+ // mark state not reflecting
3345
+ this.__reflectingProperty = null;
3346
+ }
3347
+ }
3348
+ /** @internal */
3349
+ _$attributeToProperty(name, value) {
3350
+ const ctor = this.constructor;
3351
+ // Note, hint this as an `AttributeMap` so closure clearly understands
3352
+ // the type; it has issues with tracking types through statics
3353
+ const propName = ctor.__attributeToPropertyMap.get(name);
3354
+ // Use tracking info to avoid reflecting a property value to an attribute
3355
+ // if it was just set because the attribute changed.
3356
+ if (propName !== undefined && this.__reflectingProperty !== propName) {
3357
+ const options = ctor.getPropertyOptions(propName);
3358
+ const converter = typeof options.converter === 'function'
3359
+ ? { fromAttribute: options.converter }
3360
+ : options.converter?.fromAttribute !== undefined
3361
+ ? options.converter
3362
+ : defaultConverter;
3363
+ // mark state reflecting
3364
+ this.__reflectingProperty = propName;
3365
+ this[propName] = converter.fromAttribute(value, options.type
3366
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
3367
+ );
3368
+ // mark state not reflecting
3369
+ this.__reflectingProperty = null;
3370
+ }
3371
+ }
3372
+ /**
3373
+ * Requests an update which is processed asynchronously. This should be called
3374
+ * when an element should update based on some state not triggered by setting
3375
+ * a reactive property. In this case, pass no arguments. It should also be
3376
+ * called when manually implementing a property setter. In this case, pass the
3377
+ * property `name` and `oldValue` to ensure that any configured property
3378
+ * options are honored.
3379
+ *
3380
+ * @param name name of requesting property
3381
+ * @param oldValue old value of requesting property
3382
+ * @param options property options to use instead of the previously
3383
+ * configured options
3384
+ * @category updates
3385
+ */
3386
+ requestUpdate(name, oldValue, options) {
3387
+ // If we have a property key, perform property update steps.
3388
+ if (name !== undefined) {
3389
+ if (name instanceof Event) {
3390
+ issueWarning$3(``, `The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()`);
3391
+ }
3392
+ options ??= this.constructor.getPropertyOptions(name);
3393
+ const hasChanged = options.hasChanged ?? notEqual;
3394
+ const newValue = this[name];
3395
+ if (hasChanged(newValue, oldValue)) {
3396
+ this._$changeProperty(name, oldValue, options);
3397
+ }
3398
+ else {
3399
+ // Abort the request if the property should not be considered changed.
3400
+ return;
3401
+ }
3402
+ }
3403
+ if (this.isUpdatePending === false) {
3404
+ this.__updatePromise = this.__enqueueUpdate();
3405
+ }
3406
+ }
3407
+ /**
3408
+ * @internal
3409
+ */
3410
+ _$changeProperty(name, oldValue, options) {
3411
+ // TODO (justinfagnani): Create a benchmark of Map.has() + Map.set(
3412
+ // vs just Map.set()
3413
+ if (!this._$changedProperties.has(name)) {
3414
+ this._$changedProperties.set(name, oldValue);
3415
+ }
3416
+ // Add to reflecting properties set.
3417
+ // Note, it's important that every change has a chance to add the
3418
+ // property to `__reflectingProperties`. This ensures setting
3419
+ // attribute + property reflects correctly.
3420
+ if (options.reflect === true && this.__reflectingProperty !== name) {
3421
+ (this.__reflectingProperties ??= new Set()).add(name);
3422
+ }
3423
+ }
3424
+ /**
3425
+ * Sets up the element to asynchronously update.
3426
+ */
3427
+ async __enqueueUpdate() {
3428
+ this.isUpdatePending = true;
3429
+ try {
3430
+ // Ensure any previous update has resolved before updating.
3431
+ // This `await` also ensures that property changes are batched.
3432
+ await this.__updatePromise;
3433
+ }
3434
+ catch (e) {
3435
+ // Refire any previous errors async so they do not disrupt the update
3436
+ // cycle. Errors are refired so developers have a chance to observe
3437
+ // them, and this can be done by implementing
3438
+ // `window.onunhandledrejection`.
3439
+ Promise.reject(e);
3440
+ }
3441
+ const result = this.scheduleUpdate();
3442
+ // If `scheduleUpdate` returns a Promise, we await it. This is done to
3443
+ // enable coordinating updates with a scheduler. Note, the result is
3444
+ // checked to avoid delaying an additional microtask unless we need to.
3445
+ if (result != null) {
3446
+ await result;
3447
+ }
3448
+ return !this.isUpdatePending;
3449
+ }
3450
+ /**
3451
+ * Schedules an element update. You can override this method to change the
3452
+ * timing of updates by returning a Promise. The update will await the
3453
+ * returned Promise, and you should resolve the Promise to allow the update
3454
+ * to proceed. If this method is overridden, `super.scheduleUpdate()`
3455
+ * must be called.
3456
+ *
3457
+ * For instance, to schedule updates to occur just before the next frame:
3458
+ *
3459
+ * ```ts
3460
+ * override protected async scheduleUpdate(): Promise<unknown> {
3461
+ * await new Promise((resolve) => requestAnimationFrame(() => resolve()));
3462
+ * super.scheduleUpdate();
3463
+ * }
3464
+ * ```
3465
+ * @category updates
3466
+ */
3467
+ scheduleUpdate() {
3468
+ const result = this.performUpdate();
3469
+ if (this.constructor.enabledWarnings.includes('async-perform-update') &&
3470
+ typeof result?.then ===
3471
+ 'function') {
3472
+ issueWarning$3('async-perform-update', `Element ${this.localName} returned a Promise from performUpdate(). ` +
3473
+ `This behavior is deprecated and will be removed in a future ` +
3474
+ `version of ReactiveElement.`);
3475
+ }
3476
+ return result;
3477
+ }
3478
+ /**
3479
+ * Performs an element update. Note, if an exception is thrown during the
3480
+ * update, `firstUpdated` and `updated` will not be called.
3481
+ *
3482
+ * Call `performUpdate()` to immediately process a pending update. This should
3483
+ * generally not be needed, but it can be done in rare cases when you need to
3484
+ * update synchronously.
3485
+ *
3486
+ * @category updates
3487
+ */
3488
+ performUpdate() {
3489
+ // Abort any update if one is not pending when this is called.
3490
+ // This can happen if `performUpdate` is called early to "flush"
3491
+ // the update.
3492
+ if (!this.isUpdatePending) {
3493
+ return;
3494
+ }
3495
+ debugLogEvent?.({ kind: 'update' });
3496
+ if (!this.hasUpdated) {
3497
+ // Create renderRoot before first update. This occurs in `connectedCallback`
3498
+ // but is done here to support out of tree calls to `enableUpdating`/`performUpdate`.
3499
+ this.renderRoot ??=
3500
+ this.createRenderRoot();
3501
+ {
3502
+ // Produce warning if any reactive properties on the prototype are
3503
+ // shadowed by class fields. Instance fields set before upgrade are
3504
+ // deleted by this point, so any own property is caused by class field
3505
+ // initialization in the constructor.
3506
+ const ctor = this.constructor;
3507
+ const shadowedProperties = [...ctor.elementProperties.keys()].filter((p) => this.hasOwnProperty(p) && p in getPrototypeOf(this));
3508
+ if (shadowedProperties.length) {
3509
+ throw new Error(`The following properties on element ${this.localName} will not ` +
3510
+ `trigger updates as expected because they are set using class ` +
3511
+ `fields: ${shadowedProperties.join(', ')}. ` +
3512
+ `Native class fields and some compiled output will overwrite ` +
3513
+ `accessors used for detecting changes. See ` +
3514
+ `https://lit.dev/msg/class-field-shadowing ` +
3515
+ `for more information.`);
3516
+ }
3517
+ }
3518
+ // Mixin instance properties once, if they exist.
3519
+ if (this.__instanceProperties) {
3520
+ // TODO (justinfagnani): should we use the stored value? Could a new value
3521
+ // have been set since we stored the own property value?
3522
+ for (const [p, value] of this.__instanceProperties) {
3523
+ this[p] = value;
3524
+ }
3525
+ this.__instanceProperties = undefined;
3526
+ }
3527
+ // Trigger initial value reflection and populate the initial
3528
+ // changedProperties map, but only for the case of experimental
3529
+ // decorators on accessors, which will not have already populated the
3530
+ // changedProperties map. We can't know if these accessors had
3531
+ // initializers, so we just set them anyway - a difference from
3532
+ // experimental decorators on fields and standard decorators on
3533
+ // auto-accessors.
3534
+ // For context why experimentalDecorators with auto accessors are handled
3535
+ // specifically also see:
3536
+ // https://github.com/lit/lit/pull/4183#issuecomment-1711959635
3537
+ const elementProperties = this.constructor
3538
+ .elementProperties;
3539
+ if (elementProperties.size > 0) {
3540
+ for (const [p, options] of elementProperties) {
3541
+ if (options.wrapped === true &&
3542
+ !this._$changedProperties.has(p) &&
3543
+ this[p] !== undefined) {
3544
+ this._$changeProperty(p, this[p], options);
3545
+ }
3546
+ }
3547
+ }
3548
+ }
3549
+ let shouldUpdate = false;
3550
+ const changedProperties = this._$changedProperties;
3551
+ try {
3552
+ shouldUpdate = this.shouldUpdate(changedProperties);
3553
+ if (shouldUpdate) {
3554
+ this.willUpdate(changedProperties);
3555
+ this.__controllers?.forEach((c) => c.hostUpdate?.());
3556
+ this.update(changedProperties);
3557
+ }
3558
+ else {
3559
+ this.__markUpdated();
3560
+ }
3561
+ }
3562
+ catch (e) {
3563
+ // Prevent `firstUpdated` and `updated` from running when there's an
3564
+ // update exception.
3565
+ shouldUpdate = false;
3566
+ // Ensure element can accept additional updates after an exception.
3567
+ this.__markUpdated();
3568
+ throw e;
3569
+ }
3570
+ // The update is no longer considered pending and further updates are now allowed.
3571
+ if (shouldUpdate) {
3572
+ this._$didUpdate(changedProperties);
3573
+ }
3574
+ }
3575
+ /**
3576
+ * Invoked before `update()` to compute values needed during the update.
3577
+ *
3578
+ * Implement `willUpdate` to compute property values that depend on other
3579
+ * properties and are used in the rest of the update process.
3580
+ *
3581
+ * ```ts
3582
+ * willUpdate(changedProperties) {
3583
+ * // only need to check changed properties for an expensive computation.
3584
+ * if (changedProperties.has('firstName') || changedProperties.has('lastName')) {
3585
+ * this.sha = computeSHA(`${this.firstName} ${this.lastName}`);
3586
+ * }
3587
+ * }
3588
+ *
3589
+ * render() {
3590
+ * return html`SHA: ${this.sha}`;
3591
+ * }
3592
+ * ```
3593
+ *
3594
+ * @category updates
3595
+ */
3596
+ willUpdate(_changedProperties) { }
3597
+ // Note, this is an override point for polyfill-support.
3598
+ // @internal
3599
+ _$didUpdate(changedProperties) {
3600
+ this.__controllers?.forEach((c) => c.hostUpdated?.());
3601
+ if (!this.hasUpdated) {
3602
+ this.hasUpdated = true;
3603
+ this.firstUpdated(changedProperties);
3604
+ }
3605
+ this.updated(changedProperties);
3606
+ if (this.isUpdatePending &&
3607
+ this.constructor.enabledWarnings.includes('change-in-update')) {
3608
+ issueWarning$3('change-in-update', `Element ${this.localName} scheduled an update ` +
3609
+ `(generally because a property was set) ` +
3610
+ `after an update completed, causing a new update to be scheduled. ` +
3611
+ `This is inefficient and should be avoided unless the next update ` +
3612
+ `can only be scheduled as a side effect of the previous update.`);
3613
+ }
3614
+ }
3615
+ __markUpdated() {
3616
+ this._$changedProperties = new Map();
3617
+ this.isUpdatePending = false;
3618
+ }
3619
+ /**
3620
+ * Returns a Promise that resolves when the element has completed updating.
3621
+ * The Promise value is a boolean that is `true` if the element completed the
3622
+ * update without triggering another update. The Promise result is `false` if
3623
+ * a property was set inside `updated()`. If the Promise is rejected, an
3624
+ * exception was thrown during the update.
3625
+ *
3626
+ * To await additional asynchronous work, override the `getUpdateComplete`
3627
+ * method. For example, it is sometimes useful to await a rendered element
3628
+ * before fulfilling this Promise. To do this, first await
3629
+ * `super.getUpdateComplete()`, then any subsequent state.
3630
+ *
3631
+ * @return A promise of a boolean that resolves to true if the update completed
3632
+ * without triggering another update.
3633
+ * @category updates
3634
+ */
3635
+ get updateComplete() {
3636
+ return this.getUpdateComplete();
3637
+ }
3638
+ /**
3639
+ * Override point for the `updateComplete` promise.
3640
+ *
3641
+ * It is not safe to override the `updateComplete` getter directly due to a
3642
+ * limitation in TypeScript which means it is not possible to call a
3643
+ * superclass getter (e.g. `super.updateComplete.then(...)`) when the target
3644
+ * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).
3645
+ * This method should be overridden instead. For example:
3646
+ *
3647
+ * ```ts
3648
+ * class MyElement extends LitElement {
3649
+ * override async getUpdateComplete() {
3650
+ * const result = await super.getUpdateComplete();
3651
+ * await this._myChild.updateComplete;
3652
+ * return result;
3653
+ * }
3654
+ * }
3655
+ * ```
3656
+ *
3657
+ * @return A promise of a boolean that resolves to true if the update completed
3658
+ * without triggering another update.
3659
+ * @category updates
3660
+ */
3661
+ getUpdateComplete() {
3662
+ return this.__updatePromise;
3663
+ }
3664
+ /**
3665
+ * Controls whether or not `update()` should be called when the element requests
3666
+ * an update. By default, this method always returns `true`, but this can be
3667
+ * customized to control when to update.
3668
+ *
3669
+ * @param _changedProperties Map of changed properties with old values
3670
+ * @category updates
3671
+ */
3672
+ shouldUpdate(_changedProperties) {
3673
+ return true;
3674
+ }
3675
+ /**
3676
+ * Updates the element. This method reflects property values to attributes.
3677
+ * It can be overridden to render and keep updated element DOM.
3678
+ * Setting properties inside this method will *not* trigger
3679
+ * another update.
3680
+ *
3681
+ * @param _changedProperties Map of changed properties with old values
3682
+ * @category updates
3683
+ */
3684
+ update(_changedProperties) {
3685
+ // The forEach() expression will only run when when __reflectingProperties is
3686
+ // defined, and it returns undefined, setting __reflectingProperties to
3687
+ // undefined
3688
+ this.__reflectingProperties &&= this.__reflectingProperties.forEach((p) => this.__propertyToAttribute(p, this[p]));
3689
+ this.__markUpdated();
3690
+ }
3691
+ /**
3692
+ * Invoked whenever the element is updated. Implement to perform
3693
+ * post-updating tasks via DOM APIs, for example, focusing an element.
3694
+ *
3695
+ * Setting properties inside this method will trigger the element to update
3696
+ * again after this update cycle completes.
3697
+ *
3698
+ * @param _changedProperties Map of changed properties with old values
3699
+ * @category updates
3700
+ */
3701
+ updated(_changedProperties) { }
3702
+ /**
3703
+ * Invoked when the element is first updated. Implement to perform one time
3704
+ * work on the element after update.
3705
+ *
3706
+ * ```ts
3707
+ * firstUpdated() {
3708
+ * this.renderRoot.getElementById('my-text-area').focus();
3709
+ * }
3710
+ * ```
3711
+ *
3712
+ * Setting properties inside this method will trigger the element to update
3713
+ * again after this update cycle completes.
3714
+ *
3715
+ * @param _changedProperties Map of changed properties with old values
3716
+ * @category updates
3717
+ */
3718
+ firstUpdated(_changedProperties) { }
3719
+ }
3720
+ /**
3721
+ * Memoized list of all element styles.
3722
+ * Created lazily on user subclasses when finalizing the class.
3723
+ * @nocollapse
3724
+ * @category styles
3725
+ */
3726
+ ReactiveElement.elementStyles = [];
3727
+ /**
3728
+ * Options used when calling `attachShadow`. Set this property to customize
3729
+ * the options for the shadowRoot; for example, to create a closed
3730
+ * shadowRoot: `{mode: 'closed'}`.
3731
+ *
3732
+ * Note, these options are used in `createRenderRoot`. If this method
3733
+ * is customized, options should be respected if possible.
3734
+ * @nocollapse
3735
+ * @category rendering
3736
+ */
3737
+ ReactiveElement.shadowRootOptions = { mode: 'open' };
3738
+ // Assigned here to work around a jscompiler bug with static fields
3739
+ // when compiling to ES5.
3740
+ // https://github.com/google/closure-compiler/issues/3177
3741
+ ReactiveElement[JSCompiler_renameProperty$1('elementProperties')] = new Map();
3742
+ ReactiveElement[JSCompiler_renameProperty$1('finalized')] = new Map();
3743
+ // Apply polyfills if available
3744
+ polyfillSupport$1?.({ ReactiveElement });
3745
+ // Dev mode warnings...
3746
+ {
3747
+ // Default warning set.
3748
+ ReactiveElement.enabledWarnings = [
3749
+ 'change-in-update',
3750
+ 'async-perform-update',
3751
+ ];
3752
+ const ensureOwnWarnings = function (ctor) {
3753
+ if (!ctor.hasOwnProperty(JSCompiler_renameProperty$1('enabledWarnings'))) {
3754
+ ctor.enabledWarnings = ctor.enabledWarnings.slice();
3755
+ }
3756
+ };
3757
+ ReactiveElement.enableWarning = function (warning) {
3758
+ ensureOwnWarnings(this);
3759
+ if (!this.enabledWarnings.includes(warning)) {
3760
+ this.enabledWarnings.push(warning);
3761
+ }
3762
+ };
3763
+ ReactiveElement.disableWarning = function (warning) {
3764
+ ensureOwnWarnings(this);
3765
+ const i = this.enabledWarnings.indexOf(warning);
3766
+ if (i >= 0) {
3767
+ this.enabledWarnings.splice(i, 1);
3768
+ }
3769
+ };
3770
+ }
3771
+ // IMPORTANT: do not change the property name or the assignment expression.
3772
+ // This line will be used in regexes to search for ReactiveElement usage.
3773
+ (global.reactiveElementVersions ??= []).push('2.0.4');
3774
+ if (global.reactiveElementVersions.length > 1) {
3775
+ issueWarning$3('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` +
3776
+ `is not recommended.`);
3777
+ }
3778
+
3779
+ /**
3780
+ * @license
3781
+ * Copyright 2017 Google LLC
3782
+ * SPDX-License-Identifier: BSD-3-Clause
3783
+ */
3784
+ /*
3785
+ * When using Closure Compiler, JSCompiler_renameProperty(property, object) is
3786
+ * replaced at compile time by the munged name for object[property]. We cannot
3787
+ * alias this function, so we have to use a small shim that has the same
3788
+ * behavior when not compiling.
3789
+ */
3790
+ /*@__INLINE__*/
3791
+ const JSCompiler_renameProperty = (prop, _obj) => prop;
3792
+ let issueWarning$2;
3793
+ {
3794
+ // Ensure warnings are issued only 1x, even if multiple versions of Lit
3795
+ // are loaded.
3796
+ const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set());
3797
+ // Issue a warning, if we haven't already.
3798
+ issueWarning$2 = (code, warning) => {
3799
+ warning += ` See https://lit.dev/msg/${code} for more information.`;
3800
+ if (!issuedWarnings.has(warning)) {
3801
+ console.warn(warning);
3802
+ issuedWarnings.add(warning);
3803
+ }
3804
+ };
3805
+ }
3806
+ /**
3807
+ * Base element class that manages element properties and attributes, and
3808
+ * renders a lit-html template.
3809
+ *
3810
+ * To define a component, subclass `LitElement` and implement a
3811
+ * `render` method to provide the component's template. Define properties
3812
+ * using the {@linkcode LitElement.properties properties} property or the
3813
+ * {@linkcode property} decorator.
3814
+ */
3815
+ class LitElement extends ReactiveElement {
3816
+ constructor() {
3817
+ super(...arguments);
3818
+ /**
3819
+ * @category rendering
3820
+ */
3821
+ this.renderOptions = { host: this };
3822
+ this.__childPart = undefined;
3823
+ }
3824
+ /**
3825
+ * @category rendering
3826
+ */
3827
+ createRenderRoot() {
3828
+ const renderRoot = super.createRenderRoot();
3829
+ // When adoptedStyleSheets are shimmed, they are inserted into the
3830
+ // shadowRoot by createRenderRoot. Adjust the renderBefore node so that
3831
+ // any styles in Lit content render before adoptedStyleSheets. This is
3832
+ // important so that adoptedStyleSheets have precedence over styles in
3833
+ // the shadowRoot.
3834
+ this.renderOptions.renderBefore ??= renderRoot.firstChild;
3835
+ return renderRoot;
3836
+ }
3837
+ /**
3838
+ * Updates the element. This method reflects property values to attributes
3839
+ * and calls `render` to render DOM via lit-html. Setting properties inside
3840
+ * this method will *not* trigger another update.
3841
+ * @param changedProperties Map of changed properties with old values
3842
+ * @category updates
3843
+ */
3844
+ update(changedProperties) {
3845
+ // Setting properties in `render` should not trigger an update. Since
3846
+ // updates are allowed after super.update, it's important to call `render`
3847
+ // before that.
3848
+ const value = this.render();
3849
+ if (!this.hasUpdated) {
3850
+ this.renderOptions.isConnected = this.isConnected;
3851
+ }
3852
+ super.update(changedProperties);
3853
+ this.__childPart = render(value, this.renderRoot, this.renderOptions);
3854
+ }
3855
+ /**
3856
+ * Invoked when the component is added to the document's DOM.
3857
+ *
3858
+ * In `connectedCallback()` you should setup tasks that should only occur when
3859
+ * the element is connected to the document. The most common of these is
3860
+ * adding event listeners to nodes external to the element, like a keydown
3861
+ * event handler added to the window.
3862
+ *
3863
+ * ```ts
3864
+ * connectedCallback() {
3865
+ * super.connectedCallback();
3866
+ * addEventListener('keydown', this._handleKeydown);
3867
+ * }
3868
+ * ```
3869
+ *
3870
+ * Typically, anything done in `connectedCallback()` should be undone when the
3871
+ * element is disconnected, in `disconnectedCallback()`.
3872
+ *
3873
+ * @category lifecycle
3874
+ */
3875
+ connectedCallback() {
3876
+ super.connectedCallback();
3877
+ this.__childPart?.setConnected(true);
3878
+ }
3879
+ /**
3880
+ * Invoked when the component is removed from the document's DOM.
3881
+ *
3882
+ * This callback is the main signal to the element that it may no longer be
3883
+ * used. `disconnectedCallback()` should ensure that nothing is holding a
3884
+ * reference to the element (such as event listeners added to nodes external
3885
+ * to the element), so that it is free to be garbage collected.
3886
+ *
3887
+ * ```ts
3888
+ * disconnectedCallback() {
3889
+ * super.disconnectedCallback();
3890
+ * window.removeEventListener('keydown', this._handleKeydown);
3891
+ * }
3892
+ * ```
3893
+ *
3894
+ * An element may be re-connected after being disconnected.
3895
+ *
3896
+ * @category lifecycle
3897
+ */
3898
+ disconnectedCallback() {
3899
+ super.disconnectedCallback();
3900
+ this.__childPart?.setConnected(false);
3901
+ }
3902
+ /**
3903
+ * Invoked on each update to perform rendering tasks. This method may return
3904
+ * any value renderable by lit-html's `ChildPart` - typically a
3905
+ * `TemplateResult`. Setting properties inside this method will *not* trigger
3906
+ * the element to update.
3907
+ * @category rendering
3908
+ */
3909
+ render() {
3910
+ return noChange;
3911
+ }
3912
+ }
3913
+ // This property needs to remain unminified.
3914
+ LitElement['_$litElement$'] = true;
3915
+ /**
3916
+ * Ensure this class is marked as `finalized` as an optimization ensuring
3917
+ * it will not needlessly try to `finalize`.
3918
+ *
3919
+ * Note this property name is a string to prevent breaking Closure JS Compiler
3920
+ * optimizations. See @lit/reactive-element for more information.
3921
+ */
3922
+ LitElement[JSCompiler_renameProperty('finalized')] = true;
3923
+ // Install hydration if available
3924
+ globalThis.litElementHydrateSupport?.({ LitElement });
3925
+ // Apply polyfills if available
3926
+ const polyfillSupport = globalThis.litElementPolyfillSupportDevMode
3927
+ ;
3928
+ polyfillSupport?.({ LitElement });
3929
+ // IMPORTANT: do not change the property name or the assignment expression.
3930
+ // This line will be used in regexes to search for LitElement usage.
3931
+ (globalThis.litElementVersions ??= []).push('4.1.0');
3932
+ if (globalThis.litElementVersions.length > 1) {
3933
+ issueWarning$2('multiple-versions', `Multiple versions of Lit loaded. Loading multiple versions ` +
3934
+ `is not recommended.`);
3935
+ }
3936
+
3937
+ /**
3938
+ * @license
3939
+ * Copyright 2020 Google LLC
3940
+ * SPDX-License-Identifier: BSD-3-Clause
3941
+ */
3942
+ /**
3943
+ * Prevents JSON injection attacks.
3944
+ *
3945
+ * The goals of this brand:
3946
+ * 1) fast to check
3947
+ * 2) code is small on the wire
3948
+ * 3) multiple versions of Lit in a single page will all produce mutually
3949
+ * interoperable StaticValues
3950
+ * 4) normal JSON.parse (without an unusual reviver) can not produce a
3951
+ * StaticValue
3952
+ *
3953
+ * Symbols satisfy (1), (2), and (4). We use Symbol.for to satisfy (3), but
3954
+ * we don't care about the key, so we break ties via (2) and use the empty
3955
+ * string.
3956
+ */
3957
+ const brand = Symbol.for('');
3958
+ /** Safely extracts the string part of a StaticValue. */
3959
+ const unwrapStaticValue = (value) => {
3960
+ if (value?.r !== brand) {
3961
+ return undefined;
3962
+ }
3963
+ return value?.['_$litStatic$'];
3964
+ };
3965
+ const textFromStatic = (value) => {
3966
+ if (value['_$litStatic$'] !== undefined) {
3967
+ return value['_$litStatic$'];
3968
+ }
3969
+ else {
3970
+ throw new Error(`Value passed to 'literal' function must be a 'literal' result: ${value}. Use 'unsafeStatic' to pass non-literal values, but
3971
+ take care to ensure page security.`);
3972
+ }
3973
+ };
3974
+ /**
3975
+ * Tags a string literal so that it behaves like part of the static template
3976
+ * strings instead of a dynamic value.
3977
+ *
3978
+ * The only values that may be used in template expressions are other tagged
3979
+ * `literal` results or `unsafeStatic` values (note that untrusted content
3980
+ * should never be passed to `unsafeStatic`).
3981
+ *
3982
+ * Users must take care to ensure that adding the static string to the template
3983
+ * results in well-formed HTML, or else templates may break unexpectedly.
3984
+ *
3985
+ * Static values can be changed, but they will cause a complete re-render since
3986
+ * they effectively create a new template.
3987
+ */
3988
+ const literal = (strings, ...values) => ({
3989
+ ['_$litStatic$']: values.reduce((acc, v, idx) => acc + textFromStatic(v) + strings[idx + 1], strings[0]),
3990
+ r: brand,
3991
+ });
3992
+ const stringsCache = new Map();
3993
+ /**
3994
+ * Wraps a lit-html template tag (`html` or `svg`) to add static value support.
3995
+ */
3996
+ const withStatic = (coreTag) => (strings, ...values) => {
3997
+ const l = values.length;
3998
+ let staticValue;
3999
+ let dynamicValue;
4000
+ const staticStrings = [];
4001
+ const dynamicValues = [];
4002
+ let i = 0;
4003
+ let hasStatics = false;
4004
+ let s;
4005
+ while (i < l) {
4006
+ s = strings[i];
4007
+ // Collect any unsafeStatic values, and their following template strings
4008
+ // so that we treat a run of template strings and unsafe static values as
4009
+ // a single template string.
4010
+ while (i < l &&
4011
+ ((dynamicValue = values[i]),
4012
+ (staticValue = unwrapStaticValue(dynamicValue))) !== undefined) {
4013
+ s += staticValue + strings[++i];
4014
+ hasStatics = true;
4015
+ }
4016
+ // If the last value is static, we don't need to push it.
4017
+ if (i !== l) {
4018
+ dynamicValues.push(dynamicValue);
4019
+ }
4020
+ staticStrings.push(s);
4021
+ i++;
4022
+ }
4023
+ // If the last value isn't static (which would have consumed the last
4024
+ // string), then we need to add the last string.
4025
+ if (i === l) {
4026
+ staticStrings.push(strings[l]);
4027
+ }
4028
+ if (hasStatics) {
4029
+ const key = staticStrings.join('$$lit$$');
4030
+ strings = stringsCache.get(key);
4031
+ if (strings === undefined) {
4032
+ // Beware: in general this pattern is unsafe, and doing so may bypass
4033
+ // lit's security checks and allow an attacker to execute arbitrary
4034
+ // code and inject arbitrary content.
4035
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4036
+ staticStrings.raw = staticStrings;
4037
+ stringsCache.set(key, (strings = staticStrings));
4038
+ }
4039
+ values = dynamicValues;
4040
+ }
4041
+ return coreTag(strings, ...values);
4042
+ };
4043
+ /**
4044
+ * Interprets a template literal as an HTML template that can efficiently
4045
+ * render to and update a container.
4046
+ *
4047
+ * Includes static value support from `lit-html/static.js`.
4048
+ */
4049
+ const html = withStatic(html$1);
4050
+
4051
+ /**
4052
+ * @license
4053
+ * Copyright 2017 Google LLC
4054
+ * SPDX-License-Identifier: BSD-3-Clause
4055
+ */
4056
+ let issueWarning$1;
4057
+ {
4058
+ // Ensure warnings are issued only 1x, even if multiple versions of Lit
4059
+ // are loaded.
4060
+ const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set());
4061
+ // Issue a warning, if we haven't already.
4062
+ issueWarning$1 = (code, warning) => {
4063
+ warning += ` See https://lit.dev/msg/${code} for more information.`;
4064
+ if (!issuedWarnings.has(warning)) {
4065
+ console.warn(warning);
4066
+ issuedWarnings.add(warning);
4067
+ }
4068
+ };
4069
+ }
4070
+ const legacyProperty = (options, proto, name) => {
4071
+ const hasOwnProperty = proto.hasOwnProperty(name);
4072
+ proto.constructor.createProperty(name, hasOwnProperty ? { ...options, wrapped: true } : options);
4073
+ // For accessors (which have a descriptor on the prototype) we need to
4074
+ // return a descriptor, otherwise TypeScript overwrites the descriptor we
4075
+ // define in createProperty() with the original descriptor. We don't do this
4076
+ // for fields, which don't have a descriptor, because this could overwrite
4077
+ // descriptor defined by other decorators.
4078
+ return hasOwnProperty
4079
+ ? Object.getOwnPropertyDescriptor(proto, name)
4080
+ : undefined;
4081
+ };
4082
+ // This is duplicated from a similar variable in reactive-element.ts, but
4083
+ // actually makes sense to have this default defined with the decorator, so
4084
+ // that different decorators could have different defaults.
4085
+ const defaultPropertyDeclaration = {
4086
+ attribute: true,
4087
+ type: String,
4088
+ converter: defaultConverter$1,
4089
+ reflect: false,
4090
+ hasChanged: notEqual$1,
4091
+ };
4092
+ /**
4093
+ * Wraps a class accessor or setter so that `requestUpdate()` is called with the
4094
+ * property name and old value when the accessor is set.
4095
+ */
4096
+ const standardProperty = (options = defaultPropertyDeclaration, target, context) => {
4097
+ const { kind, metadata } = context;
4098
+ if (metadata == null) {
4099
+ issueWarning$1('missing-class-metadata', `The class ${target} is missing decorator metadata. This ` +
4100
+ `could mean that you're using a compiler that supports decorators ` +
4101
+ `but doesn't support decorator metadata, such as TypeScript 5.1. ` +
4102
+ `Please update your compiler.`);
4103
+ }
4104
+ // Store the property options
4105
+ let properties = globalThis.litPropertyMetadata.get(metadata);
4106
+ if (properties === undefined) {
4107
+ globalThis.litPropertyMetadata.set(metadata, (properties = new Map()));
4108
+ }
4109
+ properties.set(context.name, options);
4110
+ if (kind === 'accessor') {
4111
+ // Standard decorators cannot dynamically modify the class, so we can't
4112
+ // replace a field with accessors. The user must use the new `accessor`
4113
+ // keyword instead.
4114
+ const { name } = context;
4115
+ return {
4116
+ set(v) {
4117
+ const oldValue = target.get.call(this);
4118
+ target.set.call(this, v);
4119
+ this.requestUpdate(name, oldValue, options);
4120
+ },
4121
+ init(v) {
4122
+ if (v !== undefined) {
4123
+ this._$changeProperty(name, undefined, options);
4124
+ }
4125
+ return v;
4126
+ },
4127
+ };
4128
+ }
4129
+ else if (kind === 'setter') {
4130
+ const { name } = context;
4131
+ return function (value) {
4132
+ const oldValue = this[name];
4133
+ target.call(this, value);
4134
+ this.requestUpdate(name, oldValue, options);
4135
+ };
4136
+ }
4137
+ throw new Error(`Unsupported decorator location: ${kind}`);
4138
+ };
4139
+ /**
4140
+ * A class field or accessor decorator which creates a reactive property that
4141
+ * reflects a corresponding attribute value. When a decorated property is set
4142
+ * the element will update and render. A {@linkcode PropertyDeclaration} may
4143
+ * optionally be supplied to configure property features.
4144
+ *
4145
+ * This decorator should only be used for public fields. As public fields,
4146
+ * properties should be considered as primarily settable by element users,
4147
+ * either via attribute or the property itself.
4148
+ *
4149
+ * Generally, properties that are changed by the element should be private or
4150
+ * protected fields and should use the {@linkcode state} decorator.
4151
+ *
4152
+ * However, sometimes element code does need to set a public property. This
4153
+ * should typically only be done in response to user interaction, and an event
4154
+ * should be fired informing the user; for example, a checkbox sets its
4155
+ * `checked` property when clicked and fires a `changed` event. Mutating public
4156
+ * properties should typically not be done for non-primitive (object or array)
4157
+ * properties. In other cases when an element needs to manage state, a private
4158
+ * property decorated via the {@linkcode state} decorator should be used. When
4159
+ * needed, state properties can be initialized via public properties to
4160
+ * facilitate complex interactions.
4161
+ *
4162
+ * ```ts
4163
+ * class MyElement {
4164
+ * @property({ type: Boolean })
4165
+ * clicked = false;
4166
+ * }
4167
+ * ```
4168
+ * @category Decorator
4169
+ * @ExportDecoratedItems
4170
+ */
4171
+ function property(options) {
4172
+ return (protoOrTarget, nameOrContext
4173
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4174
+ ) => {
4175
+ return (typeof nameOrContext === 'object'
4176
+ ? standardProperty(options, protoOrTarget, nameOrContext)
4177
+ : legacyProperty(options, protoOrTarget, nameOrContext));
4178
+ };
4179
+ }
4180
+
4181
+ /**
4182
+ * @license
4183
+ * Copyright 2017 Google LLC
4184
+ * SPDX-License-Identifier: BSD-3-Clause
4185
+ */
4186
+ /**
4187
+ * Wraps up a few best practices when returning a property descriptor from a
4188
+ * decorator.
4189
+ *
4190
+ * Marks the defined property as configurable, and enumerable, and handles
4191
+ * the case where we have a busted Reflect.decorate zombiefill (e.g. in Angular
4192
+ * apps).
4193
+ *
4194
+ * @internal
4195
+ */
4196
+ const desc = (obj, name, descriptor) => {
4197
+ // For backwards compatibility, we keep them configurable and enumerable.
4198
+ descriptor.configurable = true;
4199
+ descriptor.enumerable = true;
4200
+ if (
4201
+ // We check for Reflect.decorate each time, in case the zombiefill
4202
+ // is applied via lazy loading some Angular code.
4203
+ Reflect.decorate &&
4204
+ typeof name !== 'object') {
4205
+ // If we're called as a legacy decorator, and Reflect.decorate is present
4206
+ // then we have no guarantees that the returned descriptor will be
4207
+ // defined on the class, so we must apply it directly ourselves.
4208
+ Object.defineProperty(obj, name, descriptor);
4209
+ }
4210
+ return descriptor;
4211
+ };
4212
+
4213
+ /**
4214
+ * @license
4215
+ * Copyright 2017 Google LLC
4216
+ * SPDX-License-Identifier: BSD-3-Clause
4217
+ */
4218
+ let issueWarning;
4219
+ {
4220
+ // Ensure warnings are issued only 1x, even if multiple versions of Lit
4221
+ // are loaded.
4222
+ const issuedWarnings = (globalThis.litIssuedWarnings ??= new Set());
4223
+ // Issue a warning, if we haven't already.
4224
+ issueWarning = (code, warning) => {
4225
+ warning += code
4226
+ ? ` See https://lit.dev/msg/${code} for more information.`
4227
+ : '';
4228
+ if (!issuedWarnings.has(warning)) {
4229
+ console.warn(warning);
4230
+ issuedWarnings.add(warning);
4231
+ }
4232
+ };
4233
+ }
4234
+ /**
4235
+ * A property decorator that converts a class property into a getter that
4236
+ * executes a querySelector on the element's renderRoot.
4237
+ *
4238
+ * @param selector A DOMString containing one or more selectors to match.
4239
+ * @param cache An optional boolean which when true performs the DOM query only
4240
+ * once and caches the result.
4241
+ *
4242
+ * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector
4243
+ *
4244
+ * ```ts
4245
+ * class MyElement {
4246
+ * @query('#first')
4247
+ * first: HTMLDivElement;
4248
+ *
4249
+ * render() {
4250
+ * return html`
4251
+ * <div id="first"></div>
4252
+ * <div id="second"></div>
4253
+ * `;
4254
+ * }
4255
+ * }
4256
+ * ```
4257
+ * @category Decorator
4258
+ */
4259
+ function query(selector, cache) {
4260
+ return ((protoOrTarget, nameOrContext, descriptor) => {
4261
+ const doQuery = (el) => {
4262
+ const result = (el.renderRoot?.querySelector(selector) ?? null);
4263
+ if (result === null && cache && !el.hasUpdated) {
4264
+ const name = typeof nameOrContext === 'object'
4265
+ ? nameOrContext.name
4266
+ : nameOrContext;
4267
+ issueWarning('', `@query'd field ${JSON.stringify(String(name))} with the 'cache' ` +
4268
+ `flag set for selector '${selector}' has been accessed before ` +
4269
+ `the first update and returned null. This is expected if the ` +
4270
+ `renderRoot tree has not been provided beforehand (e.g. via ` +
4271
+ `Declarative Shadow DOM). Therefore the value hasn't been cached.`);
4272
+ }
4273
+ // TODO: if we want to allow users to assert that the query will never
4274
+ // return null, we need a new option and to throw here if the result
4275
+ // is null.
4276
+ return result;
4277
+ };
4278
+ if (cache) {
4279
+ // Accessors to wrap from either:
4280
+ // 1. The decorator target, in the case of standard decorators
4281
+ // 2. The property descriptor, in the case of experimental decorators
4282
+ // on auto-accessors.
4283
+ // 3. Functions that access our own cache-key property on the instance,
4284
+ // in the case of experimental decorators on fields.
4285
+ const { get, set } = typeof nameOrContext === 'object'
4286
+ ? protoOrTarget
4287
+ : descriptor ??
4288
+ (() => {
4289
+ const key = Symbol(`${String(nameOrContext)} (@query() cache)`)
4290
+ ;
4291
+ return {
4292
+ get() {
4293
+ return this[key];
4294
+ },
4295
+ set(v) {
4296
+ this[key] = v;
4297
+ },
4298
+ };
4299
+ })();
4300
+ return desc(protoOrTarget, nameOrContext, {
4301
+ get() {
4302
+ let result = get.call(this);
4303
+ if (result === undefined) {
4304
+ result = doQuery(this);
4305
+ if (result !== null || this.hasUpdated) {
4306
+ set.call(this, result);
4307
+ }
4308
+ }
4309
+ return result;
4310
+ },
4311
+ });
4312
+ }
4313
+ else {
4314
+ // This object works as the return type for both standard and
4315
+ // experimental decorators.
4316
+ return desc(protoOrTarget, nameOrContext, {
4317
+ get() {
4318
+ return doQuery(this);
4319
+ },
4320
+ });
4321
+ }
4322
+ });
4323
+ }
4324
+
4325
+ /**
4326
+ * @license
4327
+ * Copyright 2017 Google LLC
4328
+ * SPDX-License-Identifier: BSD-3-Clause
4329
+ */
4330
+ /**
4331
+ * A property decorator that converts a class property into a getter that
4332
+ * returns the `assignedNodes` of the given `slot`.
4333
+ *
4334
+ * Can be passed an optional {@linkcode QueryAssignedNodesOptions} object.
4335
+ *
4336
+ * Example usage:
4337
+ * ```ts
4338
+ * class MyElement {
4339
+ * @queryAssignedNodes({slot: 'list', flatten: true})
4340
+ * listItems!: Array<Node>;
4341
+ *
4342
+ * render() {
4343
+ * return html`
4344
+ * <slot name="list"></slot>
4345
+ * `;
4346
+ * }
4347
+ * }
4348
+ * ```
4349
+ *
4350
+ * Note the type of this property should be annotated as `Array<Node>`. Use the
4351
+ * queryAssignedElements decorator to list only elements, and optionally filter
4352
+ * the element list using a CSS selector.
4353
+ *
4354
+ * @category Decorator
4355
+ */
4356
+ function queryAssignedNodes(options) {
4357
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4358
+ return ((obj, name) => {
4359
+ const { slot } = options ?? {};
4360
+ const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;
4361
+ return desc(obj, name, {
4362
+ get() {
4363
+ const slotEl = this.renderRoot?.querySelector(slotSelector);
4364
+ return (slotEl?.assignedNodes(options) ?? []);
4365
+ },
4366
+ });
4367
+ });
4368
+ }
4369
+
4370
+ /**
4371
+ * @license
4372
+ * Copyright 2017 Google LLC
4373
+ * SPDX-License-Identifier: BSD-3-Clause
4374
+ */
4375
+ const PartType = {
4376
+ ATTRIBUTE: 1,
4377
+ CHILD: 2,
4378
+ PROPERTY: 3,
4379
+ BOOLEAN_ATTRIBUTE: 4,
4380
+ EVENT: 5,
4381
+ ELEMENT: 6,
4382
+ };
4383
+ /**
4384
+ * Creates a user-facing directive function from a Directive class. This
4385
+ * function has the same parameters as the directive's render() method.
4386
+ */
4387
+ const directive = (c) => (...values) => ({
4388
+ // This property needs to remain unminified.
4389
+ ['_$litDirective$']: c,
4390
+ values,
4391
+ });
4392
+ /**
4393
+ * Base class for creating custom directives. Users should extend this class,
4394
+ * implement `render` and/or `update`, and then pass their subclass to
4395
+ * `directive`.
4396
+ */
4397
+ class Directive {
4398
+ constructor(_partInfo) { }
4399
+ // See comment in Disconnectable interface for why this is a getter
4400
+ get _$isConnected() {
4401
+ return this._$parent._$isConnected;
4402
+ }
4403
+ /** @internal */
4404
+ _$initialize(part, parent, attributeIndex) {
4405
+ this.__part = part;
4406
+ this._$parent = parent;
4407
+ this.__attributeIndex = attributeIndex;
4408
+ }
4409
+ /** @internal */
4410
+ _$resolve(part, props) {
4411
+ return this.update(part, props);
4412
+ }
4413
+ update(_part, props) {
4414
+ return this.render(...props);
4415
+ }
4416
+ }
4417
+
4418
+ /**
4419
+ * @license
4420
+ * Copyright 2018 Google LLC
4421
+ * SPDX-License-Identifier: BSD-3-Clause
4422
+ */
4423
+ class ClassMapDirective extends Directive {
4424
+ constructor(partInfo) {
4425
+ super(partInfo);
4426
+ if (partInfo.type !== PartType.ATTRIBUTE ||
4427
+ partInfo.name !== 'class' ||
4428
+ partInfo.strings?.length > 2) {
4429
+ throw new Error('`classMap()` can only be used in the `class` attribute ' +
4430
+ 'and must be the only part in the attribute.');
4431
+ }
4432
+ }
4433
+ render(classInfo) {
4434
+ // Add spaces to ensure separation from static classes
4435
+ return (' ' +
4436
+ Object.keys(classInfo)
4437
+ .filter((key) => classInfo[key])
4438
+ .join(' ') +
4439
+ ' ');
4440
+ }
4441
+ update(part, [classInfo]) {
4442
+ // Remember dynamic classes on the first render
4443
+ if (this._previousClasses === undefined) {
4444
+ this._previousClasses = new Set();
4445
+ if (part.strings !== undefined) {
4446
+ this._staticClasses = new Set(part.strings
4447
+ .join(' ')
4448
+ .split(/\s/)
4449
+ .filter((s) => s !== ''));
4450
+ }
4451
+ for (const name in classInfo) {
4452
+ if (classInfo[name] && !this._staticClasses?.has(name)) {
4453
+ this._previousClasses.add(name);
4454
+ }
4455
+ }
4456
+ return this.render(classInfo);
4457
+ }
4458
+ const classList = part.element.classList;
4459
+ // Remove old classes that no longer apply
4460
+ for (const name of this._previousClasses) {
4461
+ if (!(name in classInfo)) {
4462
+ classList.remove(name);
4463
+ this._previousClasses.delete(name);
4464
+ }
4465
+ }
4466
+ // Add or remove classes based on their classMap value
4467
+ for (const name in classInfo) {
4468
+ // We explicitly want a loose truthy check of `value` because it seems
4469
+ // more convenient that '' and 0 are skipped.
4470
+ const value = !!classInfo[name];
4471
+ if (value !== this._previousClasses.has(name) &&
4472
+ !this._staticClasses?.has(name)) {
4473
+ if (value) {
4474
+ classList.add(name);
4475
+ this._previousClasses.add(name);
4476
+ }
4477
+ else {
4478
+ classList.remove(name);
4479
+ this._previousClasses.delete(name);
4480
+ }
4481
+ }
4482
+ }
4483
+ return noChange;
4484
+ }
4485
+ }
4486
+ /**
4487
+ * A directive that applies dynamic CSS classes.
4488
+ *
4489
+ * This must be used in the `class` attribute and must be the only part used in
4490
+ * the attribute. It takes each property in the `classInfo` argument and adds
4491
+ * the property name to the element's `classList` if the property value is
4492
+ * truthy; if the property value is falsy, the property name is removed from
4493
+ * the element's `class`.
4494
+ *
4495
+ * For example `{foo: bar}` applies the class `foo` if the value of `bar` is
4496
+ * truthy.
4497
+ *
4498
+ * @param classInfo
4499
+ */
4500
+ const classMap = directive(ClassMapDirective);
4501
+
4502
+ var css_248z$8 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color-default);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-body);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}a[target=_blank]{align-items:center;display:flex;gap:var(--sgds-gap-2-xs)}::slotted(a[target=_blank]):after,a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.274 3.9H9.3a.6.6 0 0 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.361 6.41c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v5.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h5.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.469-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.274c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.524-.042-1.175-.042-1.993V9.274c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C7.805 3.9 8.456 3.9 9.274 3.9Zm3.626.6a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V5.949l-5.976 5.975a.6.6 0 0 1-.848-.848L18.05 5.1H13.5a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.274 3.9H9.3a.6.6 0 0 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.361 6.41c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v5.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h5.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.469-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.274c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.524-.042-1.175-.042-1.993V9.274c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C7.805 3.9 8.456 3.9 9.274 3.9Zm3.626.6a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V5.949l-5.976 5.975a.6.6 0 0 1-.848-.848L18.05 5.1H13.5a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;padding:0 .45em}::slotted(svg){vertical-align:middle}}`;
4503
+
4504
+ /**
4505
+ * @cssprop --sgds-{stateColor} - State colors in hexadecimal value
4506
+ * @cssprop --sgds-{stateColor}-rgb - State colors in rgb value
4507
+ * @cssprop --sgds-{stateColor}-{weights} - State colors with different weightage in hexadecimal value
4508
+ * @cssprop --sgds-gray-{weights} - State colors with different weightage in hexadecimal value
4509
+ * @cssprop --overlay-background-color - The drawer and modal component overlay background color
4510
+ * @cssprop --zindex-modal - The drawer and modal component z-index value
4511
+ */
4512
+ class SgdsElement extends LitElement {
4513
+ /** Emits a custom event with more convenient defaults. */
4514
+ emit(name, options) {
4515
+ const event = new CustomEvent(name, Object.assign({ bubbles: true, cancelable: false, composed: true, detail: {} }, options));
4516
+ this.dispatchEvent(event);
4517
+ return event;
4518
+ }
4519
+ static define(name, elementConstructor = this, options = {}) {
4520
+ const currentlyRegisteredConstructor = customElements.get(name);
4521
+ if (!currentlyRegisteredConstructor) {
4522
+ // We try to register as the actual class first. If for some reason that fails, we fall back to anonymous classes.
4523
+ // customElements can only have 1 class of the same "object id" per registry, so that is why the try {} catch {} exists.
4524
+ // Some tools like Jest Snapshots and if you import the constructor and call `new SgdsButton()` they will fail with
4525
+ // the anonymous class version.
4526
+ try {
4527
+ customElements.define(name, elementConstructor, options);
4528
+ }
4529
+ catch (_err) {
4530
+ customElements.define(name, class extends elementConstructor {
4531
+ }, options);
4532
+ }
4533
+ return;
4534
+ }
4535
+ // let newVersion = ' (unknown version)';
4536
+ // let existingVersion = newVersion;
4537
+ // if ('version' in elementConstructor && elementConstructor.version) {
4538
+ // newVersion = ' v' + elementConstructor.version;
4539
+ // }
4540
+ // if ('version' in currentlyRegisteredConstructor && currentlyRegisteredConstructor.version) {
4541
+ // existingVersion = ' v' + currentlyRegisteredConstructor.version;
4542
+ // }
4543
+ // // Need to make sure we're not working with null or empty strings before doing version comparisons.
4544
+ // if (newVersion && existingVersion && newVersion === existingVersion) {
4545
+ // // If versions match, we don't need to warn anyone. Carry on.
4546
+ // return;
4547
+ // }
4548
+ // console.warn(
4549
+ // `Attempted to register <${name}>${newVersion}, but <${name}>${existingVersion} has already been registered.`
4550
+ // );
4551
+ }
4552
+ constructor() {
4553
+ super();
4554
+ Object.entries(this.constructor.dependencies).forEach(([name, component]) => {
4555
+ this.constructor.define(name, component);
4556
+ });
4557
+ }
4558
+ }
4559
+ SgdsElement.styles = [css_248z$8];
4560
+ /** @internal */
4561
+ SgdsElement.dependencies = {};
4562
+
4563
+ var css_248z$7 = css`.nav-link::slotted(a){align-items:center;color:var(--sgds-link-color-default);cursor:pointer;display:inline-flex;flex-shrink:0;gap:var(--sgds-gap-2-xs);justify-content:center;line-height:var(--sgds-line-height-body);text-decoration:none!important}.nav-link::slotted(a:focus),.nav-link::slotted(a:focus-visible),.nav-link::slotted(a:hover),.nav-link::slotted(a[active]){color:var( --sgds-link-color-emphasis)}.nav-link::slotted(a:focus),.nav-link::slotted(a:focus-visible){outline:0}.nav-link::slotted(a:focus-visible:not([disabled])),.nav-link::slotted(a:focus:not([disabled])){box-shadow:var(--sgds-box-shadow-focus)}.nav-link::slotted(a[disabled]){cursor:not-allowed;opacity:var(--sgds-opacity-50)}:host([variant=danger]) .nav-link::slotted(a){--sgds-link-color-default:var(--sgds-danger-color-default);color:var(--sgds-link-color-default,--sgds-danger-color-default)}:host([variant=danger]) .nav-link::slotted(a:focus),:host([variant=danger]) .nav-link::slotted(a:focus-visible),:host([variant=danger]) .nav-link::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-danger-color-emphasis);color:var(--sgds-link-color-emphasis,--sgds-danger-color-emphasis)}:host([variant=neutral]) .nav-link::slotted(a){--sgds-link-color-default:var(--sgds-color-default);color:var(--sgds-link-color-default,--sgds-color-default)}:host([variant=neutral]) .nav-link::slotted(a:focus),:host([variant=neutral]) .nav-link::slotted(a:focus-visible),:host([variant=neutral]) .nav-link::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-default);color:var(--sgds-link-color-emphasis,--sgds-color-default)}:host([variant=light]) .nav-link::slotted(a){--sgds-link-color-default:var(--sgds-color-fixed-light);color:var(--sgds-link-color-default,--sgds-color-fixed-light)}:host([variant=light]) .nav-link::slotted(a:focus),:host([variant=light]) .nav-link::slotted(a:focus-visible),:host([variant=light]) .nav-link::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-link-color-emphasis,--sgds-color-fixed-light)}:host([variant=dark]) .nav-link::slotted(a){--sgds-link-color-default:var(--sgds-color-fixed-dark);color:var(--sgds-link-color-default,--sgds-color-fixed-dark)}:host([variant=dark]) .nav-link::slotted(a:focus),:host([variant=dark]) .nav-link::slotted(a:focus-visible),:host([variant=dark]) .nav-link::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-fixed-dark);color:var(--sgds-link-color-emphasis,--sgds-color-fixed-dark)}:host([size=lg]) .nav-link::slotted(a){font-size:var(--sgds-font-size-3)!important}:host([size=sm]) .nav-link::slotted(a){font-size:var(--sgds-font-size-1)!important;line-height:var(--sgds-line-height-min)}:host([size=xs]) .nav-link::slotted(a){font-size:var(--sgds-font-size-0)!important;line-height:var(--sgds-line-height-16)}`;
4564
+
4565
+ /**
4566
+ * @summary Link allows users to click and navigate their way from page to page
4567
+ *
4568
+ * @slot default - Pass in a single anchor tag here
4569
+ */
4570
+ class SgdsLink extends SgdsElement {
4571
+ constructor() {
4572
+ super(...arguments);
4573
+ /** Determines the size of the link */
4574
+ this.size = "md";
4575
+ /** when true, sets the active stylings of the link */
4576
+ this.variant = "primary";
4577
+ }
4578
+ _handleSlotChange() {
4579
+ const anchor = this.querySelector("a");
4580
+ if (anchor) {
4581
+ if (anchor.hasAttribute("disabled")) {
4582
+ anchor.setAttribute("href", "javascript:void(0)");
4583
+ anchor.setAttribute("tabindex", "-1");
4584
+ }
4585
+ else {
4586
+ anchor.setAttribute("tabindex", "0");
4587
+ }
4588
+ }
4589
+ }
4590
+ render() {
4591
+ /** When removing href, link is no longer focusable */
4592
+ return html$1 `<slot class="nav-link" @slotchange=${this._handleSlotChange}></slot>`;
4593
+ }
4594
+ }
4595
+ SgdsLink.styles = [...SgdsElement.styles, css_248z$7];
4596
+ __decorate([
4597
+ property({ type: String, reflect: true })
4598
+ ], SgdsLink.prototype, "size", void 0);
4599
+ __decorate([
4600
+ property({ type: String, reflect: true })
4601
+ ], SgdsLink.prototype, "variant", void 0);
4602
+
4603
+ var css_248z$6 = css`:host([disabled]){cursor:not-allowed}:host([orientation=horizontal]) .card{flex-direction:row}:host(:not([hideBorder])) .card{border:var(--sgds-border-width-1) solid var(--sgds-border-color-muted)}:host([orientation=horizontal]) .card-body{flex:1}:host([orientation=horizontal]) .card-media{padding:var(--sgds-padding-xl) var(--sgds-padding-none) var(--sgds-padding-xl) var(--sgds-padding-xl)}:host([orientation=horizontal]) .card-image{width:40%}:host([imagePosition=after]) .card-image{order:1}:host([orientation=vertical][imagePosition=after]) slot[name=image]::slotted(img){border-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-top-left-radius:var(--sgds-border-radius-none);border-top-right-radius:var(--sgds-border-radius-none)}:host([orientation=horizontal][imagePosition=after]) slot[name=image]::slotted(img){border-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-bottom-left-radius:var(--sgds-border-radius-none);border-top-left-radius:var(--sgds-border-radius-none)}:host([orientation=horizontal]) slot[name=image]::slotted(img){border-bottom-left-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-top-right-radius:var(--sgds-border-radius-none);height:100%;object-fit:cover}:host([orientation=vertical][imageAdjustment="padding around"]) .card-image{margin:var(--sgds-margin-sm) var(--sgds-margin-sm) var(--sgds-padding-none)}:host([orientation=vertical][imageAdjustment="padding around"][imagePosition=after]) .card-image{margin:var(--sgds-margin-none) var(--sgds-margin-sm) var(--sgds-margin-sm)}:host([orientation=horizontal][imageAdjustment="padding around"]) .card-image{margin:var(--sgds-margin-sm) var(--sgds-margin-none) var(--sgds-margin-sm) var(--sgds-margin-sm)}:host([orientation=horizontal][imageAdjustment="padding around"][imagePosition=after]) .card-image{margin:var(--sgds-margin-sm) var(--sgds-margin-sm) var(--sgds-margin-sm) var(--sgds-margin-none)}:host([orientation][imageAdjustment="padding around"]) slot[name=image]::slotted(img){border-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1))}:host([orientation=vertical]:not([imageAdjustment="aspect ratio"])) slot[name=image]::slotted(img){height:auto}:host([orientation=vertical][imageAdjustment="aspect ratio"]) slot[name=image]::slotted(img){object-fit:cover}.card{word-wrap:break-word;background-clip:border-box;background-color:var(--sgds-surface-default);border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent);border-radius:var(--sgds-border-radius-md);box-shadow:none;display:flex;flex-direction:column;height:100%;min-width:0;position:relative;transition:box-shadow .3s ease}a.card{color:initial;text-decoration:none}@media (prefers-reduced-motion:reduce){.card{transition:none}}.card.disabled{opacity:var(--sgds-opacity-50);pointer-events:none}a.card:focus{outline:0}a.card:not(.disabled):focus-visible{box-shadow:var(--sgds-box-shadow-focus)}.card-tinted-bg{border-radius:var(--sgds-border-radius-md);bottom:0;left:0;opacity:var(--sgds-opacity-0);position:absolute;right:0;top:0}.card-image{flex:1;position:relative}.card-media{align-items:flex-start;display:flex;justify-content:space-between;line-height:0;padding:var(--sgds-padding-xl) var(--sgds-padding-xl) var(--sgds-padding-none)}.card-thumbnail{align-items:center;border:var(--sgds-border-width-1) solid var(--sgds-border-color-muted);border-radius:var(--sgds-border-radius-full);display:flex;height:var(--sgds-dimension-80);justify-content:center;width:var(--sgds-dimension-80)}.card-body{color:var(--sgds-body-color-default);display:flex;flex:1 1 auto;flex-direction:column;gap:var(--sgds-gap-xl);padding:var(--sgds-padding-xl);z-index:1}.card-header-container{display:flex;flex-direction:column;gap:var(--sgds-gap-sm)}.card-header{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}.card-title{--sgds-font-size-5:var(--sgds-font-size-4);--sgds-font-size-6:var(--sgds-font-size-4);--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-font-weight-bold:var(--sgds-font-weight-semibold);color:var(--sgds-body-color-default);font-size:var(--sgds-font-size-4);font-weight:var(--sgds-font-weight-semibold)}.card-subtitle,.card-text,.card-title{margin-bottom:var(--sgds-margin-none)}slot[name=subtitle]::slotted(*){--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-margin-xs:var(--sgds-margin-none);--sgds-font-size-4:var(--sgds-font-size-1);--sgds-font-size-5:var(--sgds-font-size-1);--sgds-font-size-6:var(--sgds-font-size-1);--sgds-font-weight-bold:var(--sgds-font-weight-semibold);--sgds-line-height-heading:var(--sgds-line-height-min);--sgds-letter-spacing-tight:var(--sgds-letter-spacing-wide);color:var(--sgds-color-default);font-size:var(--sgds-font-size-1);font-weight:var(--sgds-font-weight-semibold);letter-spacing:var(--sgds-letter-spacing-wide);line-height:var(--sgds-line-height-min);margin:var(--sgds-margin-none);text-transform:uppercase}slot[name=title]::slotted(a){--sgds-font-size-2:var(--sgds-font-size-4);--sgds-font-weight-regular:var(--sgds-font-weight-semibold);color:var(--sgds-link-color-default);font-size:var(--sgds-font-size-4);font-weight:var(--sgds-font-weight-semibold);text-decoration:none!important}slot[name=description]::slotted(*){color:var(--sgds-color-subtle)}slot[name=image]::slotted(img){border-top-left-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));border-top-right-radius:calc(var(--sgds-border-radius-md) - var(--sgds-border-width-1));display:block;width:100%}slot[name=link]::slotted(*){font-weight:700;margin-top:auto;padding-top:var(--sgds-padding-sm)}slot[name=link]::slotted(a){color:var(--sgds-link-color-default);display:inline-flex;gap:var(--sgds-gap-2-xs);height:auto!important;text-decoration:none!important}slot[name=link]::slotted(a:focus),slot[name=link]::slotted(a:hover),slot[name=title]::slotted(a:focus),slot[name=title]::slotted(a:hover){color:var(--sgds-link-color-emphasis)}slot[name=link]::slotted(a:focus),slot[name=title]::slotted(a:focus){outline:0}slot[name=link]::slotted(a:focus-visible),slot[name=title]::slotted(a:focus-visible){box-shadow:var(--sgds-box-shadow-focus)}`;
4604
+
4605
+ var css_248z$5 = css`.text-primary{color:var(--sgds-primary-rgb)!important}.text-secondary{color:var(--sgds-secondary-rgb)!important}.text-success{color:var(--sgds-success-rgb)!important}.text-info{color:var(--sgds-info-rgb)!important}.text-warning{color:var(--sgds-warning-rgb)!important}.text-danger{color:var(--sgds-danger-rgb)!important}.text-light{color:var(--sgds-light-rgb)!important}.text-dark{color:var(--sgds-dark-rgb)!important}.text-muted{color:var(--sgds-secondary-color)!important}`;
4606
+
4607
+ var css_248z$4 = css`.bg-primary{background-color:var(--sgds-primary)!important}.bg-secondary{background-color:var(--sgds-secondary)!important}.bg-success{background-color:var(--sgds-success)!important}.bg-info{background-color:var(--sgds-info)!important}.bg-warning{background-color:var(--sgds-warning)!important}.bg-danger{background-color:var(--sgds-danger)!important}.bg-light{background-color:var(--sgds-light)!important}.bg-dark{background-color:var(--sgds-dark)!important}`;
4608
+
4609
+ var css_248z$3 = css`.border-primary{border-color:var(--sgds-primary)!important}.border-secondary{border-color:var(--sgds-secondary)!important}.border-success{border-color:var(--sgds-success)!important}.border-info{border-color:var(--sgds-info)!important}.border-warning{border-color:var(--sgds-warning)!important}.border-danger{border-color:var(--sgds-danger)!important}.border-light{border-color:var(--sgds-light)!important}.border-dark{border-color:var(--sgds-dark)!important}`;
4610
+
4611
+ var css_248z$2 = css`.h1,.h2,.h3,.h4,.h5,.h6 ::slotted(h6),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),h1,h2,h3,h4,h5,h6{color:var(--sgds-heading-color);font-weight:700;line-height:1.2;margin-bottom:.5rem;margin-top:0}.h1,::slotted(h1),h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,::slotted(h1),h1{font-size:2.5rem}}.h2,::slotted(h2),h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,::slotted(h2),h2{font-size:2rem}}.h3,::slotted(h3),h3{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){.h3,::slotted(h3),h3{font-size:1.5rem}}.h4,::slotted(h4),h4{font-size:1.125rem}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{font-size:1rem}.h1,::slotted(h1),h1{line-height:1.2}.h2,::slotted(h2),h2{line-height:1.25}.h3,::slotted(h3),h3{line-height:1.33}.h4,::slotted(h4),h4{line-height:1.78}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{line-height:1.2}`;
4612
+
4613
+ var css_248z$1 = css`p{margin-bottom:1.5rem;margin-top:0}`;
4614
+
4615
+ class CardElement extends SgdsElement {
4616
+ constructor() {
4617
+ super(...arguments);
4618
+ /** Extends the link passed in slot[name="link"] to the entire card */
4619
+ this.stretchedLink = false;
4620
+ /** Disables the card */
4621
+ this.disabled = false;
4622
+ /** When true, hides the default border of the card. */
4623
+ this.hideBorder = false;
4624
+ /** When true, applies a tinted background color to the card. */
4625
+ this.tinted = false;
4626
+ /** Sets the orientation of the card. Available options: `vertical`, `horizontal` */
4627
+ this.orientation = "vertical";
4628
+ }
4629
+ handleTitleSlotChange(e) {
4630
+ const childNodes = e.target.assignedNodes({ flatten: true });
4631
+ if (this.stretchedLink && childNodes[0] instanceof HTMLAnchorElement) {
4632
+ const hyperlink = childNodes[0].querySelector("a") || childNodes[0];
4633
+ hyperlink.removeAttribute("href");
4634
+ }
4635
+ return;
4636
+ }
4637
+ handleLinkSlotChange(e) {
4638
+ const childNodes = e.target.assignedNodes({ flatten: true });
4639
+ if (childNodes.length > 1) {
4640
+ return console.error("Multiple elements passed into SgdsCard's link slot");
4641
+ }
4642
+ if (!this.stretchedLink)
4643
+ return;
4644
+ if (childNodes[0] instanceof HTMLAnchorElement || childNodes[0] instanceof SgdsLink) {
4645
+ const hyperlink = (childNodes[0].querySelector("a") || childNodes[0]);
4646
+ this.card.setAttribute("href", hyperlink.href);
4647
+ const linkSlot = this.shadowRoot.querySelector("slot[name='link']");
4648
+ linkSlot.style.display = "none";
4649
+ }
4650
+ }
4651
+ }
4652
+ CardElement.styles = [...SgdsElement.styles, css_248z$5, css_248z$4, css_248z$3, css_248z$2, css_248z$1, css_248z$6];
4653
+ __decorate([
4654
+ query("a.card")
4655
+ ], CardElement.prototype, "card", void 0);
4656
+ __decorate([
4657
+ property({ type: Boolean, reflect: true })
4658
+ ], CardElement.prototype, "stretchedLink", void 0);
4659
+ __decorate([
4660
+ property({ type: Boolean, reflect: true })
4661
+ ], CardElement.prototype, "disabled", void 0);
4662
+ __decorate([
4663
+ property({ type: Boolean, reflect: true })
4664
+ ], CardElement.prototype, "hideBorder", void 0);
4665
+ __decorate([
4666
+ property({ type: Boolean, reflect: true })
4667
+ ], CardElement.prototype, "tinted", void 0);
4668
+ __decorate([
4669
+ property({ type: String, reflect: true })
4670
+ ], CardElement.prototype, "orientation", void 0);
4671
+
4672
+ var css_248z = css`:host([noPadding]) .card{border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent)}:host(:not([noPadding])) .card:not(.disabled):hover{box-shadow:0 0 1px 0 hsla(0,0%,5%,.12),0 8px 16px 0 hsla(0,0%,5%,.12)}:host([orientation=vertical][noPadding]) .card-body{padding:var(--sgds-padding-xl) var(--sgds-padding-none) var(--sgds-padding-none) var(--sgds-padding-none)}:host([orientation=vertical][imagePosition=after][noPadding]) .card-body{padding:var(--sgds-padding-none) var(--sgds-padding-none) var(--sgds-padding-xl) var(--sgds-padding-none)}:host([orientation=horizontal][noPadding]) .card-body{padding:var(--sgds-padding-none) var(--sgds-padding-none) var(--sgds-padding-none) var(--sgds-padding-xl)}:host([orientation=horizontal][imagePosition=after][noPadding]) .card-body{padding:var(--sgds-padding-none) var(--sgds-padding-xl) var(--sgds-padding-none) var(--sgds-padding-none)}:host([tinted]:not([noPadding])) .card-tinted-bg{background-color:var(--sgds-bg-translucent-subtle);opacity:var(--sgds-opacity-50)}:host([orientation][noPadding]) .card-media{padding:var(--sgds-padding-none)}slot[name=thumbnail]::slotted(*){height:auto;max-width:100%}`;
4673
+
4674
+ /**
4675
+ * @summary Thumbnail cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.
4676
+ * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.
4677
+ * @slot thumbnail - Accepts a small image or visual element typically displayed alongside the card's title or content to provide quick visual context.
4678
+ * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.
4679
+ * @slot subtitle - The subtitle of the card
4680
+ * @slot title - The title of the card
4681
+ * @slot description - The paragrapher text of the card
4682
+ * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.
4683
+ * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.
4684
+ */
4685
+ class SgdsThumbnailCard extends CardElement {
4686
+ constructor() {
4687
+ super(...arguments);
4688
+ /** Removes the card's internal padding when set to true. */
4689
+ this.noPadding = false;
4690
+ }
4691
+ firstUpdated() {
4692
+ if (this._thumbnailNode.length === 0) {
4693
+ const thumbnail = this.shadowRoot.querySelector(".card-thumbnail");
4694
+ thumbnail.style.display = "none";
4695
+ if ((this.orientation === "vertical" && this._upperNode.length === 0) || this.orientation === "horizontal") {
4696
+ const media = this.shadowRoot.querySelector(".card-media");
4697
+ media.style.display = "none";
4698
+ const body = this.shadowRoot.querySelector(".card-body");
4699
+ if (this.noPadding)
4700
+ body.style.padding = "0px";
4701
+ }
4702
+ }
4703
+ }
4704
+ render() {
4705
+ const tag = this.stretchedLink ? literal `a` : literal `div`;
4706
+ const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;
4707
+ return html `
4708
+ <${tag}
4709
+ class="card ${classMap({
4710
+ disabled: this.disabled
4711
+ })}"
4712
+ tabindex=${cardTabIndex}
4713
+ >
4714
+ ${this.tinted && !this.noPadding ? html `<div class="card-tinted-bg"></div>` : nothing}
4715
+ <div class="card-media">
4716
+ <div class="card-thumbnail">
4717
+ <slot name="thumbnail"></slot>
4718
+ </div>
4719
+ ${this.orientation === "vertical" ? html `<slot name="upper"></slot>` : nothing}
4720
+ </div>
4721
+ <div class="card-body">
4722
+ ${this.orientation === "horizontal" ? html `<slot name="upper"></slot>` : nothing}
4723
+ <div class="card-header-container">
4724
+ <div class="card-header">
4725
+ <slot name="subtitle"></slot>
4726
+ <h3 class="card-title"><slot name="title" @slotchange=${this.handleTitleSlotChange}></slot></h3>
4727
+ </div>
4728
+ <slot></slot>
4729
+ </div>
4730
+ <p class="card-text">
4731
+ <slot name="description"></slot>
4732
+ </p>
4733
+ <slot name="lower"></slot>
4734
+ <slot name="link" @slotchange=${this.handleLinkSlotChange}></slot>
4735
+ </div>
4736
+ </${tag}>
4737
+ `;
4738
+ }
4739
+ }
4740
+ SgdsThumbnailCard.styles = [...CardElement.styles, css_248z];
4741
+ __decorate([
4742
+ queryAssignedNodes({ slot: "thumbnail", flatten: true })
4743
+ ], SgdsThumbnailCard.prototype, "_thumbnailNode", void 0);
4744
+ __decorate([
4745
+ queryAssignedNodes({ slot: "upper", flatten: true })
4746
+ ], SgdsThumbnailCard.prototype, "_upperNode", void 0);
4747
+ __decorate([
4748
+ property({ type: Boolean, reflect: true })
4749
+ ], SgdsThumbnailCard.prototype, "noPadding", void 0);
4750
+
4751
+ customElements.define("sgds-thumbnail-card", SgdsThumbnailCard);
4752
+
4753
+ }));
4754
+ //# sourceMappingURL=index.umd.js.map