@panphora/clayjs 1.23.0 → 1.24.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 (471) hide show
  1. package/dist/all.js +1 -1
  2. package/dist/blockeditor/themes/light-1.css +431 -0
  3. package/dist/clay-dom.js +1 -1
  4. package/dist/clay-events.js +1 -1
  5. package/dist/clay-internals.js +1 -1
  6. package/dist/clay-options.js +1 -1
  7. package/dist/clay-router.js +1 -1
  8. package/dist/clay-ui.js +1 -1
  9. package/dist/clay-utils.js +1 -1
  10. package/dist/clay.js +1 -1
  11. package/dist/clay.standalone.js +30285 -26613
  12. package/dist/m/c-277QP5ET.js +1 -0
  13. package/dist/m/c-2BLVA6IN.js +5 -0
  14. package/dist/m/c-2OJMOUPC.js +1 -0
  15. package/dist/m/c-2PVGJFI5.js +1 -0
  16. package/dist/m/{c-AYVGD6A6.js → c-3UW5EJ77.js} +1 -1
  17. package/dist/m/{c-T5NK2TVY.js → c-42ZNV7LI.js} +1 -1
  18. package/dist/m/{c-3TLG3OLG.js → c-46LJAZZJ.js} +1 -1
  19. package/dist/m/c-47IBJGPQ.js +1 -0
  20. package/dist/m/c-5FXEKU4Y.js +1 -0
  21. package/dist/m/c-5KXDKC5G.js +1 -0
  22. package/dist/m/{c-EUGJVHDD.js → c-5RZNFTWD.js} +1 -1
  23. package/dist/m/c-65LJU2H2.js +72 -0
  24. package/dist/m/{c-NQJRVJ56.js → c-6IJEVE6B.js} +1 -1
  25. package/dist/m/{c-NW54NHKE.js → c-6LEYVQJK.js} +1 -1
  26. package/dist/m/{c-GSRLXYWL.js → c-6Q6RGFBF.js} +1 -1
  27. package/dist/m/c-6RGEQNVV.js +1 -0
  28. package/dist/m/c-7CM4GMTS.js +6 -0
  29. package/dist/m/c-7NCWENHV.js +1 -0
  30. package/dist/m/c-7V6MGMX2.js +1 -0
  31. package/dist/m/{c-LKSL4AUJ.js → c-7WZSUTYP.js} +1 -1
  32. package/dist/m/c-A4L7APIU.js +1 -0
  33. package/dist/m/c-APGHGDZM.js +1 -0
  34. package/dist/m/c-AT7GLQGV.js +34 -0
  35. package/dist/m/{c-ZRXJD4G6.js → c-B7GOFGQR.js} +1 -1
  36. package/dist/m/{c-KDXIJEEF.js → c-BGN7RCTJ.js} +1 -1
  37. package/dist/m/c-BKM46LUJ.js +1 -0
  38. package/dist/m/c-BOMQIQ3V.js +1 -0
  39. package/dist/m/{c-62HZW5DH.js → c-C5AKJVRH.js} +1 -1
  40. package/dist/m/{c-BXYSDKAN.js → c-CJ7QYEWI.js} +1 -1
  41. package/dist/m/c-CTGRDT6E.js +1 -0
  42. package/dist/m/c-CV4T65JE.js +6 -0
  43. package/dist/m/c-CVSWLX3X.js +1 -0
  44. package/dist/m/c-CZHTXGJS.js +1 -0
  45. package/dist/m/c-D7NT5S4F.js +1 -0
  46. package/dist/m/c-DD26VXAP.js +1 -0
  47. package/dist/m/{c-ANNFZFLN.js → c-DDS23EY6.js} +1 -1
  48. package/dist/m/{c-ALDVFPWL.js → c-DFKBGSN2.js} +1 -1
  49. package/dist/m/c-DIKR7H57.js +147 -0
  50. package/dist/m/c-DXPOFLEJ.js +1 -0
  51. package/dist/m/c-EDE45NM7.js +1 -0
  52. package/dist/m/c-EILLN2H2.js +1 -0
  53. package/dist/m/c-EODTTNVA.js +1 -0
  54. package/dist/m/{c-G6COVIZB.js → c-ESK4S67I.js} +1 -1
  55. package/dist/m/c-FDWR3FL7.js +1 -0
  56. package/dist/m/{c-WQZTI5P2.js → c-FEC6LGFF.js} +1 -1
  57. package/dist/m/c-FLEIU6CG.js +1 -0
  58. package/dist/m/c-FQAQRXGK.js +1 -0
  59. package/dist/m/{c-W4JCVLAB.js → c-FSQXFG5T.js} +1 -1
  60. package/dist/m/c-FVPNX2GO.js +135 -0
  61. package/dist/m/c-FYDKYW6E.js +1 -0
  62. package/dist/m/c-GNI7WHKF.js +32 -0
  63. package/dist/m/c-GO635CRU.js +3 -0
  64. package/dist/m/c-H3FNLBHN.js +2 -0
  65. package/dist/m/c-HDVH3MVC.js +72 -0
  66. package/dist/m/c-HIX5H5L7.js +1 -0
  67. package/dist/m/c-HKSLOVU4.js +1 -0
  68. package/dist/m/{c-SGRIYOAJ.js → c-HL6BLJNA.js} +1 -1
  69. package/dist/m/c-HTLYXCUH.js +1 -0
  70. package/dist/m/{c-QIR5CAKM.js → c-IUL7PU4P.js} +1 -1
  71. package/dist/m/c-IXO7EI2Q.js +1 -0
  72. package/dist/m/{c-W5E5P2TZ.js → c-JQF2EUCG.js} +1 -1
  73. package/dist/m/{c-NEL7HQW3.js → c-JWDCQL6J.js} +1 -1
  74. package/dist/m/c-KQKKIVLW.js +20 -0
  75. package/dist/m/c-LATNQ6Q5.js +1 -0
  76. package/dist/m/c-LD6UVV5R.js +1 -0
  77. package/dist/m/c-LS7IVQVW.js +1 -0
  78. package/dist/m/{c-JCOQVZYS.js → c-LSVN3OLG.js} +1 -1
  79. package/dist/m/{c-JDZDF2QM.js → c-LTSPHVAK.js} +1 -1
  80. package/dist/m/c-MFOSMAVM.js +3 -0
  81. package/dist/m/c-MJ7GVE46.js +1 -0
  82. package/dist/m/c-MP6S4AZU.js +6 -0
  83. package/dist/m/c-MQKSKQHG.js +2 -0
  84. package/dist/m/{c-UHUNXWKN.js → c-MQYEDF3Q.js} +1 -1
  85. package/dist/m/{c-IHUWUKIU.js → c-MR75YPRT.js} +1 -1
  86. package/dist/m/c-ND3Q2G2I.js +1 -0
  87. package/dist/m/c-NEQRFC4O.js +1 -0
  88. package/dist/m/{c-5FKRZNJV.js → c-NFQFV7OP.js} +1 -1
  89. package/dist/m/c-NHXOBD6A.js +1 -0
  90. package/dist/m/{c-QIKT6SKM.js → c-NICICT4P.js} +1 -1
  91. package/dist/m/c-NQAPWM7O.js +1 -0
  92. package/dist/m/{c-QUGCKMWF.js → c-NVU3DORS.js} +1 -1
  93. package/dist/m/{c-LWIDDWAR.js → c-OCYG4NBQ.js} +22 -22
  94. package/dist/m/c-OH2FPYSY.js +19 -0
  95. package/dist/m/c-OYHI67B6.js +1 -0
  96. package/dist/m/{c-R2XUODVY.js → c-OYW5MFPZ.js} +1 -1
  97. package/dist/m/{c-5B4YBZXC.js → c-P2HKMJAW.js} +1 -1
  98. package/dist/m/{c-TSBVMWAH.js → c-PCNJETUA.js} +1 -1
  99. package/dist/m/c-PDBNCJCT.js +1 -0
  100. package/dist/m/c-PGSBXHUE.js +1 -0
  101. package/dist/m/{c-5TIZ2I64.js → c-PYG2NGWU.js} +1 -1
  102. package/dist/m/c-Q26XHBLQ.js +1 -0
  103. package/dist/m/c-Q6BG3ZLO.js +1 -0
  104. package/dist/m/c-QENKN7QI.js +1 -0
  105. package/dist/m/c-QQFHEODI.js +1 -0
  106. package/dist/m/c-QTEUO2K6.js +1 -0
  107. package/dist/m/c-R23UHMXG.js +1 -0
  108. package/dist/m/c-RETTCOWO.js +10 -0
  109. package/dist/m/c-SE3SIY7Y.js +7 -0
  110. package/dist/m/{c-XX75FFNL.js → c-SGGGCIVD.js} +1 -1
  111. package/dist/m/c-SGH3UTF3.js +1 -0
  112. package/dist/m/c-SIM7Z3U7.js +1 -0
  113. package/dist/m/{c-X5LNHET5.js → c-SKMIR5HQ.js} +1 -1
  114. package/dist/m/{c-R27DWQKX.js → c-STRI73GQ.js} +1 -1
  115. package/dist/m/c-SUXHUL7U.js +1 -0
  116. package/dist/m/c-SXGEWPFC.js +10 -0
  117. package/dist/m/c-SXNSSHPP.js +1 -0
  118. package/dist/m/c-T3P3AXEW.js +1 -0
  119. package/dist/m/{c-PXLTUYZC.js → c-TFLRT5JX.js} +1 -1
  120. package/dist/m/{c-YCLU4UNT.js → c-TGIMBAWE.js} +1 -1
  121. package/dist/m/c-TGSHHFO6.js +1 -0
  122. package/dist/m/c-U4NTUVDZ.js +1 -0
  123. package/dist/m/c-UOOIF2AL.js +1 -0
  124. package/dist/m/{c-6TYGD5AB.js → c-UOUUI265.js} +1 -1
  125. package/dist/m/c-V2U3F4QX.js +1 -0
  126. package/dist/m/c-V2V5FKXX.js +1 -0
  127. package/dist/m/c-VBXRXTVS.js +26 -0
  128. package/dist/m/c-VHSMPITY.js +1 -0
  129. package/dist/m/c-VPXCXBDT.js +1 -0
  130. package/dist/m/c-WCG6AKA7.js +1 -0
  131. package/dist/m/c-WNOLMHI2.js +1 -0
  132. package/dist/m/{c-CRPIDGXC.js → c-X6MOYATI.js} +1 -1
  133. package/dist/m/{c-FQGHR32O.js → c-X75G43SZ.js} +1 -1
  134. package/dist/m/c-XB6EAIAR.js +13 -0
  135. package/dist/m/c-XMIDHEKF.js +1 -0
  136. package/dist/m/c-XUZMRQ7O.js +4 -0
  137. package/dist/m/{c-2Z22FCFK.js → c-XW5TIYYB.js} +1 -1
  138. package/dist/m/c-YDW4VCHP.js +1 -0
  139. package/dist/m/{c-QGAPG7OM.js → c-YLHTD3KX.js} +1 -1
  140. package/dist/m/c-YNIEIPBS.js +1 -0
  141. package/dist/m/c-Z4G2UK6T.js +4 -0
  142. package/dist/m/c-Z6MROEQ4.js +1 -0
  143. package/dist/m/c-ZFO5RW6G.js +2 -0
  144. package/dist/m/c-ZGCO4J3H.js +8 -0
  145. package/dist/m/c-ZKKAF4UT.js +3 -0
  146. package/dist/m/c-ZRGEN6QQ.js +4 -0
  147. package/dist/m/core/{admin-attrs-U7IJNYBG.js → admin-attrs-ONRWVXPK.js} +1 -1
  148. package/dist/m/core/{autosave-F5YQCKVL.js → autosave-TBKAAAFB.js} +1 -1
  149. package/dist/m/core/conflict-notice-FOEE6I7E.js +1 -0
  150. package/dist/m/core/draft-mode-4MCL3LYI.js +1 -0
  151. package/dist/m/core/{host-permission-6EVJGNPL.js → host-permission-X4BENZEU.js} +1 -1
  152. package/dist/m/core/{is-edit-mode-GCX6767E.js → is-edit-mode-FFHCQ5DR.js} +1 -1
  153. package/dist/m/core/{persist-CJXIL7D4.js → persist-6ILUR34S.js} +1 -1
  154. package/dist/m/core/{recovery-DRFZRJED.js → recovery-APWADU4K.js} +1 -1
  155. package/dist/m/core/save-6HT2LABE.js +1 -0
  156. package/dist/m/core/save-core-EVMNZQ4V.js +1 -0
  157. package/dist/m/core/site-edits-G4BOZMV4.js +1 -0
  158. package/dist/m/core/{unsaved-warning-HNQVTA2D.js → unsaved-warning-ITZDIZ2I.js} +1 -1
  159. package/dist/m/internals/{index-NRPNDTSA.js → index-HS3CQDFW.js} +1 -1
  160. package/dist/m/loader-GLLVDUZA.js +1 -0
  161. package/dist/m/manifest-50FF1C45.js +1 -0
  162. package/dist/m/manifest-edit-BE1A621D.js +1 -0
  163. package/dist/m/manifest.json +2072 -1811
  164. package/dist/m/page/editor-KAZDJNND.js +307 -0
  165. package/dist/m/plugins/ai-edit-LABECCSN.js +6 -0
  166. package/dist/m/plugins/{cms-H7DTMUQX.js → cms-T2HLI7JG.js} +16 -16
  167. package/dist/m/plugins/{demo-42BSYQ7T.js → demo-T7B4RIKL.js} +1 -1
  168. package/dist/m/plugins/{derive-QVI3LI3A.js → derive-6LPJOCAV.js} +1 -1
  169. package/dist/m/plugins/indicator-J4ABFARX.js +1 -0
  170. package/dist/m/plugins/{live-DCUBKXY4.js → live-PGBIEMGB.js} +1 -1
  171. package/dist/m/plugins/menu-YZL3X2AJ.js +1 -0
  172. package/dist/m/plugins/page-WOCNX2IN.js +2 -0
  173. package/dist/m/plugins/page-view-SJODOOGE.js +1 -0
  174. package/dist/m/plugins/{people-5XRNRP5U.js → people-C4TCWFOQ.js} +1 -1
  175. package/dist/m/plugins/{quickcrop-WWF5I422.js → quickcrop-X5MRIBAP.js} +2 -2
  176. package/dist/m/plugins/richclay-Y2NV44NA.js +549 -0
  177. package/dist/m/plugins/sortable-XCHQG65Z.js +1 -0
  178. package/dist/m/plugins/{source-6BKMK4PO.js → source-YK7MO23W.js} +1 -1
  179. package/dist/m/plugins/{undo-3JEYK5QY.js → undo-VLRBQNPN.js} +1 -1
  180. package/dist/m/plugins/upgrade-NNTJBSK2.js +1 -0
  181. package/dist/m/plugins/{upload-TTCQRIM5.js → upload-ZKKJV76X.js} +1 -1
  182. package/dist/m/plugins/visitor-drafts-RTZNONHT.js +20 -0
  183. package/dist/m/plugins/{visitor-drafts-owner-Z5B2OQBR.js → visitor-drafts-owner-LHUHFU3L.js} +1 -1
  184. package/dist/m/plugins/{visitor-menu-4LQMKLPP.js → visitor-menu-FY4KM2SW.js} +1 -1
  185. package/dist/m/plugins/wire-M2NR354P.js +1 -0
  186. package/dist/m/{reader-core-POFQCKRV.js → reader-core-T2S3JC4E.js} +2 -2
  187. package/dist/m/sync/live-sync-Z64YREWQ.js +1 -0
  188. package/dist/m/ui/index-MGTWOW2C.js +1 -0
  189. package/dist/m/vendor/{sap-core.vendor-OA5SKL7Q.js → sap-core.vendor-QAEPMETX.js} +1 -1
  190. package/dist/offline-manifest.json +1250 -1082
  191. package/dist/server/core.cjs +132 -109
  192. package/dist/server/page-compaction-worker.cjs +5 -5
  193. package/dist/server/rooms.mjs +3 -1
  194. package/docs/guide.md +89 -44
  195. package/entries/clay-data.js +1 -1
  196. package/entries/sap.js +1 -1
  197. package/package.json +5 -3
  198. package/src/blockeditor/themes/content.css +70 -0
  199. package/src/blockeditor/themes/light-1.css +431 -0
  200. package/src/blockeditor/themes/light-1.source.css +270 -0
  201. package/src/blockeditor/themes/light-2.css +211 -0
  202. package/src/blockeditor/themes/light-3.css +130 -0
  203. package/src/blockeditor/themes/light-4.css +299 -0
  204. package/src/core/conflict-notice.js +28 -0
  205. package/src/core/draft-mode.js +6 -0
  206. package/src/core/host-meta.js +6 -6
  207. package/src/core/is-edit-mode.js +9 -3
  208. package/src/core/mode-support.js +3 -0
  209. package/src/core/mode-switch.js +4 -4
  210. package/src/core/mode-transition.js +3 -1
  211. package/src/core/page-format-wire.js +1 -1
  212. package/src/core/page-format.js +8 -8
  213. package/src/core/save-accepted.js +6 -7
  214. package/src/core/save-core.js +52 -23
  215. package/src/core/save-failure-notice.js +37 -0
  216. package/src/core/save-feedback.js +6 -0
  217. package/src/core/save-replace.js +1 -1
  218. package/src/core/save-size.js +2 -2
  219. package/src/core/save.js +78 -15
  220. package/src/core/site-edits.js +166 -0
  221. package/src/core/unsaved-warning.js +2 -2
  222. package/src/core/upgrade-run.js +4 -4
  223. package/src/lib/ai-comment.js +23 -0
  224. package/src/lib/effect.js +8 -0
  225. package/src/lib/idb-error-code.js +20 -0
  226. package/src/live/fast-lane.js +10 -10
  227. package/src/live/local-lane.js +10 -10
  228. package/src/live/page-compaction.js +8 -8
  229. package/src/live/server-lane.js +1 -1
  230. package/src/loader-logic.js +48 -18
  231. package/src/loader.js +11 -6
  232. package/src/page/adopt-boot.js +1 -1
  233. package/src/page/adopt.js +2 -2
  234. package/src/page/ai-area.js +182 -0
  235. package/src/page/ai-preview.js +80 -0
  236. package/src/page/ai-surface.js +257 -0
  237. package/src/page/ai-tool.js +308 -145
  238. package/src/page/announce.js +2 -2
  239. package/src/page/awareness.js +18 -18
  240. package/src/page/blocks.js +35 -34
  241. package/src/page/blocksel.js +2 -2
  242. package/src/page/board-drag.js +11 -11
  243. package/src/page/board-face.js +1 -1
  244. package/src/page/board-panel.js +26 -26
  245. package/src/page/board-style.js +127 -127
  246. package/src/page/board-view.js +48 -48
  247. package/src/page/chart.js +29 -29
  248. package/src/page/checkpoint-proof.js +19 -19
  249. package/src/page/chrome.js +74 -65
  250. package/src/page/clipboard-shape.js +1 -1
  251. package/src/page/csv-import.js +4 -4
  252. package/src/page/drag.js +5 -5
  253. package/src/page/editor.js +301 -296
  254. package/src/page/export-html.js +8 -8
  255. package/src/page/features/checklist.js +36 -36
  256. package/src/page/features/export-html.js +19 -19
  257. package/src/page/features/export-markdown.js +10 -10
  258. package/src/page/features/import-markdown.js +13 -13
  259. package/src/page/features/media.js +50 -50
  260. package/src/page/features/table.js +17 -17
  261. package/src/page/features/title-cover.js +17 -17
  262. package/src/page/features/title-icon.js +7 -7
  263. package/src/page/features/toc.js +1 -1
  264. package/src/page/features/tool.js +42 -18
  265. package/src/page/format-command.js +4 -4
  266. package/src/page/format-gate.js +6 -6
  267. package/src/page/format-host.js +6 -6
  268. package/src/page/format-level.js +3 -3
  269. package/src/page/format-native-commands.js +2 -2
  270. package/src/page/highlight-slot.js +1 -1
  271. package/src/page/highlight.js +4 -4
  272. package/src/page/history-intent.js +2 -2
  273. package/src/page/image-actions.js +4 -4
  274. package/src/page/link.js +10 -10
  275. package/src/page/media.js +3 -3
  276. package/src/page/mention-picker.js +7 -7
  277. package/src/page/merge.js +1 -1
  278. package/src/page/placeholder.js +3 -3
  279. package/src/page/projection.js +11 -11
  280. package/src/page/reader-patch.js +2 -2
  281. package/src/page/recover.js +26 -26
  282. package/src/page/recovery-ui.js +28 -28
  283. package/src/page/rich/chart.js +1 -1
  284. package/src/page/rich/page-tool.js +21 -6
  285. package/src/page/rich/tool-runtime.js +3 -2
  286. package/src/page/save-projection.js +2 -2
  287. package/src/page/save-states.js +9 -9
  288. package/src/page/schema.js +9 -9
  289. package/src/page/table-style.js +21 -21
  290. package/src/page/toc-link.js +1 -1
  291. package/src/page/tool-capability.js +8 -3
  292. package/src/page/tool-transport.js +52 -0
  293. package/src/page/tool-views.js +4 -0
  294. package/src/page/tools.js +6 -1
  295. package/src/page/view.js +6 -6
  296. package/src/page/ybind/binding.js +1 -1
  297. package/src/page/ybind/conversion.js +1 -1
  298. package/src/page/ybind/layout.js +4 -4
  299. package/src/page/ybind/migrate.js +1 -1
  300. package/src/page/ybind/origins.js +2 -2
  301. package/src/page/ybind/provider.js +2 -2
  302. package/src/page/ybind/recovery-proof.js +3 -3
  303. package/src/page/ybind/recovery-replay.js +2 -2
  304. package/src/plugins/ai-edit/picker.js +235 -0
  305. package/src/plugins/ai-edit.js +220 -34
  306. package/src/plugins/indicator-chip.js +39 -34
  307. package/src/plugins/indicator.js +13 -4
  308. package/src/plugins/live.js +21 -13
  309. package/src/plugins/menu/actions.js +89 -17
  310. package/src/plugins/menu/seo.js +32 -6
  311. package/src/plugins/menu/shell-style.js +26 -7
  312. package/src/plugins/menu/shell.js +12 -7
  313. package/src/plugins/menu/variants.js +6 -10
  314. package/src/plugins/menu/visitor.js +44 -34
  315. package/src/plugins/menu.js +3 -2
  316. package/src/plugins/page-view.js +2 -2
  317. package/src/plugins/page.js +257 -98
  318. package/src/plugins/sortable.js +7 -0
  319. package/src/plugins/upgrade.js +2 -1
  320. package/src/plugins/visitor-drafts/commit.js +303 -0
  321. package/src/plugins/visitor-drafts/idb.js +221 -0
  322. package/src/plugins/visitor-drafts/intro-style.js +1 -1
  323. package/src/plugins/visitor-drafts/intro.js +8 -25
  324. package/src/plugins/visitor-drafts/prompt.js +30 -4
  325. package/src/plugins/visitor-drafts/session.js +345 -0
  326. package/src/plugins/visitor-drafts/store.js +351 -32
  327. package/src/plugins/visitor-drafts.js +158 -27
  328. package/src/server/checkpoint/index.js +8 -8
  329. package/src/server/rooms/index.js +2 -2
  330. package/src/server/rooms/live-data-rooms.js +35 -35
  331. package/src/server/rooms/live-page-history.js +2 -2
  332. package/src/server/rooms/page-admission.js +34 -6
  333. package/src/server/rooms/page-conversion.js +1 -1
  334. package/src/server/rooms/page-lineage.js +4 -4
  335. package/src/server/rooms/page-rebase.js +4 -4
  336. package/src/server/rooms/page-room-conformance.js +14 -14
  337. package/src/server/rooms/page-state.js +2 -2
  338. package/src/server/rooms/page-write-admission.js +7 -7
  339. package/src/server/rooms/page-write-guard.js +3 -3
  340. package/src/sync/data-guard-notice.js +265 -0
  341. package/src/sync/live-sync.js +54 -11
  342. package/src/sync/page-relay.js +4 -4
  343. package/src/sync/presence-store.js +1 -1
  344. package/src/sync/presence-target.js +3 -3
  345. package/src/sync/presence.js +1 -1
  346. package/src/sync/stream.js +54 -13
  347. package/src/sync/wire-profile.js +8 -3
  348. package/src/ui/bevel.js +1 -1
  349. package/src/ui/index.js +9 -10
  350. package/src/ui/skins/cms.js +1 -1
  351. package/src/ui/skins/quickcrop.js +1 -1
  352. package/src/ui/skins/richclay.js +2 -2
  353. package/src/ui/toast-lazy.js +12 -3
  354. package/src/ui/toast.js +9 -3
  355. package/src/vendor/hyper-html-api-data.vendor.js +1 -1
  356. package/src/vendor/hyper-html-api-upgrade.vendor.js +2 -2
  357. package/src/vendor/hypercms.vendor.js +16 -16
  358. package/src/vendor/richclay.vendor.js +48 -20
  359. package/src/vendor/sap-core.vendor.js +1 -1
  360. package/tool-generation/context.md +44 -0
  361. package/tool-generation/system.md +23 -0
  362. package/dist/m/c-24PMUJIV.js +0 -2
  363. package/dist/m/c-2AYVYEI4.js +0 -1
  364. package/dist/m/c-2AZDZWCK.js +0 -1
  365. package/dist/m/c-2L6O5PDS.js +0 -6
  366. package/dist/m/c-2RYOGUQM.js +0 -2
  367. package/dist/m/c-2ZVOEU4M.js +0 -1
  368. package/dist/m/c-37NAONZA.js +0 -1
  369. package/dist/m/c-3GJ4SDE2.js +0 -1
  370. package/dist/m/c-3O7OBDCM.js +0 -1
  371. package/dist/m/c-5OJ7YF2N.js +0 -1
  372. package/dist/m/c-5WMXEKFH.js +0 -135
  373. package/dist/m/c-6RDOKLN7.js +0 -1
  374. package/dist/m/c-A4IP6MBC.js +0 -1
  375. package/dist/m/c-A6L3FMUS.js +0 -1
  376. package/dist/m/c-ATKAOH23.js +0 -1
  377. package/dist/m/c-B6O7AJYG.js +0 -32
  378. package/dist/m/c-BCGWJYXW.js +0 -1
  379. package/dist/m/c-BGKAT2FL.js +0 -7
  380. package/dist/m/c-BYTKL6UX.js +0 -1
  381. package/dist/m/c-DHBRA6DL.js +0 -1
  382. package/dist/m/c-DTMZ3ZHI.js +0 -1
  383. package/dist/m/c-E3ZXARWA.js +0 -1
  384. package/dist/m/c-EK63G3CG.js +0 -1
  385. package/dist/m/c-ELYIIYRS.js +0 -1
  386. package/dist/m/c-EXKHPOVC.js +0 -3
  387. package/dist/m/c-FCSZ3DC5.js +0 -20
  388. package/dist/m/c-FTWGYI5E.js +0 -1
  389. package/dist/m/c-G4PWUDD5.js +0 -1
  390. package/dist/m/c-GBKB5WDL.js +0 -2
  391. package/dist/m/c-GBTVCJXC.js +0 -1
  392. package/dist/m/c-GC2HICFJ.js +0 -1
  393. package/dist/m/c-GRWMD6O5.js +0 -1
  394. package/dist/m/c-HCNWJE4A.js +0 -4
  395. package/dist/m/c-HG2C77BM.js +0 -4
  396. package/dist/m/c-JGHEACGK.js +0 -1
  397. package/dist/m/c-JGLX6TBK.js +0 -1
  398. package/dist/m/c-JNRKHYWO.js +0 -1
  399. package/dist/m/c-KBS3UV6B.js +0 -1
  400. package/dist/m/c-KQ7E3PYY.js +0 -1
  401. package/dist/m/c-L3F5ZLIV.js +0 -1
  402. package/dist/m/c-L4KMT7FO.js +0 -6
  403. package/dist/m/c-L5VFATT6.js +0 -1
  404. package/dist/m/c-LCYPMULG.js +0 -1
  405. package/dist/m/c-LIGQYZ7M.js +0 -6
  406. package/dist/m/c-LKIWEPAV.js +0 -1
  407. package/dist/m/c-MPSKIU2I.js +0 -1
  408. package/dist/m/c-N7JPUPGC.js +0 -1
  409. package/dist/m/c-NK33MMYF.js +0 -1
  410. package/dist/m/c-NQLWOHLH.js +0 -10
  411. package/dist/m/c-NTHUTABN.js +0 -1
  412. package/dist/m/c-NWX3MFT4.js +0 -1
  413. package/dist/m/c-OKXI52N7.js +0 -1
  414. package/dist/m/c-OPONJ2UK.js +0 -128
  415. package/dist/m/c-OWQWOGYI.js +0 -1
  416. package/dist/m/c-P6Q2ZTFQ.js +0 -1
  417. package/dist/m/c-QEN6HZCA.js +0 -1
  418. package/dist/m/c-QIXT3Q7C.js +0 -28
  419. package/dist/m/c-QM5LXRDT.js +0 -9
  420. package/dist/m/c-QYYUVLVG.js +0 -1
  421. package/dist/m/c-RQRMPZXD.js +0 -1
  422. package/dist/m/c-SBCBXKOZ.js +0 -26
  423. package/dist/m/c-SKF5HL4I.js +0 -4
  424. package/dist/m/c-SRPC3VBE.js +0 -1
  425. package/dist/m/c-TANBH7FI.js +0 -1
  426. package/dist/m/c-THGQQDYY.js +0 -1
  427. package/dist/m/c-UD5JZTDL.js +0 -1
  428. package/dist/m/c-UDGEFWNU.js +0 -1
  429. package/dist/m/c-UGNV5MFB.js +0 -1
  430. package/dist/m/c-VIRFF5HG.js +0 -8
  431. package/dist/m/c-VJYEVRYK.js +0 -1
  432. package/dist/m/c-VQCEOGKH.js +0 -13
  433. package/dist/m/c-VYJ7O4RI.js +0 -34
  434. package/dist/m/c-W7IPVCAA.js +0 -1
  435. package/dist/m/c-WBGWGOM7.js +0 -1
  436. package/dist/m/c-WJ5DRBHT.js +0 -72
  437. package/dist/m/c-X5WC4PX5.js +0 -1
  438. package/dist/m/c-XCFQEWW6.js +0 -3
  439. package/dist/m/c-XGH4GS2T.js +0 -1
  440. package/dist/m/c-XLQ3BDMM.js +0 -1
  441. package/dist/m/c-ZQXNHZZT.js +0 -72
  442. package/dist/m/core/conflict-notice-42H4ASLA.js +0 -1
  443. package/dist/m/core/draft-mode-WSQAT67S.js +0 -1
  444. package/dist/m/core/save-ESPSQPLV.js +0 -1
  445. package/dist/m/core/save-core-6SQHOR6W.js +0 -1
  446. package/dist/m/loader-FBDE2UAB.js +0 -1
  447. package/dist/m/manifest-1D2F5CA5.js +0 -1
  448. package/dist/m/manifest-edit-F7CC5CFD.js +0 -1
  449. package/dist/m/page/editor-OSKOW6RS.js +0 -304
  450. package/dist/m/plugins/ai-edit-VV4QTINH.js +0 -6
  451. package/dist/m/plugins/indicator-WVPGMOZ7.js +0 -1
  452. package/dist/m/plugins/menu-Q4MFFQ6E.js +0 -1
  453. package/dist/m/plugins/page-OAWUJQEL.js +0 -2
  454. package/dist/m/plugins/page-view-DZ26ZDDQ.js +0 -1
  455. package/dist/m/plugins/richclay-PGOOJ4OK.js +0 -517
  456. package/dist/m/plugins/sortable-266HY6TR.js +0 -1
  457. package/dist/m/plugins/upgrade-BNZVFHMZ.js +0 -1
  458. package/dist/m/plugins/visitor-drafts-2AUYKAIJ.js +0 -20
  459. package/dist/m/plugins/wire-W2EV36KZ.js +0 -1
  460. package/dist/m/sync/live-sync-XGUPHI3I.js +0 -1
  461. package/dist/m/ui/index-VGYAKAKI.js +0 -1
  462. package/dist/page/themes/light-1.css +0 -431
  463. package/src/page/themes/content.css +0 -70
  464. package/src/page/themes/light-1.css +0 -431
  465. package/src/page/themes/light-1.source.css +0 -270
  466. package/src/page/themes/light-2.css +0 -211
  467. package/src/page/themes/light-3.css +0 -130
  468. package/src/page/themes/light-4.css +0 -299
  469. /package/dist/m/{c-FILLTJA7.js → c-QTTJYJMA.js} +0 -0
  470. /package/dist/m/plugins/{quickcrop-WWF5I422.js.LEGAL.txt → quickcrop-X5MRIBAP.js.LEGAL.txt} +0 -0
  471. /package/dist/m/plugins/{richclay-PGOOJ4OK.js.LEGAL.txt → richclay-Y2NV44NA.js.LEGAL.txt} +0 -0
@@ -2,7 +2,7 @@
2
2
  // hyper-html-api/dist/hyper-html-api.engine.min.js via hyper-html-api
3
3
  // `npm run copy-to-clayjs`. Edit the hyper-html-api source and re-run.
4
4
  (function () {
5
- var hyperHtmlApiData=(()=>{var le=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var Ne=(e,t)=>{for(var n in t)le(e,n,{get:t[n],enumerable:!0})},at=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ft(t))!ut.call(e,r)&&r!==n&&le(e,r,{get:()=>t[r],enumerable:!(i=ct(t,r))||i.enumerable});return e};var ht=e=>at(le({},"__esModule",{value:!0}),e);var on={};Ne(on,{applyData:()=>Re,default:()=>rn,engine:()=>Z,extractData:()=>be});var Q=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],ee=new Set(Q),ce=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),v=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),Ce=new Set(["checked","selected","disabled","readOnly","paused"]);function fe(e,t){return t==null?Ce.has(e)?!1:"":Ce.has(e)?t==="false"?!1:!!t:t}var R={};Ne(R,{EmptyListInsert:()=>N,MAX_RULE_DEPTH:()=>j,MaxRuleDepthExceeded:()=>k,NoRulesTag:()=>ue,RuleTargetReadOnly:()=>q,RulesParseError:()=>I,ShapeMismatch:()=>H,UnknownRulesVersion:()=>B,WriteNotRoundTripped:()=>te,WriteRefused:()=>V,WriteRejected:()=>ae});var I=class extends Error{constructor(t,n){super(t),this.name="RulesParseError",this.cause=n}},B=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},j=20,k=class extends Error{constructor(t){super(`rule depth exceeded ${j} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},H=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},N=class extends Error{constructor(t,n){super(n?`cannot add items to empty list at "${t.join(".")}" \u2014 ${n}`:`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},q=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}},V=class extends Error{constructor(t){super(`write refused: ${t.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=t}};function dt(e){return e.reduce((n,i)=>typeof i=="number"?`${n}[${i}]`:n?`${n}.${i}`:String(i),"")||"(root)"}var te=class extends Error{constructor(t){super(`write did not round-trip at "${dt(t)}"`),this.name="WriteNotRoundTripped",this.path=t}},ue=class extends Error{constructor(t){super(`no <script data-rules-name~="${t}"> rules tag in this document`),this.name="NoRulesTag",this.token=t}},ae=class extends Error{constructor(t,n){super(`write rejected: ${t.length} unknown key(s), ${n.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=t,this.unmatched=n}};function b(e){let t=0,n=null,i=-1;for(let r=0;r<e.length;r++){let o=e[r];o==="\\"?r++:n?o===n&&(n=null):o==='"'||o==="'"?n=o:o==="["||o==="("?t++:o==="]"||o===")"?t>0&&t--:o==="@"&&t===0&&(i=r)}return i}function he(e){let t=b(e);return t===-1?{selector:e,prop:null}:{selector:e.slice(0,t),prop:e.slice(t+1)||null}}function de(e){let t=0,n=null,i=-1,r=!1;for(let o=0;o<e.length;o++){let l=e[o];l==="\\"?o++:n?l===n&&(n=null):l==='"'||l==="'"?n=l:l==="["||l==="("?t++:l==="]"||l===")"?t>0&&t--:t===0&&l===">"?i=o:t===0&&l===","&&(r=!0)}return r||i===-1||!pt(e,i+1)?null:e.slice(0,i).trim()||null}function pt(e,t){let n=t,i=e.replace(/\s+$/,"").length;for(;n<i&&/\s/.test(e[n]);)n++;let r=0,o=null;for(;n<i;n++){let l=e[n];if(l==="\\")n++;else if(o)l===o&&(o=null);else if(l==='"'||l==="'")o=l;else if(l==="["||l==="(")r++;else if(l==="]"||l===")")r>0&&r--;else if(r===0&&(l==="+"||l==="~"||/\s/.test(l)))return!1}return!0}var mt=/^--[A-Za-z0-9_-]+$/;function C(e){return typeof e=="string"&&mt.test(e)}function Pe(e){let t=[],n=[],i=null,r=0;for(let o=0;o<e.length;o++){let l=e[o];if(i){l==="\\"?o++:l===i&&(i=null);continue}if(l==="/"&&e[o+1]==="*"){let c=e.indexOf("*/",o+2);o=c===-1?e.length:c+1;continue}l==='"'||l==="'"?i=l:l==="("?n.push(")"):l==="["?n.push("]"):l==="{"?n.push("}"):(l===")"||l==="]"||l==="}")&&n[n.length-1]===l?n.pop():l===";"&&n.length===0&&(t.push(e.slice(r,o)),r=o+1)}return t.push(e.slice(r)),t}function yt(e){let t="",n=null;for(let i=0;i<e.length;i++){let r=e[i];if(n){t+=r,r==="\\"&&i+1<e.length?t+=e[++i]:r===n&&(n=null);continue}if(r==="/"&&e[i+1]==="*"){let o=e.indexOf("*/",i+2);i=o===-1?e.length:o+1,t+=" ";continue}(r==='"'||r==="'")&&(n=r),t+=r}return t}function Me(e){e=yt(e);let t=e.indexOf(":");if(t===-1)return null;let n=e.slice(0,t).trim(),i=e.slice(t+1).trim(),r=/!\s*important\s*$/i.exec(i);return r&&(i=i.slice(0,r.index).trim()),{name:n,value:i,important:!!r}}function $(e,t){if(e==null)return null;let n=null;for(let i of Pe(String(e))){let r=Me(i);!r||r.name!==t||(!n||r.important||!n.important)&&(n=r)}return n?n.value:null}function ke(e,t,n){let i=e==null?"":String(e),r=n==null||n==="",o=Pe(i),l=o.map(Me),c=l.some(d=>d&&d.name===t&&d.important),s=[],f=!1;o.forEach((d,p)=>{let w=l[p];if(!w||w.name!==t){s.push(d);return}if(r||f)return;let a=/^\s*/.exec(d)[0];s.push(`${a}${t}: ${n}${c?" !important":""}`),f=!0});let u=s.join(";");if(!r&&!f){let d=u.trimEnd();u=d===""?`${t}: ${n}`:`${d}${d.endsWith(";")?" ":"; "}${t}: ${n}`}return u.trim()===""?null:u}function ne(e,t,n,i){let r=e.attr(t,"style");if(($(r,n)??"")===i)return;let o=ke(r,n,i);o==null?e.removeAttr(t,"style"):e.attr(t,"style",o)}function P(e,t,n,i={}){if(Object.prototype.hasOwnProperty.call(i,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return pe(e,t,n,{depth:0,path:[]},i)}function pe(e,t,n,i,r){if(i.depth>j)throw new k(i.path);if(typeof n=="string")return gt(e,t,n,i,r);if(Array.isArray(n)){let[o,l]=n,c=e.find(t,o,r);return Ie(r,i,c),c.map((s,f)=>pe(e,s,l,{depth:i.depth+1,path:[...i.path,f]},r))}if(typeof n=="object"&&n!==null){let o={};for(let[l,c]of Object.entries(n))o[l]=pe(e,t,c,{depth:i.depth+1,path:[...i.path,l]},r);return o}return null}function gt(e,t,n,i,r){if(n.endsWith("[]")){let c=n.slice(0,-2),s=e.find(t,c,r);return Ie(r,i,s),s.map(f=>e.text(f))}if(n.startsWith("@"))return Le(e,t,n.slice(1));let o=b(n);if(o!==-1){let c=n.slice(0,o),s=n.slice(o+1),f=c?e.find(t,c,r):[t];return f.length===0?null:Le(e,f[0],s)}if(n===".")return e.text(t);let l=e.find(t,n,r);return l.length===0?null:e.text(l[0])}function Ie(e,t,n){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),n)}catch(i){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,i)}}function Le(e,t,n){if(C(n))return $(e.attr(t,"style"),n);if(ee.has(n)){let r=e.prop(t,n);return r==null?null:String(r)}let i=e.attr(t,n);return i??null}function _e(e,t,n,i){let r=e.length,o=t.length,l=new Array(r).fill(-1);if(i){let h=new Set;for(let y=0;y<r;y++){let A=i[y];!(A>=0&&A<o)||h.has(A)||(l[y]=A,h.add(A))}}if(r===0||o===0)return l;let c=e.map(h=>je(h,n)),s=t.map(h=>je(h,n)),f=new Array(o).fill(!1);for(let h of l)h>=0&&(f[h]=!0);let u=new Map;s.forEach((h,y)=>{f[y]||u.set(h,u.has(h)?-1:y)});let d=new Map;c.forEach((h,y)=>{l[y]>=0||d.set(h,(d.get(h)||0)+1)}),c.forEach((h,y)=>{if(l[y]>=0||d.get(h)!==1)return;let A=u.get(h);A===void 0||A===-1||f[A]||(l[y]=A,f[A]=!0)});let p=[];for(let h=0;h<r;h++)l[h]<0&&p.push(h);let w=[];for(let h=0;h<o;h++)f[h]||w.push(h);if(p.length===0||w.length===0)return l;let a=r*o+1,m=At(e,t,n),g=(h,y)=>m(h,y)*a+Math.abs(h-y);for(let[h,y]of Tt(p,w,g))l[h]=y;return l}var De=e=>typeof e=="object"&&e!==null;function je(e,t){if(!De(t))return e==null?" null":String(e);let n=Object.keys(t);return JSON.stringify(n.map(i=>{let r=JSON.stringify(e?.[i]);return r===void 0?" undef":r}))}function At(e,t,n){if(!De(n))return(c,s)=>e[c]===t[s]?0:1;let i=Object.keys(n),r=c=>i.map(s=>JSON.stringify(c?.[s])),o=e.map(r),l=t.map(r);return(c,s)=>{let f=o[c],u=l[s],d=0;for(let p=0;p<i.length;p++)f[p]!==u[p]&&d++;return d}}function Tt(e,t,n){return e.length<=t.length?$e(e,t,n,!1):$e(t,e,(i,r)=>n(r,i),!0)}function $e(e,t,n,i){let r=e.length,o=t.length,l=[];for(let d=0;d<=r;d++)l.push(new Float64Array(o+1).fill(1/0));let c=[];for(let d=0;d<=r;d++)c.push(new Uint8Array(o+1));for(let d=0;d<=o;d++)l[r][d]=0;for(let d=r-1;d>=0;d--)for(let p=o-1;p>=0;p--){let w=n(e[d],t[p])+l[d+1][p+1],a=l[d][p+1];w<=a?(l[d][p]=w,c[d][p]=1):l[d][p]=a}let s=[],f=0,u=0;for(;f<r&&u<o;)c[f][u]&&(s.push(i?[t[u],e[f]]:[e[f],t[u]]),f++),u++;return s}function ye(e,t,n,i,r,o,l,c={}){let s=e.find(t,n,c);if(r.length===0){s.forEach(T=>e.remove(T)),me(c,"onRowsApplied",o.path,[]);return}let f=r.length>s.length,u=s[0]||null;if(f&&!u&&(u=St(e,t,n,c),!u))throw new N(o.path);let d=s.map(T=>Ot(e,T,i,c)),p=null;if(f&&u){p=e.clone(u),c.templateAttr&&e.removeAttr(p,c.templateAttr);let T=e.stripIds(p);T>0&&console.warn(`[hyper-html-api] stripped ${T} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let w=_e(r,d,i,wt(e,s,r,o,c)),a=s.length>0?e.parent(s[0]):Nt(e,t,n,u,o,c),m=s.length>0?qe(e,a,s[0]):0,g=Mt(e,s),h=new Set,y=[],A=r.map((T,x)=>{let O=w[x];if(O>=0)return h.add(O),y.push(!1),s[O];y.push(!0);let E=e.clone(p);return e.stripIds(E),E});s.forEach((T,x)=>{h.has(x)||e.remove(T)}),g?Pt(e,a,m,A,y):kt(e,A,y,a,m),Et(e,A,i,r,o,l,c),me(c,"onRowsApplied",o.path,A)}function me(e,t,n,i){if(typeof e[t]=="function")try{return e[t](n.slice(),i)}catch(r){console.warn(`[hyper-html-api] ${t} threw at "${n.join(".")||"(root)"}"`,r);return}}function wt(e,t,n,i,r){let o=me(r,"identifyRows",i.path,n);if(!Array.isArray(o))return null;let l=new Array(n.length).fill(-1),c=new Set,s=new Map(t.map((f,u)=>[e.identity(f),u]));for(let f=0;f<n.length;f++){if(!o[f])continue;let u=s.get(e.identity(o[f]));u===void 0||c.has(u)||(l[f]=u,c.add(u))}return l}function Et(e,t,n,i,r,o,l){t.forEach((c,s)=>{if(n===null){let f=i[s],u=f==null?"":String(f);e.text(c)!==u&&e.text(c,u)}else{let f=o(e,c,n,i[s],{depth:r.depth+1,path:[...r.path,s]},l);f&&f!==c&&(t[s]=f)}})}function Ot(e,t,n,i){return n===null?e.text(t):P(e,t,n,i.onRowsRead?{...i,onRowsRead:void 0}:i)}function qe(e,t,n){let i=e.children(t);for(let r=0;r<i.length;r++)if(e.sameNode(i[r],n))return r;return-1}function St(e,t,n,i){if(!i.templateAttr)return null;let r=/^\s*:scope\s*>\s*/.test(n),o=new RegExp(":not\\(\\["+i.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),l=n.replace(/^\s*:scope\s*>\s*/,"").replace(o,""),c=r?xt(l):0,s=de(l),f=t;for(;f;){let u=e.find(f,l,{includeRulesTag:!1,templateAttr:null});for(let d of u)if(e.attr(d,i.templateAttr)!=null&&!(r&&!Rt(e,t,d,c))&&!(s&&!e.matches(e.parent(d),s)))return d;f=e.parent(f)}return null}function xt(e){let t=0,n=null,i=1;for(let r=0;r<e.length;r++){let o=e[r];if(o==="\\")r++;else if(n)o===n&&(n=null);else if(o==='"'||o==="'")n=o;else if(o==="["||o==="(")t++;else if(o==="]"||o===")")t>0&&t--;else if(t===0&&o===">")i++;else{if(t===0&&(o==="+"||o==="~"))return null;if(t===0&&/\s/.test(o)){if(!bt(e,r))return null;for(;r+1<e.length&&/\s/.test(e[r+1]);)r++}}}return i}function bt(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;let i=t>0?e[t-1]:"",r=n<e.length?e[n]:"";return We(i)||We(r)}function We(e){return e===">"||e==="+"||e==="~"}function Rt(e,t,n,i){if(i===null)return!0;let r=n;for(let s=0;s<i;s++)if(r=e.parent(r),!r)return!1;let o=e.prop(t,"tagName");if(!o)return!0;let l=e.prop(r,"tagName");if(!l||String(l).toLowerCase()!==String(o).toLowerCase())return!1;let c=new Set(ve(e,r));return ve(e,t).every(s=>c.has(s))}function ve(e,t){let n=e.attr(t,"class");return n?String(n).split(/\s+/).filter(Boolean):[]}function Nt(e,t,n,i,r,o){let l=e.parent(i);if(l&&Ct(e,t,l)&&!He(e,l,o))return l;let c=de(n);if(!c)throw new N(r.path,`the list selector "${n}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let f=(c===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,c,o)).filter(u=>!He(e,u,o));if(f.length===0)throw new N(r.path,`no container matching "${c}" inside this context to hold the new rows`);if(f.length>1)throw new N(r.path,`"${c}" matches ${f.length} containers inside this context, so the new rows have no single destination`);return f[0]}function Ct(e,t,n){let i=n;for(;i;){if(e.sameNode(i,t))return!0;i=e.parent(i)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(r=>e.sameNode(r,n))}var Be=["no-data","editor-ui"];function He(e,t,n){let i=t;for(;i;){if(n.templateAttr&&e.attr(i,n.templateAttr)!=null||Be.some(o=>e.attr(i,o)!=null))return!0;let r=e.attr(i,"clay");if(r&&r.split(/\s+/).some(o=>Be.includes(o)))return!0;i=e.parent(i)}return!1}function Pt(e,t,n,i,r){let o=e.children(t),l=o.map(s=>e.identity(s)),c=!1;i.forEach((s,f)=>{let u=e.identity(s),d=n+f;if(l[d]===u)return;if(!r[f]){let w=l.indexOf(u);w!==-1&&(l.splice(w,1),o.splice(w,1))}let p=Math.min(d,o.length);p<o.length?e.insertBefore(o[p],s):o.length?c?e.insertAfter(o[o.length-1],s):(e.insertAt(t,s,d),c=!0):e.insertAt(t,s,0),l.splice(p,0,u),o.splice(p,0,s)})}function Mt(e,t){if(t.length<=1)return!0;let n=e.parent(t[0]);if(!n)return!1;let i=new Map(e.children(n).map((o,l)=>[e.identity(o),l])),r=[];for(let o of t){let l=i.get(e.identity(o));if(l===void 0)return!1;r.push(l)}return r.sort((o,l)=>o-l),r[r.length-1]-r[0]===r.length-1}function kt(e,t,n,i,r){let o=null,l=r;for(let c=0;c<t.length;c++){if(!n[c]){o=t[c];continue}let s=o?e.parent(o):i;if(!s)continue;let f=o?qe(e,s,o)+1:l++;e.insertAt(s,t[c],f),o=t[c]}}function L(e,t,n,i,r={}){if(Object.prototype.hasOwnProperty.call(r,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");let o=[];if(ge(n,i,[],o),o.length)throw new H(o);re(e,t,n,i,{depth:0,path:[]},r)}function re(e,t,n,i,r,o={}){if(r.depth>j)throw new k(r.path);if(i===void 0)return t;if(typeof n=="string")return Lt(e,t,n,i,r,o);if(Array.isArray(n)){let[l,c]=n;return ye(e,t,l,c,i,r,re,o),t}if(typeof n=="object"&&n!==null){for(let[l,c]of Object.entries(n)){let s=re(e,t,c,i==null?i:i[l],{depth:r.depth+1,path:[...r.path,l]},o);s&&s!==t&&(t=s)}return t}return t}function Lt(e,t,n,i,r,o){if(n.endsWith("[]")){let s=n.slice(0,-2);return ye(e,t,s,null,i,r,re,o),t}if(n.startsWith("@"))return Ue(e,t,n.slice(1),i);let l=b(n);if(l!==-1){let s=n.slice(0,l),f=n.slice(l+1),u=s?e.find(t,s,o):[t];return u.length===0||Ue(e,u[0],f,i),t}if(n===".")return Ve(e,t,i),t;let c=e.find(t,n,o);return c.length===0||Ve(e,c[0],i),t}function Ve(e,t,n){let i=n==null?"":String(n);e.text(t)!==i&&e.text(t,i)}function It(e,t,n,i){if(e.styleVar){e.styleVar(t,n,i);return}ne(e,t,n,i)}function Ue(e,t,n,i){if(C(n))return It(e,t,n,i==null?"":String(i).trim()),t;if(v.has(n)){let r=e.prop(t,n);if(r===i||r!=null&&i!=null&&String(r)===String(i))return t;throw new q(n)}if(n==="outerHTML"){let r=i==null?"":String(i);return e.replaceWith(t,r)}if(ce.has(n)){let r=fe(n,i);return e.prop(t,n)!==r&&e.prop(t,n,r),t}if(i==null)e.attr(t,n)!=null&&e.removeAttr(t,n);else{let r=String(i);e.attr(t,n)!==r&&e.attr(t,n,r)}return t}function ge(e,t,n,i){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((r,o)=>{typeof r=="object"&&r!==null&&i.push({path:z([...n,o]),expected:"scalar",got:U(r)})}):i.push({path:z(n),expected:"array",got:U(t)});return}t!==null&&typeof t=="object"&&i.push({path:z(n),expected:"scalar",got:U(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){i.push({path:z(n),expected:"array",got:U(t)});return}let r=e[1];t.forEach((o,l)=>ge(r,o,[...n,l],i));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){i.push({path:z(n),expected:"object",got:U(t)});return}for(let[r,o]of Object.entries(e))ge(o,t[r],[...n,r],i)}}}function U(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function z(e){return e.join(".")}function Ae(e){try{return JSON.parse(e)}catch(t){throw new I(`Invalid strict JSON: ${t.message}`,t)}}function F(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function n(r){let o=[],l=0;for(;l<r.length;){let c=r[l];if(/\s/.test(c)){l++;continue}if("{}".includes(c)){o.push({type:c,value:c}),l++;continue}if(c==="["){let d=!1,p=l+1;for(;p<r.length&&/\s/.test(r[p]);)p++;if(p<r.length&&/[a-zA-Z_]/.test(r[p])&&(d=!0),!d){o.push({type:c,value:c}),l++;continue}}if(c==="]"){o.push({type:c,value:c}),l++;continue}if(c===":"){o.push({type:t.COLON,value:c}),l++;continue}if(c===","){o.push({type:t.COMMA,value:c}),l++;continue}if(c==='"'||c==="'"){let d=c,p=l+1;for(;p<r.length&&r[p]!==d;)r[p]==="\\"&&p++,p++;o.push({type:t.STRING,value:r.substring(l+1,p),quoted:!0,sourceQuote:d}),l=p+1;continue}let s=l,f;for(;s<r.length&&!/[{},]/.test(r[s]);)if(r[s]===":"){let d=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],p=!1;for(let w of d){let a=w.substring(1);if(r.substring(s+1,s+1+a.length)===a){p=!0,s+=a.length;break}}if(!p)break}else if(r[s]==="["){for(s++;s<r.length&&r[s]!=="]";){if(r[s]==='"'||r[s]==="'"){let d=r[s];for(s++;s<r.length&&r[s]!==d;)r[s]==="\\"&&s++,s++}s++}s<r.length&&r[s]==="]"&&s++}else s++;f=r.substring(l,s);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(f)?u=t.NUMBER:f==="true"||f==="false"||f==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(f)&&(u=t.SELECTOR),o.push({type:u,value:f,quoted:!1}),l=s}return o}function i(r){let o="";for(let l=0;l<r.length;l++){let c=r[l];if("{}".includes(c.type)||"[]".includes(c.type)){o+=c.value;continue}if(c.type===t.COLON){o+=c.value;continue}if(c.type===t.COMMA){let s=r[l+1];if(s&&(s.type==="}"||s.type==="]"))continue;o+=c.value;continue}if(c.type===t.STRING&&c.quoted){let s=c.value;c.sourceQuote==="'"&&(s=s.replace(/\\'/g,"'"),s=s.replace(/(\\*)"/g,(f,u)=>u.length%2===0?u+'\\"':f)),o+=`"${s}"`;continue}if(c.type===t.NUMBER||c.type===t.BOOLEAN){o+=c.value;continue}if(c.type===t.SELECTOR||c.type===t.IDENTIFIER){o+=`"${c.value}"`;continue}o+=`"${c.value}"`}return o}try{let r=n(e),o=i(r);return JSON.parse(o)}catch(r){throw new I("Invalid extraction rules syntax: "+r.message,r)}}var jt="1",ze=/^[a-zA-Z0-9_-]+$/;function _(e,t,n){let i;if(n===void 0)i="script[data-rules-name]";else{if(typeof n!="string"||!ze.test(n))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(n)} (must match ${ze})`);i=`script[data-rules-name~="${n}"]`}let r=e.find(t,i,{includeRulesTag:!0});if(r.length===0)return null;n!==void 0&&r.length>1&&console.warn(`hyper-html-api: ${r.length} rules tags match data-rules-name~="${n}"; using the first.`);let o=r[0],l=e.attr(o,"data-rules-version");if(l!==jt)throw new B(l);return{rules:F(e.text(o)),tagNode:o}}var ie=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),$t=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Fe=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function K(e,t){if(!e||e.nodeType!==1)return!1;let n=e.getAttribute?.("clay");return!!(n&&n.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function Te(e,t){if(K(e,t))return!0;for(let[n,i]of Object.entries($t))if(i.includes(t)&&K(e,n))return!0;return!1}function J(e){let t=ie[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(n=>[`[clay~="${n}"]`,`[${n}]`]).join(", ")}function _t(e,t){let n=e&&e.nodeType===1?e:e?.parentElement;for(;n&&n.nodeType===1;){let i=ie[t];if(!i)throw new Error(`Unknown region capability: ${t}`);if(i.tokens.some(r=>Te(n,r))||i.bundles.some(r=>K(n,r)))return n;n=n.parentElement}return null}function Ke(e,t){return!!_t(e,t)}var oe=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...Fe],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})}),Dt=new Set(["textContent","innerText"]);function Je(e){let n=String(e).replace(/^[\u0000- ]+|[\u0000- ]+$/g,"").replace(/[\t\n\r]/g,"").match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);return n?n[1].toLowerCase():null}var Wt=/^[^\t\n\f\r "'>/=\u0000-\u001f\u007f]+$/;function Xe(e,t,n=oe){if(!Wt.test(String(e)))return`attribute name ${JSON.stringify(String(e))} is not valid`;let i=String(e).toLowerCase();if(n.refusedAttributePrefixes.some(r=>i.startsWith(r)))return`attribute "${i}" can run script`;if(n.refusedAttributes.includes(i))return`attribute "${i}" is not content`;if(n.urlAttributes.includes(i)&&t!=null){let r=i==="srcset"?String(t).split(",").map(o=>o.trim().split(/\s+/)[0]).filter(Boolean):[String(t)];for(let o of r){let l=Je(o);if(l&&n.refusedSchemes.includes(l))return`"${l}:" URLs are not allowed in "${i}"`}}return null}function we(e,t){let n=e.prop(t,"tagName");return n?String(n).toLowerCase():""}function vt(e,t){let n=we(e,t)||"node",i=e.attr(t,"id");return i?`<${n}#${i}>`:`<${n}>`}function Bt(e,t,n){let i=t;for(;i;){let r=we(e,i);if(r&&n.refusedTargets.includes(r))return r;i=e.parent(i)}return null}function Ye(e,t){return e.find(t,"script[data-rules-name]",{includeRulesTag:!0,templateAttr:null}).length>0}function Ht(e,t){return we(e,t)==="script"&&e.attr(t,"data-rules-name")!=null?!0:Ye(e,t)}function qt(e){if(/[\u0000-\u001f\u007f]/.test(e))return"control characters are not allowed in a custom property value";let t=[],n=null;for(let i=0;i<e.length;i++){let r=e[i];if(n){r===n&&(n=null);continue}if(r==='"'||r==="'")n=r;else{if(r==="/"&&e[i+1]==="*")return"comments are not allowed in a custom property value";if(r==="(")t.push(")");else if(r==="[")t.push("]");else if((r===")"||r==="]")&&t.pop()!==r)return`"${r}" does not close anything in this custom property value`}}return n?"a custom property value must close its quotes":t.length?"a custom property value must close its brackets":null}function Ge(e,t=oe){let n=t.customPropertyValues,i=String(e);if(i.length>n.maxLength)return`custom property values are limited to ${n.maxLength} characters`;let r=n.refusedCharacters.find(s=>i.includes(s));if(r)return`${JSON.stringify(r)} is not allowed in a custom property value`;let o=qt(i);if(o)return o;let l=i.toLowerCase(),c=n.refusedFunctions.find(s=>new RegExp(`(^|[^a-z0-9_-])${s.replace(/[-]/g,"\\-")}\\s*\\(`).test(l));return c?`"${c}()" is not allowed in a custom property value`:null}function se(e,t=oe){let n=[],i=(s,f)=>(n.push({target:vt(e,s),reason:f}),!1),r=s=>{let f=Bt(e,s,t);return f?i(s,`inside <${f}>, which is not content`):!0},o=s=>r(s)?Ye(e,s)?i(s,"a text write here would delete the data rules tag"):!0:!1,l=(s,f,u)=>{if(!r(s))return!1;let d=Xe(f,u,t);return d?i(s,d):!0};return{...e,text(s,f){if(f===void 0)return e.text(s);o(s)&&e.text(s,f)},attr(s,f,u){if(u===void 0)return e.attr(s,f);l(s,f,u)&&e.attr(s,f,u)},removeAttr(s,f){l(s,f,null)&&e.removeAttr(s,f)},styleVar(s,f,u){if(($(e.attr(s,"style"),f)??"")!==u&&r(s)){if(!C(f))return i(s,`"${f}" is not a custom property`);if(u!==""){let d=Ge(u,t);if(d)return i(s,d)}ne(e,s,f,u)}},prop(s,f,u){if(u===void 0)return e.prop(s,f);if(t.refusedRuleForms.includes(f))return i(s,`"@${f}" writes HTML, only text is allowed`);if(Dt.has(f)){o(s)&&e.prop(s,f,u);return}l(s,f==="className"?"class":f,u)&&e.prop(s,f,u)},remove(s){if(Ht(e,s)){i(s,"removing this would delete the data rules tag");return}e.remove(s)},replaceWith(s,f){return f===e.prop(s,"outerHTML")||i(s,'"@outerHTML" writes HTML, only text is allowed'),s},refusals:n,assertClean(){if(n.length)throw new V(n.slice())}}}function X(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ze(e){return e.reduce((t,n)=>typeof n=="number"?`${t}[${n}]`:t?`${t}.${n}`:n,"")}function Ee(e,t,n,i,r={}){let o=[],l=[];function c(f,u,d){if(Array.isArray(f)){let[,p]=f;if(!Array.isArray(u)||!X(p))return;u.forEach((w,a)=>c(p,w,[...d,a]));return}if(!(!X(f)||!X(u)))for(let p of Object.keys(u))Object.prototype.hasOwnProperty.call(f,p)?c(f[p],u[p],[...d,p]):o.push(Ze([...d,p]))}function s(f,u,d,p){if(d!==void 0){if(typeof u=="string"){if(u.endsWith("[]")||u==="."||u.startsWith("@"))return;let w=b(u),a=w===-1?u:u.slice(0,w);if(!a)return;e.find(f,a,r).length===0&&l.push({path:Ze(p),selector:a});return}if(!Array.isArray(u)&&X(u)&&X(d))for(let[w,a]of Object.entries(u))s(f,a,d[w],[...p,w])}}return c(n,i,[]),s(t,n,i,[]),{unknownKeys:o,unmatched:l}}function Oe(e,t,n){if(n&&typeof n=="object")return{rules:n,tagNode:null};if(typeof n=="string"){let i=t&&t.ownerDocument?t.ownerDocument:t;return _(e,i,n)}return null}var Ut=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function zt(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let n=(e.getAttribute?.("type")||"").toLowerCase();"value"in e&&"value"in t&&e.tagName!=="OPTION"&&n!=="checkbox"&&n!=="radio"&&n!=="file"&&(t.value=e.value),e.tagName==="INPUT"&&(n==="checkbox"||n==="radio")&&(t.checked=e.checked),e.tagName==="OPTION"&&(t.selected=e.selected),"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function Qe(e,t,n,i){if(i)return!!e.closest?.(t);let r=e;for(;r?.nodeType===1;){if(r.matches(t))return!0;if(r===n)break;r=r.parentElement}return!1}function et(e,t,n,i,r,o){return(o?Ke(e,t):Qe(e,n,r,!1))||!!(i&&(o&&e!==r?e.matches(i):Qe(e,i,r,o)))}function Ft(e,t){let n=ie[t];return n.tokens.some(i=>Te(e,i))||n.bundles.some(i=>K(e,i))}var Kt=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function tt(e,t,n,i){if(e.nodeType===1&&i(e)){n.dropped.push(t);return}n.cloneToLive.set(t,e),n.liveToClone.set(e,t);let r=e,o=t;if(e.nodeType===1){if(Kt.has(e.tagName)&&n.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);r=e.content,o=t.content,n.cloneToLive.set(o,r),n.liveToClone.set(r,o)}}else if(e.nodeType!==11)return;let l=o.firstChild;for(let c=r.firstChild;c&&l;c=c.nextSibling)tt(c,l,n,i),l=l.nextSibling}function Y(e,{capability:t="data",exclude:n=null,inherit:i=!0,provenance:r=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let o=e.nodeType===9?e:e.ownerDocument;if(!o?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let l=o.implementation.createHTMLDocument(""),c=r||new WeakMap,s=new WeakMap,f=e.nodeType===9?e.documentElement:e;n&&l.documentElement.matches(n);let u=J(t),d=i?a=>Ft(a,t)||!!(n&&a.matches(n)):a=>et(a,t,u,n,f,!1),p=null;if(f.nodeType!==1||!et(f,t,u,n,f,i)){p=l.importNode(f,!0);let a={cloneToLive:c,liveToClone:s,dropped:[],controls:[]};tt(f,p,a,d);for(let m of a.dropped)m.remove();for(let m=0;m<a.controls.length;m+=2)zt(a.controls[m],a.controls[m+1])}e.nodeType===9&&p&&(l.replaceChild(p,l.documentElement),s.set(e,l),c.set(l,e));let w=a=>{if(Ut.test(a))throw new Error(`Filtered content queries do not support stateful selector: ${a}`)};return{root:p,document:l,capability:t,selector:J(t),cloneToLive:c,liveToClone:s,original(a){return c.get(a)||null},cloneOf(a){return s.get(a)||null},query(a,m=p){return w(a),Array.from(m.querySelectorAll(a),g=>c.get(g)||g)},text(a=p){return(a===p?p:s.get(a))?.textContent||""},html(a=p){return(a===p?p:s.get(a))?.innerHTML??""},clone(a=p){let m=a===p?p:s.get(a);return m?l.importNode(m,!0):null}}}function rt(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function Jt(e){return e?(e.nodeType===9||e.nodeType===11,e):null}function nt(e,t,n){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=n===null?"":n:t==="checked"&&e.tagName==="INPUT"?e.checked=n!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=n!==null))}function it(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function ot(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let n of t)if(n.tagName==="TEXTAREA")n.value=n.defaultValue;else if(n.tagName==="INPUT"){let i=n.type;i!=="file"&&i!=="checkbox"&&i!=="radio"&&(n.value=n.defaultValue),n.checked=n.defaultChecked}else n.tagName==="OPTION"&&(n.selected=n.defaultSelected)}var S={semanticExclude:!0,find(e,t,n={}){let i=Jt(e);if(!i||!i.querySelectorAll)return[];let r=Array.from(i.querySelectorAll(t));n.includeRulesTag||(r=r.filter(c=>!rt(c)));let o=[];n.skip&&o.push(n.skip);let l=n.templateAttr===null?null:n.templateAttr||"cms-template";if(l&&o.push("["+l+"]"),o.length){let c=o.join(", ");r=r.filter(s=>!s.closest||!s.closest(c))}return r},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,it(e,t)},attr(e,t,n){if(n===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,n),nt(e,t,n)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),nt(e,t,null)},prop(e,t,n){if(n===void 0){let i=e?e[t]:void 0;return i!==void 0?i:null}e[t]=n},clone(e){let t=e.cloneNode(!0);return ot(t),t},insertAt(e,t,n){let i=e.children[n]||null;e.insertBefore(t,i)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let i=e.ownerDocument.createElement("template");i.innerHTML=t;let r=i.content.firstElementChild;if(!r)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(r,e),r},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(i=>{i.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function M(e,t={}){if(t.exclude===null)return S;let n=[J("data"),t.exclude].filter(Boolean).join(", "),i=e.nodeType===9?e:e.ownerDocument||e,r=e.nodeType===9?e.documentElement:e;if(!t._write&&!r?.matches?.(n)&&!r?.querySelector?.(n)&&!i?.querySelector?.(n))return S;let o=e.nodeType===9||!e.isConnected?e:e.ownerDocument,l=e.nodeType===9?e:e.ownerDocument,c=null,s=()=>c||(c=Y(o,{capability:"data",exclude:t.exclude||null})),f=a=>{let m=s();return a===e?m.cloneOf(e):m.cloneOf(a)||a},u=a=>c?.original(a)||a,d=(a,m)=>{s().liveToClone.set(a,m),s().cloneToLive.set(m,a);let g=a.childNodes||[],h=m.childNodes||[];for(let y=0;y<Math.min(g.length,h.length);y++)d(g[y],h[y])},p=(a,m,g,h)=>{let y=Array.from(a.childNodes).filter(E=>c.cloneOf(E)),T=y[0];for(;T&&y.includes(T);)T=T.nextSibling;for(let E of y)E.remove();if(g==="innerHTML"){let E=l.createElement("template");E.innerHTML=h;for(let W of Array.from(E.content.childNodes))a.insertBefore(W,T||null)}else a.insertBefore(l.createTextNode(h),T||null),it(a,h);let x=Y(a,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(x.root?.childNodes||[]));let O=E=>{let W=x.original(E);W&&(c.liveToClone.set(W,E),c.cloneToLive.set(E,W));for(let lt of Array.from(E.childNodes||[]))O(lt)};for(let E of Array.from(m.childNodes))O(E)},w={...S,find(a,m,g={}){let h=f(a);if(!h?.querySelectorAll)return[];let y=s().query(m,h);g.includeRulesTag||(y=y.filter(x=>!rt(x)));let A=[];g.skip&&A.push(g.skip);let T=g.templateAttr===null?null:g.templateAttr||"cms-template";if(T&&A.push(`[${T}]`),A.length){let x=A.join(", ");y=y.filter(O=>!O.closest?.(x))}return y},parent(a){let m=f(a)?.parentElement;return m?u(m):null},children(a){return Array.from(f(a)?.children||[],u)},text(a,m){if(m===void 0){let y=u(a);return!y?.matches?.(n)&&!y?.querySelector?.(n)?S.text(y):(f(a)?.textContent||"").trim()}let g=u(a);if(!g?.matches?.(n)&&!g?.querySelector?.(n)&&!c){S.text(g,m);return}let h=s().cloneOf(g);h?p(g,h,"textContent",m):S.text(g,m)},attr(a,m,g){let h=u(a);if(g===void 0)return S.attr(h,m);S.attr(h,m,g);let y=c?.cloneOf(h);y&&(S.attr(y,m,g),Y(h,{capability:"data",exclude:t.exclude||null}).root===null&&(y.remove(),c.liveToClone.delete(h),c.cloneToLive.delete(y)))},removeAttr(a,m){let g=u(a);S.removeAttr(g,m);let h=c?.cloneOf(g);h&&S.removeAttr(h,m)},prop(a,m,g){let h=u(a);if(g===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?S.prop(f(h),m):S.prop(h,m);let y=m==="innerHTML"||m==="textContent"||m==="innerText",A=y?s().cloneOf(h):c?.cloneOf(h);A&&y?p(h,A,m,g):(S.prop(h,m,g),A&&S.prop(A,m,g))},clone(a){let m=f(a);if(m===a)return S.clone(a);let g=l.importNode(m,!0);return ot(g),g},insertAt(a,m,g){let h=u(a),A=w.children(h)[g]||(()=>{for(let O=h.children.length-1;O>=0;O--){let E=h.children[O];if(s().cloneOf(E))return E.nextElementSibling}return h.firstElementChild})(),T=u(m);h.insertBefore(T,A||null);let x=s().cloneOf(h);if(x){let O=s().cloneOf(T);O||(O=l.importNode(T,!0),d(T,O));let E=Array.from(x.children);x.insertBefore(O,E[g]||null)}},insertBefore(a,m){let g=u(a),h=u(m);g.parentNode.insertBefore(h,g);let y=s().cloneOf(g.parentNode);if(y){let A=s().cloneOf(h);A||(A=l.importNode(h,!0),d(h,A));let T=s().cloneOf(g);T?T.before(A):y.appendChild(A)}},insertAfter(a,m){let g=u(a),h=u(m);g.parentNode.insertBefore(h,g.nextSibling);let y=s().cloneOf(g.parentNode);if(y){let A=s().cloneOf(h);A||(A=l.importNode(h,!0),d(h,A));let T=s().cloneOf(g);T?T.after(A):y.appendChild(A)}},identity(a){return u(a)||null},remove(a){let m=u(a),g=s().cloneOf(m);S.remove(m),g&&S.remove(g)},replaceWith(a,m){let g=u(a),h=s().cloneOf(g),y=S.replaceWith(g,m);if(h){let A=Y(y,{capability:"data",exclude:t.exclude||null});if(!A.root)h.remove();else{h.replaceWith(A.root);let T=x=>{let O=A.original(x);O&&(c.liveToClone.set(O,x),c.cloneToLive.set(x,O));for(let E of Array.from(x.childNodes||[]))T(E)};T(A.root)}}return y}};return w}var G=S;var Z={extract:(e,t,n={})=>P(M(e,n),e,t,n),apply:(e,t,n,i={})=>L(M(e,{...i,_write:!0}),e,t,n,i),findRulesIn:(e,t)=>_(G,e,t),findRules:(e,t)=>Oe(G,e,t),bind:(e,t,n={})=>{let i=Oe(G,e,t);if(!i){let r=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${r}`)}return{...i,get:()=>P(M(e,n),e,i.rules,n),set:r=>L(M(e,{...n,_write:!0}),e,i.rules,r,n)}},parseStrict:Ae,parseRelaxed:F,ruleAttrIndex:b,splitRule:he,errors:R,DOM_PROPERTIES:Q},Se=e=>!!e&&typeof e.nodeType=="number";function st(e){let t=e&&e.ownerDocument?e.ownerDocument:e,n=_(G,t,"api");if(!n)throw new R.NoRulesTag("api");return n.rules}function Xt(e){if(e.nodeType===9)return e;let t=e.ownerDocument?.documentElement;if(t?.contains(e))return t;let n=e;for(;n.parentNode;)n=n.parentNode;return n}function Yt(e){if(e.nodeType!==11||!e.host)return e.cloneNode(!0);let t=e.ownerDocument.createDocumentFragment();for(let n of e.childNodes)t.appendChild(n.cloneNode(!0));return t}function Gt(e,t){let n=[];for(;t!==e;){let i=t.parentNode;n.push(Array.prototype.indexOf.call(i.childNodes,t)),t=i}return n.reverse()}function Zt(e,t){return t.reduce((n,i)=>n.childNodes[i],e)}function D(e,t){let n=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&n.unshift(e),n}function Qt(e,t){let n=D(e,"option"),i=D(t,"option");n.forEach((s,f)=>i[f].selected=s.selected);let r=D(e,"input"),o=D(t,"input");r.forEach((s,f)=>{let u=s.type.toLowerCase();u!=="file"&&(o[f].value=s.value),(u==="checkbox"||u==="radio")&&(o[f].checked=s.checked)});let l=D(e,"textarea"),c=D(t,"textarea");l.forEach((s,f)=>c[f].value=s.value)}function xe(e,t){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]"))return;let n=e.startsWith("@")?0:b(e);if(n===-1)return;let i=e.slice(n+1);if(v.has(i))throw new R.RuleTargetReadOnly(i);return}if(Array.isArray(e)){if(!Array.isArray(t))return;t.forEach(n=>xe(e[1],n));return}if(e&&typeof e=="object"&&t&&typeof t=="object"&&!Array.isArray(t))for(let[n,i]of Object.entries(e))xe(i,t[n])}}function en(e,t,n){let i={templateAttr:"cms-template"},r=Xt(e),o=Gt(r,e),l=Yt(r);Qt(r,l);let c=Zt(l,o),s=M(l,{...i,_write:!0}),f=Ee(s,c,t,n,i);if(f.unknownKeys.length||f.unmatched.length)throw new R.WriteRejected(f.unknownKeys,f.unmatched);let u=se(s);L(u,c,t,n,i),u.assertClean(),xe(t,n);let d=se(M(r,{...i,_write:!0}));L(d,e,t,n,i),d.assertClean()}function tn(e){if(!(e instanceof Error))return e;let t=e.name||"Error";try{e.code=t}catch{Object.defineProperty(e,"code",{value:t,configurable:!0,enumerable:!0})}return e instanceof R.WriteRefused?e.details=e.refusals:e instanceof R.WriteRejected?e.details={unknownKeys:e.unknownKeys,unmatched:e.unmatched}:e instanceof R.ShapeMismatch?e.details=e.mismatches:Array.isArray(e.path)?e.details={path:e.path}:typeof e.target=="string"?e.details={target:e.target}:e.token!==void 0?e.details={token:e.token}:e.version!==void 0?e.details={version:e.version}:e.details={},e}function be(e,t){let n=Se(e)?e:document,i=Se(e)?t:e;return i===void 0?P(M(n),n,st(n)):Z.bind(n,i).get()}function Re(e,t,n){try{if(!Se(e))throw new Error("hyper-html-api: applyData(root, data, source?) needs a DOM root as the first argument.");let i=n===void 0?st(e):Z.bind(e,n).rules;en(e,i,t)}catch(i){throw tn(i)}return e}var nn={engine:Z,extractData:be,applyData:Re},rn=nn;return ht(on);})();
5
+ var hyperHtmlApiData=(()=>{var he=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var Ot=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var ve=(e,t)=>{for(var n in t)he(e,n,{get:t[n],enumerable:!0})},xt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ot(t))!St.call(e,r)&&r!==n&&he(e,r,{get:()=>t[r],enumerable:!(i=Tt(t,r))||i.enumerable});return e};var bt=e=>xt(he({},"__esModule",{value:!0}),e);var Tn={};ve(Tn,{applyData:()=>De,default:()=>En,engine:()=>re,extractData:()=>je});var ie=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],oe=new Set(ie),pe=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),B=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]),We=new Set(["checked","selected","disabled","readOnly","paused"]);function me(e,t){return t==null?We.has(e)?!1:"":We.has(e)?t==="false"?!1:!!t:t}var R={};ve(R,{CodecRefused:()=>we,EmptyListInsert:()=>P,MAX_RULE_DEPTH:()=>M,MaxRuleDepthExceeded:()=>_,NoRulesTag:()=>ye,RuleTargetReadOnly:()=>z,RulesParseError:()=>C,ShapeMismatch:()=>U,UnknownCodec:()=>K,UnknownRulesVersion:()=>H,WriteNotRoundTripped:()=>se,WriteRefused:()=>F,WriteRejected:()=>ge});var C=class extends Error{constructor(t,n){super(t),this.name="RulesParseError",this.cause=n}},H=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1" and "2".`),this.name="UnknownRulesVersion",this.version=t}},M=20,_=class extends Error{constructor(t){super(`rule depth exceeded ${M} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},U=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},P=class extends Error{constructor(t,n){super(n?`cannot add items to empty list at "${t.join(".")}" \u2014 ${n}`:`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},z=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}},F=class extends Error{constructor(t){super(`write refused: ${t.length} write(s) broke the content-only policy`),this.name="WriteRefused",this.refusals=t}};function Rt(e){return e.reduce((n,i)=>typeof i=="number"?`${n}[${i}]`:n?`${n}.${i}`:String(i),"")||"(root)"}var se=class extends Error{constructor(t){super(`write did not round-trip at "${Rt(t)}"`),this.name="WriteNotRoundTripped",this.path=t}},ye=class extends Error{constructor(t){super(`no <script data-rules-name~="${t}"> rules tag in this document`),this.name="NoRulesTag",this.token=t}},ge=class extends Error{constructor(t,n){super(`write rejected: ${t.length} unknown key(s), ${n.length} rule(s) with no matching element`),this.name="WriteRejected",this.unknownKeys=t,this.unmatched=n}},K=class extends Error{constructor(t){super(`unknown codec "${t}": no codec by that name is given to this call`),this.name="UnknownCodec",this.code="unknown-codec",this.codec=t}},we=class extends Error{constructor(t,n){super(n),this.name="CodecRefused",this.code=t}};function N(e){let t=0,n=null,i=-1;for(let r=0;r<e.length;r++){let o=e[r];o==="\\"?r++:n?o===n&&(n=null):o==='"'||o==="'"?n=o:o==="["||o==="("?t++:o==="]"||o===")"?t>0&&t--:o==="@"&&t===0&&(i=r)}return i}var qe="[*]";function b(e){let t=N(e),n=t===-1?e:e.slice(0,t),i=n.endsWith(qe),r={selector:i?n.slice(0,-qe.length):n,prop:t===-1?null:e.slice(t+1)||null};return i&&(r.all=!0),r}function Ae(e){let t=0,n=null,i=-1,r=!1;for(let o=0;o<e.length;o++){let c=e[o];c==="\\"?o++:n?c===n&&(n=null):c==='"'||c==="'"?n=c:c==="["||c==="("?t++:c==="]"||c===")"?t>0&&t--:t===0&&c===">"?i=o:t===0&&c===","&&(r=!0)}return r||i===-1||!Ct(e,i+1)?null:e.slice(0,i).trim()||null}function Ct(e,t){let n=t,i=e.replace(/\s+$/,"").length;for(;n<i&&/\s/.test(e[n]);)n++;let r=0,o=null;for(;n<i;n++){let c=e[n];if(c==="\\")n++;else if(o)c===o&&(o=null);else if(c==='"'||c==="'")o=c;else if(c==="["||c==="(")r++;else if(c==="]"||c===")")r>0&&r--;else if(r===0&&(c==="+"||c==="~"||/\s/.test(c)))return!1}return!0}var Nt=/^codec\(([a-z][a-z0-9-]*)\)$/;function $(e){if(typeof e!="string")return null;let t=N(e);if(t===-1)return null;let n=Nt.exec(e.slice(t+1));if(!n)return null;let{selector:i,all:r}=b(e);if(r)throw new C("A @codec(name) rule cannot use [*].");return{selector:i,name:n[1]}}var Pt=/^--[A-Za-z0-9_-]+$/;function k(e){return typeof e=="string"&&Pt.test(e)}function Ve(e){let t=[],n=[],i=null,r=0;for(let o=0;o<e.length;o++){let c=e[o];if(i){c==="\\"?o++:c===i&&(i=null);continue}if(c==="/"&&e[o+1]==="*"){let l=e.indexOf("*/",o+2);o=l===-1?e.length:l+1;continue}c==='"'||c==="'"?i=c:c==="("?n.push(")"):c==="["?n.push("]"):c==="{"?n.push("}"):(c===")"||c==="]"||c==="}")&&n[n.length-1]===c?n.pop():c===";"&&n.length===0&&(t.push(e.slice(r,o)),r=o+1)}return t.push(e.slice(r)),t}function Mt(e){let t="",n=null;for(let i=0;i<e.length;i++){let r=e[i];if(n){t+=r,r==="\\"&&i+1<e.length?t+=e[++i]:r===n&&(n=null);continue}if(r==="/"&&e[i+1]==="*"){let o=e.indexOf("*/",i+2);i=o===-1?e.length:o+1,t+=" ";continue}(r==='"'||r==="'")&&(n=r),t+=r}return t}function Be(e){e=Mt(e);let t=e.indexOf(":");if(t===-1)return null;let n=e.slice(0,t).trim(),i=e.slice(t+1).trim(),r=/!\s*important\s*$/i.exec(i);return r&&(i=i.slice(0,r.index).trim()),{name:n,value:i,important:!!r}}function v(e,t){if(e==null)return null;let n=null;for(let i of Ve(String(e))){let r=Be(i);!r||r.name!==t||(!n||r.important||!n.important)&&(n=r)}return n?n.value:null}function He(e,t,n){let i=e==null?"":String(e),r=n==null||n==="",o=Ve(i),c=o.map(Be),l=c.some(d=>d&&d.name===t&&d.important),s=[],f=!1;o.forEach((d,h)=>{let A=c[h];if(!A||A.name!==t){s.push(d);return}if(r||f)return;let a=/^\s*/.exec(d)[0];s.push(`${a}${t}: ${n}${l?" !important":""}`),f=!0});let u=s.join(";");if(!r&&!f){let d=u.trimEnd();u=d===""?`${t}: ${n}`:`${d}${d.endsWith(";")?" ":"; "}${t}: ${n}`}return u.trim()===""?null:u}function ce(e,t,n,i){let r=e.attr(t,"style");if((v(r,n)??"")===i)return;let o=He(r,n,i);o==null?e.removeAttr(t,"style"):e.attr(t,"style",o)}var Ue=/^[a-z][a-z0-9-]*$/,Ee=new Map;function Te(e,t){if(typeof e!="string"||!Ue.test(e))throw new Error(`hyper-html-api: invalid codec name ${JSON.stringify(e)} (must match ${Ue})`);if(!t||typeof t.read!="function"||typeof t.write!="function"||typeof t.same!="function")throw new Error(`hyper-html-api: codec "${e}" needs read, write and same functions`);Ee.set(e,t)}function Oe(e){return Ee.get(e)??null}function Se(){return Object.fromEntries(Ee)}var kt='The @codec(name) rule form needs a rules tag with data-rules-version="2".',Lt="A @codec(name) rule must be the value of a top level key.";function le(e,t){let n=$(e);return n?{...n,codec:t.codecs[n.name]}:null}function j(e,t={}){let n=t.version??"1",i=t.codecs??{};r(e,0);function r(o,c){if(!(c>M)){if(typeof o=="string"){let l=$(o);if(!l)return;if(n!=="2")throw new C(kt);if(c!==1)throw new C(Lt);if(!Object.prototype.hasOwnProperty.call(i,l.name))throw new K(l.name);return}if(Array.isArray(o)){r(o[1],c+1);return}if(o&&typeof o=="object")for(let l of Object.values(o))r(l,c+1)}}}function L(e,t,n,i={}){if(Object.prototype.hasOwnProperty.call(i,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return j(n,i),be(e,t,n,{depth:0,path:[]},i)}function be(e,t,n,i,r){if(i.depth>M)throw new _(i.path);if(typeof n=="string")return It(e,t,n,i,r);if(Array.isArray(n)){let[o,c]=n,l=e.find(t,o,r);return ze(r,i,l),l.map((s,f)=>be(e,s,c,{depth:i.depth+1,path:[...i.path,f]},r))}if(typeof n=="object"&&n!==null){let o={};for(let[c,l]of Object.entries(n))o[c]=be(e,t,l,{depth:i.depth+1,path:[...i.path,c]},r);return o}return null}function It(e,t,n,i,r){if(n.endsWith("[]")){let u=n.slice(0,-2),d=e.find(t,u,r);return ze(r,i,d),d.map(h=>e.text(h))}let o=le(n,r);if(o)return _t(e,t,o,r);if(n.startsWith("@"))return xe(e,t,n.slice(1));let c=N(n);if(c!==-1){let{selector:u,all:d}=b(n),h=n.slice(c+1),A=u?e.find(t,u,r):[t];return d&&r.allMatches?A.map(a=>xe(e,a,h)):A.length===0?null:xe(e,A[0],h)}if(n===".")return e.text(t);let{selector:l,all:s}=b(n),f=e.find(t,l,r);return s&&r.allMatches?f.map(u=>e.text(u)):f.length===0?null:e.text(f[0])}function _t(e,t,{selector:n,codec:i},r){let o=n?e.find(t,n,r):[t];return o.length===0?null:i.read(e,o[0],{query:r.query,view:r.view,region:r.region})}function ze(e,t,n){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),n)}catch(i){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,i)}}function xe(e,t,n){if(k(n))return v(e.attr(t,"style"),n);if(oe.has(n)){let r=e.prop(t,n);return r==null?null:String(r)}let i=e.attr(t,n);return i??null}function Je(e,t,n,i){let r=e.length,o=t.length,c=new Array(r).fill(-1);if(i){let p=new Set;for(let y=0;y<r;y++){let w=i[y];!(w>=0&&w<o)||p.has(w)||(c[y]=w,p.add(w))}}if(r===0||o===0)return c;let l=e.map(p=>Fe(p,n)),s=t.map(p=>Fe(p,n)),f=new Array(o).fill(!1);for(let p of c)p>=0&&(f[p]=!0);let u=new Map;s.forEach((p,y)=>{f[y]||u.set(p,u.has(p)?-1:y)});let d=new Map;l.forEach((p,y)=>{c[y]>=0||d.set(p,(d.get(p)||0)+1)}),l.forEach((p,y)=>{if(c[y]>=0||d.get(p)!==1)return;let w=u.get(p);w===void 0||w===-1||f[w]||(c[y]=w,f[w]=!0)});let h=[];for(let p=0;p<r;p++)c[p]<0&&h.push(p);let A=[];for(let p=0;p<o;p++)f[p]||A.push(p);if(h.length===0||A.length===0)return c;let a=r*o+1,m=$t(e,t,n),g=(p,y)=>m(p,y)*a+Math.abs(p-y);for(let[p,y]of jt(h,A,g))c[p]=y;return c}var Xe=e=>typeof e=="object"&&e!==null;function Fe(e,t){if(!Xe(t))return e==null?" null":String(e);let n=Object.keys(t);return JSON.stringify(n.map(i=>{let r=JSON.stringify(e?.[i]);return r===void 0?" undef":r}))}function $t(e,t,n){if(!Xe(n))return(l,s)=>e[l]===t[s]?0:1;let i=Object.keys(n),r=l=>i.map(s=>JSON.stringify(l?.[s])),o=e.map(r),c=t.map(r);return(l,s)=>{let f=o[l],u=c[s],d=0;for(let h=0;h<i.length;h++)f[h]!==u[h]&&d++;return d}}function jt(e,t,n){return e.length<=t.length?Ke(e,t,n,!1):Ke(t,e,(i,r)=>n(r,i),!0)}function Ke(e,t,n,i){let r=e.length,o=t.length,c=[];for(let d=0;d<=r;d++)c.push(new Float64Array(o+1).fill(1/0));let l=[];for(let d=0;d<=r;d++)l.push(new Uint8Array(o+1));for(let d=0;d<=o;d++)c[r][d]=0;for(let d=r-1;d>=0;d--)for(let h=o-1;h>=0;h--){let A=n(e[d],t[h])+c[d+1][h+1],a=c[d][h+1];A<=a?(c[d][h]=A,l[d][h]=1):c[d][h]=a}let s=[],f=0,u=0;for(;f<r&&u<o;)l[f][u]&&(s.push(i?[t[u],e[f]]:[e[f],t[u]]),f++),u++;return s}function Ce(e,t,n,i,r,o,c,l={}){let s=e.find(t,n,l);if(r.length===0){s.forEach(E=>e.remove(E)),Re(l,"onRowsApplied",o.path,[]);return}let f=r.length>s.length,u=s[0]||null;if(f&&!u&&(u=qt(e,t,n,l),!u))throw new P(o.path);let d=s.map(E=>Wt(e,E,i,l)),h=null;if(f&&u){h=e.clone(u),l.templateAttr&&e.removeAttr(h,l.templateAttr);let E=e.stripIds(h);E>0&&console.warn(`[hyper-html-api] stripped ${E} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let A=Je(r,d,i,Dt(e,s,r,o,l)),a=s.length>0?e.parent(s[0]):Ut(e,t,n,u,o,l),m=s.length>0?et(e,a,s[0]):0,g=Kt(e,s),p=new Set,y=[],w=r.map((E,x)=>{let O=A[x];if(O>=0)return p.add(O),y.push(!1),s[O];y.push(!0);let T=e.clone(h);return e.stripIds(T),T});s.forEach((E,x)=>{p.has(x)||e.remove(E)}),g?Ft(e,a,m,w,y):Jt(e,w,y,a,m),vt(e,w,i,r,o,c,l),Re(l,"onRowsApplied",o.path,w)}function Re(e,t,n,i){if(typeof e[t]=="function")try{return e[t](n.slice(),i)}catch(r){console.warn(`[hyper-html-api] ${t} threw at "${n.join(".")||"(root)"}"`,r);return}}function Dt(e,t,n,i,r){let o=Re(r,"identifyRows",i.path,n);if(!Array.isArray(o))return null;let c=new Array(n.length).fill(-1),l=new Set,s=new Map(t.map((f,u)=>[e.identity(f),u]));for(let f=0;f<n.length;f++){if(!o[f])continue;let u=s.get(e.identity(o[f]));u===void 0||l.has(u)||(c[f]=u,l.add(u))}return c}function vt(e,t,n,i,r,o,c){t.forEach((l,s)=>{if(n===null){let f=i[s],u=f==null?"":String(f);e.text(l)!==u&&e.text(l,u)}else{let f=o(e,l,n,i[s],{depth:r.depth+1,path:[...r.path,s]},c);f&&f!==l&&(t[s]=f)}})}function Wt(e,t,n,i){return n===null?e.text(t):L(e,t,n,i.onRowsRead?{...i,onRowsRead:void 0}:i)}function et(e,t,n){let i=e.children(t);for(let r=0;r<i.length;r++)if(e.sameNode(i[r],n))return r;return-1}function qt(e,t,n,i){if(!i.templateAttr)return null;let r=/^\s*:scope\s*>\s*/.test(n),o=new RegExp(":not\\(\\["+i.templateAttr.replace(/[.*+?^${}()|[\]\\-]/g,"\\$&")+"\\]\\)","g"),c=n.replace(/^\s*:scope\s*>\s*/,"").replace(o,""),l=r?Vt(c):0,s=Ae(c),f=t;for(;f;){let u=e.find(f,c,{includeRulesTag:!1,templateAttr:null});for(let d of u)if(e.attr(d,i.templateAttr)!=null&&!(r&&!Ht(e,t,d,l))&&!(s&&!e.matches(e.parent(d),s)))return d;f=e.parent(f)}return null}function Vt(e){let t=0,n=null,i=1;for(let r=0;r<e.length;r++){let o=e[r];if(o==="\\")r++;else if(n)o===n&&(n=null);else if(o==='"'||o==="'")n=o;else if(o==="["||o==="(")t++;else if(o==="]"||o===")")t>0&&t--;else if(t===0&&o===">")i++;else{if(t===0&&(o==="+"||o==="~"))return null;if(t===0&&/\s/.test(o)){if(!Bt(e,r))return null;for(;r+1<e.length&&/\s/.test(e[r+1]);)r++}}}return i}function Bt(e,t){let n=t;for(;n<e.length&&/\s/.test(e[n]);)n++;let i=t>0?e[t-1]:"",r=n<e.length?e[n]:"";return Ye(i)||Ye(r)}function Ye(e){return e===">"||e==="+"||e==="~"}function Ht(e,t,n,i){if(i===null)return!0;let r=n;for(let s=0;s<i;s++)if(r=e.parent(r),!r)return!1;let o=e.prop(t,"tagName");if(!o)return!0;let c=e.prop(r,"tagName");if(!c||String(c).toLowerCase()!==String(o).toLowerCase())return!1;let l=new Set(Ge(e,r));return Ge(e,t).every(s=>l.has(s))}function Ge(e,t){let n=e.attr(t,"class");return n?String(n).split(/\s+/).filter(Boolean):[]}function Ut(e,t,n,i,r,o){let c=e.parent(i);if(c&&zt(e,t,c)&&!Qe(e,c,o))return c;let l=Ae(n);if(!l)throw new P(r.path,`the list selector "${n}" names no container to hold the new rows \u2014 write it as "container > row" (for example "ol.comments > li") so the cloned row lands in the list`);let f=(l===":scope"?e.prop(t,"tagName")?[t]:[]:e.find(t,l,o)).filter(u=>!Qe(e,u,o));if(f.length===0)throw new P(r.path,`no container matching "${l}" inside this context to hold the new rows`);if(f.length>1)throw new P(r.path,`"${l}" matches ${f.length} containers inside this context, so the new rows have no single destination`);return f[0]}function zt(e,t,n){let i=n;for(;i;){if(e.sameNode(i,t))return!0;i=e.parent(i)}return e.parent(t)?!1:e.find(t,"*",{includeRulesTag:!0,templateAttr:null}).some(r=>e.sameNode(r,n))}var Ze=["no-data","editor-ui"];function Qe(e,t,n){let i=t;for(;i;){if(n.templateAttr&&e.attr(i,n.templateAttr)!=null||Ze.some(o=>e.attr(i,o)!=null))return!0;let r=e.attr(i,"clay");if(r&&r.split(/\s+/).some(o=>Ze.includes(o)))return!0;i=e.parent(i)}return!1}function Ft(e,t,n,i,r){let o=e.children(t),c=o.map(s=>e.identity(s)),l=!1;i.forEach((s,f)=>{let u=e.identity(s),d=n+f;if(c[d]===u)return;if(!r[f]){let A=c.indexOf(u);A!==-1&&(c.splice(A,1),o.splice(A,1))}let h=Math.min(d,o.length);h<o.length?e.insertBefore(o[h],s):o.length?l?e.insertAfter(o[o.length-1],s):(e.insertAt(t,s,d),l=!0):e.insertAt(t,s,0),c.splice(h,0,u),o.splice(h,0,s)})}function Kt(e,t){if(t.length<=1)return!0;let n=e.parent(t[0]);if(!n)return!1;let i=new Map(e.children(n).map((o,c)=>[e.identity(o),c])),r=[];for(let o of t){let c=i.get(e.identity(o));if(c===void 0)return!1;r.push(c)}return r.sort((o,c)=>o-c),r[r.length-1]-r[0]===r.length-1}function Jt(e,t,n,i,r){let o=null,c=r;for(let l=0;l<t.length;l++){if(!n[l]){o=t[l];continue}let s=o?e.parent(o):i;if(!s)continue;let f=o?et(e,s,o)+1:c++;e.insertAt(s,t[l],f),o=t[l]}}function D(e,t,n,i,r={}){if(Object.prototype.hasOwnProperty.call(r,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");j(n,r);let o=[];if(Ne(n,i,[],o),o.length)throw new U(o);fe(e,t,n,i,{depth:0,path:[]},r)}function fe(e,t,n,i,r,o={}){if(r.depth>M)throw new _(r.path);if(i===void 0)return t;if(typeof n=="string")return Xt(e,t,n,i,r,o);if(Array.isArray(n)){let[c,l]=n;return Ce(e,t,c,l,i,r,fe,o),t}if(typeof n=="object"&&n!==null){for(let[c,l]of Object.entries(n)){let s=fe(e,t,l,i==null?i:i[c],{depth:r.depth+1,path:[...r.path,c]},o);s&&s!==t&&(t=s)}return t}return t}function Xt(e,t,n,i,r,o){if(n.endsWith("[]")){let d=n.slice(0,-2);return Ce(e,t,d,null,i,r,fe,o),t}let c=le(n,o);if(c){let d=c.selector?e.find(t,c.selector,o):[t];return d.length&&c.codec.write(e,d[0],i,{query:o.query}),t}if(n.startsWith("@"))return nt(e,t,n.slice(1),i);let l=N(n);if(l!==-1){let{selector:d,all:h}=b(n),A=n.slice(l+1),a=d?e.find(t,d,o):[t];for(let m of h?a:a.slice(0,1))nt(e,m,A,i);return t}if(n===".")return tt(e,t,i),t;let{selector:s,all:f}=b(n),u=e.find(t,s,o);for(let d of f?u:u.slice(0,1))tt(e,d,i);return t}function tt(e,t,n){let i=n==null?"":String(n);e.text(t)!==i&&e.text(t,i)}function Yt(e,t,n,i){if(e.styleVar){e.styleVar(t,n,i);return}ce(e,t,n,i)}function nt(e,t,n,i){if(k(n))return Yt(e,t,n,i==null?"":String(i).trim()),t;if(B.has(n)){let r=e.prop(t,n);if(r===i||r!=null&&i!=null&&String(r)===String(i))return t;throw new z(n)}if(n==="outerHTML"){let r=i==null?"":String(i);return e.replaceWith(t,r)}if(pe.has(n)){let r=me(n,i);return e.prop(t,n)!==r&&e.prop(t,n,r),t}if(i==null)e.attr(t,n)!=null&&e.removeAttr(t,n);else{let r=String(i);e.attr(t,n)!==r&&e.attr(t,n,r)}return t}function Ne(e,t,n,i){if(t!==void 0){if(typeof e=="string"){if($(e))return;if(e.endsWith("[]")){Array.isArray(t)?t.forEach((r,o)=>{typeof r=="object"&&r!==null&&i.push({path:X([...n,o]),expected:"scalar",got:J(r)})}):i.push({path:X(n),expected:"array",got:J(t)});return}t!==null&&typeof t=="object"&&i.push({path:X(n),expected:"scalar",got:J(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){i.push({path:X(n),expected:"array",got:J(t)});return}let r=e[1];t.forEach((o,c)=>Ne(r,o,[...n,c],i));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){i.push({path:X(n),expected:"object",got:J(t)});return}for(let[r,o]of Object.entries(e))Ne(o,t[r],[...n,r],i)}}}function J(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function X(e){return e.join(".")}function Pe(e){try{return JSON.parse(e)}catch(t){throw new C(`Invalid strict JSON: ${t.message}`,t)}}function Y(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function n(r){let o=[],c=0;for(;c<r.length;){let l=r[c];if(/\s/.test(l)){c++;continue}if("{}".includes(l)){o.push({type:l,value:l}),c++;continue}if(l==="["){let d=!1,h=c+1;for(;h<r.length&&/\s/.test(r[h]);)h++;if(h<r.length&&/[a-zA-Z_]/.test(r[h])&&(d=!0),!d){o.push({type:l,value:l}),c++;continue}}if(l==="]"){o.push({type:l,value:l}),c++;continue}if(l===":"){o.push({type:t.COLON,value:l}),c++;continue}if(l===","){o.push({type:t.COMMA,value:l}),c++;continue}if(l==='"'||l==="'"){let d=l,h=c+1;for(;h<r.length&&r[h]!==d;)r[h]==="\\"&&h++,h++;o.push({type:t.STRING,value:r.substring(c+1,h),quoted:!0,sourceQuote:d}),c=h+1;continue}let s=c,f;for(;s<r.length&&!/[{},]/.test(r[s]);)if(r[s]===":"){let d=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],h=!1;for(let A of d){let a=A.substring(1);if(r.substring(s+1,s+1+a.length)===a){h=!0,s+=a.length;break}}if(!h)break}else if(r[s]==="["){for(s++;s<r.length&&r[s]!=="]";){if(r[s]==='"'||r[s]==="'"){let d=r[s];for(s++;s<r.length&&r[s]!==d;)r[s]==="\\"&&s++,s++}s++}s<r.length&&r[s]==="]"&&s++}else s++;f=r.substring(c,s);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(f)?u=t.NUMBER:f==="true"||f==="false"||f==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(f)&&(u=t.SELECTOR),o.push({type:u,value:f,quoted:!1}),c=s}return o}function i(r){let o="";for(let c=0;c<r.length;c++){let l=r[c];if("{}".includes(l.type)||"[]".includes(l.type)){o+=l.value;continue}if(l.type===t.COLON){o+=l.value;continue}if(l.type===t.COMMA){let s=r[c+1];if(s&&(s.type==="}"||s.type==="]"))continue;o+=l.value;continue}if(l.type===t.STRING&&l.quoted){let s=l.value;l.sourceQuote==="'"&&(s=s.replace(/\\'/g,"'"),s=s.replace(/(\\*)"/g,(f,u)=>u.length%2===0?u+'\\"':f)),o+=`"${s}"`;continue}if(l.type===t.NUMBER||l.type===t.BOOLEAN){o+=l.value;continue}if(l.type===t.SELECTOR||l.type===t.IDENTIFIER){o+=`"${l.value}"`;continue}o+=`"${l.value}"`}return o}try{let r=n(e),o=i(r);return JSON.parse(o)}catch(r){throw new C("Invalid extraction rules syntax: "+r.message,r)}}var it=["1","2"],rt=/^[a-zA-Z0-9_-]+$/;function W(e,t,n){let i;if(n===void 0)i="script[data-rules-name]";else{if(typeof n!="string"||!rt.test(n))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(n)} (must match ${rt})`);i=`script[data-rules-name~="${n}"]`}let r=e.find(t,i,{includeRulesTag:!0});if(r.length===0)return null;n!==void 0&&r.length>1&&console.warn(`hyper-html-api: ${r.length} rules tags match data-rules-name~="${n}"; using the first.`);let o=r[0],c=e.attr(o,"data-rules-version");if(!it.includes(c))throw new H(c);return{rules:Y(e.text(o)),tagNode:o,version:c}}var ue=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),Gt=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),ot=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui","live"]);function G(e,t){if(!e||e.nodeType!==1)return!1;let n=e.getAttribute?.("clay");return!!(n&&n.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function Me(e,t){if(G(e,t))return!0;for(let[n,i]of Object.entries(Gt))if(i.includes(t)&&G(e,n))return!0;return!1}function Z(e){let t=ue[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(n=>[`[clay~="${n}"]`,`[${n}]`]).join(", ")}function Zt(e,t){let n=e&&e.nodeType===1?e:e?.parentElement;for(;n&&n.nodeType===1;){let i=ue[t];if(!i)throw new Error(`Unknown region capability: ${t}`);if(i.tokens.some(r=>Me(n,r))||i.bundles.some(r=>G(n,r)))return n;n=n.parentElement}return null}function st(e,t){return!!Zt(e,t)}var ae=Object.freeze({refusedRuleForms:["innerHTML","outerHTML"],refusedTargets:["script","style","template","noscript","iframe","object","embed","xmp","plaintext","noembed","noframes","meta","link","base","animate","set","animatemotion","animatetransform"],refusedAttributes:["style","srcdoc","is","http-equiv","sandbox","allow","nonce","integrity","charset","htmlclaytoken","htmlclayid","data-rules-name","data-rules-version","clay","contenteditable",...ot],refusedAttributePrefixes:["on"],urlAttributes:["href","src","srcset","action","formaction","poster","cite","data","ping","background","longdesc","usemap","xlink:href","manifest","codebase","icon"],refusedSchemes:["javascript","vbscript","data"],customPropertyValues:Object.freeze({maxLength:200,refusedCharacters:[";","{","}","<",">","\\"],refusedFunctions:["url","src","image","image-set","-webkit-image-set","cross-fade","element","expression","paint"]})}),Qt=new Set(["textContent","innerText"]);function ct(e){let n=String(e).replace(/^[\u0000- ]+|[\u0000- ]+$/g,"").replace(/[\t\n\r]/g,"").match(/^([a-zA-Z][a-zA-Z0-9+.-]*):/);return n?n[1].toLowerCase():null}var en=/^[^\t\n\f\r "'>/=\u0000-\u001f\u007f]+$/;function lt(e,t,n=ae){if(!en.test(String(e)))return`attribute name ${JSON.stringify(String(e))} is not valid`;let i=String(e).toLowerCase();if(n.refusedAttributePrefixes.some(r=>i.startsWith(r)))return`attribute "${i}" can run script`;if(n.refusedAttributes.includes(i))return`attribute "${i}" is not content`;if(n.urlAttributes.includes(i)&&t!=null){let r=i==="srcset"?String(t).split(",").map(o=>o.trim().split(/\s+/)[0]).filter(Boolean):[String(t)];for(let o of r){let c=ct(o);if(c&&n.refusedSchemes.includes(c))return`"${c}:" URLs are not allowed in "${i}"`}}return null}function ke(e,t){let n=e.prop(t,"tagName");return n?String(n).toLowerCase():""}function tn(e,t){let n=ke(e,t)||"node",i=e.attr(t,"id");return i?`<${n}#${i}>`:`<${n}>`}function nn(e,t,n){let i=t;for(;i;){let r=ke(e,i);if(r&&n.refusedTargets.includes(r))return r;i=e.parent(i)}return null}function ft(e,t){return e.find(t,"script[data-rules-name]",{includeRulesTag:!0,templateAttr:null}).length>0}function rn(e,t){return ke(e,t)==="script"&&e.attr(t,"data-rules-name")!=null?!0:ft(e,t)}function on(e){if(/[\u0000-\u001f\u007f]/.test(e))return"control characters are not allowed in a custom property value";let t=[],n=null;for(let i=0;i<e.length;i++){let r=e[i];if(n){r===n&&(n=null);continue}if(r==='"'||r==="'")n=r;else{if(r==="/"&&e[i+1]==="*")return"comments are not allowed in a custom property value";if(r==="(")t.push(")");else if(r==="[")t.push("]");else if((r===")"||r==="]")&&t.pop()!==r)return`"${r}" does not close anything in this custom property value`}}return n?"a custom property value must close its quotes":t.length?"a custom property value must close its brackets":null}function ut(e,t=ae){let n=t.customPropertyValues,i=String(e);if(i.length>n.maxLength)return`custom property values are limited to ${n.maxLength} characters`;let r=n.refusedCharacters.find(s=>i.includes(s));if(r)return`${JSON.stringify(r)} is not allowed in a custom property value`;let o=on(i);if(o)return o;let c=i.toLowerCase(),l=n.refusedFunctions.find(s=>new RegExp(`(^|[^a-z0-9_-])${s.replace(/[-]/g,"\\-")}\\s*\\(`).test(c));return l?`"${l}()" is not allowed in a custom property value`:null}function de(e,t=ae){let n=[],i=(s,f)=>(n.push({target:tn(e,s),reason:f}),!1),r=s=>{let f=nn(e,s,t);return f?i(s,`inside <${f}>, which is not content`):!0},o=s=>r(s)?ft(e,s)?i(s,"a text write here would delete the data rules tag"):!0:!1,c=(s,f,u)=>{if(!r(s))return!1;let d=lt(f,u,t);return d?i(s,d):!0};return{...e,text(s,f){if(f===void 0)return e.text(s);o(s)&&e.text(s,f)},attr(s,f,u){if(u===void 0)return e.attr(s,f);c(s,f,u)&&e.attr(s,f,u)},removeAttr(s,f){c(s,f,null)&&e.removeAttr(s,f)},styleVar(s,f,u){if((v(e.attr(s,"style"),f)??"")!==u&&r(s)){if(!k(f))return i(s,`"${f}" is not a custom property`);if(u!==""){let d=ut(u,t);if(d)return i(s,d)}ce(e,s,f,u)}},prop(s,f,u){if(u===void 0)return e.prop(s,f);if(t.refusedRuleForms.includes(f))return i(s,`"@${f}" writes HTML, only text is allowed`);if(Qt.has(f)){o(s)&&e.prop(s,f,u);return}c(s,f==="className"?"class":f,u)&&e.prop(s,f,u)},remove(s){if(rn(e,s)){i(s,"removing this would delete the data rules tag");return}e.remove(s)},replaceWith(s,f){return f===e.prop(s,"outerHTML")||i(s,'"@outerHTML" writes HTML, only text is allowed'),s},refusals:n,assertClean(){if(n.length)throw new F(n.slice())}}}function Q(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function at(e){return e.reduce((t,n)=>typeof n=="number"?`${t}[${n}]`:t?`${t}.${n}`:n,"")}function Le(e,t,n,i,r={}){j(n,r);let o=[],c=[];function l(f,u,d){if(Array.isArray(f)){let[,h]=f;if(!Array.isArray(u)||!Q(h))return;u.forEach((A,a)=>l(h,A,[...d,a]));return}if(!(!Q(f)||!Q(u)))for(let h of Object.keys(u))Object.prototype.hasOwnProperty.call(f,h)?l(f[h],u[h],[...d,h]):o.push(at([...d,h]))}function s(f,u,d,h){if(d!==void 0){if(typeof u=="string"){if(u.endsWith("[]")||u==="."||u.startsWith("@"))return;let{selector:A}=b(u);if(!A)return;e.find(f,A,r).length===0&&c.push({path:at(h),selector:A});return}if(!Array.isArray(u)&&Q(u)&&Q(d))for(let[A,a]of Object.entries(u))s(f,a,d[A],[...h,A])}}return l(n,i,[]),s(t,n,i,[]),{unknownKeys:o,unmatched:c}}function Ie(e,t,n){if(n&&typeof n=="object")return{rules:n,tagNode:null,version:"1"};if(typeof n=="string"){let i=t&&t.ownerDocument?t.ownerDocument:t;return W(e,i,n)}return null}var cn=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function ln(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let n=(e.getAttribute?.("type")||"").toLowerCase();"value"in e&&"value"in t&&e.tagName!=="OPTION"&&n!=="checkbox"&&n!=="radio"&&n!=="file"&&(t.value=e.value),e.tagName==="INPUT"&&(n==="checkbox"||n==="radio")&&(t.checked=e.checked),e.tagName==="OPTION"&&(t.selected=e.selected),"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function dt(e,t,n,i){if(i)return!!e.closest?.(t);let r=e;for(;r?.nodeType===1;){if(r.matches(t))return!0;if(r===n)break;r=r.parentElement}return!1}function ht(e,t,n,i,r,o){return(o?st(e,t):dt(e,n,r,!1))||!!(i&&(o&&e!==r?e.matches(i):dt(e,i,r,o)))}function fn(e,t){let n=ue[t];return n.tokens.some(i=>Me(e,i))||n.bundles.some(i=>G(e,i))}var un=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function pt(e,t,n,i){if(e.nodeType===1&&i(e)){n.dropped.push(t);return}n.cloneToLive.set(t,e),n.liveToClone.set(e,t);let r=e,o=t;if(e.nodeType===1){if(un.has(e.tagName)&&n.controls.push(e,t),e.tagName==="TEMPLATE"){for(;t.firstChild;)t.removeChild(t.firstChild);r=e.content,o=t.content,n.cloneToLive.set(o,r),n.liveToClone.set(r,o)}}else if(e.nodeType!==11)return;let c=o.firstChild;for(let l=r.firstChild;l&&c;l=l.nextSibling)pt(l,c,n,i),c=c.nextSibling}function ee(e,{capability:t="data",exclude:n=null,inherit:i=!0,provenance:r=null}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let o=e.nodeType===9?e:e.ownerDocument;if(!o?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let c=o.implementation.createHTMLDocument(""),l=r||new WeakMap,s=new WeakMap,f=e.nodeType===9?e.documentElement:e;n&&c.documentElement.matches(n);let u=Z(t),d=i?a=>fn(a,t)||!!(n&&a.matches(n)):a=>ht(a,t,u,n,f,!1),h=null;if(f.nodeType!==1||!ht(f,t,u,n,f,i)){h=c.importNode(f,!0);let a={cloneToLive:l,liveToClone:s,dropped:[],controls:[]};pt(f,h,a,d);for(let m of a.dropped)m.remove();for(let m=0;m<a.controls.length;m+=2)ln(a.controls[m],a.controls[m+1])}e.nodeType===9&&h&&(c.replaceChild(h,c.documentElement),s.set(e,c),l.set(c,e));let A=a=>{if(cn.test(a))throw new Error(`Filtered content queries do not support stateful selector: ${a}`)};return{root:h,document:c,capability:t,selector:Z(t),cloneToLive:l,liveToClone:s,original(a){return l.get(a)||null},cloneOf(a){return s.get(a)||null},query(a,m=h){return A(a),Array.from(m.querySelectorAll(a),g=>l.get(g)||g)},text(a=h){return(a===h?h:s.get(a))?.textContent||""},html(a=h){return(a===h?h:s.get(a))?.innerHTML??""},clone(a=h){let m=a===h?h:s.get(a);return m?c.importNode(m,!0):null}}}function yt(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function an(e){return e?(e.nodeType===9||e.nodeType===11,e):null}function mt(e,t,n){!e||e.nodeType!==1||(t==="value"&&e.tagName==="INPUT"?e.value=n===null?"":n:t==="checked"&&e.tagName==="INPUT"?e.checked=n!==null:t==="selected"&&e.tagName==="OPTION"&&(e.selected=n!==null))}function gt(e,t){e&&e.tagName==="TEXTAREA"&&(e.value=t)}function wt(e){if(!e||e.nodeType!==1)return;let t=[e,...e.querySelectorAll?e.querySelectorAll("textarea, input, option"):[]];for(let n of t)if(n.tagName==="TEXTAREA")n.value=n.defaultValue;else if(n.tagName==="INPUT"){let i=n.type;i!=="file"&&i!=="checkbox"&&i!=="radio"&&(n.value=n.defaultValue),n.checked=n.defaultChecked}else n.tagName==="OPTION"&&(n.selected=n.defaultSelected)}var S={semanticExclude:!0,find(e,t,n={}){let i=an(e);if(!i||!i.querySelectorAll)return[];let r=Array.from(i.querySelectorAll(t));n.includeRulesTag||(r=r.filter(l=>!yt(l)));let o=[];n.skip&&o.push(n.skip);let c=n.templateAttr===null?null:n.templateAttr||"cms-template";if(c&&o.push("["+c+"]"),o.length){let l=o.join(", ");r=r.filter(s=>!s.closest||!s.closest(l))}return r},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},matches(e,t){return!!(e&&e.matches)&&e.matches(t)},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t,gt(e,t)},attr(e,t,n){if(n===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,n),mt(e,t,n)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t),mt(e,t,null)},prop(e,t,n){if(n===void 0){let i=e?e[t]:void 0;return i!==void 0?i:null}e[t]=n},clone(e){let t=e.cloneNode(!0);return wt(t),t},insertAt(e,t,n){let i=e.children[n]||null;e.insertBefore(t,i)},insertBefore(e,t){e.parentNode.insertBefore(t,e)},insertAfter(e,t){e.parentNode.insertBefore(t,e.nextSibling)},identity(e){return e||null},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let i=e.ownerDocument.createElement("template");i.innerHTML=t;let r=i.content.firstElementChild;if(!r)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(r,e),r},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(i=>{i.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function I(e,t={}){if(t.exclude===null)return S;let n=[Z("data"),t.exclude].filter(Boolean).join(", "),i=e.nodeType===9?e:e.ownerDocument||e,r=e.nodeType===9?e.documentElement:e;if(!t._write&&!r?.matches?.(n)&&!r?.querySelector?.(n)&&!i?.querySelector?.(n))return S;let o=e.nodeType===9||!e.isConnected?e:e.ownerDocument,c=e.nodeType===9?e:e.ownerDocument,l=null,s=()=>l||(l=ee(o,{capability:"data",exclude:t.exclude||null})),f=a=>{let m=s();return a===e?m.cloneOf(e):m.cloneOf(a)||a},u=a=>l?.original(a)||a,d=(a,m)=>{s().liveToClone.set(a,m),s().cloneToLive.set(m,a);let g=a.childNodes||[],p=m.childNodes||[];for(let y=0;y<Math.min(g.length,p.length);y++)d(g[y],p[y])},h=(a,m,g,p)=>{let y=Array.from(a.childNodes).filter(T=>l.cloneOf(T)),E=y[0];for(;E&&y.includes(E);)E=E.nextSibling;for(let T of y)T.remove();if(g==="innerHTML"){let T=c.createElement("template");T.innerHTML=p;for(let V of Array.from(T.content.childNodes))a.insertBefore(V,E||null)}else a.insertBefore(c.createTextNode(p),E||null),gt(a,p);let x=ee(a,{capability:"data",exclude:t.exclude||null});m.replaceChildren(...Array.from(x.root?.childNodes||[]));let O=T=>{let V=x.original(T);V&&(l.liveToClone.set(V,T),l.cloneToLive.set(T,V));for(let Et of Array.from(T.childNodes||[]))O(Et)};for(let T of Array.from(m.childNodes))O(T)},A={...S,find(a,m,g={}){let p=f(a);if(!p?.querySelectorAll)return[];let y=s().query(m,p);g.includeRulesTag||(y=y.filter(x=>!yt(x)));let w=[];g.skip&&w.push(g.skip);let E=g.templateAttr===null?null:g.templateAttr||"cms-template";if(E&&w.push(`[${E}]`),w.length){let x=w.join(", ");y=y.filter(O=>!O.closest?.(x))}return y},parent(a){let m=f(a)?.parentElement;return m?u(m):null},children(a){return Array.from(f(a)?.children||[],u)},text(a,m){if(m===void 0){let y=u(a);return!y?.matches?.(n)&&!y?.querySelector?.(n)?S.text(y):(f(a)?.textContent||"").trim()}let g=u(a);if(!g?.matches?.(n)&&!g?.querySelector?.(n)&&!l){S.text(g,m);return}let p=s().cloneOf(g);p?h(g,p,"textContent",m):S.text(g,m)},attr(a,m,g){let p=u(a);if(g===void 0)return S.attr(p,m);S.attr(p,m,g);let y=l?.cloneOf(p);y&&(S.attr(y,m,g),ee(p,{capability:"data",exclude:t.exclude||null}).root===null&&(y.remove(),l.liveToClone.delete(p),l.cloneToLive.delete(y)))},removeAttr(a,m){let g=u(a);S.removeAttr(g,m);let p=l?.cloneOf(g);p&&S.removeAttr(p,m)},prop(a,m,g){let p=u(a);if(g===void 0)return m==="innerHTML"||m==="outerHTML"||m==="textContent"||m==="innerText"?S.prop(f(p),m):S.prop(p,m);let y=m==="innerHTML"||m==="textContent"||m==="innerText",w=y?s().cloneOf(p):l?.cloneOf(p);w&&y?h(p,w,m,g):(S.prop(p,m,g),w&&S.prop(w,m,g))},clone(a){let m=f(a);if(m===a)return S.clone(a);let g=c.importNode(m,!0);return wt(g),g},insertAt(a,m,g){let p=u(a),w=A.children(p)[g]||(()=>{for(let O=p.children.length-1;O>=0;O--){let T=p.children[O];if(s().cloneOf(T))return T.nextElementSibling}return p.firstElementChild})(),E=u(m);p.insertBefore(E,w||null);let x=s().cloneOf(p);if(x){let O=s().cloneOf(E);O||(O=c.importNode(E,!0),d(E,O));let T=Array.from(x.children);x.insertBefore(O,T[g]||null)}},insertBefore(a,m){let g=u(a),p=u(m);g.parentNode.insertBefore(p,g);let y=s().cloneOf(g.parentNode);if(y){let w=s().cloneOf(p);w||(w=c.importNode(p,!0),d(p,w));let E=s().cloneOf(g);E?E.before(w):y.appendChild(w)}},insertAfter(a,m){let g=u(a),p=u(m);g.parentNode.insertBefore(p,g.nextSibling);let y=s().cloneOf(g.parentNode);if(y){let w=s().cloneOf(p);w||(w=c.importNode(p,!0),d(p,w));let E=s().cloneOf(g);E?E.after(w):y.appendChild(w)}},identity(a){return u(a)||null},remove(a){let m=u(a),g=s().cloneOf(m);S.remove(m),g&&S.remove(g)},replaceWith(a,m){let g=u(a),p=s().cloneOf(g),y=S.replaceWith(g,m);if(p){let w=ee(y,{capability:"data",exclude:t.exclude||null});if(!w.root)p.remove();else{p.replaceWith(w.root);let E=x=>{let O=w.original(x);O&&(l.liveToClone.set(O,x),l.cloneToLive.set(x,O));for(let T of Array.from(x.childNodes||[]))E(T)};E(w.root)}}return y}};return A}var te=S;var ne=e=>({codecs:Se(),...e}),re={extract:(e,t,n={})=>L(I(e,n),e,t,ne(n)),apply:(e,t,n,i={})=>D(I(e,{...i,_write:!0}),e,t,n,ne(i)),findRulesIn:(e,t)=>W(te,e,t),findRules:(e,t)=>Ie(te,e,t),bind:(e,t,n={})=>{let i=Ie(te,e,t);if(!i){let o=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${o}`)}let r=ne({version:i.version,...n});return{...i,get:()=>L(I(e,n),e,i.rules,r),set:o=>D(I(e,{...n,_write:!0}),e,i.rules,o,r)}},codecs:{register:Te,get:Oe},parseStrict:Pe,parseRelaxed:Y,ruleAttrIndex:N,splitRule:b,errors:R,DOM_PROPERTIES:ie},_e=e=>!!e&&typeof e.nodeType=="number";function At(e){let t=e&&e.ownerDocument?e.ownerDocument:e,n=W(te,t,"api");if(!n)throw new R.NoRulesTag("api");return{rules:n.rules,version:n.version}}function dn(e){if(e.nodeType===9)return e;let t=e.ownerDocument?.documentElement;if(t?.contains(e))return t;let n=e;for(;n.parentNode;)n=n.parentNode;return n}function hn(e){if(e.nodeType!==11||!e.host)return e.cloneNode(!0);let t=e.ownerDocument.createDocumentFragment();for(let n of e.childNodes)t.appendChild(n.cloneNode(!0));return t}function pn(e,t){let n=[];for(;t!==e;){let i=t.parentNode;n.push(Array.prototype.indexOf.call(i.childNodes,t)),t=i}return n.reverse()}function mn(e,t){return t.reduce((n,i)=>n.childNodes[i],e)}function q(e,t){let n=e.querySelectorAll?Array.from(e.querySelectorAll(t)):[];return e.matches?.(t)&&n.unshift(e),n}function yn(e,t){let n=q(e,"option"),i=q(t,"option");n.forEach((s,f)=>i[f].selected=s.selected);let r=q(e,"input"),o=q(t,"input");r.forEach((s,f)=>{let u=s.type.toLowerCase();u!=="file"&&(o[f].value=s.value),(u==="checkbox"||u==="radio")&&(o[f].checked=s.checked)});let c=q(e,"textarea"),l=q(t,"textarea");c.forEach((s,f)=>l[f].value=s.value)}function $e(e,t){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]"))return;let n=e.startsWith("@")?0:N(e);if(n===-1)return;let i=e.slice(n+1);if(B.has(i))throw new R.RuleTargetReadOnly(i);return}if(Array.isArray(e)){if(!Array.isArray(t))return;t.forEach(n=>$e(e[1],n));return}if(e&&typeof e=="object"&&t&&typeof t=="object"&&!Array.isArray(t))for(let[n,i]of Object.entries(e))$e(i,t[n])}}function gn(e,t,n,i){let r=ne({templateAttr:"cms-template",version:i}),o=dn(e),c=pn(o,e),l=hn(o);yn(o,l);let s=mn(l,c),f=I(l,{...r,_write:!0}),u=Le(f,s,t,n,r);if(u.unknownKeys.length||u.unmatched.length)throw new R.WriteRejected(u.unknownKeys,u.unmatched);let d=de(f);D(d,s,t,n,r),d.assertClean(),$e(t,n);let h=de(I(o,{...r,_write:!0}));D(h,e,t,n,r),h.assertClean()}function wn(e){if(!(e instanceof Error))return e;let n=e instanceof R.UnknownCodec||e instanceof R.CodecRefused?e.code:e.name||"Error";try{e.code=n}catch{Object.defineProperty(e,"code",{value:n,configurable:!0,enumerable:!0})}return e instanceof R.WriteRefused?e.details=e.refusals:e instanceof R.WriteRejected?e.details={unknownKeys:e.unknownKeys,unmatched:e.unmatched}:e instanceof R.ShapeMismatch?e.details=e.mismatches:Array.isArray(e.path)?e.details={path:e.path}:typeof e.target=="string"?e.details={target:e.target}:e.token!==void 0?e.details={token:e.token}:e.version!==void 0?e.details={version:e.version}:e.details={},e}function je(e,t){let n=_e(e)?e:document,i=_e(e)?t:e;if(i===void 0){let{rules:r,version:o}=At(n);return L(I(n),n,r,ne({version:o}))}return re.bind(n,i).get()}function De(e,t,n){try{if(!_e(e))throw new Error("hyper-html-api: applyData(root, data, source?) needs a DOM root as the first argument.");let{rules:i,version:r}=n===void 0?At(e):re.bind(e,n);gn(e,i,t,r)}catch(i){throw wn(i)}return e}var An={engine:re,extractData:je,applyData:De},En=An;return bt(Tn);})();
6
6
  window.clay = window.clay || {};
7
7
  window.clay.extractData = hyperHtmlApiData.extractData;
8
8
  window.clay.applyData = function (values, optionsOrSource, source) {
package/entries/sap.js CHANGED
@@ -6,7 +6,7 @@ var Sap=(()=>{var Qt=Object.defineProperty;var Bn=Object.getOwnPropertyDescripto
6
6
  `)),i}error(e,r,n={}){let o=this.block(e,r,n);return this.errors.push(o),o}warn(e,r,n={}){let o=this.block(e,r,n);return this.warnings.push(o),o}report(){return{ok:this.errors.length===0&&!this.halted,app:this.appName,halted:this.halted,haltReason:this.haltReason,errors:this.errors.slice(),warnings:this.warnings.slice()}}};function V(t,e){t&&t.getAttribute("sap-error")!==e&&t.setAttribute("sap-error",e)}function ct(t){t&&t.hasAttribute("sap-error")&&t.removeAttribute("sap-error")}function wt(t,e){let r=null,n=3;for(let o of e){let i=Un(t,o);i<n&&(n=i,r=o)}return r}function Un(t,e){let r=t.length,n=e.length,o=Array.from({length:r+1},(i,s)=>[s,...new Array(n).fill(0)]);for(let i=0;i<=n;i++)o[0][i]=i;for(let i=1;i<=r;i++)for(let s=1;s<=n;s++)o[i][s]=Math.min(o[i-1][s]+1,o[i][s-1]+1,o[i-1][s-1]+(t[i-1]===e[s-1]?0:1));return o[r][n]}var Gn=new Set(ut),Yn={readonly:"readOnly",novalidate:"noValidate"},Xn=0,ge=new WeakMap;function Lt(t,e="sap"){let r=t.getAttribute("data-id");if(r)return r;if(t.id)return t.id;let n=ge.get(t);return n||(n=`${e}-${(Xn++).toString(36)}`,ge.set(t,n)),n}function we(t,e="row"){for(;;){let r=`${e}-${Math.random().toString(36).slice(2,8)}`;if(!t.getElementById(r)&&!t.querySelector(`[data-id="${r}"]`))return r}}function Kn(t){return t.hasAttribute("scope")||t.hasAttribute("items")||t.hasAttribute("detail")||t.hasAttribute("each")}function Jn(t){return t.tagName==="TEMPLATE"||t.hasAttribute("sap-ignore")||t.hasAttribute("template")||t.hasAttribute("cms-template")}function H(t,e){for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(Jn(n))return;let o=Kn(n);if(e(n,o),!o)for(let i=n.firstElementChild;i;i=i.nextElementSibling)r(i)}}function j(t){let e=t;for(;e;){if(e.hasAttribute("sap")||e.hasAttribute("scope")||e.hasAttribute("item")||e.hasAttribute("detail"))return e;e=e.parentElement}return null}function tt(t){for(let e=t;e&&e.nodeType===1;e=e.parentElement){if(e._sapEachRow)return e;if(e.hasAttribute("item")||e.hasAttribute("sap"))return null}return null}function Ct(t){let e=t;for(;e;){if(e.hasAttribute("detail")||e.hasAttribute("item"))return e;e=e.parentElement}return null}function yt(t){let e=t;for(;e;){if(e.hasAttribute("detail"))return e;e=e.parentElement}return null}function et(t,e){if(t.hasAttribute("item")&&t.getAttribute("bind")===e)return t;let r=null;return H(t,n=>{!r&&n.getAttribute("bind")===e&&(r=n)}),r}function ft(t,e){let r=null;return H(t,n=>{!r&&n.getAttribute("items")===e&&(r=n)}),r}function lt(t,e){return!t||t.nodeType!==1||!t.hasAttribute("item")?!1:et(t,e)||ft(t,e)?!0:W(t.getAttribute("state")||"").some(r=>r.name===e)}function ye(t){let e=t&&t.$el;return e&&e.nodeType===1&&e.isConnected&&e.hasAttribute("item")?e:null}function Dt(t){return!!t.closest("form[trigger-add]")}function G(t){let e=[];for(let r=t.firstElementChild;r;r=r.nextElementSibling)r.hasAttribute("item")&&!r.hasAttribute("template")&&!r.hasAttribute("cms-template")&&e.push(r);return e}function te(t,e){if(!t||!e)return null;let r=[...t.querySelectorAll(`template[items="${e}"]`)].find(o=>o.closest("[sap]")===t),n=r&&r.content.firstElementChild;return n&&n.hasAttribute("item")?n:null}function Ft(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.hasAttribute("item")&&e.hasAttribute("template"))return e;return te(t.closest("[sap]"),t.getAttribute("items"))}function W(t){let e=[];if(!t)return e;for(let r of t.trim().split(/\s+/)){if(!r)continue;let n=r,o,i=n.indexOf("=");i>=0&&(o=n.slice(i+1),n=n.slice(0,i));let s=n.split(":"),b=s[0],m="string",d=!1;for(let A of s.slice(1))A==="num"?m="num":A==="bool"?m="bool":A==="presence"?m="presence":A==="transient"&&(d=!0);let u=b,E=u.startsWith("data-")&&u.length>5?u.slice(5).replace(/-([a-z])/g,(A,N)=>N.toUpperCase()):u;e.push({name:E,attr:u,type:m,default:o,transient:d})}return e}function Z(t,e){if(e==="num"){if(t==null||t==="")return 0;let r=Number(t);return Number.isNaN(r)?0:r}return e==="bool"?t==="true"||t===""||t==="1":t??""}function ee(t,e){return e==="bool"?t?"true":"false":t==null?"":String(t)}function ne(t,e){return Gn.has(e)&&typeof t[Yn[e]||e]=="boolean"}function Y(t,e){return e.type==="presence"||e.type!=="num"&&ne(t,e.attr||e.name)}function At(t){return t.default!=null?t.default:t.type==="num"?"0":t.type==="bool"?"false":""}function Ae(t,e){let r=e.attr||e.name;if(Y(t,e))return t.hasAttribute(r);let n=t.getAttribute(r);return Z(n??At(e),e.type)}function ve(t,e){return Y(t,e)?e.default!=null?Z(e.default,"bool"):!1:Z(At(e),e.type)}function vt(t,e,r){let n=e.attr||e.name;if(Y(t,e)){r?t.hasAttribute(n)||t.setAttribute(n,""):t.hasAttribute(n)&&t.removeAttribute(n);return}t.setAttribute(n,ee(r,e.type))}function Mt(t,e){let r=e.attr||e.name,n=t._sapTransient||(t._sapTransient={});if(!(e.name in n)){let o=t.getAttribute(r);o==null&&(o=At(e)),n[e.name]=Z(o,e.type)}return t.hasAttribute(r)&&t.removeAttribute(r),n[e.name]}function Et(t,e,r){let n=e.attr||e.name;(t._sapTransient||(t._sapTransient={}))[e.name]=r,t.hasAttribute(n)&&t.removeAttribute(n)}function xt(t,e,r){let n=String(r).split("."),o=n[n.length-1];if(n.length===1){let b=Qn(e,o);return b||(t.getAttribute("items")===o?t:t.querySelector(`[items="${o}"]:not(template)`))}let i=n[n.length-2],s=[...t.querySelectorAll(`[scope="${i}"]`)].find(b=>ft(b,o));return s?ft(s,o):null}function Qn(t,e){let r=j(t);for(;r;){if(r.getAttribute("items")===e)return r;let n=ft(r,e);if(n)return n;r=j(r.parentElement)}return null}function q(t){if(typeof t=="number")return t;if(t==null||t==="")return 0;let e=Number(typeof t=="string"?t.replace(/[$,%\s]/g,""):t);return Number.isNaN(e)?0:e}function Ot(t,e){return Array.isArray(t)?e==null?t:t.map(r=>typeof e=="function"?e(r):r?.[e]):[]}function re(t,e){return Ot(t,e).reduce((r,n)=>r+q(n),0)}function Ee(t,e){return Array.isArray(t)?e==null?t.length:t.reduce((r,n)=>r+(e(n)?1:0),0):0}function xe(t,e){let r=Ot(t,e);return r.length?re(t,e)/r.length:0}function Se(t,e){let r=Ot(t,e).filter(n=>n!=null&&n!=="");return r.length?r.every(n=>typeof n=="number"||!Number.isNaN(Number(n)))?Math.min(...r.map(Number)):r.reduce((n,o)=>String(n)<=String(o)?n:o):0}function ke(t,e){let r=Ot(t,e).filter(n=>n!=null&&n!=="");return r.length?r.every(n=>typeof n=="number"||!Number.isNaN(Number(n)))?Math.max(...r.map(Number)):r.reduce((n,o)=>String(n)>=String(o)?n:o):0}function $e(t,e,r){let n=q(t)===1?e:r??e+"s";return`${t} ${n}`}function _e(t,e){let r=new Date(t),n=new Date(e);return Number.isNaN(+r)||Number.isNaN(+n)?0:Math.round((n-r)/864e5)}function U(t){return typeof t=="number"?t:Number(t)}var dt={usd:t=>"$"+U(t).toLocaleString("en-US",{maximumFractionDigits:0}),usd2:t=>"$"+U(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),pct:t=>Math.round(U(t))+"%",pct1:t=>U(t).toFixed(1)+"%",int:t=>Math.round(U(t)).toLocaleString("en-US"),num:t=>U(t).toLocaleString("en-US"),num2:t=>U(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),compact:t=>U(t).toLocaleString("en-US",{notation:"compact"}),date:t=>{let e=new Date(t);return Number.isNaN(+e)?String(t):e.toLocaleDateString("en-US")},clock:t=>{let e=U(t),r=Math.floor(e/100),n=r%10,o=Math.floor(r/10)%60;return`${Math.floor(r/600)}:${String(o).padStart(2,"0")}.${n}`}},Zn=new Set(["usd","usd2","pct","pct1","int","num","num2","compact","clock"]);function Te(t,e){if(!t)return e==null?"":String(e);let r=dt[t];if(typeof r!="function"){let n=new Error(`unknown format "${t}"`);throw n.sapCode="E22",n}if(Zn.has(t)){let n=typeof e=="number"?e:Number(e);if(!Number.isFinite(n)){let o=new Error(`format "${t}" received ${typeof e=="string"?`"${e}"`:e}`);throw o.sapCode="E22",o}}return r(e)}var tr=["state","item","el","root","fmt","num","sum","count","avg","min","max","plural","days"],Pt=new Map,Ne=/\bstate\.([a-z][a-z0-9_]*)/g,Re=/\bitem\.([a-z][a-z0-9_]*)/g;function er(t){let e=new Set,r=new Set,n;for(Ne.lastIndex=0;n=Ne.exec(t);)e.add(n[1]);for(Re.lastIndex=0;n=Re.exec(t);)r.add(n[1]);return{state:e,item:r}}function P(t,e=!1){let r=(e?"!":"")+t,n=Pt.get(r);if(n)return n;Pt.size>512&&Pt.clear();try{let o=e?`"use strict";
7
7
  ${t}`:`"use strict"; return (${t});`;n={fn:new Function(...tr,o),src:t,statement:e,deps:er(t),error:null}}catch(o){n={fn:null,src:t,statement:e,deps:{state:new Set,item:new Set},error:o}}return Pt.set(r,n),n}function nt(t,e){return z(t,e.state,e.item,e.el??null,e.root)}function z(t,e,r,n,o){if(t.error)throw t.error;return t.fn(e,r,n,o,dt,q,re,Ee,xe,Se,ke,$e,_e)}function Le(t){let e=new Map;for(let s of t)e.set(s.name,s);let r=[],n=new Map,o=[];function i(s){let b=n.get(s.name);if(b!==1){if(b===0){let m=[...o.slice(o.indexOf(s.name)),s.name].join(" -> "),d=new Error(`calc: cycle: ${m}`);throw d.sapCode="E07",d.cycle=m,d}n.set(s.name,0),o.push(s.name);for(let m of s.entry.deps.state){let d=e.get(m);d&&d!==s&&i(d)}for(let m of s.entry.deps.item){let d=e.get(m);d&&d!==s&&i(d)}o.pop(),n.set(s.name,1),r.push(s)}}for(let s of t)i(s);return r}var St={},rt=null,De=!0,Wt=!1;function Fe(){St={}}function Me(t){let e=Wt;return rt?oe(rt.takeRecords()):De&&nr(),Wt=!!rt&&t.getRootNode()===document,e}function Oe(t){Wt=t}function Bt(){rt&&oe(rt.takeRecords())}function nr(){if(typeof document>"u"||typeof MutationObserver!="function"){De=!1;return}rt=new MutationObserver(oe),rt.observe(document,{attributes:!0,childList:!0,subtree:!0})}function oe(t){for(let e of t)if(e.type==="attributes")e.target._sapPlan&&(e.target._sapPlan=null);else for(let r of e.addedNodes)r.nodeType===1&&Pe(r)}function Pe(t){t._sapPlan&&(t._sapPlan=null);for(let e=t.firstElementChild;e;e=e.nextElementSibling)Pe(e)}function X(t){if(!Wt)return Ce(t);let e=t._sapPlan;return e&&e.gen===St?e:t._sapPlan=Ce(t)}function Ce(t){let e={gen:St,inert:t.tagName==="TEMPLATE",template:!1,cms:!1,item:!1,scope:!1,items:!1,detail:!1,each:!1,boundary:null,bind:null,transient:!1,decls:null,calcs:null,paints:null,effects:null,invalids:null};for(let r of t.attributes){let n=r.name,o=r.value,i=n.indexOf(":");if(i<0){switch(n){case"sap-ignore":e.inert=!0;break;case"cms-template":e.inert=!0,e.cms=!0;break;case"template":e.inert=!0,e.template=!0;break;case"item":e.item=!0;break;case"scope":e.scope=!0;break;case"items":e.items=!0;break;case"detail":e.detail=!0;break;case"each":e.each=!0;break;case"bind":e.bind=o;break;case"transient":e.transient=!0;break;case"state":e.decls=W(o);break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:null,entry:P(o)});break;case"show":(e.paints||(e.paints=[])).push({kind:"show",entry:P(o)});break;case"effect":(e.effects||(e.effects=[])).push({entry:P(o,!0)});break;case"invalid":(e.invalids||(e.invalids=[])).push({entry:P(o)});break}continue}let s=n.slice(0,i),b=n.slice(i+1);switch(s){case"calc":(e.calcs||(e.calcs=[])).push({name:b,entry:P(o)});break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:b,entry:P(o)});break;case"attr":(e.paints||(e.paints=[])).push({kind:"attr",arg:b,entry:P(o)});break;case"class":(e.paints||(e.paints=[])).push({kind:"class",arg:b,entry:P(o)});break;case"css":(e.paints||(e.paints=[])).push({kind:"css",arg:b,entry:P(o)});break;case"show-when":case"option":(e.paints||(e.paints=[])).push({kind:"when",match:"show",field:b,values:o.split("|")});break;case"hide-when":(e.paints||(e.paints=[])).push({kind:"when",match:"hide",field:b,values:o.split("|")});break;case"option-not":(e.paints||(e.paints=[])).push({kind:"when",match:"show-not",field:b,values:o.split("|")});break}}return e.boundary=e.scope?"scope":e.items?"items":e.detail?"detail":e.each?"each":null,or(e)?rr():e}var It=null;function rr(){return(!It||It.gen!==St)&&(It=Object.freeze({gen:St,inert:!1,template:!1,cms:!1,item:!1,scope:!1,items:!1,detail:!1,each:!1,boundary:null,bind:null,transient:!1,decls:null,calcs:null,paints:null,effects:null,invalids:null})),It}function or(t){return!t.inert&&!t.item&&t.boundary===null&&t.bind===null&&!t.transient&&!t.decls&&!t.calcs&&!t.paints&&!t.effects&&!t.invalids}var ot=new WeakMap,it=new WeakMap,pt=null,K=!1;function We(){ot=new WeakMap,it=new WeakMap}function Ie(t){for(let e of t){let r=e.target.nodeType===1?e.target:e.target.parentElement;for(let n=r;n;n=n.parentElement)it.delete(n);if(e.type==="attributes"){ot.delete(e.target);continue}for(let n=r;n;n=n.parentElement)ot.delete(n);for(let n of e.addedNodes||[])if(n.nodeType===1){ot.delete(n),it.delete(n);for(let o of n.querySelectorAll("*"))ot.delete(o),it.delete(o)}}}function Be(){return K}function je(t){return K?it.get(t):void 0}function qe(t,e){K&&it.set(t,e)}function jt(t){it.delete(t)}function ze(t){let e=K;return!pt&&typeof MutationObserver=="function"&&(pt=new MutationObserver(Ie),pt.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),pt&&Ie(pt.takeRecords()),K=!!pt&&t.getRootNode()===document,e}function He(t){K=t}function Ve(t){let e=ot.get(t);return e||ot.set(t,e={attrs:new Map,hasText:!1,text:""}),e}function Ue(t,e){if(!K)return t.getAttribute(e);let r=Ve(t);return r.attrs.has(e)||r.attrs.set(e,t.getAttribute(e)),r.attrs.get(e)}function Ge(t){if(!K)return t.textContent;let e=Ve(t);return e.hasText||(e.text=t.textContent,e.hasText=!0),e.text}function Ye(t){return(t.getAttribute("type")||"text").toLowerCase()}function mt(t){let e=t.tagName;if(e==="INPUT"){let r=Ye(t);r==="checkbox"||r==="radio"?t.checked?t.setAttribute("checked",""):t.removeAttribute("checked"):t.setAttribute("value",t.value);return}if(e==="TEXTAREA"){t.setAttribute("data-value",t.value);return}if(e==="SELECT"){let r=t.options;for(let n=0;n<r.length;n++)r[n].selected?r[n].setAttribute("selected",""):r[n].removeAttribute("selected")}}function Xe(t,e=t){let r=t.tagName;if(r==="INPUT"){let n=Ye(t);n==="checkbox"||n==="radio"?e.checked?t.hasAttribute("checked")||t.setAttribute("checked",""):t.removeAttribute("checked"):e.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",e.value);return}if(r==="TEXTAREA"){let n=e.value.startsWith(`
8
8
  `)?`
9
- `+e.value:e.value;t.textContent!==n&&(t.textContent=n),t.removeAttribute("data-value");return}if(r==="SELECT"){let n=t.options,o=e.options;for(let i=0;i<n.length;i++)o[i]&&o[i].selected?n[i].hasAttribute("selected")||n[i].setAttribute("selected",""):n[i].removeAttribute("selected")}}function qt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function O(t){if(typeof window>"u")return null;let e=window.clay,r=window.hyperclay;return t==="consent"?e?.confirm||r?.consent||null:e?.[t]||r?.[t]||null}function Ke(){let t=O("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var ie=["clay:mutation-ready","hyperclay:mutation-ready"],ir=["clay:sync-applied","hyperclay:livesync-applied"],sr=["clay:ready","hyperclay:ready"],ar=["clay:route"],ur=["clay:modechange"];function kt(t,e,r){let n=null,o=i=>{n!==null&&n!==i.type||(n=i.type,queueMicrotask(()=>{n=null}),r(i))};for(let i of e)t.addEventListener(i,o);return()=>{for(let i of e)t.removeEventListener(i,o)}}function Je(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function zt(t){let e=O("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function $t(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function F(t,{transient:e=!1}={}){if(e)return!0;let r=$t();return typeof r?.canWrite!="function"||O("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Qe(){let t=O("consent");return typeof t=="function"?t:null}function Ze(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=O("undo");r&&r.flush&&r.flush();let n=e();if(n&&typeof n.then=="function")throw new Error("Sap.batch fn must be synchronous (it returned a promise)");return r&&r.commitCaptured&&r.commitCaptured(t),n}function tn(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let A=!1;for(let N of t.apps())N.root.isConnected?t.runNow(N,"platform"):A=!0;A&&t.pruneDisconnected(),t.remountIfPresent()},r=O("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:kt(document,ir,e),i=kt(document,ar,e),s=null,b=!1,m=()=>{let A=s;s=null,A&&(A[2](),A[3]())},d=()=>{if(b)return!1;let A=O("undo"),N=$t()?.state?.generation;if(s&&s[0]===A&&s[1]===N)return!0;if(m(),!A||typeof A.on!="function")return!1;let R=A.on("undo",e);if(typeof R!="function")return!1;let p=A.on("redo",e);return typeof p!="function"?(R(),!1):(s=[A,N,R,p],!0)};d();let u=[ie,sr,ur].map(A=>kt(document,A,d)),E=O("ready");return E&&typeof E.then=="function"&&E.then(d,()=>{}),()=>{b=!0,typeof n=="function"&&n(),o&&o(),i();for(let A of u)A();m()}}function _t(t){let e=t.tagName;if(e==="INPUT"){let r=(t.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return e==="TEXTAREA"?"text":e==="SELECT"?t.multiple?"select-multiple":"select-one":"leaf"}function cr(t){if(t.validity&&t.validity.badInput)return t.hasAttribute("value")?Number(t.getAttribute("value"))||0:t._sapLastGood??0;if(t.value==="")return 0;let e=Number(t.value);return Number.isNaN(e)?t._sapLastGood??0:(t._sapLastGood=e,e)}function en(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return cr(t);case"select-one":return t.value;case"select-multiple":return[...t.selectedOptions].map(r=>r.value);case"hidden":case"text":return t.value;case"leaf":return t.textContent;default:return t.value}}function nn(t,e,r){switch(e){case"checkbox":t.checked=!!r;break;case"radio":t.checked=String(t.value)===String(r);break;case"number":case"text":case"hidden":t.value=r==null?"":String(r);break;case"select-one":t.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of t.options)o.selected=n.has(o.value);break}case"leaf":t.textContent=r==null?"":String(r);break;default:t.value=r==null?"":String(r)}}function se(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}zt(t)||mt(t)}function fr(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Ht(t,e){return en(t,e)}function rn(t,e,r){nn(t,e,r),se(t)}function B(t){let e=_t(t);return{el:t,kind:e,read(){return en(t,e)},write(r,n={}){nn(t,e,r),n.noMirror||se(t),n.silent||fr(t)},mirror(){se(t)}}}var J=null,Ut=!1,ht=null;function on(t){let e=null;return{kind:"hub",subscribe(r){let n=t.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(e=n)},suppress(r){t.pause();try{return r()}finally{t.resume()}},teardown(){if(e){try{e()}catch{}e=null}}}}function lr(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(dr(n)));let r=typeof document<"u"&&document.body||typeof document<"u"&&document.documentElement;r&&t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(e){let r=O("undo");r&&r.pause&&r.pause();try{return e()}finally{t&&t.takeRecords(),r&&r.resume&&r.resume()}},teardown(){t&&(t.disconnect(),t=null)}}}function dr(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!Vt(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!Vt(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||Vt(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))Vt(o)||e.push({type:"add",element:o});for(let n of r.removedNodes)n.nodeType===1&&e.push({type:"remove",element:n,parent:r.target})}return e}function Vt(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function pr(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let i=o.type==="remove"?o.parent:o.element,s=i&&t.appFor(i);s&&r.add(s),o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(t.isRegistered&&t.isRegistered(o.element))&&(n=!0)}n&&t.remountIfPresent();for(let o of r)o.root.isConnected&&t.schedule(o,"mutation")}function sn(t){if(J)return J.suppress(t);let e=O("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function ae(t,e){Ut=!0,J=t,t.subscribe(r=>pr(e,r))}function ue(t){if(Ut||typeof window>"u"||typeof document>"u")return;let e=O("Mutation");if(e&&typeof e.onAnyChange=="function"){ae(on(e),t);return}typeof MutationObserver=="function"&&(ae(lr(),t),ht=kt(document,ie,function(){let n=O("Mutation");n&&(ht(),ht=null,J&&J.teardown(),Ut=!1,ae(on(n),t))}))}function ce(){if(J)try{J.teardown()}catch{}ht&&typeof document<"u"&&ht(),J=null,Ut=!1,ht=null}var mr=new Set(ut),Gt=Object.freeze([]),Q=[],un={},cn={};function fn(t){Q.includes(t)||(Q.push(t),t.boundary&&Object.assign(un,t.boundary),t.paintKinds&&Object.assign(cn,t.paintKinds))}function bt(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),V(t.root,"loop");return}e.full&&(Fe(),We());let r=Me(t.root);try{sn(()=>hr(t,e))}finally{Oe(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function hr(t,e){let r=t.root,n={},o=[],i=[],s=new Set;t.diag.errors=[];let b={root:n,state:n,item:null,ownerEl:r,projection:!1},m=null;function d(f,S,k=!1){let $=S.attr||S.name,_=k?Ue(f,$):f.getAttribute($);return _==null&&(_=At(S),i.push({el:f,name:S.name,attr:$,value:ee(Z(_,S.type),S.type)})),Z(_,S.type)}function u(f,S,k,$){let _=S.decls;if(!_)return;let L=!!$.item&&!$.projection&&!$.view;for(let D of _){if(D.transient){m&&(m.pure=!1),k[D.name]=Mt(f,D);continue}if(Y(f,D)){k[D.name]=f.hasAttribute(D.attr);continue}k[D.name]=d(f,D,L)}}function E(f,S,k){let $=S.bind,_=k.item||k.state,L=_t(f);m&&(L!=="leaf"||S.transient)&&(m.pure=!1),L==="radio"?($ in _||(_[$]=""),f.checked&&(_[$]=f.value)):L==="leaf"&&k.item&&!k.projection&&!k.view?_[$]=Ge(f):_[$]=Ht(f,L),S.transient&&(f.removeAttribute("value"),f.removeAttribute("checked"))}function A(f,S,k){let $=!1;if(S.paints){$=!0;for(let _ of S.paints)_.kind==="when"&&s.add(_.field),o.push({def:_,el:f,ctx:k})}for(let _ of Q)_.collect&&_.collect(a,f,S,k)!==!1&&($=!0);m&&$&&(S.calcs&&(m.pure=!1),m.collects.push(f,S))}function N(f,S,k){Object.defineProperty(f,"$key",{value:Lt(S,"row"),enumerable:!1}),Object.defineProperty(f,"$index",{value:k,enumerable:!1,configurable:!0}),Object.defineProperty(f,"$el",{value:S,enumerable:!1})}function R(f,S,k){let $=X(f);u(f,$,S,k),f._sapScope=S,!k.projection&&$.bind!=null&&E(f,$,k),A(f,$,k),$.items?w(f,S,k):p(f,S,k)}function p(f,S,k){for(let $=f.firstElementChild;$;$=$.nextElementSibling)y($,S,k)}function y(f,S,k){let $=X(f);if(!$.inert){if($.boundary){m&&(m.pure=!1),$.boundary==="scope"?h(f,S,k):$.boundary==="items"?(A(f,$,k),w(f,S,k)):un[$.boundary](a,f,$,S,k);return}!k.projection&&!k.view&&$.bind!=null&&E(f,$,k),A(f,$,k);for(let _=f.firstElementChild;_;_=_.nextElementSibling)y(_,S,k)}}function h(f,S,k){let $=f.getAttribute("scope"),_={};S[$]=_;let L={root:k.root,state:_,item:null,ownerEl:f,projection:k.projection};R(f,_,L)}function w(f,S,k){m&&(m.pure=!1);let $=f.getAttribute("items"),_=[];S[$]=_,f._sapList=_;let L=!k.projection&&!k.view&&Be(),D=0;for(let M=f.firstElementChild;M;M=M.nextElementSibling){let C=X(M);if(!C.item||C.template||C.cms)continue;let I=L?je(M):void 0;_.push(I&&I.plan===C&&Object.isExtensible(I.obj)&&c(I,M,D,k)||x(M,C,D,k,L)),D++}}function x(f,S,k,$,_){let L={};N(L,f,k);let D={root:$.root,state:$.state,item:L,ownerEl:f,projection:$.projection};if(!_)return R(f,L,D),L;let M=m,C={plan:S,obj:L,fields:null,presence:Gt,pending:Gt,collects:[],pure:!0},I=i.length,Wn=t.diag.errors.length;m=C;try{R(f,L,D)}finally{m=M}if(!C.pure||t.halted||t.diag.errors.length!==Wn)return L;let he=[];for(let st of Object.keys(L)){let Jt=L[st];if(Jt!==null&&typeof Jt=="object")return L;he.push(st,Jt)}if(S.decls)for(let st of S.decls)Y(f,st)&&(C.presence===Gt?C.presence=[]:C.presence).push(st.name,st.attr);return i.length>I&&(C.pending=i.slice(I)),C.collects.length||(C.collects=Gt),C.fields=he,qe(f,C),L}function c(f,S,k,$){let _=f.obj;try{_.$index!==k&&Object.defineProperty(_,"$index",{value:k,enumerable:!1,configurable:!0});let M=f.presence;for(let I=0;I<M.length;I+=2)_[M[I]]=S.hasAttribute(M[I+1]);let C=f.fields;for(let I=0;I<C.length;I+=2)_[C[I]]=C[I+1]}catch{return jt(S),null}S._sapScope=_;let L=f.pending;for(let M=0;M<L.length;M++)i.push(L[M]);let D=f.collects;if(D.length){let M={root:$.root,state:$.state,item:_,ownerEl:S,projection:$.projection};for(let C=0;C<D.length;C+=2)A(D[C],D[C+1],M)}return _}let a={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:d,collectEl:A,walkScope:p};for(let f of Q)f.begin&&f.begin(a);let l=e.cacheReads===!1?null:ze(r);try{R(r,n,b)}finally{e.cacheReads!==!1&&He(l)}if(t.halted)return;for(let f of Q)f.afterIntake&&f.afterIntake(a);if(i.length&&s.size)for(let f of i)s.has(f.attr)&&f.el.getAttribute(f.attr)==null&&f.el.setAttribute(f.attr,f.value);for(let f of Q)f.compute&&f.compute(a);let g=0;for(let f of Q)f.reconcile&&(g+=f.reconcile(a));let v=0,T=g;for(let f of o){let S=gr(f,t);f.ctx.view?T+=S:v+=S}for(let f of Q)f.afterPaint&&f.afterPaint(a);t._state=n,t._stats={fields:Object.keys(n).filter(f=>typeof n[f]!="function").length,calcs:a.stats.calcs,paints:o.length,lists:a.stats.lists,writes:v,viewWrites:T},t._viewsChanged=T>0,t._lastPass={trigger:e.trigger||"refresh",writes:v},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${v}/${o.length}`)}function br(t){return t.kind==="text"?t.fmt?"text:"+t.fmt:"text":t.kind==="attr"?"attr:"+t.arg:t.kind==="class"?"class:"+t.arg:t.kind==="css"?"css:"+t.arg:t.kind==="when"?(t.match==="hide"?"hide-when:":t.match==="show-not"?"option-not:":"show-when:")+t.field:t.kind}function fe(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let i=r.includes(o.getAttribute(e));if(n?!i:i)return!0}o=o.parentElement}return!1}function gr(t,e){let r=t.def,n=t.el,o=cn[r.kind];if(o)return o(t,e);if(r.kind==="when")return an(r,n,null);try{let i=z(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),s=an(r,n,i);return ct(n),s}catch(i){return e.diag.error(i.sapCode==="E22"?"E22":"E24",n,{attr:br(r),expr:r.entry&&r.entry.src,problem:String(i.message)}),V(n,i.sapCode||"E24"),0}}function an(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?Te(t.fmt,r):r==null?"":String(r);return e.textContent!==n?(e.textContent=n,1):0}case"show":{let n=!r;return e.hidden!==n?(e.hidden=n,1):0}case"when":{let n=O("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!fe(e,t.field,t.values,!1):t.match==="show-not"?o=fe(e,t.field,t.values,!0):o=fe(e,t.field,t.values,!1),e._sapWhen=!0;let i=!o;return e.hidden!==i?(e.hidden=i,1):0}case"attr":{let n=t.arg;if((n==="checked"||n==="selected")&&typeof e[n]=="boolean"&&!e.hasAttribute("bind")&&!e.closest("select[bind]")){let i=0;return e[n]!==!!r&&(e[n]=!!r,i=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),i=1),i}if(mr.has(n)){let i=e.hasAttribute(n);return r&&!i?(e.setAttribute(n,""),1):!r&&i?(e.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return e.getAttribute(n)!==o?(e.setAttribute(n,o),1):0}case"class":{let n=!!r;return e.classList.contains(t.arg)!==n?(e.classList.toggle(t.arg,n),1):0}case"css":{let n=r==null?"":String(r);return e.style.getPropertyValue("--"+t.arg)!==n?(e.style.setProperty("--"+t.arg,n),1):0}default:return 0}}var wr=new Set(ut),ln=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),yr=new Set(["show-when","hide-when","option","option-not"]),Ar=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,dn=new Set(["sap","scope","items","item","template","bind","show","effect","invalid","detail","state","transient","confirm","default","persist","sortable","trigger-add","trigger-remove","trigger-reset","sap-ignore","sap-error","no-save","no-watch","no-undo","no-trigger-autosave","freeze","mutations-ignore","save-remove","save-ignore","save-freeze"]),de=[];function pn(t){de.includes(t)||de.push(t)}function vr(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function le(t){return t.hasAttribute("bind")}function Er(t,e){e(t);for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(!n.hasAttribute("sap-ignore")){if(n.tagName==="TEMPLATE"){if(n.hasAttribute("items"))for(let o=n.content.firstElementChild;o;o=o.nextElementSibling)r(o);return}e(n);for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function Yt(t,e){let r=!1,n=(s,b,m)=>{e.error(s,b,m),r=!0},o=t.ownerDocument.createTreeWalker(t,4),i;for(;i=o.nextNode();)if(/\{\{.*\}\}/.test(i.nodeValue||"")){n("E02",i.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Er(t,s=>{let b=new Set;for(let d of de)d(s,n,u=>b.add(u));let m=s.closest&&s.closest("[detail]");for(let d of[...s.attributes]){let u=d.name;if(b.has(u))continue;if(u.includes(":")){let A=u.slice(0,u.indexOf(":"));if(ln.has(A)){if(yr.has(A)&&Ar.test(d.value)){let N=u.slice(u.indexOf(":")+1);e.warn("W04",s,{attr:u,expr:d.value,problem:`${A}: compares the "${N}" attribute against a literal value, not a JS expression`,fix:`use show="${d.value}" for an expression, or a literal like ${A}:${N}="overview"`})}}else{let N=wt(A,[...ln]);e.warn("W03",s,{attr:u,problem:`unknown "${A}:" attribute`,didYouMean:N?`${N}:`:null})}}else if(!dn.has(u)&&!gt.has(u)&&!wr.has(u)&&!/^(data-|aria-|on)/.test(u)&&!(u in s)){let A=wt(u,[...dn]);A&&e.warn("W03",s,{attr:u,problem:`unknown "${u}" attribute`,didYouMean:A})}u==="attr:hidden"&&e.warn("W03",s,{attr:u,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let E=le(s)||u==="attr:selected"&&s.tagName==="OPTION"&&!!s.closest("select[bind]");(u==="attr:value"||u==="attr:checked"||u==="attr:selected")&&E&&n("E30",s,{attr:u,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),u==="effect"&&le(s)&&/\b(value|checked)\s*=[^=]/.test(d.value)&&n("E30",s,{attr:u,expr:d.value,problem:"effect writes value/checked on a bound control (writes a stale value with no synthetic event)",fix:"write through onclick + Sap(this) instead"}),(u==="text"||u.startsWith("text:")||u==="show")&&vr(s)&&(u==="show"||n("E18",s,{attr:u,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(s.hasAttribute("state")){let d=W(s.getAttribute("state")),u=new Set;for(let E of d){E.name.includes("-")&&n("E08",s,{attr:"state",problem:`field "${E.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${E.name.replace(/-/g,"")}`}),u.has(E.name)&&n("E04",s,{attr:"state",problem:`field "${E.name}" is declared twice in one scope`}),u.add(E.name),Nt.has(E.attr)&&n("E05",s,{attr:"state",problem:`"${E.name}" is a reserved Sap word`}),gt.has(E.attr)&&n("E06",s,{attr:"state",problem:`"${E.name}" is a global HTML attribute name; pick another field name`}),E.name==="open"&&s.tagName==="DIALOG"&&n("E33",s,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let A=ne(s,E.attr);A&&(E.attr==="checked"||E.attr==="selected")&&n("E35",s,{attr:"state",problem:`"${E.attr}" on a form control is the control's own state, not a declared field`,fix:'bind the control instead, e.g. <input type="checkbox" bind="done">'}),A&&E.type==="num"&&n("E35",s,{attr:"state",problem:`"${E.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${E.attr}"`}),E.transient&&(A||E.type==="presence")&&n("E35",s,{attr:"state",problem:`"${E.name}" is carried by attribute presence, which transient would strip`,fix:"declare a separate name:bool:transient field and paint the attribute from it"})}}if(le(s)){if(s.hasAttribute("-"),s.tagName==="INPUT"){let d=(s.getAttribute("type")||"text").toLowerCase();d==="file"&&n("E32",s,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),d==="password"&&!s.hasAttribute("transient")&&n("E31",s,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(s.tagName!=="SELECT"&&s.tagName!=="TEXTAREA"){let d=s.getAttribute("contenteditable");!(d!=null&&d!=="false")&&s.children.length>0&&n("E20",s,{attr:"bind",problem:"bind on a container element is not a control; a write would overwrite its children",fix:"bind a control (input/select/textarea), a contenteditable, or an empty text leaf"})}}if(s.hasAttribute("transient")&&s.hasAttribute("persist")&&n("E34",s,{problem:"transient and persist are opposite: persist forces the live value into the saved bytes, leaking exactly what transient drops",fix:"remove one \u2014 transient to keep it out of the file, or persist to save it"}),s.tagName==="DIALOG"&&s.hasAttribute("detail")&&!(s.parentElement&&s.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",s,{attr:"detail",problem:"a detail dialog writes open when it opens, and that attribute would be saved into the file",fix:'wrap the dialog in an element with clay="freeze" (not editor-ui, which removes it from the file), and make its key field transient'}),s.hasAttribute("item")&&!s.hasAttribute("template")&&s.parentNode&&s.parentNode.nodeType===1){let d=s.parentElement;(!d||!d.hasAttribute("items"))&&n("E10",s,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(s.hasAttribute("items")&&m&&n("E17",s,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),s.hasAttribute("items")){let d=t.querySelector(`[trigger-add="${s.getAttribute("items")}"]`);!Ft(s)&&!te(t,s.getAttribute("items"))&&G(s).length===0&&d&&n("E17",s,{attr:"items",problem:`trigger-add targets items="${s.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(e.halted=!0,e.haltReason=e.errors[0]?e.errors[0].code:"halt",V(t,e.haltReason)),!r}var mn="sap-styles",hn="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",pe=new WeakSet;function xr(t){if(pe.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(hn),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],pe.add(t);return}catch{}if(!t.getElementById(mn)){let n=t.createElement("style");n.id=mn,n.textContent=hn,(t.head||t.documentElement).appendChild(n)}pe.add(t)}var Sr=0;function bn(){return typeof performance<"u"&&performance.now?performance.now():0}function me(t){let e=t.id||t.getAttribute("sap")||`app-${Sr++}`,r=new at(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Yt(t,r))return n.halted=!0,n;xr(t.ownerDocument);for(let s of t.querySelectorAll("textarea[data-value]"))qt(s);let i=bn();return bt(n,{trigger:"mount",full:!0}),n._mountMs=bn()-i,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ke()&&!O("derived")&&r.warn("W30",t,{problem:`${n._mountWrites} paint(s) ran at mount; the saved file was out of sync with its declared state`,fix:"re-save once so the file mounts clean (a settled file writes nothing)"}),n}var gn=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Xt(t){return`${t.tagName.toLowerCase()}[sap]`}function kr(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(gn.test(n.name)){e++;break}for(let r of t.attributes)if(gn.test(r.name)){e++;break}return e}function wn(t){function e(b){let m=b._stats||{},d=b.root;return{root:Xt(d),fields:m.fields||0,calcs:m.calcs||0,paints:m.paints||0,actions:kr(d),lists:(d.hasAttribute("items")?1:0)+d.querySelectorAll("[items]").length,rows:d.querySelectorAll("[item]:not([template])").length,warnings:b.diag.warnings.length,errors:b.diag.errors.length,mountWrites:b._mountWrites||0,ms:Math.round((b._mountMs||0)*10)/10,passes:b._passes||0,lastPass:b._lastPass||null,ok:b.diag.errors.length===0&&!b.halted}}function r(){let b=t.apps().map(e);return{ok:b.every(m=>m.ok),apps:b}}function n(b){let m=e(b);return m.ok?`sap \u2713 ${m.root} \xB7 fields ${m.fields} \xB7 calcs ${m.calcs} \xB7 paints ${m.paints} \xB7 actions ${m.actions} \xB7 lists ${m.lists} \xB7 rows ${m.rows} \xB7 warnings ${m.warnings} \xB7 mount writes ${m.mountWrites} \xB7 ${m.ms}ms`:`sap \u2717 ${m.root} \xB7 errors ${m.errors} \xB7 warnings ${m.warnings} \xB7 ${m.ms}ms`}function o(){for(let b of t.apps()){let m=n(b);b.diag.errors.length||b.halted?console.error(m):console.log(m)}}function i(){let b=[],m=[];for(let d of t.apps())b.push(...d.diag.errors),m.push(...d.diag.warnings);return{ok:b.length===0,errors:b,warnings:m,counts:{errors:b.length,warnings:m.length}}}function s(b){let m=b===void 0?!0:!!b;for(let d of t.apps())d._debug=m;return console.log(`sap debug ${m?"on":"off"} \u2014 per-pass headers will ${m?"":"no longer "}log`),m}return{status:r,report:i,debug:s,greenLine:n,printGreenLines:o,REGISTRY:Zt}}var yn="0.7.1";function An({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],i=be(bt);function s(l){let g=l;for(;g;){if(g.nodeType===1&&g.hasAttribute&&g.hasAttribute("sap"))return n.get(g)||null;g=g.parentNode&&g.parentNode.host?g.parentNode.host:g.parentElement}return null}function b(){for(let l=o.length-1;l>=0;l--){let g=o[l];g.root.isConnected||(n.delete(g.root),o.splice(l,1))}}function m(l,g){if(l.moveBefore)try{l.moveBefore(g,null);return}catch{}l.appendChild(g)}function d(l,g){let v=g.parentElement;if(v){if(v.moveBefore)try{v.moveBefore(l,g);return}catch{}v.insertBefore(l,g)}}let u={apps:()=>o.slice(),appFor:s,isRegistered:l=>n.has(l),pruneDisconnected:b,schedule:(l,g)=>i.schedule(l,g),runNow:(l,g)=>i.runNow(l,g),moveInto:m,placeBefore:d,remountIfPresent:()=>x()},E=t(u),A=wn(u),N=r?r(u,A):{},R=!1,p=!1,y=null;function h(){R||(R=!0,e(u,E,document),y=tn(u))}function w(){let l=O("derived");l&&typeof l.mounted=="function"&&l.mounted()}function x(l=document){if(p)return[];h(),ue(u);let g=l.querySelectorAll("[sap]"),v=[];for(let T of g){if(n.has(T))continue;let f=me(T);n.set(T,f),o.push(f),v.push(f)}for(let T of v){let f=A.greenLine(T);T.diag.errors.length||T.halted?console.error(f):console.log(f)}return w(),v}function c(l){if(p)return null;if(h(),ue(u),!l)return x();let g=typeof l=="string"?document.querySelector(l):l;if(!g)return null;if(n.has(g))return n.get(g);let v=me(g);n.set(g,v),o.push(v);let T=A.greenLine(v);return v.diag.errors.length||v.halted?console.error(T):console.log(T),v}let a=E.Sap;return a.version=yn,a.refresh=function(){for(let g of o)g.root.isConnected&&i.runNow(g,"refresh")},a.batch=Ze,a.status=A.status,a.report=A.report,a.why=N.why,a.debug=A.debug,a.doctor=N.doctor,a.greenLine=A.greenLine,a.formats=dt,a.serializeControlToAttributes=mt,a.finalizeControlForSave=Xe,a.rehydrateControlFromAttributes=qt,a.mount=c,a.config=function(g={}){return g.formats&&Object.assign(dt,g.formats),a},a._registry=n,a._reset=function(){n.clear(),o.length=0,ce()},a.unmount=function(){p=!0,n.clear(),o.length=0,ce(),typeof y=="function"&&y()},{Sap:a,mountAll:x,mount:c,runtime:u}}function vn(t){if(typeof document>"u")return;let e=()=>Je(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}var $r=["for","form","list","headers","popovertarget","commandfor","anchor","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function _r(t,e){let r=null;return H(t,n=>{!r&&n.getAttribute("scope")===e&&(r=n)}),r}function En(t,e,r){let n=j(t)||e;for(;n;){for(let o of W(n.getAttribute("state")||""))if(o.name===r)return{el:n,decl:o};if(n.hasAttribute("sap"))break;n=j(n.parentElement)}return null}function Tr(t){return typeof t=="number"?"num":typeof t=="boolean"?"bool":"string"}function xn(t){function e(p){let y=t.appFor(p);if(!y)return null;let h=tt(p),w=h&&h._sapEachItem&&h._sapEachItem.$el;if(w&&w.isConnected)return{ctxEl:w,appRec:y,isRow:!0};let x=yt(p);if(x)return x._sapDetailRow?{ctxEl:x._sapDetailRow,appRec:y,isRow:!0}:{ctxEl:j(x.parentElement)||y.root,appRec:y,isRow:!1};let c=Ct(p);if(c&&c.hasAttribute("item"))return{ctxEl:c,appRec:y,isRow:!0};let a=j(p)||y.root;return{ctxEl:a,appRec:y,isRow:a.hasAttribute("item")}}function r(p){let y=typeof p=="string"?document.querySelector(p):p;if(!y||y.nodeType!==1)return null;let h=e(y);return h?R(h.ctxEl,h.appRec,h.isRow):null}function n(p,y){let h=tt(p);if(!h)return r(p);let w=t.appFor(p),x=h._sapEachItem&&h._sapEachItem.$el;if(x&&x.nodeType===1&&x.hasAttribute("item")&&lt(x,y))return x.isConnected?R(x,w,!0):null;let c=h.parentElement&&h.parentElement._sapDrawnEl;return!c||!c.isConnected?null:R(c,w,c.hasAttribute("item"))}function o(p,y,h){let w=et(p,h);if(w)return B(w).read();let x=ft(p,h);if(x)return G(x).map(g=>R(g,y,!0));let c=_r(p,h);if(c)return R(c,y,!1);let a=En(p,y.root,h);if(a)return a.decl.transient?Mt(a.el,a.decl):Ae(a.el,a.decl);let l=p._sapScope;return l?l[h]:void 0}function i(p,y,h,w,x){w.transient?Et(p,w,h):vt(p,w,h),t.schedule(x,"set:"+y)}function s(p,y){let h=new Set,w=j(p)||y;for(;w;){for(let x of W(w.getAttribute("state")||""))h.add(x.name);if(w.hasAttribute("sap"))break;w=j(w.parentElement)}return H(p,x=>{let c=x.getAttribute("bind");c&&h.add(c)}),h}function b(p,y,h,w){let x=et(p,h);if(x){if(!F(x))return;B(x).write(w);return}let c=p;for(;c;){for(let k of c.attributes)if(k.name==="calc:"+h){y.diag.error("E16",c,{attr:"calc:"+h,problem:`"${h}" is a computed field; computed fields are read-only`});return}if(c.hasAttribute("sap"))break;c=c.parentElement}let a=En(p,y.root,h);if(a){if(!F(a.el,{transient:a.decl.transient}))return;i(a.el,h,w,a.decl,y);return}let l=s(p,y.root);l.delete(h);let g=h.length>=4?wt(h,[...l]):null;if(g){y.diag.error("E12",p,{key:h,problem:`unknown state key "${h}"`,didYouMean:g});return}if(Nt.has(h)||gt.has(h)){y.diag.error("E15",p,{key:h,problem:`cannot write undeclared field "${h}" \u2014 it is a reserved/global name and cannot become state`,fix:"pick a different field name, or declare it explicitly in a state= attribute"});return}let v=y.root;if(!F(v))return;let T=Tr(w),f=v.getAttribute("state")||"",S=T==="string"?h:`${h}:${T}`;v.setAttribute("state",f?`${f} ${S}`:S),i(v,h,w,{name:h,attr:h,type:T,transient:!1},y)}function m(p){let y=p.ownerDocument,h=new Map,w=(x,c)=>{let a=we(y),l=x.getAttribute(c);l&&c==="id"&&h.set(l,a),x.setAttribute(c,a)};p.querySelectorAll("[id]").forEach(x=>w(x,"id")),p.querySelectorAll("[data-id]").forEach(x=>w(x,"data-id")),p.querySelectorAll("[sap-error]").forEach(x=>x.removeAttribute("sap-error")),p.removeAttribute("sap-error"),p.hasAttribute("data-id")?(p.removeAttribute("id"),w(p,"data-id")):w(p,"id");for(let x of[p,...p.querySelectorAll("*")])for(let c of $r){let a=x.getAttribute(c);if(a==null)continue;let l=a.split(/\s+/).map(g=>h.get(g)||g).join(" ");l!==a&&x.setAttribute(c,l)}}function d(p,y,h){let w=xt(y.root,p,h);if(!w)return y.diag.error("E17",p,{problem:`cannot resolve a list named "${h}" from here`}),null;if(!F(w))return null;let x=Ft(w);if(!x)return y.diag.error("E17",w,{problem:`items="${h}" has no [item template] to clone`}),null;let c=w.ownerDocument.importNode(x,!0);return c.removeAttribute("template"),m(c),w.appendChild(c),t.schedule(y,"trigger-add:"+h),R(c,y,!0)}function u(p,y){let h=W(p.getAttribute("state")||""),w=!0;H(p,x=>{x.hasAttribute("bind")&&!F(x)&&(w=!1)});for(let x of h)F(p,{transient:x.transient})||(w=!1);if(w){H(p,x=>{if(x.hasAttribute("bind")){let c=B(x),a=x.getAttribute("default");c.kind==="checkbox"||c.kind==="radio"?c.write(a!=null?a===""||a==="true"||x.value===a:x.hasAttribute("checked")):c.write(a??(x.getAttribute("value")||""))}});for(let x of h){let c=ve(p,x);x.transient?Et(p,x,c):vt(p,x,c)}t.schedule(y,"trigger-reset")}}function E(p,y){if(!p.isConnected)throw new Error("stale row handle: $remove() on a removed row");F(p)&&(p.remove(),t.schedule(y,"trigger-remove"))}function A(p,y,h){if(!p.isConnected)throw new Error("stale row handle: $move() on a removed row");let w=null;if(h&&h.nodeType===1?w=h:typeof h=="string"&&(w=xt(y.root,p,h)),!w){y.diag.error("E17",p,{problem:`$move() cannot resolve target "${h}"`});return}!F(p)||!F(w)||(t.moveInto(w,p),t.schedule(y,"trigger-move"))}function N(p){let y=p.parentElement;return y?G(y).indexOf(p):-1}function R(p,y,h){let w={get $el(){return p},get $key(){return Lt(p,h?"row":"scope")},get $index(){return N(p)},$add(c){return d(p,y,c)},$reset(){return u(p,y),x},$remove(){E(p,y)},$move(c){A(p,y,c)},get $appRec(){return y}},x=new Proxy(w,{get(c,a){return typeof a=="symbol"||a[0]==="$"?c[a]:o(p,y,a)},set(c,a,l){return typeof a=="string"&&a[0]==="$"?(c[a]=l,!0):(b(p,y,a,l),!0)},has(c,a){return typeof a=="string"&&a[0]==="$"?a in c:o(p,y,a)!==void 0}});return x}return{Sap:r,contextElFor:e,readField:o,writeField:b,makeProxy:R,writeTargetFor:n}}var Nr=["trigger-add","trigger-remove","trigger-reset"];function Rr(t){if(t.nodeType!==1)return!1;for(let e of t.attributes){let r=e.name;if(r.startsWith("set:")||r.startsWith("move:")||r.startsWith("sort:")||Nr.includes(r))return!0}return!1}function Lr(t,e){let r=t,n=e.parentElement;for(;r&&r!==n;){if(r.nodeType===1&&Rr(r)&&!(r.tagName==="FORM"&&r.hasAttribute("trigger-add")))return r;r=r.parentElement}return null}function Sn(t,e){let{Sap:r}=e;function n(c,a){let l=null,g=tt(c),v=yt(c);if(g)l=g._sapEachItem??null;else if(v&&v._sapDetailRow)l=v._sapDetailRow._sapScope||null;else{let S=Ct(c);S&&S.hasAttribute("item")&&(l=S._sapScope||null)}return{state:(j(c)||a.root)._sapScope||a._state||{},item:l,el:c,root:a._state||{}}}function o(c,a,l){if(!c.hasAttribute("confirm")){l();return}let g=c.getAttribute("confirm"),v=g,T=P(g);if(!T.error)try{let _=nt(T,n(c,a));(typeof _=="string"||typeof _=="number")&&(v=String(_))}catch{}let f=$t(),S=()=>{$t()===f&&l()},k=Qe();if(!k){window.confirm(v)&&S();return}if(c._sapGatePending)return;c._sapGatePending=!0;let $=()=>{c._sapGatePending=!1};k(v,()=>{$(),S()}).catch($)}function i(c,a){for(let l of c.attributes){if(!l.name.startsWith("set:"))continue;let g=l.name.slice(4),v=P(l.value);if(v.error){a.diag.error("E08",c,{attr:l.name,expr:l.value,problem:String(v.error.message)});continue}let T;try{T=nt(v,n(c,a))}catch(S){a.diag.error("E24",c,{attr:l.name,expr:l.value,problem:String(S.message)});continue}let f=e.writeTargetFor(c,g);f&&(f[g]=T)}}function s(c){let a=tt(c);if(!a)return c.closest("[item]");let l=a._sapEachItem&&a._sapEachItem.$el;return l&&l.nodeType===1&&l.hasAttribute("item")?l:null}function b(c,a){let l=s(c);if(!l||!F(l)||!F(l.parentElement))return;let g=G(l.parentElement),v=g.indexOf(l);a==="up"&&v>0?t.placeBefore(l,g[v-1]):a==="down"&&v<g.length-1&&t.placeBefore(g[v+1],l)}function m(c,a,l){if(a)return xt(l.root,c,a);let g=c;for(;g;){if(g.hasAttribute&&g.hasAttribute("items"))return g;g=g.parentElement}let v=j(c)||l.root,T=[];return H(v,f=>{f.hasAttribute("items")&&T.push(f)}),T[0]||null}function d(c,a){let l=c==null||c==="",g=a==null||a==="";if(l&&g)return 0;if(l)return 1;if(g)return-1;let v=Number(c),T=Number(a);return!Number.isNaN(v)&&!Number.isNaN(T)?v-T:String(c)<String(a)?-1:String(c)>String(a)?1:0}function u(c,a,l,g){let v=m(c,l,g);if(!v){g.diag.error("E17",c,{attr:"sort:"+a,problem:`no items list resolvable for sort:${a}`});return}if(!F(v))return;let T=G(v),f=_=>_._sapScope?_._sapScope[a]:void 0,S=[...T].sort((_,L)=>d(f(_),f(L))),$=S.every((_,L)=>_===T[L])?[...S].reverse():S;for(let _ of $)t.moveInto(v,_);t.schedule(g,"sort:"+a)}function E(c){if(!c||c.hidden)return;let a=c.querySelector("[bind]:not([type=hidden]), [contenteditable]");a&&typeof a.focus=="function"&&a.focus()}function A(c,a){o(c,a,()=>{let l=r(c);for(let g of[...c.attributes]){let v=g.name;if(v==="trigger-remove")l&&l.$remove();else if(v==="trigger-reset")l&&l.$reset();else if(v==="trigger-add"){let T=l&&l.$add(g.value);T&&E(T.$el)}else v==="move:up"?(b(c,"up"),t.schedule(a,"move:up")):v==="move:down"?(b(c,"down"),t.schedule(a,"move:down")):v.startsWith("move:to")?l&&l.$move(g.value):v.startsWith("sort:")&&u(c,v.slice(5),g.value,a)}[...c.attributes].some(g=>g.name.startsWith("set:"))&&i(c,a)})}function N(c){let a=c.target;if(!a||a.nodeType!==1)return;let l=t.appFor(a);if(!l)return;let g=Lr(a,l.root);g&&A(g,l)}function R(c){let a=B(c),l=c.getAttribute("default");a.kind==="checkbox"?a.write(l===""||l==="true"):a.write(l??"")}function p(c,a,l){let g=r(c);if(!g)return;let v=g.$add(l);if(!v)return;let T=[];H(c,f=>{f.hasAttribute("bind")&&T.push(f)});for(let f of T){if(f.type==="radio"&&!f.checked)continue;let S=f.getAttribute("bind"),k=et(v.$el,S);k?B(k).write(B(f).read()):lt(v.$el,S)&&(v[S]=B(f).read())}T.forEach(R),T.length?typeof T[0].focus=="function"&&T[0].focus():E(v.$el)}function y(c){let a=c.target;if(!a||!a.hasAttribute||!a.hasAttribute("trigger-add"))return;let l=t.appFor(a);l&&(c.preventDefault(),o(a,l,()=>p(a,l,a.getAttribute("trigger-add"))))}function h(c){let a=c.target;if(!a||a.tagName!=="DIALOG"||!a.hasAttribute("detail"))return;if(a._sapEngineClose){a._sapEngineClose=!1;return}if(a.open)return;let l=/^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(a.getAttribute("detail")||""),g=t.appFor(a);if(!l||!g)return;let v=W(a.getAttribute("state")||"").find(f=>f.name===l[1]);if(v){if(!F(a,{transient:v.transient}))return;v.transient?Et(a,v,""):vt(a,v,""),t.schedule(g,"close");return}let T=r(a.parentElement);T&&T[l[1]]!==""&&(T[l[1]]="")}function w(c,a){let l=c.hasAttribute("bind")&&Dt(c);if(!l&&c.hasAttribute("bind")&&tt(c)){let v=c.getAttribute("bind"),T=c._sapViewBind?e.writeTargetFor(c,v):null;return T&&(T[v]=B(c).read()),!0}let g=yt(c);if(g&&g._sapDetailRow&&c.hasAttribute("bind")&&!l){let v=g._sapDetailRow,T=c.getAttribute("bind"),f=et(v,T);if(f&&f!==c)return F(f)&&B(f).write(B(c).read()),!0;if(!f&&W(v.getAttribute("state")||"").some(S=>S.name===T))return e.writeField(v,a,T,B(c).read()),!0}return!1}function x(c=document){c.addEventListener("click",N),c.addEventListener("submit",y),c.addEventListener("close",h,!0)}return{install:x,routeInput:w}}function kn(t){let e=[];function r(m){let d=m.target;if(!d||d.nodeType!==1)return;let u=t.appFor(d);if(u){d.hasAttribute("persist")&&!zt(d)&&F(d)&&mt(d);for(let E of e)if(E(d,u))return;t.schedule(u,m.type+" "+(d.id||d.tagName.toLowerCase()))}}function n(m){let d=m.target,u=t.appFor(d);u&&[...d.querySelectorAll("[bind]")].every(E=>F(E))&&setTimeout(()=>{d.querySelectorAll("[bind]").forEach(E=>{E.dispatchEvent(new Event("input",{bubbles:!0})),E.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(u,"reset")},0)}function o(m){let d=t.appFor(m.target);d&&t.schedule(d,"toggle")}function i(m){let d=m.detail||{};for(let u of[d.from,d.to,m.target]){if(!u||u.nodeType!==1)continue;let E=t.appFor(u);E&&t.schedule(E,"sorted")}}function s(m){if(m.key!=="ArrowUp"&&m.key!=="ArrowDown")return;let d=m.target;if(!d||d.nodeType!==1||d.tagName!=="INPUT"||!d.hasAttribute("bind")||!d.hasAttribute("step"))return;let u=(d.getAttribute("type")||"text").toLowerCase();if(u!=="text"&&u!=="tel"&&u!=="search"||!t.appFor(d)||!F(d))return;m.preventDefault();let A=q(d.getAttribute("step"))||1,N=m.key==="ArrowUp"?1:-1,R=q(d.value)+A*(m.shiftKey?10:1)*N,p=d.getAttribute("min"),y=d.getAttribute("max");p!==null&&p!==""&&R<q(p)&&(R=q(p)),y!==null&&y!==""&&R>q(y)&&(R=q(y)),B(d).write(String(Number(R.toFixed(2))))}function b(m=document){m.addEventListener("reset",n),m.addEventListener("toggle",o,!0),m.addEventListener("input",r),m.addEventListener("change",r),m.addEventListener("clay:sorted",i),m.addEventListener("keydown",s)}return{install:b,addRouter:m=>e.push(m)}}function $n(t){let e=t.toLowerCase();return/^x-text$|^x-html$/.test(e)?'use text="state.x" (Sap paints text only)':/^x-show$|^v-show$|^v-if$/.test(e)?'use show="expr" (toggles native hidden)':/^x-model$|^v-model$/.test(e)?'use bind="field"':/^@|^x-on:|^v-on:|^on:/.test(e)?"use native onclick + Sap(this) (no event directive)":/^:|^x-bind:class$|^v-bind:class$/.test(e)?'use class:NAME="expr" or attr:NAME="expr"':/^x-for$|^v-for$/.test(e)?'use items="name" on the container and item template on the row':/^x-data$/.test(e)?"declare state with state= / bind / items (no JS state object)":/^x-init$/.test(e)?"use a <script> or onclick + Sap(this)":/^bind:/.test(e)?'use bind="field"; one-way paint is attr:NAME="expr"':/^x-/.test(e)||/^v-/.test(e)?"this is a foreign-dialect attribute; Sap has no x-/v- attributes":null}function _n(t){let e=[],r=n=>{for(let o of n.attributes){let i=o.name;(i.startsWith("calc:")||i==="text"||i.startsWith("text:")||i==="show"||i.startsWith("attr:")||i.startsWith("class:")||i.startsWith("css:")||i==="effect"||i==="invalid"||i.startsWith("set:")||i==="detail")&&e.push({el:n,attr:i,src:o.value})}};r(t);for(let n of t.querySelectorAll("*"))r(n);return e}function Tn(t){function e(o){return o?typeof o=="string"?document.querySelector(o):o.nodeType===1?o:null:null}function r(o,i){let s=e(o);if(!s)return console.warn("sap why: element not found"),null;let b=[`sap why <${s.tagName.toLowerCase()}> \u2014 ${Rt(s)}`],m=[...s.attributes].filter(u=>/^(bind|text|show|effect|invalid|detail|calc:|text:|attr:|class:|css:|set:|state|items|scope)/.test(u.name));for(let u of m)b.push(` ${u.name}="${u.value}"`);let d=s;for(;d&&!d._sapScope;)d=d.parentElement;if(d&&d._sapScope){let u=d._sapScope,E=i?[i]:Object.keys(u);b.push(" reads:");for(let A of E){let N=u[A];typeof N!="function"&&b.push(` ${A} = ${JSON.stringify(Array.isArray(N)?`[${N.length} rows]`:N)}`)}}return b.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"),console.log(b.join(`
9
+ `+e.value:e.value;t.textContent!==n&&(t.textContent=n),t.removeAttribute("data-value");return}if(r==="SELECT"){let n=t.options,o=e.options;for(let i=0;i<n.length;i++)o[i]&&o[i].selected?n[i].hasAttribute("selected")||n[i].setAttribute("selected",""):n[i].removeAttribute("selected")}}function qt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function O(t){if(typeof window>"u")return null;let e=window.clay,r=window.hyperclay;return t==="consent"?e?.confirm||r?.consent||null:e?.[t]||r?.[t]||null}function Ke(){let t=O("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var ie=["clay:mutation-ready","hyperclay:mutation-ready"],ir=["clay:sync-applied","hyperclay:livesync-applied"],sr=["clay:ready","hyperclay:ready"],ar=["clay:route"],ur=["clay:modechange"];function kt(t,e,r){let n=null,o=i=>{n!==null&&n!==i.type||(n=i.type,queueMicrotask(()=>{n=null}),r(i))};for(let i of e)t.addEventListener(i,o);return()=>{for(let i of e)t.removeEventListener(i,o)}}function Je(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function zt(t){let e=O("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function $t(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function F(t,{transient:e=!1}={}){if(e)return!0;let r=$t();return typeof r?.canWrite!="function"||O("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Qe(){let t=O("consent");return typeof t=="function"?t:null}function Ze(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=O("undo");r&&r.flush&&r.flush();let n=e();if(n&&typeof n.then=="function")throw new Error("Sap.batch fn must be synchronous (it returned a promise)");return r&&r.commitCaptured&&r.commitCaptured(t),n}function tn(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let A=!1;for(let N of t.apps())N.root.isConnected?t.runNow(N,"platform"):A=!0;A&&t.pruneDisconnected(),t.remountIfPresent()},r=O("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:kt(document,ir,e),i=kt(document,ar,e),s=null,b=!1,m=()=>{let A=s;s=null,A&&(A[2](),A[3]())},d=()=>{if(b)return!1;let A=O("undo"),N=$t()?.state?.generation;if(s&&s[0]===A&&s[1]===N)return!0;if(m(),!A||typeof A.on!="function")return!1;let R=A.on("undo",e);if(typeof R!="function")return!1;let p=A.on("redo",e);return typeof p!="function"?(R(),!1):(s=[A,N,R,p],!0)};d();let u=[ie,sr,ur].map(A=>kt(document,A,d)),E=O("ready");return E&&typeof E.then=="function"&&E.then(d,()=>{}),()=>{b=!0,typeof n=="function"&&n(),o&&o(),i();for(let A of u)A();m()}}function _t(t){let e=t.tagName;if(e==="INPUT"){let r=(t.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return e==="TEXTAREA"?"text":e==="SELECT"?t.multiple?"select-multiple":"select-one":"leaf"}function cr(t){if(t.validity&&t.validity.badInput)return t.hasAttribute("value")?Number(t.getAttribute("value"))||0:t._sapLastGood??0;if(t.value==="")return 0;let e=Number(t.value);return Number.isNaN(e)?t._sapLastGood??0:(t._sapLastGood=e,e)}function en(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return cr(t);case"select-one":return t.value;case"select-multiple":return[...t.selectedOptions].map(r=>r.value);case"hidden":case"text":return t.value;case"leaf":return t.textContent;default:return t.value}}function nn(t,e,r){switch(e){case"checkbox":t.checked=!!r;break;case"radio":t.checked=String(t.value)===String(r);break;case"number":case"text":case"hidden":t.value=r==null?"":String(r);break;case"select-one":t.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of t.options)o.selected=n.has(o.value);break}case"leaf":t.textContent=r==null?"":String(r);break;default:t.value=r==null?"":String(r)}}function se(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}zt(t)||mt(t)}function fr(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Ht(t,e){return en(t,e)}function rn(t,e,r){nn(t,e,r),se(t)}function B(t){let e=_t(t);return{el:t,kind:e,read(){return en(t,e)},write(r,n={}){nn(t,e,r),n.noMirror||se(t),n.silent||fr(t)},mirror(){se(t)}}}var J=null,Ut=!1,ht=null;function on(t){let e=null;return{kind:"hub",subscribe(r){let n=t.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(e=n)},suppress(r){t.pause();try{return r()}finally{t.resume()}},teardown(){if(e){try{e()}catch{}e=null}}}}function lr(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(dr(n)));let r=typeof document<"u"&&document.body||typeof document<"u"&&document.documentElement;r&&t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(e){let r=O("undo");r&&r.pause&&r.pause();try{return e()}finally{t&&t.takeRecords(),r&&r.resume&&r.resume()}},teardown(){t&&(t.disconnect(),t=null)}}}function dr(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!Vt(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!Vt(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||Vt(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))Vt(o)||e.push({type:"add",element:o});for(let n of r.removedNodes)n.nodeType===1&&e.push({type:"remove",element:n,parent:r.target})}return e}function Vt(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function pr(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let i=o.type==="remove"?o.parent:o.element,s=i&&t.appFor(i);s&&r.add(s),o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(t.isRegistered&&t.isRegistered(o.element))&&(n=!0)}n&&t.remountIfPresent();for(let o of r)o.root.isConnected&&t.schedule(o,"mutation")}function sn(t){if(J)return J.suppress(t);let e=O("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function ae(t,e){Ut=!0,J=t,t.subscribe(r=>pr(e,r))}function ue(t){if(Ut||typeof window>"u"||typeof document>"u")return;let e=O("Mutation");if(e&&typeof e.onAnyChange=="function"){ae(on(e),t);return}typeof MutationObserver=="function"&&(ae(lr(),t),ht=kt(document,ie,function(){let n=O("Mutation");n&&(ht(),ht=null,J&&J.teardown(),Ut=!1,ae(on(n),t))}))}function ce(){if(J)try{J.teardown()}catch{}ht&&typeof document<"u"&&ht(),J=null,Ut=!1,ht=null}var mr=new Set(ut),Gt=Object.freeze([]),Q=[],un={},cn={};function fn(t){Q.includes(t)||(Q.push(t),t.boundary&&Object.assign(un,t.boundary),t.paintKinds&&Object.assign(cn,t.paintKinds))}function bt(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),V(t.root,"loop");return}e.full&&(Fe(),We());let r=Me(t.root);try{sn(()=>hr(t,e))}finally{Oe(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function hr(t,e){let r=t.root,n={},o=[],i=[],s=new Set;t.diag.errors=[];let b={root:n,state:n,item:null,ownerEl:r,projection:!1},m=null;function d(f,S,k=!1){let $=S.attr||S.name,_=k?Ue(f,$):f.getAttribute($);return _==null&&(_=At(S),i.push({el:f,name:S.name,attr:$,value:ee(Z(_,S.type),S.type)})),Z(_,S.type)}function u(f,S,k,$){let _=S.decls;if(!_)return;let L=!!$.item&&!$.projection&&!$.view;for(let D of _){if(D.transient){m&&(m.pure=!1),k[D.name]=Mt(f,D);continue}if(Y(f,D)){k[D.name]=f.hasAttribute(D.attr);continue}k[D.name]=d(f,D,L)}}function E(f,S,k){let $=S.bind,_=k.item||k.state,L=_t(f);m&&(L!=="leaf"||S.transient)&&(m.pure=!1),L==="radio"?($ in _||(_[$]=""),f.checked&&(_[$]=f.value)):L==="leaf"&&k.item&&!k.projection&&!k.view?_[$]=Ge(f):_[$]=Ht(f,L),S.transient&&(f.removeAttribute("value"),f.removeAttribute("checked"))}function A(f,S,k){let $=!1;if(S.paints){$=!0;for(let _ of S.paints)_.kind==="when"&&s.add(_.field),o.push({def:_,el:f,ctx:k})}for(let _ of Q)_.collect&&_.collect(a,f,S,k)!==!1&&($=!0);m&&$&&(S.calcs&&(m.pure=!1),m.collects.push(f,S))}function N(f,S,k){Object.defineProperty(f,"$key",{value:Lt(S,"row"),enumerable:!1}),Object.defineProperty(f,"$index",{value:k,enumerable:!1,configurable:!0}),Object.defineProperty(f,"$el",{value:S,enumerable:!1})}function R(f,S,k){let $=X(f);u(f,$,S,k),f._sapScope=S,!k.projection&&$.bind!=null&&E(f,$,k),A(f,$,k),$.items?w(f,S,k):p(f,S,k)}function p(f,S,k){for(let $=f.firstElementChild;$;$=$.nextElementSibling)y($,S,k)}function y(f,S,k){let $=X(f);if(!$.inert){if($.boundary){m&&(m.pure=!1),$.boundary==="scope"?h(f,S,k):$.boundary==="items"?(A(f,$,k),w(f,S,k)):un[$.boundary](a,f,$,S,k);return}!k.projection&&!k.view&&$.bind!=null&&E(f,$,k),A(f,$,k);for(let _=f.firstElementChild;_;_=_.nextElementSibling)y(_,S,k)}}function h(f,S,k){let $=f.getAttribute("scope"),_={};S[$]=_;let L={root:k.root,state:_,item:null,ownerEl:f,projection:k.projection};R(f,_,L)}function w(f,S,k){m&&(m.pure=!1);let $=f.getAttribute("items"),_=[];S[$]=_,f._sapList=_;let L=!k.projection&&!k.view&&Be(),D=0;for(let M=f.firstElementChild;M;M=M.nextElementSibling){let C=X(M);if(!C.item||C.template||C.cms)continue;let I=L?je(M):void 0;_.push(I&&I.plan===C&&Object.isExtensible(I.obj)&&c(I,M,D,k)||x(M,C,D,k,L)),D++}}function x(f,S,k,$,_){let L={};N(L,f,k);let D={root:$.root,state:$.state,item:L,ownerEl:f,projection:$.projection};if(!_)return R(f,L,D),L;let M=m,C={plan:S,obj:L,fields:null,presence:Gt,pending:Gt,collects:[],pure:!0},I=i.length,Wn=t.diag.errors.length;m=C;try{R(f,L,D)}finally{m=M}if(!C.pure||t.halted||t.diag.errors.length!==Wn)return L;let he=[];for(let st of Object.keys(L)){let Jt=L[st];if(Jt!==null&&typeof Jt=="object")return L;he.push(st,Jt)}if(S.decls)for(let st of S.decls)Y(f,st)&&(C.presence===Gt?C.presence=[]:C.presence).push(st.name,st.attr);return i.length>I&&(C.pending=i.slice(I)),C.collects.length||(C.collects=Gt),C.fields=he,qe(f,C),L}function c(f,S,k,$){let _=f.obj;try{_.$index!==k&&Object.defineProperty(_,"$index",{value:k,enumerable:!1,configurable:!0});let M=f.presence;for(let I=0;I<M.length;I+=2)_[M[I]]=S.hasAttribute(M[I+1]);let C=f.fields;for(let I=0;I<C.length;I+=2)_[C[I]]=C[I+1]}catch{return jt(S),null}S._sapScope=_;let L=f.pending;for(let M=0;M<L.length;M++)i.push(L[M]);let D=f.collects;if(D.length){let M={root:$.root,state:$.state,item:_,ownerEl:S,projection:$.projection};for(let C=0;C<D.length;C+=2)A(D[C],D[C+1],M)}return _}let a={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:d,collectEl:A,walkScope:p};for(let f of Q)f.begin&&f.begin(a);let l=e.cacheReads===!1?null:ze(r);try{R(r,n,b)}finally{e.cacheReads!==!1&&He(l)}if(t.halted)return;for(let f of Q)f.afterIntake&&f.afterIntake(a);if(i.length&&s.size)for(let f of i)s.has(f.attr)&&f.el.getAttribute(f.attr)==null&&f.el.setAttribute(f.attr,f.value);for(let f of Q)f.compute&&f.compute(a);let g=0;for(let f of Q)f.reconcile&&(g+=f.reconcile(a));let v=0,T=g;for(let f of o){let S=gr(f,t);f.ctx.view?T+=S:v+=S}for(let f of Q)f.afterPaint&&f.afterPaint(a);t._state=n,t._stats={fields:Object.keys(n).filter(f=>typeof n[f]!="function").length,calcs:a.stats.calcs,paints:o.length,lists:a.stats.lists,writes:v,viewWrites:T},t._viewsChanged=T>0,t._lastPass={trigger:e.trigger||"refresh",writes:v},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${v}/${o.length}`)}function br(t){return t.kind==="text"?t.fmt?"text:"+t.fmt:"text":t.kind==="attr"?"attr:"+t.arg:t.kind==="class"?"class:"+t.arg:t.kind==="css"?"css:"+t.arg:t.kind==="when"?(t.match==="hide"?"hide-when:":t.match==="show-not"?"option-not:":"show-when:")+t.field:t.kind}function fe(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let i=r.includes(o.getAttribute(e));if(n?!i:i)return!0}o=o.parentElement}return!1}function gr(t,e){let r=t.def,n=t.el,o=cn[r.kind];if(o)return o(t,e);if(r.kind==="when")return an(r,n,null);try{let i=z(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),s=an(r,n,i);return ct(n),s}catch(i){return e.diag.error(i.sapCode==="E22"?"E22":"E24",n,{attr:br(r),expr:r.entry&&r.entry.src,problem:String(i.message)}),V(n,i.sapCode||"E24"),0}}function an(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?Te(t.fmt,r):r==null?"":String(r);return e.textContent!==n?(e.textContent=n,1):0}case"show":{let n=!r;return e.hidden!==n?(e.hidden=n,1):0}case"when":{let n=O("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!fe(e,t.field,t.values,!1):t.match==="show-not"?o=fe(e,t.field,t.values,!0):o=fe(e,t.field,t.values,!1),e._sapWhen=!0;let i=!o;return e.hidden!==i?(e.hidden=i,1):0}case"attr":{let n=t.arg;if((n==="checked"||n==="selected")&&typeof e[n]=="boolean"&&!e.hasAttribute("bind")&&!e.closest("select[bind]")){let i=0;return e[n]!==!!r&&(e[n]=!!r,i=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),i=1),i}if(mr.has(n)){let i=e.hasAttribute(n);return r&&!i?(e.setAttribute(n,""),1):!r&&i?(e.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return e.getAttribute(n)!==o?(e.setAttribute(n,o),1):0}case"class":{let n=!!r;return e.classList.contains(t.arg)!==n?(e.classList.toggle(t.arg,n),1):0}case"css":{let n=r==null?"":String(r);return e.style.getPropertyValue("--"+t.arg)!==n?(e.style.setProperty("--"+t.arg,n),1):0}default:return 0}}var wr=new Set(ut),ln=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),yr=new Set(["show-when","hide-when","option","option-not"]),Ar=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,dn=new Set(["sap","scope","items","item","template","bind","show","effect","invalid","detail","state","transient","confirm","default","persist","sortable","trigger-add","trigger-remove","trigger-reset","sap-ignore","sap-error","no-save","no-watch","no-undo","no-trigger-autosave","freeze","mutations-ignore","save-remove","save-ignore","save-freeze"]),de=[];function pn(t){de.includes(t)||de.push(t)}function vr(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function le(t){return t.hasAttribute("bind")}function Er(t,e){e(t);for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(!n.hasAttribute("sap-ignore")){if(n.tagName==="TEMPLATE"){if(n.hasAttribute("items"))for(let o=n.content.firstElementChild;o;o=o.nextElementSibling)r(o);return}e(n);for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function Yt(t,e){let r=!1,n=(s,b,m)=>{e.error(s,b,m),r=!0},o=t.ownerDocument.createTreeWalker(t,4),i;for(;i=o.nextNode();)if(/\{\{.*\}\}/.test(i.nodeValue||"")){n("E02",i.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Er(t,s=>{let b=new Set;for(let d of de)d(s,n,u=>b.add(u));let m=s.closest&&s.closest("[detail]");for(let d of[...s.attributes]){let u=d.name;if(b.has(u))continue;if(u.includes(":")){let A=u.slice(0,u.indexOf(":"));if(ln.has(A)){if(yr.has(A)&&Ar.test(d.value)){let N=u.slice(u.indexOf(":")+1);e.warn("W04",s,{attr:u,expr:d.value,problem:`${A}: compares the "${N}" attribute against a literal value, not a JS expression`,fix:`use show="${d.value}" for an expression, or a literal like ${A}:${N}="overview"`})}}else{let N=wt(A,[...ln]);e.warn("W03",s,{attr:u,problem:`unknown "${A}:" attribute`,didYouMean:N?`${N}:`:null})}}else if(!dn.has(u)&&!gt.has(u)&&!wr.has(u)&&!/^(data-|aria-|on)/.test(u)&&!(u in s)){let A=wt(u,[...dn]);A&&e.warn("W03",s,{attr:u,problem:`unknown "${u}" attribute`,didYouMean:A})}u==="attr:hidden"&&e.warn("W03",s,{attr:u,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let E=le(s)||u==="attr:selected"&&s.tagName==="OPTION"&&!!s.closest("select[bind]");(u==="attr:value"||u==="attr:checked"||u==="attr:selected")&&E&&n("E30",s,{attr:u,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),u==="effect"&&le(s)&&/\b(value|checked)\s*=[^=]/.test(d.value)&&n("E30",s,{attr:u,expr:d.value,problem:"effect writes value/checked on a bound control (writes a stale value with no synthetic event)",fix:"write through onclick + Sap(this) instead"}),(u==="text"||u.startsWith("text:")||u==="show")&&vr(s)&&(u==="show"||n("E18",s,{attr:u,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(s.hasAttribute("state")){let d=W(s.getAttribute("state")),u=new Set;for(let E of d){E.name.includes("-")&&n("E08",s,{attr:"state",problem:`field "${E.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${E.name.replace(/-/g,"")}`}),u.has(E.name)&&n("E04",s,{attr:"state",problem:`field "${E.name}" is declared twice in one scope`}),u.add(E.name),Nt.has(E.attr)&&n("E05",s,{attr:"state",problem:`"${E.name}" is a reserved Sap word`}),gt.has(E.attr)&&n("E06",s,{attr:"state",problem:`"${E.name}" is a global HTML attribute name; pick another field name`}),E.name==="open"&&s.tagName==="DIALOG"&&n("E33",s,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let A=ne(s,E.attr);A&&(E.attr==="checked"||E.attr==="selected")&&n("E35",s,{attr:"state",problem:`"${E.attr}" on a form control is the control's own state, not a declared field`,fix:'bind the control instead, e.g. <input type="checkbox" bind="done">'}),A&&E.type==="num"&&n("E35",s,{attr:"state",problem:`"${E.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${E.attr}"`}),E.transient&&(A||E.type==="presence")&&n("E35",s,{attr:"state",problem:`"${E.name}" is carried by attribute presence, which transient would strip`,fix:"declare a separate name:bool:transient field and paint the attribute from it"})}}if(le(s)){if(s.hasAttribute("-"),s.tagName==="INPUT"){let d=(s.getAttribute("type")||"text").toLowerCase();d==="file"&&n("E32",s,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),d==="password"&&!s.hasAttribute("transient")&&n("E31",s,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(s.tagName!=="SELECT"&&s.tagName!=="TEXTAREA"){let d=s.getAttribute("contenteditable");!(d!=null&&d!=="false")&&s.children.length>0&&n("E20",s,{attr:"bind",problem:"bind on a container element is not a control; a write would overwrite its children",fix:"bind a control (input/select/textarea), a contenteditable, or an empty text leaf"})}}if(s.hasAttribute("transient")&&s.hasAttribute("persist")&&n("E34",s,{problem:"transient and persist are opposite: persist forces the live value into the saved bytes, leaking exactly what transient drops",fix:"remove one \u2014 transient to keep it out of the file, or persist to save it"}),s.tagName==="DIALOG"&&s.hasAttribute("detail")&&!(s.parentElement&&s.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",s,{attr:"detail",problem:"a detail dialog writes open when it opens, and that attribute would be saved into the file",fix:'wrap the dialog in an element with clay="freeze" (not editor-ui, which removes it from the file), and make its key field transient'}),s.hasAttribute("item")&&!s.hasAttribute("template")&&s.parentNode&&s.parentNode.nodeType===1){let d=s.parentElement;(!d||!d.hasAttribute("items"))&&n("E10",s,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(s.hasAttribute("items")&&m&&n("E17",s,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),s.hasAttribute("items")){let d=t.querySelector(`[trigger-add="${s.getAttribute("items")}"]`);!Ft(s)&&!te(t,s.getAttribute("items"))&&G(s).length===0&&d&&n("E17",s,{attr:"items",problem:`trigger-add targets items="${s.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(e.halted=!0,e.haltReason=e.errors[0]?e.errors[0].code:"halt",V(t,e.haltReason)),!r}var mn="sap-styles",hn="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",pe=new WeakSet;function xr(t){if(pe.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(hn),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],pe.add(t);return}catch{}if(!t.getElementById(mn)){let n=t.createElement("style");n.id=mn,n.textContent=hn,(t.head||t.documentElement).appendChild(n)}pe.add(t)}var Sr=0;function bn(){return typeof performance<"u"&&performance.now?performance.now():0}function me(t){let e=t.id||t.getAttribute("sap")||`app-${Sr++}`,r=new at(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Yt(t,r))return n.halted=!0,n;xr(t.ownerDocument);for(let s of t.querySelectorAll("textarea[data-value]"))qt(s);let i=bn();return bt(n,{trigger:"mount",full:!0}),n._mountMs=bn()-i,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ke()&&!O("derived")&&r.warn("W30",t,{problem:`${n._mountWrites} paint(s) ran at mount; the saved file was out of sync with its declared state`,fix:"re-save once so the file mounts clean (a settled file writes nothing)"}),n}var gn=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Xt(t){return`${t.tagName.toLowerCase()}[sap]`}function kr(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(gn.test(n.name)){e++;break}for(let r of t.attributes)if(gn.test(r.name)){e++;break}return e}function wn(t){function e(b){let m=b._stats||{},d=b.root;return{root:Xt(d),fields:m.fields||0,calcs:m.calcs||0,paints:m.paints||0,actions:kr(d),lists:(d.hasAttribute("items")?1:0)+d.querySelectorAll("[items]").length,rows:d.querySelectorAll("[item]:not([template])").length,warnings:b.diag.warnings.length,errors:b.diag.errors.length,mountWrites:b._mountWrites||0,ms:Math.round((b._mountMs||0)*10)/10,passes:b._passes||0,lastPass:b._lastPass||null,ok:b.diag.errors.length===0&&!b.halted}}function r(){let b=t.apps().map(e);return{ok:b.every(m=>m.ok),apps:b}}function n(b){let m=e(b);return m.ok?`sap \u2713 ${m.root} \xB7 fields ${m.fields} \xB7 calcs ${m.calcs} \xB7 paints ${m.paints} \xB7 actions ${m.actions} \xB7 lists ${m.lists} \xB7 rows ${m.rows} \xB7 warnings ${m.warnings} \xB7 mount writes ${m.mountWrites} \xB7 ${m.ms}ms`:`sap \u2717 ${m.root} \xB7 errors ${m.errors} \xB7 warnings ${m.warnings} \xB7 ${m.ms}ms`}function o(){for(let b of t.apps()){let m=n(b);b.diag.errors.length||b.halted?console.error(m):console.log(m)}}function i(){let b=[],m=[];for(let d of t.apps())b.push(...d.diag.errors),m.push(...d.diag.warnings);return{ok:b.length===0,errors:b,warnings:m,counts:{errors:b.length,warnings:m.length}}}function s(b){let m=b===void 0?!0:!!b;for(let d of t.apps())d._debug=m;return console.log(`sap debug ${m?"on":"off"} \u2014 per-pass headers will ${m?"":"no longer "}log`),m}return{status:r,report:i,debug:s,greenLine:n,printGreenLines:o,REGISTRY:Zt}}var yn="0.8.0";function An({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],i=be(bt);function s(l){let g=l;for(;g;){if(g.nodeType===1&&g.hasAttribute&&g.hasAttribute("sap"))return n.get(g)||null;g=g.parentNode&&g.parentNode.host?g.parentNode.host:g.parentElement}return null}function b(){for(let l=o.length-1;l>=0;l--){let g=o[l];g.root.isConnected||(n.delete(g.root),o.splice(l,1))}}function m(l,g){if(l.moveBefore)try{l.moveBefore(g,null);return}catch{}l.appendChild(g)}function d(l,g){let v=g.parentElement;if(v){if(v.moveBefore)try{v.moveBefore(l,g);return}catch{}v.insertBefore(l,g)}}let u={apps:()=>o.slice(),appFor:s,isRegistered:l=>n.has(l),pruneDisconnected:b,schedule:(l,g)=>i.schedule(l,g),runNow:(l,g)=>i.runNow(l,g),moveInto:m,placeBefore:d,remountIfPresent:()=>x()},E=t(u),A=wn(u),N=r?r(u,A):{},R=!1,p=!1,y=null;function h(){R||(R=!0,e(u,E,document),y=tn(u))}function w(){let l=O("derived");l&&typeof l.mounted=="function"&&l.mounted()}function x(l=document){if(p)return[];h(),ue(u);let g=l.querySelectorAll("[sap]"),v=[];for(let T of g){if(n.has(T))continue;let f=me(T);n.set(T,f),o.push(f),v.push(f)}for(let T of v){let f=A.greenLine(T);T.diag.errors.length||T.halted?console.error(f):console.log(f)}return w(),v}function c(l){if(p)return null;if(h(),ue(u),!l)return x();let g=typeof l=="string"?document.querySelector(l):l;if(!g)return null;if(n.has(g))return n.get(g);let v=me(g);n.set(g,v),o.push(v);let T=A.greenLine(v);return v.diag.errors.length||v.halted?console.error(T):console.log(T),v}let a=E.Sap;return a.version=yn,a.refresh=function(){for(let g of o)g.root.isConnected&&i.runNow(g,"refresh")},a.batch=Ze,a.status=A.status,a.report=A.report,a.why=N.why,a.debug=A.debug,a.doctor=N.doctor,a.greenLine=A.greenLine,a.formats=dt,a.serializeControlToAttributes=mt,a.finalizeControlForSave=Xe,a.rehydrateControlFromAttributes=qt,a.mount=c,a.config=function(g={}){return g.formats&&Object.assign(dt,g.formats),a},a._registry=n,a._reset=function(){n.clear(),o.length=0,ce()},a.unmount=function(){p=!0,n.clear(),o.length=0,ce(),typeof y=="function"&&y()},{Sap:a,mountAll:x,mount:c,runtime:u}}function vn(t){if(typeof document>"u")return;let e=()=>Je(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}var $r=["for","form","list","headers","popovertarget","commandfor","anchor","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function _r(t,e){let r=null;return H(t,n=>{!r&&n.getAttribute("scope")===e&&(r=n)}),r}function En(t,e,r){let n=j(t)||e;for(;n;){for(let o of W(n.getAttribute("state")||""))if(o.name===r)return{el:n,decl:o};if(n.hasAttribute("sap"))break;n=j(n.parentElement)}return null}function Tr(t){return typeof t=="number"?"num":typeof t=="boolean"?"bool":"string"}function xn(t){function e(p){let y=t.appFor(p);if(!y)return null;let h=tt(p),w=h&&h._sapEachItem&&h._sapEachItem.$el;if(w&&w.isConnected)return{ctxEl:w,appRec:y,isRow:!0};let x=yt(p);if(x)return x._sapDetailRow?{ctxEl:x._sapDetailRow,appRec:y,isRow:!0}:{ctxEl:j(x.parentElement)||y.root,appRec:y,isRow:!1};let c=Ct(p);if(c&&c.hasAttribute("item"))return{ctxEl:c,appRec:y,isRow:!0};let a=j(p)||y.root;return{ctxEl:a,appRec:y,isRow:a.hasAttribute("item")}}function r(p){let y=typeof p=="string"?document.querySelector(p):p;if(!y||y.nodeType!==1)return null;let h=e(y);return h?R(h.ctxEl,h.appRec,h.isRow):null}function n(p,y){let h=tt(p);if(!h)return r(p);let w=t.appFor(p),x=h._sapEachItem&&h._sapEachItem.$el;if(x&&x.nodeType===1&&x.hasAttribute("item")&&lt(x,y))return x.isConnected?R(x,w,!0):null;let c=h.parentElement&&h.parentElement._sapDrawnEl;return!c||!c.isConnected?null:R(c,w,c.hasAttribute("item"))}function o(p,y,h){let w=et(p,h);if(w)return B(w).read();let x=ft(p,h);if(x)return G(x).map(g=>R(g,y,!0));let c=_r(p,h);if(c)return R(c,y,!1);let a=En(p,y.root,h);if(a)return a.decl.transient?Mt(a.el,a.decl):Ae(a.el,a.decl);let l=p._sapScope;return l?l[h]:void 0}function i(p,y,h,w,x){w.transient?Et(p,w,h):vt(p,w,h),t.schedule(x,"set:"+y)}function s(p,y){let h=new Set,w=j(p)||y;for(;w;){for(let x of W(w.getAttribute("state")||""))h.add(x.name);if(w.hasAttribute("sap"))break;w=j(w.parentElement)}return H(p,x=>{let c=x.getAttribute("bind");c&&h.add(c)}),h}function b(p,y,h,w){let x=et(p,h);if(x){if(!F(x))return;B(x).write(w);return}let c=p;for(;c;){for(let k of c.attributes)if(k.name==="calc:"+h){y.diag.error("E16",c,{attr:"calc:"+h,problem:`"${h}" is a computed field; computed fields are read-only`});return}if(c.hasAttribute("sap"))break;c=c.parentElement}let a=En(p,y.root,h);if(a){if(!F(a.el,{transient:a.decl.transient}))return;i(a.el,h,w,a.decl,y);return}let l=s(p,y.root);l.delete(h);let g=h.length>=4?wt(h,[...l]):null;if(g){y.diag.error("E12",p,{key:h,problem:`unknown state key "${h}"`,didYouMean:g});return}if(Nt.has(h)||gt.has(h)){y.diag.error("E15",p,{key:h,problem:`cannot write undeclared field "${h}" \u2014 it is a reserved/global name and cannot become state`,fix:"pick a different field name, or declare it explicitly in a state= attribute"});return}let v=y.root;if(!F(v))return;let T=Tr(w),f=v.getAttribute("state")||"",S=T==="string"?h:`${h}:${T}`;v.setAttribute("state",f?`${f} ${S}`:S),i(v,h,w,{name:h,attr:h,type:T,transient:!1},y)}function m(p){let y=p.ownerDocument,h=new Map,w=(x,c)=>{let a=we(y),l=x.getAttribute(c);l&&c==="id"&&h.set(l,a),x.setAttribute(c,a)};p.querySelectorAll("[id]").forEach(x=>w(x,"id")),p.querySelectorAll("[data-id]").forEach(x=>w(x,"data-id")),p.querySelectorAll("[sap-error]").forEach(x=>x.removeAttribute("sap-error")),p.removeAttribute("sap-error"),p.hasAttribute("data-id")?(p.removeAttribute("id"),w(p,"data-id")):w(p,"id");for(let x of[p,...p.querySelectorAll("*")])for(let c of $r){let a=x.getAttribute(c);if(a==null)continue;let l=a.split(/\s+/).map(g=>h.get(g)||g).join(" ");l!==a&&x.setAttribute(c,l)}}function d(p,y,h){let w=xt(y.root,p,h);if(!w)return y.diag.error("E17",p,{problem:`cannot resolve a list named "${h}" from here`}),null;if(!F(w))return null;let x=Ft(w);if(!x)return y.diag.error("E17",w,{problem:`items="${h}" has no [item template] to clone`}),null;let c=w.ownerDocument.importNode(x,!0);return c.removeAttribute("template"),m(c),w.appendChild(c),t.schedule(y,"trigger-add:"+h),R(c,y,!0)}function u(p,y){let h=W(p.getAttribute("state")||""),w=!0;H(p,x=>{x.hasAttribute("bind")&&!F(x)&&(w=!1)});for(let x of h)F(p,{transient:x.transient})||(w=!1);if(w){H(p,x=>{if(x.hasAttribute("bind")){let c=B(x),a=x.getAttribute("default");c.kind==="checkbox"||c.kind==="radio"?c.write(a!=null?a===""||a==="true"||x.value===a:x.hasAttribute("checked")):c.write(a??(x.getAttribute("value")||""))}});for(let x of h){let c=ve(p,x);x.transient?Et(p,x,c):vt(p,x,c)}t.schedule(y,"trigger-reset")}}function E(p,y){if(!p.isConnected)throw new Error("stale row handle: $remove() on a removed row");F(p)&&(p.remove(),t.schedule(y,"trigger-remove"))}function A(p,y,h){if(!p.isConnected)throw new Error("stale row handle: $move() on a removed row");let w=null;if(h&&h.nodeType===1?w=h:typeof h=="string"&&(w=xt(y.root,p,h)),!w){y.diag.error("E17",p,{problem:`$move() cannot resolve target "${h}"`});return}!F(p)||!F(w)||(t.moveInto(w,p),t.schedule(y,"trigger-move"))}function N(p){let y=p.parentElement;return y?G(y).indexOf(p):-1}function R(p,y,h){let w={get $el(){return p},get $key(){return Lt(p,h?"row":"scope")},get $index(){return N(p)},$add(c){return d(p,y,c)},$reset(){return u(p,y),x},$remove(){E(p,y)},$move(c){A(p,y,c)},get $appRec(){return y}},x=new Proxy(w,{get(c,a){return typeof a=="symbol"||a[0]==="$"?c[a]:o(p,y,a)},set(c,a,l){return typeof a=="string"&&a[0]==="$"?(c[a]=l,!0):(b(p,y,a,l),!0)},has(c,a){return typeof a=="string"&&a[0]==="$"?a in c:o(p,y,a)!==void 0}});return x}return{Sap:r,contextElFor:e,readField:o,writeField:b,makeProxy:R,writeTargetFor:n}}var Nr=["trigger-add","trigger-remove","trigger-reset"];function Rr(t){if(t.nodeType!==1)return!1;for(let e of t.attributes){let r=e.name;if(r.startsWith("set:")||r.startsWith("move:")||r.startsWith("sort:")||Nr.includes(r))return!0}return!1}function Lr(t,e){let r=t,n=e.parentElement;for(;r&&r!==n;){if(r.nodeType===1&&Rr(r)&&!(r.tagName==="FORM"&&r.hasAttribute("trigger-add")))return r;r=r.parentElement}return null}function Sn(t,e){let{Sap:r}=e;function n(c,a){let l=null,g=tt(c),v=yt(c);if(g)l=g._sapEachItem??null;else if(v&&v._sapDetailRow)l=v._sapDetailRow._sapScope||null;else{let S=Ct(c);S&&S.hasAttribute("item")&&(l=S._sapScope||null)}return{state:(j(c)||a.root)._sapScope||a._state||{},item:l,el:c,root:a._state||{}}}function o(c,a,l){if(!c.hasAttribute("confirm")){l();return}let g=c.getAttribute("confirm"),v=g,T=P(g);if(!T.error)try{let _=nt(T,n(c,a));(typeof _=="string"||typeof _=="number")&&(v=String(_))}catch{}let f=$t(),S=()=>{$t()===f&&l()},k=Qe();if(!k){window.confirm(v)&&S();return}if(c._sapGatePending)return;c._sapGatePending=!0;let $=()=>{c._sapGatePending=!1};k(v,()=>{$(),S()}).catch($)}function i(c,a){for(let l of c.attributes){if(!l.name.startsWith("set:"))continue;let g=l.name.slice(4),v=P(l.value);if(v.error){a.diag.error("E08",c,{attr:l.name,expr:l.value,problem:String(v.error.message)});continue}let T;try{T=nt(v,n(c,a))}catch(S){a.diag.error("E24",c,{attr:l.name,expr:l.value,problem:String(S.message)});continue}let f=e.writeTargetFor(c,g);f&&(f[g]=T)}}function s(c){let a=tt(c);if(!a)return c.closest("[item]");let l=a._sapEachItem&&a._sapEachItem.$el;return l&&l.nodeType===1&&l.hasAttribute("item")?l:null}function b(c,a){let l=s(c);if(!l||!F(l)||!F(l.parentElement))return;let g=G(l.parentElement),v=g.indexOf(l);a==="up"&&v>0?t.placeBefore(l,g[v-1]):a==="down"&&v<g.length-1&&t.placeBefore(g[v+1],l)}function m(c,a,l){if(a)return xt(l.root,c,a);let g=c;for(;g;){if(g.hasAttribute&&g.hasAttribute("items"))return g;g=g.parentElement}let v=j(c)||l.root,T=[];return H(v,f=>{f.hasAttribute("items")&&T.push(f)}),T[0]||null}function d(c,a){let l=c==null||c==="",g=a==null||a==="";if(l&&g)return 0;if(l)return 1;if(g)return-1;let v=Number(c),T=Number(a);return!Number.isNaN(v)&&!Number.isNaN(T)?v-T:String(c)<String(a)?-1:String(c)>String(a)?1:0}function u(c,a,l,g){let v=m(c,l,g);if(!v){g.diag.error("E17",c,{attr:"sort:"+a,problem:`no items list resolvable for sort:${a}`});return}if(!F(v))return;let T=G(v),f=_=>_._sapScope?_._sapScope[a]:void 0,S=[...T].sort((_,L)=>d(f(_),f(L))),$=S.every((_,L)=>_===T[L])?[...S].reverse():S;for(let _ of $)t.moveInto(v,_);t.schedule(g,"sort:"+a)}function E(c){if(!c||c.hidden)return;let a=c.querySelector("[bind]:not([type=hidden]), [contenteditable]");a&&typeof a.focus=="function"&&a.focus()}function A(c,a){o(c,a,()=>{let l=r(c);for(let g of[...c.attributes]){let v=g.name;if(v==="trigger-remove")l&&l.$remove();else if(v==="trigger-reset")l&&l.$reset();else if(v==="trigger-add"){let T=l&&l.$add(g.value);T&&E(T.$el)}else v==="move:up"?(b(c,"up"),t.schedule(a,"move:up")):v==="move:down"?(b(c,"down"),t.schedule(a,"move:down")):v.startsWith("move:to")?l&&l.$move(g.value):v.startsWith("sort:")&&u(c,v.slice(5),g.value,a)}[...c.attributes].some(g=>g.name.startsWith("set:"))&&i(c,a)})}function N(c){let a=c.target;if(!a||a.nodeType!==1)return;let l=t.appFor(a);if(!l)return;let g=Lr(a,l.root);g&&A(g,l)}function R(c){let a=B(c),l=c.getAttribute("default");a.kind==="checkbox"?a.write(l===""||l==="true"):a.write(l??"")}function p(c,a,l){let g=r(c);if(!g)return;let v=g.$add(l);if(!v)return;let T=[];H(c,f=>{f.hasAttribute("bind")&&T.push(f)});for(let f of T){if(f.type==="radio"&&!f.checked)continue;let S=f.getAttribute("bind"),k=et(v.$el,S);k?B(k).write(B(f).read()):lt(v.$el,S)&&(v[S]=B(f).read())}T.forEach(R),T.length?typeof T[0].focus=="function"&&T[0].focus():E(v.$el)}function y(c){let a=c.target;if(!a||!a.hasAttribute||!a.hasAttribute("trigger-add"))return;let l=t.appFor(a);l&&(c.preventDefault(),o(a,l,()=>p(a,l,a.getAttribute("trigger-add"))))}function h(c){let a=c.target;if(!a||a.tagName!=="DIALOG"||!a.hasAttribute("detail"))return;if(a._sapEngineClose){a._sapEngineClose=!1;return}if(a.open)return;let l=/^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(a.getAttribute("detail")||""),g=t.appFor(a);if(!l||!g)return;let v=W(a.getAttribute("state")||"").find(f=>f.name===l[1]);if(v){if(!F(a,{transient:v.transient}))return;v.transient?Et(a,v,""):vt(a,v,""),t.schedule(g,"close");return}let T=r(a.parentElement);T&&T[l[1]]!==""&&(T[l[1]]="")}function w(c,a){let l=c.hasAttribute("bind")&&Dt(c);if(!l&&c.hasAttribute("bind")&&tt(c)){let v=c.getAttribute("bind"),T=c._sapViewBind?e.writeTargetFor(c,v):null;return T&&(T[v]=B(c).read()),!0}let g=yt(c);if(g&&g._sapDetailRow&&c.hasAttribute("bind")&&!l){let v=g._sapDetailRow,T=c.getAttribute("bind"),f=et(v,T);if(f&&f!==c)return F(f)&&B(f).write(B(c).read()),!0;if(!f&&W(v.getAttribute("state")||"").some(S=>S.name===T))return e.writeField(v,a,T,B(c).read()),!0}return!1}function x(c=document){c.addEventListener("click",N),c.addEventListener("submit",y),c.addEventListener("close",h,!0)}return{install:x,routeInput:w}}function kn(t){let e=[];function r(m){let d=m.target;if(!d||d.nodeType!==1)return;let u=t.appFor(d);if(u){d.hasAttribute("persist")&&!zt(d)&&F(d)&&mt(d);for(let E of e)if(E(d,u))return;t.schedule(u,m.type+" "+(d.id||d.tagName.toLowerCase()))}}function n(m){let d=m.target,u=t.appFor(d);u&&[...d.querySelectorAll("[bind]")].every(E=>F(E))&&setTimeout(()=>{d.querySelectorAll("[bind]").forEach(E=>{E.dispatchEvent(new Event("input",{bubbles:!0})),E.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(u,"reset")},0)}function o(m){let d=t.appFor(m.target);d&&t.schedule(d,"toggle")}function i(m){let d=m.detail||{};for(let u of[d.from,d.to,m.target]){if(!u||u.nodeType!==1)continue;let E=t.appFor(u);E&&t.schedule(E,"sorted")}}function s(m){if(m.key!=="ArrowUp"&&m.key!=="ArrowDown")return;let d=m.target;if(!d||d.nodeType!==1||d.tagName!=="INPUT"||!d.hasAttribute("bind")||!d.hasAttribute("step"))return;let u=(d.getAttribute("type")||"text").toLowerCase();if(u!=="text"&&u!=="tel"&&u!=="search"||!t.appFor(d)||!F(d))return;m.preventDefault();let A=q(d.getAttribute("step"))||1,N=m.key==="ArrowUp"?1:-1,R=q(d.value)+A*(m.shiftKey?10:1)*N,p=d.getAttribute("min"),y=d.getAttribute("max");p!==null&&p!==""&&R<q(p)&&(R=q(p)),y!==null&&y!==""&&R>q(y)&&(R=q(y)),B(d).write(String(Number(R.toFixed(2))))}function b(m=document){m.addEventListener("reset",n),m.addEventListener("toggle",o,!0),m.addEventListener("input",r),m.addEventListener("change",r),m.addEventListener("clay:sorted",i),m.addEventListener("keydown",s)}return{install:b,addRouter:m=>e.push(m)}}function $n(t){let e=t.toLowerCase();return/^x-text$|^x-html$/.test(e)?'use text="state.x" (Sap paints text only)':/^x-show$|^v-show$|^v-if$/.test(e)?'use show="expr" (toggles native hidden)':/^x-model$|^v-model$/.test(e)?'use bind="field"':/^@|^x-on:|^v-on:|^on:/.test(e)?"use native onclick + Sap(this) (no event directive)":/^:|^x-bind:class$|^v-bind:class$/.test(e)?'use class:NAME="expr" or attr:NAME="expr"':/^x-for$|^v-for$/.test(e)?'use items="name" on the container and item template on the row':/^x-data$/.test(e)?"declare state with state= / bind / items (no JS state object)":/^x-init$/.test(e)?"use a <script> or onclick + Sap(this)":/^bind:/.test(e)?'use bind="field"; one-way paint is attr:NAME="expr"':/^x-/.test(e)||/^v-/.test(e)?"this is a foreign-dialect attribute; Sap has no x-/v- attributes":null}function _n(t){let e=[],r=n=>{for(let o of n.attributes){let i=o.name;(i.startsWith("calc:")||i==="text"||i.startsWith("text:")||i==="show"||i.startsWith("attr:")||i.startsWith("class:")||i.startsWith("css:")||i==="effect"||i==="invalid"||i.startsWith("set:")||i==="detail")&&e.push({el:n,attr:i,src:o.value})}};r(t);for(let n of t.querySelectorAll("*"))r(n);return e}function Tn(t){function e(o){return o?typeof o=="string"?document.querySelector(o):o.nodeType===1?o:null:null}function r(o,i){let s=e(o);if(!s)return console.warn("sap why: element not found"),null;let b=[`sap why <${s.tagName.toLowerCase()}> \u2014 ${Rt(s)}`],m=[...s.attributes].filter(u=>/^(bind|text|show|effect|invalid|detail|calc:|text:|attr:|class:|css:|set:|state|items|scope)/.test(u.name));for(let u of m)b.push(` ${u.name}="${u.value}"`);let d=s;for(;d&&!d._sapScope;)d=d.parentElement;if(d&&d._sapScope){let u=d._sapScope,E=i?[i]:Object.keys(u);b.push(" reads:");for(let A of E){let N=u[A];typeof N!="function"&&b.push(` ${A} = ${JSON.stringify(Array.isArray(N)?`[${N.length} rows]`:N)}`)}}return b.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"),console.log(b.join(`
10
10
  `)),null}function n(){let o=[],i=0;for(let u of t.apps()){let E=u.root,A=Xt(E);i++;let N=new at(u.name);Yt(E,N);for(let w of N.errors)o.push({code:w.code,severity:"error",message:`${A}: ${w.code} ${w.slug} at ${w.el}`});for(let w of N.warnings)o.push({code:w.code,severity:"warn",message:`${A}: ${w.code} ${w.slug} at ${w.el}`});i++,bt(u,{trigger:"doctor-dryrun"});let R=u._stats?u._stats.writes:0;R>0&&o.push({code:"W30",severity:"warn",message:`${A}: dry recompute wrote ${R} cells on a quiet page; an element is stale or non-idempotent`}),i++;let p=_n(E).map(w=>w.src).join(" \0 "),y=[];for(let w of[E,...E.querySelectorAll("[state]")])for(let x of W(w.getAttribute("state")||""))y.push(x.name);for(let w of y)new RegExp(`(state|item)\\.${w}\\b`).test(p)||o.push({code:"I33",severity:"info",message:`${A}: field "${w}" is declared but read nowhere (dead state)`});i++;let h=new Map;for(let w of E.querySelectorAll("[id]"))h.set(w.id,(h.get(w.id)||0)+1);for(let[w,x]of h)x>1&&o.push({code:"W32",severity:"warn",message:`${A}: duplicate id "${w}" (${x} elements) \u2014 clone/edit collision`});i++;for(let w of _n(E))w.src.length>120&&o.push({code:"I33",severity:"info",message:`${A}: ${w.attr} expression is ${w.src.length} chars; consider a calc: field`});i++;for(let w of E.querySelectorAll("[text], [text\\:num]")){let x=w.textContent||"";/\.\d{5,}/.test(x)&&o.push({code:"I33",severity:"info",message:`${A}: ${Rt(w)} paints >4 decimals; consider text:FMT`})}}let s=o.filter(u=>u.severity==="error").length,b=o.filter(u=>u.severity==="warn").length,m=o.filter(u=>u.severity==="info").length;console.log(`sap doctor \xB7 ${t.apps().map(u=>Xt(u.root)).join(", ")} \xB7 errors ${s} \xB7 warnings ${b} \xB7 info ${m} \xB7 ${i} checks \xB7 0ms`);for(let u of o)(u.severity==="error"?console.error:u.severity==="warn"?console.warn:console.info)(` ${u.severity==="error"?"\u2717":u.severity==="warn"?"\u26A0":"\xB7"} ${u.message}`);return o}return{why:r,doctor:n}}function Cr(t,e){let r=String(t).split("."),n=i=>{for(let s of r){if(i==null)return;i=Array.isArray(i)?i.flatMap(b=>b&&b[s]!=null?b[s]:[]):i[s]}return i},o=n(e.state);return o===void 0?n(e.root):o}function Dr(t,e,r,n){e._sapScope=r;let o=e.getAttribute("detail")||"",i=/^([\w.]+)\s+by\s+(.+)$/.exec(o);if(!i){e.hidden=!0,e._sapDetailRow=null;return}let s=i[1],b=i[2].trim(),m=Cr(s,n),d;try{d=nt(P(b),{state:r,item:n.item,el:e,root:n.root})}catch{d=void 0}let u=Array.isArray(m)&&d!=null?m.find(A=>A&&typeof A=="object"&&A.$el&&String(A.$key)===String(d)):null;if(e._sapDetailRow=u?u.$el:null,u&&jt(u.$el),e.tagName==="DIALOG"){let A=u?String(u.$key):null;if(A!==e._sapDetailKey&&(e._sapDetailKey=A,e._sapDismissed=!1),!u){e._sapOpenedFor=null,e.open&&typeof e.close=="function"&&(e._sapEngineClose=!0,e.close());return}e.open?e._sapOpenedFor=A:(e._sapOpenedFor===A&&(e._sapDismissed=!0),e._sapOpenedFor=null,!e._sapDismissed&&e.isConnected&&typeof e.showModal=="function"&&(e.hidden&&(e.hidden=!1),e.showModal(),e._sapOpenedFor=A))}else{if(!u){e.hidden||(e.hidden=!0);return}e.hidden&&(e.hidden=!1)}Bt();let E={root:n.root,state:r,item:u,ownerEl:u.$el,projection:!0};t.collectEl(e,X(e),E),t.walkScope(e,u,E)}var Nn={name:"detail",begin(t){t.deferredDetails=[]},boundary:{detail(t,e,r,n,o){for(let i of W(e.getAttribute("state")||""))i.name in n||(n[i.name]=Y(e,i)?e.hasAttribute(i.attr):t.resolveDefault(e,i));t.deferredDetails.push({el:e,parentObj:n,ctx:o})}},afterIntake(t){for(let e=0;e<t.deferredDetails.length;e++){let{el:r,parentObj:n,ctx:o}=t.deferredDetails[e];Dr(t,r,n,o)}}};function Rn(t){let e=0,r=t;for(;r&&!(r.hasAttribute&&r.hasAttribute("sap"));)r=r.parentElement,e++;return e}var Ln={name:"calc",begin(t){t.calcs=[]},collect(t,e,r,n){if(!r.calcs)return!1;let o=n.item||n.state;for(let i of r.calcs)t.calcs.push({owner:o,ownerEl:n.ownerEl,name:i.name,entry:i.entry,def:i,el:e,ctx:n})},compute(t){let e=t.app,r=new Map;for(let o of t.calcs){let i=r.get(o.owner);i||(i={ownerEl:o.ownerEl,list:[]},r.set(o.owner,i)),i.list.push(o)}let n=[...r.values()].sort((o,i)=>Rn(i.ownerEl)-Rn(o.ownerEl));for(let o of n){let i;try{i=Le(o.list)}catch(s){e.diag.error("E07",o.list[0].el,{problem:s.message}),i=o.list}for(let s of i)try{s.owner[s.name]=z(s.entry,s.ctx.state,s.ctx.item,s.el,s.ctx.root),ct(s.el)}catch(b){s.owner[s.name]=void 0,e.diag.error("E24",s.el,{attr:"calc:"+s.name,expr:s.entry.src,problem:String(b.message)}),V(s.el,b.sapCode||"E24")}}t.stats.calcs=t.calcs.length,t.stats.lists=r.size}};function Fr(t,e,r){let n=r.nextSibling;if(e.isConnected&&t.moveBefore)try{t.moveBefore(e,n);return}catch{}t.insertBefore(e,n)}function Mr(t,e,r){for(let n=e.parentElement;n;n=n.parentElement)if(n._sapScope===r&&!n.hasAttribute("detail")||n.hasAttribute("sap"))return n;return t}function Or(t,e,r){let n=t.app;e._sapDrawnEl=Mr(t.root,e,r.state);let o=null;for(let p=e.firstElementChild;p;p=p.nextElementSibling)if(p.tagName==="TEMPLATE"){o=p;break}let i=o&&o.content.children.length===1?o.content.firstElementChild:null;if(!i)return n.diag.error("E42",e,{attr:"each",problem:"each needs one <template> child with exactly one element root"}),0;let s=e.getAttribute("each"),b;try{b=nt(P(s),{state:r.state,item:r.item,el:e,root:r.root})}catch(p){return n.diag.error("E24",e,{attr:"each",expr:s,problem:String(p.message)}),0}if(!Array.isArray(b))return n.diag.error("E40",e,{attr:"each",expr:s,problem:"each must evaluate to an array; the list keeps its last good rows"}),0;let m=P(e.getAttribute("key")||"item.$key"),d=[],u=new Set;for(let p of b){let y;try{y=z(m,r.state,p,e,r.root)}catch{y=void 0}let h=y==null?"":String(y);if(h===""||u.has(h))return n.diag.error("E41",e,{attr:"key",expr:m.src,problem:h===""?"an item has no key; the list keeps its last good rows":`duplicate key "${h}"; the list keeps its last good rows`}),0;u.add(h),d.push(h)}let E=e._sapEach||new Map,A=new Map,N=0,R=o;d.forEach((p,y)=>{let h=E.get(p);if(!h||h.parentElement!==e){h=e.ownerDocument.importNode(i,!0);let w=(h.getAttribute("clay")||"").split(/\s+/).filter(Boolean);w.includes("editor-ui")||h.setAttribute("clay",[...w,"editor-ui"].join(" ")),h._sapEachRow=!0,N++}h.getAttribute("data-key")!==p&&h.setAttribute("data-key",p),R.nextElementSibling!==h&&(Fr(e,h,R),N++),h._sapEachItem=b[y],A.set(p,h),R=h});for(let[p,y]of E)A.get(p)!==y&&y.parentElement===e&&(y.remove(),N++);return e._sapEach=A,Bt(),d.forEach((p,y)=>{let h=A.get(p),w={root:r.root,state:r.state,item:b[y],ownerEl:h,projection:!1,view:!0};t.collectEl(h,X(h),w),t.walkScope(h,{},w)}),N}var Cn={name:"each",begin(t){t.eachList=[]},boundary:{each(t,e,r,n,o){t.collectEl(e,r,o),t.eachList.push({el:e,ctx:o})}},reconcile(t){let e=0;for(let r=0;r<t.eachList.length;r++)e+=Or(t,t.eachList[r].el,t.eachList[r].ctx);return e}};function Pr(t,e){try{z(t.def.entry,t.ctx.state,t.ctx.item,t.el,t.ctx.root),ct(t.el)}catch(r){e.diag.error("E24",t.el,{attr:"effect",expr:t.def.entry&&t.def.entry.src,problem:String(r.message)}),V(t.el,"E24")}}var Dn={name:"effect",begin(t){t.effects=[]},collect(t,e,r,n){if(!r.effects)return!1;for(let o of r.effects)t.effects.push({def:o,el:e,ctx:n})},afterPaint(t){for(let e of t.effects)Pr(e,t.app)}};function Ir(t){let e="";try{let r=z(t.def.entry,t.ctx.state,t.ctx.item,t.el,t.ctx.root);e=typeof r=="string"?r:""}catch{e=""}typeof t.el.setCustomValidity=="function"&&t.el.setCustomValidity(e)}var Fn={name:"validation",begin(t){t.invalids=[]},collect(t,e,r,n){if(!r.invalids)return!1;for(let o of r.invalids)t.invalids.push({def:o,el:e,ctx:n})},afterPaint(t){for(let e of t.invalids)Ir(e)}};function Mn(t,e){if(t===t.ownerDocument.activeElement)return 0;if(t.type==="radio"){let i=e!=null&&String(t.value)===String(e);return t.checked===i?0:(t.checked=i,1)}let r=_t(t),n=Ht(t,r),o=e??"";return String(n)!==String(o)?(rn(t,r,o),1):0}var On={name:"projection",collect(t,e,r,n){if(!(r.bind!=null&&(n.view||n.projection)&&!Dt(e)))return!1;let o=r.bind,i=t.paints;n.view?lt(ye(n.item),o)?(e._sapViewBind="item",i.push({def:{kind:"projection",field:o,from:"item"},el:e,ctx:n})):o in n.state||o in n.root?(e._sapViewBind="drawn",i.push({def:{kind:"projection",field:o,from:"drawn"},el:e,ctx:n})):(e._sapViewBind=null,t.app.diag.error("E43",e,{attr:"bind",expr:o,problem:`bind="${o}" inside an each row matches no field of the row's record or of the scope the row is drawn in`,fix:"bind a field the record owns (bind, state= or items= on the [item]), or declare it with state= where the list is drawn"})):i.push({def:{kind:"projection",field:o,from:null},el:e,ctx:n})},paintKinds:{projection(t){let e=t.def;if(e.from==="drawn"){let r=e.field in t.ctx.state?t.ctx.state:t.ctx.root;return Mn(t.el,r[e.field])}return Mn(t.el,t.ctx.item?t.ctx.item[e.field]:"")}}};function Pn(){for(let t of[Nn,Ln,Cn,Dn,Fn,On])fn(t)}Pn();pn((t,e,r)=>{for(let n of t.attributes){let o=$n(n.name);o&&(e("E01",t,{attr:n.name,expr:n.value,problem:`"${n.name}" is a foreign-dialect attribute; Sap has no ${n.name.split(/[:=]/)[0]} directive`,fix:o+" \u2014 or wrap the subtree in sap-ignore if intentional"}),r(n.name))}});var{Sap:Kt,mountAll:In,mount:Wr,runtime:Br}=An({createAccessor:xn,debugExtras:Tn,installInput(t,e,r){let n=kn(t),o=Sn(t,e);n.addRouter(o.routeInput),n.install(r),o.install(r)}}),Tt=typeof window<"u"?window.Sap:null;Tt&&Tt!==Kt&&Tt.core&&typeof Tt.unmount=="function"&&Tt.unmount();vn(In);typeof window<"u"&&(window.Sap=Kt);var jr=Kt;return Vn(qr);})();
11
11
  if (typeof window !== 'undefined' && Sap && Sap.default) window.Sap = Sap.default;
12
12
  var sapDefault = Sap.default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panphora/clayjs",
3
- "version": "1.23.0",
3
+ "version": "1.24.1",
4
4
  "type": "module",
5
5
  "description": "clayjs: malleable documents. Save lifecycle for self-saving HTML.",
6
6
  "license": "MIT-0",
@@ -36,6 +36,7 @@
36
36
  "./tailwind": "./src/tailwind.js",
37
37
  "./page/yjs": "./src/page/ybind/external.js",
38
38
  "./dist/*": "./dist/*",
39
+ "./tool-generation/*": "./tool-generation/*",
39
40
  "./server/rooms": {
40
41
  "import": "./dist/server/rooms.mjs",
41
42
  "require": "./dist/server/rooms.cjs"
@@ -58,7 +59,8 @@
58
59
  "docs/guide.md",
59
60
  "compat/",
60
61
  "fonts/",
61
- "src/"
62
+ "src/",
63
+ "tool-generation/"
62
64
  ],
63
65
  "publishConfig": {
64
66
  "access": "public"
@@ -96,7 +98,7 @@
96
98
  "@fontsource-variable/work-sans": "5.3.0",
97
99
  "@fontsource/ibm-plex-mono": "5.3.0",
98
100
  "@fontsource/ibm-plex-sans": "5.3.0",
99
- "@panphora/bevel": "0.3.2",
101
+ "@panphora/bevel": "0.4.0",
100
102
  "@web/test-runner": "^0.20.2",
101
103
  "@web/test-runner-commands": "^0.9.0",
102
104
  "@web/test-runner-playwright": "^0.11.1",