@panphora/clayjs 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/dist/all.js +1 -1
  2. package/dist/clay-dom.js +1 -1
  3. package/dist/clay-events.js +1 -1
  4. package/dist/clay-internals.js +1 -1
  5. package/dist/clay-options.js +1 -1
  6. package/dist/clay-router.js +1 -1
  7. package/dist/clay-ui.js +1 -1
  8. package/dist/clay-utils.js +1 -1
  9. package/dist/clay.js +1 -1
  10. package/dist/clay.standalone.js +72519 -59839
  11. package/dist/m/attrs/refetch-on-save-ZUE7PSCI.js +1 -0
  12. package/dist/m/attrs/save-freeze-LWGF6XUN.js +1 -0
  13. package/dist/m/c-2GRUM77Q.js +30 -0
  14. package/dist/m/c-2KIEGNC4.js +1 -0
  15. package/dist/m/{c-5R4PTRG2.js → c-2KL3BD52.js} +1 -1
  16. package/dist/m/c-2YYDMLNZ.js +1 -0
  17. package/dist/m/c-2ZZBC45O.js +1 -0
  18. package/dist/m/c-372N6H3B.js +1 -0
  19. package/dist/m/{c-4WKFKEKF.js → c-3G2DGZUP.js} +1 -1
  20. package/dist/m/c-3LDGIBMN.js +1 -0
  21. package/dist/m/c-3O7OBDCM.js +1 -0
  22. package/dist/m/c-4ASQPRQL.js +1 -0
  23. package/dist/m/c-4TXNLX4K.js +6 -0
  24. package/dist/m/c-4YU3BR4D.js +6 -0
  25. package/dist/m/c-5734MF2P.js +1 -0
  26. package/dist/m/c-57XDY6HC.js +1 -0
  27. package/dist/m/{c-VFX45IZQ.js → c-5B4YBZXC.js} +1 -1
  28. package/dist/m/c-5ONTYIUI.js +1 -0
  29. package/dist/m/c-5OOVFCJM.js +1 -0
  30. package/dist/m/c-5T6NZHNM.js +1 -0
  31. package/dist/m/{c-YDH7Q3NY.js → c-5ZQV7KC4.js} +1 -1
  32. package/dist/m/{c-Z36J63PP.js → c-6DB2OLRJ.js} +1 -1
  33. package/dist/m/c-6DNRCPNM.js +1 -0
  34. package/dist/m/c-6UGWFMQC.js +2 -0
  35. package/dist/m/c-7K4SCQB7.js +1 -0
  36. package/dist/m/c-7MG5RU63.js +1 -0
  37. package/dist/m/c-7PRJCA3E.js +1 -0
  38. package/dist/m/c-A6L3FMUS.js +1 -0
  39. package/dist/m/c-AMU3BPPR.js +4 -0
  40. package/dist/m/c-AMYEFA2E.js +1 -0
  41. package/dist/m/c-AQYCG7QW.js +1 -0
  42. package/dist/m/c-ATKAOH23.js +1 -0
  43. package/dist/m/c-B3JM5ZXC.js +1 -0
  44. package/dist/m/c-B5CS55WR.js +1 -0
  45. package/dist/m/c-B5UJQT7W.js +1 -0
  46. package/dist/m/c-B7J4K2AE.js +3 -0
  47. package/dist/m/c-BHZYSHW4.js +1 -0
  48. package/dist/m/c-BIJALSRD.js +1 -0
  49. package/dist/m/c-BJ7YQ5QZ.js +1 -0
  50. package/dist/m/c-BPF2NSPV.js +1 -0
  51. package/dist/m/{c-KIPQJX4B.js → c-BRLCTNMC.js} +1 -1
  52. package/dist/m/c-BUAYFEV5.js +1 -0
  53. package/dist/m/c-C6IPRG34.js +1 -0
  54. package/dist/m/{c-2JL6E75N.js → c-CAS3NND4.js} +1 -1
  55. package/dist/m/{c-4DRMS4QG.js → c-CCQ25GFY.js} +1 -1
  56. package/dist/m/c-CJFDLD43.js +1 -0
  57. package/dist/m/c-COPTL5WB.js +1 -0
  58. package/dist/m/c-D3E4WJ4M.js +166 -0
  59. package/dist/m/c-D5IKEKXW.js +7 -0
  60. package/dist/m/c-DHBRA6DL.js +1 -0
  61. package/dist/m/c-DKLS74XB.js +72 -0
  62. package/dist/m/c-DVYGFTSK.js +3 -0
  63. package/dist/m/c-E3ZXARWA.js +1 -0
  64. package/dist/m/c-EK63G3CG.js +1 -0
  65. package/dist/m/c-ERQSNR6K.js +13 -0
  66. package/dist/m/c-EVYAISP3.js +1 -0
  67. package/dist/m/c-EXKHPOVC.js +3 -0
  68. package/dist/m/{c-7VGZ7RU5.js → c-FWKHM4E7.js} +1 -1
  69. package/dist/m/{c-4Q2XTQ2N.js → c-GBKB5WDL.js} +1 -1
  70. package/dist/m/c-GNDL3TKB.js +1 -0
  71. package/dist/m/c-GRWMD6O5.js +1 -0
  72. package/dist/m/c-GRXHHFPO.js +1 -0
  73. package/dist/m/{c-OYTFP5QN.js → c-GY422N3Q.js} +1 -1
  74. package/dist/m/c-HAWFNBYG.js +1 -0
  75. package/dist/m/c-HG2C77BM.js +4 -0
  76. package/dist/m/c-HHGJBU4D.js +1 -0
  77. package/dist/m/c-HMV6P4RX.js +1 -0
  78. package/dist/m/c-HMYWIHFG.js +1 -0
  79. package/dist/m/c-HT2DKBV2.js +1 -0
  80. package/dist/m/c-I2SCCUEW.js +1 -0
  81. package/dist/m/{c-HRDCD3WN.js → c-ICJYHABF.js} +2 -2
  82. package/dist/m/c-IMZCWYHR.js +7 -0
  83. package/dist/m/c-IVMD3FEM.js +1 -0
  84. package/dist/m/c-IVTRVENZ.js +1 -0
  85. package/dist/m/c-IW6GGOU2.js +1 -0
  86. package/dist/m/c-JKZJIUIP.js +1 -0
  87. package/dist/m/{c-NZMNXVF6.js → c-JNLX3RJB.js} +1 -1
  88. package/dist/m/c-JRKY44DK.js +1 -0
  89. package/dist/m/c-K3ADYNLU.js +1 -0
  90. package/dist/m/c-KBS3UV6B.js +1 -0
  91. package/dist/m/c-KGHVFRR3.js +1 -0
  92. package/dist/m/c-KJJPV77R.js +1 -0
  93. package/dist/m/{c-CZUSOB7V.js → c-KNPDOMDY.js} +1 -1
  94. package/dist/m/{c-5Y6TNX5W.js → c-KP64LT2A.js} +2 -2
  95. package/dist/m/c-KQ7E3PYY.js +1 -0
  96. package/dist/m/c-L3F5ZLIV.js +1 -0
  97. package/dist/m/{c-LR4CGEPT.js → c-L42OLXWM.js} +3 -2
  98. package/dist/m/c-L5VFATT6.js +1 -0
  99. package/dist/m/c-L7JL5TL3.js +3 -0
  100. package/dist/m/c-LKSL4AUJ.js +1 -0
  101. package/dist/m/c-M6FNQCTQ.js +1 -0
  102. package/dist/m/c-MCOOHCSG.js +1 -0
  103. package/dist/m/c-MHI3GYKF.js +1 -0
  104. package/dist/m/c-MWXFLW4J.js +1 -0
  105. package/dist/m/c-NEL7HQW3.js +1 -0
  106. package/dist/m/c-NQJRVJ56.js +1 -0
  107. package/dist/m/c-NWX3MFT4.js +1 -0
  108. package/dist/m/{c-HPURYVZS.js → c-OJYM642Q.js} +1 -1
  109. package/dist/m/c-OKXI52N7.js +1 -0
  110. package/dist/m/{c-MMUIUUZG.js → c-OPLUZR3A.js} +1 -1
  111. package/dist/m/{c-J7CA54IP.js → c-OTMKN2OO.js} +1 -1
  112. package/dist/m/{c-LTGMXXKO.js → c-OYRZ7XG2.js} +1 -1
  113. package/dist/m/c-P3OFYUMA.js +1 -0
  114. package/dist/m/c-PLN76GF3.js +6 -0
  115. package/dist/m/c-PLP4JKFC.js +1 -0
  116. package/dist/m/c-Q26MME6N.js +1 -0
  117. package/dist/m/{c-S7H2DRCB.js → c-Q3XOWZEV.js} +1 -1
  118. package/dist/m/{c-SWRJFCNN.js → c-QIKT6SKM.js} +1 -1
  119. package/dist/m/c-QIXT3Q7C.js +28 -0
  120. package/dist/m/c-QO4HNGCQ.js +1 -0
  121. package/dist/m/c-R27DWQKX.js +1 -0
  122. package/dist/m/{c-HVYXIS72.js → c-R2XUODVY.js} +1 -1
  123. package/dist/m/{c-QNKREOL6.js → c-R7LBFMF5.js} +1 -1
  124. package/dist/m/c-RND3G2S2.js +1 -0
  125. package/dist/m/c-S2U6NJU4.js +1 -0
  126. package/dist/m/c-SPZPGD3R.js +1 -0
  127. package/dist/m/c-SW4YEG2D.js +8 -0
  128. package/dist/m/c-SZGYW5HT.js +1 -0
  129. package/dist/m/c-T637T7SN.js +1 -0
  130. package/dist/m/c-TJAXGIRV.js +1 -0
  131. package/dist/m/{c-KKWLDOPM.js → c-TNEM3RNM.js} +1 -1
  132. package/dist/m/c-TTB5EK4S.js +32 -0
  133. package/dist/m/c-U7SHNWDH.js +1 -0
  134. package/dist/m/c-UDHIVLYH.js +20 -0
  135. package/dist/m/{c-BBVGTQG7.js → c-UGNV5MFB.js} +1 -1
  136. package/dist/m/{c-TQZ2JYHD.js → c-UORXLSD3.js} +1 -1
  137. package/dist/m/c-UPD33ZPE.js +1 -0
  138. package/dist/m/c-URSMSFCB.js +1 -0
  139. package/dist/m/c-UY4QX42B.js +1 -0
  140. package/dist/m/c-V44KWI2L.js +4 -0
  141. package/dist/m/c-VG5XIN4T.js +1 -0
  142. package/dist/m/c-VILENZTD.js +1 -0
  143. package/dist/m/{c-33HUYEDI.js → c-VJYEVRYK.js} +1 -1
  144. package/dist/m/c-VR2BJ4AN.js +1 -0
  145. package/dist/m/c-W4JCVLAB.js +1 -0
  146. package/dist/m/c-W6DQSHXI.js +135 -0
  147. package/dist/m/c-WBGWGOM7.js +1 -0
  148. package/dist/m/{c-4L3BTFRK.js → c-WCXLG3MV.js} +1 -1
  149. package/dist/m/c-WGW764WX.js +1 -0
  150. package/dist/m/c-WMRJKQ2V.js +5 -0
  151. package/dist/m/c-WNTYKCDG.js +1 -0
  152. package/dist/m/c-WQWIRWO3.js +72 -0
  153. package/dist/m/c-X5LNHET5.js +1 -0
  154. package/dist/m/c-X5TSXZYJ.js +2 -0
  155. package/dist/m/c-XGH4GS2T.js +1 -0
  156. package/dist/m/c-Y6F2FORL.js +1 -0
  157. package/dist/m/c-YBKHUAK7.js +10 -0
  158. package/dist/m/c-YBSS55KU.js +20 -0
  159. package/dist/m/c-YCLU4UNT.js +2 -0
  160. package/dist/m/c-YVZ2L7CE.js +1 -0
  161. package/dist/m/c-ZK4GIZH2.js +1 -0
  162. package/dist/m/c-ZRXJD4G6.js +1 -0
  163. package/dist/m/c-ZWBI4HYK.js +1 -0
  164. package/dist/m/{c-HT33EQRN.js → c-ZWIOJGMT.js} +1 -1
  165. package/dist/m/core/admin-attrs-YY7T5FGU.js +1 -0
  166. package/dist/m/core/autosave-S6OMNDCK.js +1 -0
  167. package/dist/m/core/conflict-notice-IWHMHH43.js +1 -0
  168. package/dist/m/core/host-permission-6EVJGNPL.js +1 -0
  169. package/dist/m/core/is-edit-mode-GCX6767E.js +1 -0
  170. package/dist/m/core/{persist-HKHA66IY.js → persist-UKXV5KLA.js} +1 -1
  171. package/dist/m/core/recovery-DRFZRJED.js +1 -0
  172. package/dist/m/core/save-LYY7K6U7.js +1 -0
  173. package/dist/m/core/save-core-MKRPSEEO.js +1 -0
  174. package/dist/m/core/snapshot-NU3YM6GR.js +1 -0
  175. package/dist/m/core/unsaved-warning-7QTKEN7Z.js +1 -0
  176. package/dist/m/events/index-RN2JNGBV.js +1 -0
  177. package/dist/m/internals/index-TGLQINN3.js +1 -0
  178. package/dist/m/lib/cache-bust-MUMFXZK6.js +1 -0
  179. package/dist/m/loader-3BBNZZGM.js +1 -0
  180. package/dist/m/manifest-F449FF98.js +1 -0
  181. package/dist/m/manifest-edit-4396A009.js +1 -0
  182. package/dist/m/manifest.json +2509 -1474
  183. package/dist/m/options/options-EJMS3K24.js +1 -0
  184. package/dist/m/page/editor-6LRB3GE4.js +304 -0
  185. package/dist/m/plugins/ai-edit-UTV7YO2I.js +6 -0
  186. package/dist/m/plugins/{cms-HP3LSTPN.js → cms-LRAOZHT7.js} +9 -9
  187. package/dist/m/plugins/demo-OYO5GCAO.js +1 -0
  188. package/dist/m/plugins/{derive-UAAA4V4S.js → derive-FRE5JJQE.js} +1 -1
  189. package/dist/m/plugins/indicator-4VDXWYTD.js +1 -0
  190. package/dist/m/plugins/live-AD4H6XSL.js +1 -0
  191. package/dist/m/plugins/menu-M5WW7DBF.js +1 -0
  192. package/dist/m/plugins/page-MD3T2ZX3.js +2 -0
  193. package/dist/m/plugins/page-view-PAWVZNFY.js +1 -0
  194. package/dist/m/plugins/people-JCHVPF7P.js +1 -0
  195. package/dist/m/plugins/quickcrop-BQ5YYFCH.js +26 -0
  196. package/dist/m/plugins/{richclay-RC3L2F6X.js → richclay-KLGETK77.js} +2 -2
  197. package/dist/m/plugins/sortable-4S6SQC3D.js +1 -0
  198. package/dist/m/plugins/source-TJXOIOYY.js +1 -0
  199. package/dist/m/plugins/undo-NLPGCJQY.js +1 -0
  200. package/dist/m/plugins/{unsent-HJFLQJ2O.js → unsent-OA4RGBUT.js} +1 -1
  201. package/dist/m/plugins/upgrade-HSUNDNJD.js +1 -0
  202. package/dist/m/plugins/upload-NHGJXZK2.js +1 -0
  203. package/dist/m/plugins/visitor-drafts-BW43DGY3.js +20 -0
  204. package/dist/m/plugins/visitor-drafts-owner-7ODQG7JX.js +1 -0
  205. package/dist/m/plugins/wire-VBWXEXU2.js +1 -0
  206. package/dist/m/reader-core-4W2KYEWQ.js +77 -0
  207. package/dist/m/route/route-62CHXL5B.js +1 -0
  208. package/dist/m/sync/live-sync-MO5DH33W.js +1 -0
  209. package/dist/m/ui/index-IVWN2QC4.js +1 -0
  210. package/dist/m/vendor/sap-core.vendor-RN4ZVY4X.js +6 -0
  211. package/dist/offline-manifest.json +1560 -889
  212. package/dist/page/themes/light-1.css +33 -8
  213. package/dist/server/core.cjs +1554 -311
  214. package/dist/server/offline-runtime.cjs +63 -63
  215. package/dist/server/offline-runtime.mjs +63 -63
  216. package/dist/server/page-compaction-worker.cjs +3710 -0
  217. package/dist/server/rooms.mjs +5 -0
  218. package/docs/guide.md +653 -101
  219. package/entries/sap.js +5 -5
  220. package/package.json +1 -1
  221. package/src/core/admin-contenteditable.js +5 -2
  222. package/src/core/admin-inputs.js +1 -0
  223. package/src/core/admin-onclick.js +2 -1
  224. package/src/core/boot-phase.js +2 -1
  225. package/src/core/conflict-download.js +3 -29
  226. package/src/core/conflict-notice-ui.js +4 -7
  227. package/src/core/download.js +32 -0
  228. package/src/core/host-meta.js +56 -0
  229. package/src/core/is-edit-mode.js +17 -1
  230. package/src/core/mode-key.js +125 -19
  231. package/src/core/mode-support.js +5 -0
  232. package/src/core/mode-transition.js +20 -6
  233. package/src/core/preserve-authored.js +4 -4
  234. package/src/core/recovery.js +121 -33
  235. package/src/core/save-accepted.js +33 -0
  236. package/src/core/save-core.js +111 -32
  237. package/src/core/save-job.js +108 -0
  238. package/src/core/save-prepare.js +53 -0
  239. package/src/core/save-size-notice.js +3 -1
  240. package/src/core/save-slices.js +15 -0
  241. package/src/core/save.js +557 -127
  242. package/src/core/serialize-steps.js +109 -0
  243. package/src/core/snapshot.js +209 -40
  244. package/src/core/source-map.js +83 -38
  245. package/src/core/stale-host-notice.js +1 -0
  246. package/src/core/upgrade-run.js +59 -8
  247. package/src/dom/active-element.js +5 -0
  248. package/src/lib/assets.js +1 -0
  249. package/src/lib/autosave-scheduler.js +3 -4
  250. package/src/lib/slice.js +65 -0
  251. package/src/lib/uimotion.js +774 -0
  252. package/src/lib/unsaved-state.js +2 -2
  253. package/src/live/fast-lane.js +10 -3
  254. package/src/live/local-lane.js +202 -11
  255. package/src/live/ops.js +16 -0
  256. package/src/live/page-compaction.js +162 -0
  257. package/src/live/server-lane.js +1 -0
  258. package/src/live/store.js +11 -3
  259. package/src/loader-logic.js +3 -1
  260. package/src/loader.js +14 -4
  261. package/src/page/adopt-boot.js +2 -1
  262. package/src/page/awareness.js +33 -2
  263. package/src/page/blocks.js +122 -27
  264. package/src/page/board-views.js +2 -16
  265. package/src/page/boot-pack.js +1 -1
  266. package/src/page/chart-tables.js +29 -0
  267. package/src/page/chart.js +411 -72
  268. package/src/page/checklist.js +10 -135
  269. package/src/page/checkpoint-proof.js +295 -0
  270. package/src/page/chrome.js +257 -40
  271. package/src/page/clipboard-shape.js +126 -0
  272. package/src/page/document-title-dom.js +12 -0
  273. package/src/page/document-title-runtime.js +15 -1
  274. package/src/page/document-title.js +4 -1
  275. package/src/page/drag.js +33 -3
  276. package/src/page/editor.js +207 -31
  277. package/src/page/emoji-data.js +162 -0
  278. package/src/page/export-assets.js +357 -0
  279. package/src/page/export-html.js +209 -0
  280. package/src/page/export-markdown.js +361 -0
  281. package/src/page/features/board.js +12 -3
  282. package/src/page/features/chart.js +11 -0
  283. package/src/page/features/checklist.js +428 -0
  284. package/src/page/features/dates.js +180 -0
  285. package/src/page/features/emoji.js +187 -0
  286. package/src/page/features/export-html.js +189 -0
  287. package/src/page/features/export-markdown.js +169 -0
  288. package/src/page/features/import-markdown.js +349 -0
  289. package/src/page/features/media.js +61 -5
  290. package/src/page/features/mentions.js +188 -0
  291. package/src/page/features/registry.js +24 -1
  292. package/src/page/features/table.js +375 -85
  293. package/src/page/features/title-cover.js +331 -0
  294. package/src/page/features/title-icon.js +213 -0
  295. package/src/page/features/toc.js +87 -0
  296. package/src/page/format-command.js +33 -0
  297. package/src/page/format-gate.js +68 -18
  298. package/src/page/format-host.js +71 -0
  299. package/src/page/format-native-commands.js +158 -0
  300. package/src/page/format-native.js +42 -0
  301. package/src/page/image-actions.js +64 -0
  302. package/src/page/import-markdown.js +262 -0
  303. package/src/page/inline.js +32 -8
  304. package/src/page/items.js +141 -11
  305. package/src/page/markdown.js +30 -2
  306. package/src/page/media.js +35 -119
  307. package/src/page/mention-picker.js +99 -0
  308. package/src/page/merge.js +1 -1
  309. package/src/page/placeholder.js +14 -1
  310. package/src/page/projection.js +156 -25
  311. package/src/page/recover.js +10 -12
  312. package/src/page/recovery-ui.js +464 -0
  313. package/src/page/rich/chart.js +63 -7
  314. package/src/page/save-projection.js +67 -0
  315. package/src/page/save-states.js +14 -4
  316. package/src/page/schema.js +52 -3
  317. package/src/page/table-paste.js +3 -1
  318. package/src/page/table-style.js +4 -4
  319. package/src/page/table.js +44 -2
  320. package/src/page/themes/content.css +25 -1
  321. package/src/page/themes/light-1.css +33 -8
  322. package/src/page/themes/light-1.source.css +8 -7
  323. package/src/page/toc-link.js +31 -0
  324. package/src/page/toc.js +5 -0
  325. package/src/page/view-hooks.js +58 -0
  326. package/src/page/view.js +13 -0
  327. package/src/page/ybind/binding.js +116 -6
  328. package/src/page/ybind/bridge.js +187 -20
  329. package/src/page/ybind/containment.js +162 -0
  330. package/src/page/ybind/doc.js +17 -9
  331. package/src/page/ybind/file-debt.js +63 -0
  332. package/src/page/ybind/layout.js +7 -2
  333. package/src/page/ybind/marks.js +2 -1
  334. package/src/page/ybind/moves.js +5 -4
  335. package/src/page/ybind/origins.js +106 -4
  336. package/src/page/ybind/parts.js +8 -1
  337. package/src/page/ybind/provider.js +125 -18
  338. package/src/page/ybind/recovery-proof.js +32 -9
  339. package/src/page/ybind/recovery-replay.js +905 -4
  340. package/src/page/ybind/recovery.js +174 -45
  341. package/src/page/ybind/table.js +67 -11
  342. package/src/page/ybind/walk-delta.js +258 -0
  343. package/src/page/ybind/walk.js +54 -29
  344. package/src/page/ybind/writer.js +1 -1
  345. package/src/plugins/ai-edit.js +13 -9
  346. package/src/plugins/indicator-chip.js +91 -0
  347. package/src/plugins/indicator.js +13 -80
  348. package/src/plugins/live.js +126 -15
  349. package/src/plugins/menu/actions.js +196 -0
  350. package/src/plugins/menu/people.js +279 -0
  351. package/src/plugins/menu/placement.js +121 -0
  352. package/src/plugins/menu/preferences.js +9 -0
  353. package/src/plugins/menu/seo.js +316 -397
  354. package/src/plugins/menu/style.js +171 -0
  355. package/src/plugins/menu/variants.js +296 -0
  356. package/src/plugins/menu.js +186 -183
  357. package/src/plugins/page-view.js +3 -2
  358. package/src/plugins/page.js +362 -43
  359. package/src/plugins/sortable.js +8 -1
  360. package/src/plugins/source.js +6 -0
  361. package/src/plugins/upgrade.js +51 -17
  362. package/src/plugins/upload-ui.js +12 -17
  363. package/src/plugins/visitor-drafts/bottom-ui.js +12 -4
  364. package/src/plugins/visitor-drafts/intro-style.js +7 -2
  365. package/src/plugins/visitor-drafts/intro.js +7 -4
  366. package/src/plugins/visitor-drafts/owner-chip.js +8 -12
  367. package/src/plugins/visitor-drafts/prompt.js +11 -9
  368. package/src/plugins/visitor-drafts/source.js +4 -3
  369. package/src/plugins/visitor-drafts/store.js +138 -9
  370. package/src/plugins/visitor-drafts/ui-memory.js +2 -2
  371. package/src/plugins/visitor-drafts-owner.js +4 -6
  372. package/src/plugins/visitor-drafts.js +5 -3
  373. package/src/recovery/store.js +1 -1
  374. package/src/route/route.js +4 -0
  375. package/src/server/checkpoint/index.js +2 -2
  376. package/src/server/rooms/index.js +5 -1
  377. package/src/server/rooms/live-data-rooms.js +302 -50
  378. package/src/server/rooms/page-compaction-worker.js +12 -0
  379. package/src/server/rooms/page-compactor.js +92 -0
  380. package/src/server/rooms/page-room-conformance.js +461 -0
  381. package/src/source/parse-steps.js +94 -0
  382. package/src/source/session.js +233 -57
  383. package/src/sync/editing-sender.js +12 -0
  384. package/src/sync/live-sync-edit.js +22 -2
  385. package/src/sync/live-sync.js +150 -23
  386. package/src/sync/page-relay.js +52 -0
  387. package/src/sync/presence-store.js +44 -4
  388. package/src/sync/presence.js +6 -3
  389. package/src/sync/saved-stream.js +28 -14
  390. package/src/ui/bevel-controls.js +1 -0
  391. package/src/ui/bevel-dialog.js +5 -2
  392. package/src/ui/editor-ui.js +77 -0
  393. package/src/ui/page-colour.js +281 -0
  394. package/src/ui/toast.js +16 -7
  395. package/src/vendor/hyper-html-api-upgrade.vendor.js +2 -2
  396. package/src/vendor/hyper-undo.vendor.js +1 -1
  397. package/src/vendor/hypercms.vendor.js +9 -9
  398. package/src/vendor/parse5.vendor.js +2 -2
  399. package/src/vendor/sap-core.vendor.js +5 -5
  400. package/dist/m/attrs/refetch-on-save-NWPPXOCZ.js +0 -1
  401. package/dist/m/attrs/save-freeze-FUP4Q4X3.js +0 -1
  402. package/dist/m/c-2M73252O.js +0 -1
  403. package/dist/m/c-2SPVQSHC.js +0 -1
  404. package/dist/m/c-35NBGMZB.js +0 -1
  405. package/dist/m/c-3IQRECYS.js +0 -1
  406. package/dist/m/c-4B6H4G5V.js +0 -1
  407. package/dist/m/c-4FFHZM32.js +0 -1
  408. package/dist/m/c-4YSCRICO.js +0 -1
  409. package/dist/m/c-54RCDCBU.js +0 -1
  410. package/dist/m/c-5M4YEKCX.js +0 -4
  411. package/dist/m/c-5V3MOVJT.js +0 -1
  412. package/dist/m/c-66O32MV3.js +0 -28
  413. package/dist/m/c-6HMB24EV.js +0 -1
  414. package/dist/m/c-7O6AFR65.js +0 -1
  415. package/dist/m/c-ANQTJ3B5.js +0 -2
  416. package/dist/m/c-AYVOREBE.js +0 -1
  417. package/dist/m/c-B2ZXPOS3.js +0 -3
  418. package/dist/m/c-BMIZKMPV.js +0 -1
  419. package/dist/m/c-BTDI4Y23.js +0 -1
  420. package/dist/m/c-CJZSLMVQ.js +0 -1
  421. package/dist/m/c-DBE6ORSI.js +0 -1
  422. package/dist/m/c-EDHUR4MX.js +0 -1
  423. package/dist/m/c-EY6UOM54.js +0 -1
  424. package/dist/m/c-F3CKJTJS.js +0 -1
  425. package/dist/m/c-F7Y6FLPY.js +0 -1
  426. package/dist/m/c-FA4DZVTC.js +0 -1
  427. package/dist/m/c-G2BUZITR.js +0 -1
  428. package/dist/m/c-GB3JTV6E.js +0 -1
  429. package/dist/m/c-GBGWXTX4.js +0 -1
  430. package/dist/m/c-GHBCCVG4.js +0 -1
  431. package/dist/m/c-GJAEGGXY.js +0 -1
  432. package/dist/m/c-GOWBDM6J.js +0 -1
  433. package/dist/m/c-IB52R237.js +0 -1
  434. package/dist/m/c-IKWNE4R4.js +0 -1
  435. package/dist/m/c-IU3IYEU6.js +0 -1
  436. package/dist/m/c-IZ2EBRAJ.js +0 -1
  437. package/dist/m/c-KR4UW4KW.js +0 -1
  438. package/dist/m/c-KY3VJGUA.js +0 -8
  439. package/dist/m/c-LFPHCXY3.js +0 -1
  440. package/dist/m/c-LRPUO2MX.js +0 -1
  441. package/dist/m/c-LXENEBV7.js +0 -1
  442. package/dist/m/c-NMJRXKPC.js +0 -8
  443. package/dist/m/c-OIBUTDXI.js +0 -1
  444. package/dist/m/c-PPOSCAQD.js +0 -1
  445. package/dist/m/c-QIX5BJYN.js +0 -1
  446. package/dist/m/c-QQHEX6HA.js +0 -1
  447. package/dist/m/c-R7RMANJI.js +0 -9
  448. package/dist/m/c-RI4NT75Y.js +0 -1
  449. package/dist/m/c-RM7J7BV2.js +0 -1
  450. package/dist/m/c-RUJKSUQW.js +0 -1
  451. package/dist/m/c-SGCCC4FW.js +0 -25
  452. package/dist/m/c-T4VO4OCB.js +0 -1
  453. package/dist/m/c-TQEMVJCS.js +0 -1
  454. package/dist/m/c-TR6RMDQ7.js +0 -3
  455. package/dist/m/c-UKHTLWUW.js +0 -1
  456. package/dist/m/c-UNN7LWCT.js +0 -1
  457. package/dist/m/c-UXBMRDZB.js +0 -235
  458. package/dist/m/c-V7PZZRG7.js +0 -1
  459. package/dist/m/c-VL52ADDR.js +0 -1
  460. package/dist/m/c-WNYBLIOZ.js +0 -1
  461. package/dist/m/c-WWDBYXLK.js +0 -1
  462. package/dist/m/c-XNNW2CWK.js +0 -1
  463. package/dist/m/c-Y6USGTS5.js +0 -5
  464. package/dist/m/c-YG2NJYS6.js +0 -135
  465. package/dist/m/c-Z4VRC7GU.js +0 -7
  466. package/dist/m/c-Z6K52OLP.js +0 -19
  467. package/dist/m/c-ZDY2MDAA.js +0 -21
  468. package/dist/m/c-ZUCOKOHT.js +0 -1
  469. package/dist/m/core/admin-attrs-VGNLAUDK.js +0 -1
  470. package/dist/m/core/autosave-E4PEFPZ6.js +0 -1
  471. package/dist/m/core/conflict-notice-VQ6Y64PH.js +0 -1
  472. package/dist/m/core/host-permission-XN3K2IW3.js +0 -1
  473. package/dist/m/core/is-edit-mode-JXHDVGUL.js +0 -1
  474. package/dist/m/core/recovery-TBBSICE2.js +0 -1
  475. package/dist/m/core/save-WUCHTQBE.js +0 -1
  476. package/dist/m/core/save-core-FJVHT5M3.js +0 -1
  477. package/dist/m/core/snapshot-F3SWDZMM.js +0 -1
  478. package/dist/m/core/unsaved-warning-STKBHE6G.js +0 -1
  479. package/dist/m/events/index-23DPTUT4.js +0 -1
  480. package/dist/m/internals/index-WOVAP3RU.js +0 -1
  481. package/dist/m/lib/cache-bust-CGWT6ZJI.js +0 -1
  482. package/dist/m/loader-HXX6YNH5.js +0 -1
  483. package/dist/m/manifest-F22DEDAC.js +0 -1
  484. package/dist/m/manifest-edit-C3C7376B.js +0 -1
  485. package/dist/m/options/options-2LH76JQ3.js +0 -1
  486. package/dist/m/page/editor-XUTB2HB2.js +0 -189
  487. package/dist/m/plugins/ai-edit-ZQ4CGWIP.js +0 -6
  488. package/dist/m/plugins/demo-ZIBFAA3R.js +0 -1
  489. package/dist/m/plugins/indicator-PV4YW2ID.js +0 -1
  490. package/dist/m/plugins/live-NUTTXSBS.js +0 -1
  491. package/dist/m/plugins/menu-HCKO3DSP.js +0 -138
  492. package/dist/m/plugins/page-KSUH7G6J.js +0 -2
  493. package/dist/m/plugins/page-view-W73OW7WI.js +0 -1
  494. package/dist/m/plugins/people-AJJ32YCG.js +0 -1
  495. package/dist/m/plugins/quickcrop-QNY3PKLD.js +0 -26
  496. package/dist/m/plugins/sortable-YRMQX3ZU.js +0 -1
  497. package/dist/m/plugins/source-KHK5UUSK.js +0 -1
  498. package/dist/m/plugins/undo-OF2L3CXU.js +0 -1
  499. package/dist/m/plugins/upgrade-ZNYODP5Y.js +0 -1
  500. package/dist/m/plugins/upload-XSGNILUY.js +0 -1
  501. package/dist/m/plugins/visitor-drafts-XK5GW55Q.js +0 -21
  502. package/dist/m/plugins/visitor-drafts-owner-KSSH75EV.js +0 -1
  503. package/dist/m/plugins/wire-ZWVWKF76.js +0 -1
  504. package/dist/m/reader-core-ILWLXVMP.js +0 -68
  505. package/dist/m/route/route-KOCZSEGN.js +0 -1
  506. package/dist/m/sync/live-sync-4AUVXVJU.js +0 -1
  507. package/dist/m/ui/index-EVHKMKBL.js +0 -1
  508. package/dist/m/vendor/sap-core.vendor-A7BMUYZT.js +0 -6
  509. /package/dist/m/{c-FILLTJA7.js → c-QTTJYJMA.js} +0 -0
  510. /package/dist/m/plugins/{quickcrop-QNY3PKLD.js.LEGAL.txt → quickcrop-BQ5YYFCH.js.LEGAL.txt} +0 -0
  511. /package/dist/m/plugins/{richclay-RC3L2F6X.js.LEGAL.txt → richclay-KLGETK77.js.LEGAL.txt} +0 -0
package/entries/sap.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // GENERATED — do not edit. Vendored from sapjs/dist/sap.min.js via sapjs
2
2
  // `npm run copy-to-clayjs`. Edit the sapjs source and re-run.
3
3
  (function () {
4
- var Sap=(()=>{var Ht=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var Tn=Object.getOwnPropertyNames;var Nn=Object.prototype.hasOwnProperty;var Ln=(t,e)=>{for(var r in e)Ht(t,r,{get:e[r],enumerable:!0})},Rn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Tn(e))!Nn.call(t,o)&&o!==r&&Ht(t,o,{get:()=>e[o],enumerable:!(n=_n(e,o))||n.enumerable});return t};var Cn=t=>Rn(Ht({},"__esModule",{value:!0}),t);var Nr={};Ln(Nr,{Sap:()=>jt,default:()=>Tr,mount:()=>$r,mountAll:()=>kn,runtime:()=>_r});function se(t){let e=!1,r=new Set,n=[];function o(u){u&&(n.push(u),n.length>8&&n.shift())}function i(u,E){if(o(E),u._broken){if(E==="mutation")return;p(u)}r.add(u),!e&&(e=!0,queueMicrotask(s))}function s(){e=!1;let u=[...r];r.clear();for(let E of u)g(E)}function g(u,E=!1){if(!(u._broken||u.halted)){if(u._passes=(u._passes||0)+1,u._passes>50){u._broken=!0,u._breakerRing=n.slice(),t(u,{breaker:!0});return}u._resetArmed||(u._resetArmed=!0,setTimeout(()=>{u._passes=0,u._resetArmed=!1},0)),t(u,E?{full:!0}:{})}}function b(u,E){o(E),u._broken&&p(u),g(u,!0)}function p(u){u._broken=!1,u._passes=0}return{schedule:i,runNow:b,rearm:p,ring:n}}var Vt={E01:{slug:"foreign-dialect",behavior:"HALT"},E02:{slug:"moustaches-in-text",behavior:"HALT"},E04:{slug:"duplicate-declaration",behavior:"HALT"},E05:{slug:"reserved-name",behavior:"HALT"},E06:{slug:"global-html-name",behavior:"HALT"},E07:{slug:"calc-cycle",behavior:"ERR"},E08:{slug:"expression-syntax",behavior:"HALT"},E10:{slug:"orphan-item",behavior:"HALT"},E12:{slug:"unknown-state-key",behavior:"ERR"},E15:{slug:"write-to-undeclared-key",behavior:"ERR"},E16:{slug:"write-to-computed-field",behavior:"ERR"},E17:{slug:"unresolvable-action-target",behavior:"HALT"},E18:{slug:"paint-on-form-control",behavior:"HALT"},E20:{slug:"bind-on-non-control",behavior:"HALT"},E22:{slug:"format-type",behavior:"ERR"},E24:{slug:"runtime-expression-throw",behavior:"ERR"},E26:{slug:"circuit-breaker",behavior:"HALT"},E30:{slug:"attr-on-bound-control",behavior:"HALT"},E31:{slug:"password-without-transient",behavior:"HALT"},E32:{slug:"file-bind",behavior:"HALT"},E33:{slug:"dialog-state-open",behavior:"HALT"},E34:{slug:"transient-persist-collision",behavior:"HALT"},E35:{slug:"presence-state-misuse",behavior:"HALT"},E40:{slug:"each-not-array",behavior:"ERR"},E41:{slug:"each-bad-key",behavior:"ERR"},E42:{slug:"each-template",behavior:"ERR"},E43:{slug:"bind-in-each-row",behavior:"ERR"},E50:{slug:"needs-full-sapjs",behavior:"HALT"},W03:{slug:"unknown-colon-attribute",behavior:"WARN"},W04:{slug:"expression-in-when",behavior:"WARN"},W30:{slug:"nonzero-mount-writes",behavior:"WARN"},W31:{slug:"detail-dialog-saved-open",behavior:"WARN"}},et=["disabled","readonly","required","checked","selected","multiple","open","inert","autofocus","novalidate","hidden"],ft=new Set(["title","style","hidden","lang","dir","translate","class","id","nonce","autofocus","tabindex","contenteditable","spellcheck","draggable","role","slot","part","name","value","type","itemscope","itemtype","itemid","itemprop","itemref"]),xt=new Set(["sap","scope","items","item","template","bind","calc","text","show","attr","set","trigger","move","sort","detail","each","effect","invalid","confirm","transient","default","persist","sortable","editmode"]);function St(t){if(!t||t.nodeType!==1)return"?";if(t.id)return`${t.tagName.toLowerCase()}#${t.id}`;let e=[],r=t,n=0;for(;r&&r.nodeType===1&&n<4;){let o=r.tagName.toLowerCase();if(r.hasAttribute("sap"))o+="[sap]";else if(r.parentElement){let i=0,s=0;for(let g=r.parentElement.firstElementChild;g;g=g.nextElementSibling)g.tagName===r.tagName&&(i++,g===r&&(s=i));i>1&&(o+=`:nth-of-type(${s})`)}if(e.unshift(o),r.hasAttribute("sap"))break;r=r.parentElement,n++}return e.join(" > ")}var tt=class{constructor(e){this.appName=e,this.errors=[],this.warnings=[],this.halted=!1,this.haltReason=null}block(e,r,n={}){let o=(Vt[e]||{}).slug||"error",i={code:e,slug:o,el:St(r),attr:n.attr||null,expr:n.expr||null,key:n.key||null,problem:n.problem||"",didYouMean:n.didYouMean||null,fix:n.fix||null,phase:n.phase||"runtime"},s=[`
4
+ var Sap=(()=>{var Qt=Object.defineProperty;var Bn=Object.getOwnPropertyDescriptor;var jn=Object.getOwnPropertyNames;var qn=Object.prototype.hasOwnProperty;var zn=(t,e)=>{for(var r in e)Qt(t,r,{get:e[r],enumerable:!0})},Hn=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jn(e))!qn.call(t,o)&&o!==r&&Qt(t,o,{get:()=>e[o],enumerable:!(n=Bn(e,o))||n.enumerable});return t};var Vn=t=>Hn(Qt({},"__esModule",{value:!0}),t);var qr={};zn(qr,{Sap:()=>Kt,default:()=>jr,mount:()=>Wr,mountAll:()=>In,runtime:()=>Br});function be(t){let e=!1,r=new Set,n=[];function o(u){u&&(n.push(u),n.length>8&&n.shift())}function i(u,E){if(o(E),u._broken){if(E==="mutation")return;d(u)}r.add(u),!e&&(e=!0,queueMicrotask(s))}function s(){e=!1;let u=[...r];r.clear();for(let E of u)b(E)}function b(u,E=!1){if(!(u._broken||u.halted)){if(u._passes=(u._passes||0)+1,u._passes>50){u._broken=!0,u._breakerRing=n.slice(),t(u,{breaker:!0});return}u._resetArmed||(u._resetArmed=!0,setTimeout(()=>{u._passes=0,u._resetArmed=!1},0)),t(u,E?{full:!0}:{})}}function m(u,E){o(E),u._broken&&d(u),b(u,!0)}function d(u){u._broken=!1,u._passes=0}return{schedule:i,runNow:m,rearm:d,ring:n}}var Zt={E01:{slug:"foreign-dialect",behavior:"HALT"},E02:{slug:"moustaches-in-text",behavior:"HALT"},E04:{slug:"duplicate-declaration",behavior:"HALT"},E05:{slug:"reserved-name",behavior:"HALT"},E06:{slug:"global-html-name",behavior:"HALT"},E07:{slug:"calc-cycle",behavior:"ERR"},E08:{slug:"expression-syntax",behavior:"HALT"},E10:{slug:"orphan-item",behavior:"HALT"},E12:{slug:"unknown-state-key",behavior:"ERR"},E15:{slug:"write-to-undeclared-key",behavior:"ERR"},E16:{slug:"write-to-computed-field",behavior:"ERR"},E17:{slug:"unresolvable-action-target",behavior:"HALT"},E18:{slug:"paint-on-form-control",behavior:"HALT"},E20:{slug:"bind-on-non-control",behavior:"HALT"},E22:{slug:"format-type",behavior:"ERR"},E24:{slug:"runtime-expression-throw",behavior:"ERR"},E26:{slug:"circuit-breaker",behavior:"HALT"},E30:{slug:"attr-on-bound-control",behavior:"HALT"},E31:{slug:"password-without-transient",behavior:"HALT"},E32:{slug:"file-bind",behavior:"HALT"},E33:{slug:"dialog-state-open",behavior:"HALT"},E34:{slug:"transient-persist-collision",behavior:"HALT"},E35:{slug:"presence-state-misuse",behavior:"HALT"},E40:{slug:"each-not-array",behavior:"ERR"},E41:{slug:"each-bad-key",behavior:"ERR"},E42:{slug:"each-template",behavior:"ERR"},E43:{slug:"bind-in-each-row",behavior:"ERR"},E50:{slug:"needs-full-sapjs",behavior:"HALT"},W03:{slug:"unknown-colon-attribute",behavior:"WARN"},W04:{slug:"expression-in-when",behavior:"WARN"},W30:{slug:"nonzero-mount-writes",behavior:"WARN"},W31:{slug:"detail-dialog-saved-open",behavior:"WARN"}},ut=["disabled","readonly","required","checked","selected","multiple","open","inert","autofocus","novalidate","hidden"],gt=new Set(["title","style","hidden","lang","dir","translate","class","id","nonce","autofocus","tabindex","contenteditable","spellcheck","draggable","role","slot","part","name","value","type","itemscope","itemtype","itemid","itemprop","itemref"]),Nt=new Set(["sap","scope","items","item","template","bind","calc","text","show","attr","set","trigger","move","sort","detail","each","effect","invalid","confirm","transient","default","persist","sortable","editmode"]);function Rt(t){if(!t||t.nodeType!==1)return"?";if(t.id)return`${t.tagName.toLowerCase()}#${t.id}`;let e=[],r=t,n=0;for(;r&&r.nodeType===1&&n<4;){let o=r.tagName.toLowerCase();if(r.hasAttribute("sap"))o+="[sap]";else if(r.parentElement){let i=0,s=0;for(let b=r.parentElement.firstElementChild;b;b=b.nextElementSibling)b.tagName===r.tagName&&(i++,b===r&&(s=i));i>1&&(o+=`:nth-of-type(${s})`)}if(e.unshift(o),r.hasAttribute("sap"))break;r=r.parentElement,n++}return e.join(" > ")}var at=class{constructor(e){this.appName=e,this.errors=[],this.warnings=[],this.halted=!1,this.haltReason=null}block(e,r,n={}){let o=(Zt[e]||{}).slug||"error",i={code:e,slug:o,el:Rt(r),attr:n.attr||null,expr:n.expr||null,key:n.key||null,problem:n.problem||"",didYouMean:n.didYouMean||null,fix:n.fix||null,phase:n.phase||"runtime"},s=[`
5
5
  `+(e[0]==="W"?"sap \u26A0 ":"sap \u2717 ")+e+" "+o];return s.push(` at ${i.el}${i.attr?` \u2014 ${i.attr}="${i.expr??""}"`:""}`),i.problem&&s.push(` problem: ${i.problem}`),i.didYouMean&&s.push(` did you mean: ${i.didYouMean}`),i.fix&&s.push(` fix: ${i.fix}`),(e[0]==="W"?console.warn:console.error)(s.join(`
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 B(t,e){t&&t.getAttribute("sap-error")!==e&&t.setAttribute("sap-error",e)}function nt(t){t&&t.hasAttribute("sap-error")&&t.removeAttribute("sap-error")}function lt(t,e){let r=null,n=3;for(let o of e){let i=Dn(t,o);i<n&&(n=i,r=o)}return r}function Dn(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 Fn=new Set(et),Mn={readonly:"readOnly",novalidate:"noValidate"},Pn=0,ae=new WeakMap;function kt(t,e="sap"){let r=t.getAttribute("data-id");if(r)return r;if(t.id)return t.id;let n=ae.get(t);return n||(n=`${e}-${(Pn++).toString(36)}`,ae.set(t,n)),n}function ue(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 In(t){return t.hasAttribute("scope")||t.hasAttribute("items")||t.hasAttribute("detail")||t.hasAttribute("each")}function On(t){return t.tagName==="TEMPLATE"||t.hasAttribute("sap-ignore")||t.hasAttribute("template")||t.hasAttribute("cms-template")}function W(t,e){for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(On(n))return;let o=In(n);if(e(n,o),!o)for(let i=n.firstElementChild;i;i=i.nextElementSibling)r(i)}}function P(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 Y(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 $t(t){let e=t;for(;e;){if(e.hasAttribute("detail")||e.hasAttribute("item"))return e;e=e.parentElement}return null}function dt(t){let e=t;for(;e;){if(e.hasAttribute("detail"))return e;e=e.parentElement}return null}function X(t,e){if(t.hasAttribute("item")&&t.getAttribute("bind")===e)return t;let r=null;return W(t,n=>{!r&&n.getAttribute("bind")===e&&(r=n)}),r}function rt(t,e){let r=null;return W(t,n=>{!r&&n.getAttribute("items")===e&&(r=n)}),r}function ot(t,e){return!t||t.nodeType!==1||!t.hasAttribute("item")?!1:X(t,e)||rt(t,e)?!0:D(t.getAttribute("state")||"").some(r=>r.name===e)}function ce(t){let e=t&&t.$el;return e&&e.nodeType===1&&e.isConnected&&e.hasAttribute("item")?e:null}function _t(t){return!!t.closest("form[trigger-add]")}function H(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 zt(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 Tt(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.hasAttribute("item")&&e.hasAttribute("template"))return e;return zt(t.closest("[sap]"),t.getAttribute("items"))}function D(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(":"),g=s[0],b="string",p=!1;for(let x of s.slice(1))x==="num"?b="num":x==="bool"?b="bool":x==="presence"?b="presence":x==="transient"&&(p=!0);let u=g,E=u.startsWith("data-")&&u.length>5?u.slice(5).replace(/-([a-z])/g,(x,$)=>$.toUpperCase()):u;e.push({name:E,attr:u,type:b,default:o,transient:p})}return e}function G(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 Ut(t,e){return e==="bool"?t?"true":"false":t==null?"":String(t)}function Gt(t,e){return Fn.has(e)&&typeof t[Mn[e]||e]=="boolean"}function K(t,e){return e.type==="presence"||e.type!=="num"&&Gt(t,e.attr||e.name)}function pt(t){return t.default!=null?t.default:t.type==="num"?"0":t.type==="bool"?"false":""}function fe(t,e){let r=e.attr||e.name;if(K(t,e))return t.hasAttribute(r);let n=t.getAttribute(r);return G(n??pt(e),e.type)}function le(t,e){return K(t,e)?e.default!=null?G(e.default,"bool"):!1:G(pt(e),e.type)}function mt(t,e,r){let n=e.attr||e.name;if(K(t,e)){r?t.hasAttribute(n)||t.setAttribute(n,""):t.hasAttribute(n)&&t.removeAttribute(n);return}t.setAttribute(n,Ut(r,e.type))}function Nt(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=pt(e)),n[e.name]=G(o,e.type)}return t.hasAttribute(r)&&t.removeAttribute(r),n[e.name]}function ht(t,e,r){let n=e.attr||e.name;(t._sapTransient||(t._sapTransient={}))[e.name]=r,t.hasAttribute(n)&&t.removeAttribute(n)}function bt(t,e,r){let n=String(r).split("."),o=n[n.length-1];if(n.length===1){let g=Wn(e,o);return g||(t.getAttribute("items")===o?t:t.querySelector(`[items="${o}"]:not(template)`))}let i=n[n.length-2],s=[...t.querySelectorAll(`[scope="${i}"]`)].find(g=>rt(g,o));return s?rt(s,o):null}function Wn(t,e){let r=P(t);for(;r;){if(r.getAttribute("items")===e)return r;let n=rt(r,e);if(n)return n;r=P(r.parentElement)}return null}function I(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 Lt(t,e){return Array.isArray(t)?e==null?t:t.map(r=>typeof e=="function"?e(r):r?.[e]):[]}function Yt(t,e){return Lt(t,e).reduce((r,n)=>r+I(n),0)}function de(t,e){return Array.isArray(t)?e==null?t.length:t.reduce((r,n)=>r+(e(n)?1:0),0):0}function pe(t,e){let r=Lt(t,e);return r.length?Yt(t,e)/r.length:0}function me(t,e){let r=Lt(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 he(t,e){let r=Lt(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 be(t,e,r){let n=I(t)===1?e:r??e+"s";return`${t} ${n}`}function ge(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 q(t){return typeof t=="number"?t:Number(t)}var it={usd:t=>"$"+q(t).toLocaleString("en-US",{maximumFractionDigits:0}),usd2:t=>"$"+q(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),pct:t=>Math.round(q(t))+"%",pct1:t=>q(t).toFixed(1)+"%",int:t=>Math.round(q(t)).toLocaleString("en-US"),num:t=>q(t).toLocaleString("en-US"),num2:t=>q(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),compact:t=>q(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=q(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}`}},Bn=new Set(["usd","usd2","pct","pct1","int","num","num2","compact","clock"]);function we(t,e){if(!t)return e==null?"":String(e);let r=it[t];if(typeof r!="function"){let n=new Error(`unknown format "${t}"`);throw n.sapCode="E22",n}if(Bn.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 qn=["state","item","el","root","fmt","num","sum","count","avg","min","max","plural","days"],Rt=new Map,ye=/\bstate\.([a-z][a-z0-9_]*)/g,Ae=/\bitem\.([a-z][a-z0-9_]*)/g;function jn(t){let e=new Set,r=new Set,n;for(ye.lastIndex=0;n=ye.exec(t);)e.add(n[1]);for(Ae.lastIndex=0;n=Ae.exec(t);)r.add(n[1]);return{state:e,item:r}}function C(t,e=!1){let r=(e?"!":"")+t,n=Rt.get(r);if(n)return n;Rt.size>512&&Rt.clear();try{let o=e?`"use strict";
7
- ${t}`:`"use strict"; return (${t});`;n={fn:new Function(...qn,o),src:t,statement:e,deps:jn(t),error:null}}catch(o){n={fn:null,src:t,statement:e,deps:{state:new Set,item:new Set},error:o}}return Rt.set(r,n),n}function J(t,e){return O(t,e.state,e.item,e.el??null,e.root)}function O(t,e,r,n,o){if(t.error)throw t.error;return t.fn(e,r,n,o,it,I,Yt,de,pe,me,he,be,ge)}function ve(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 g=n.get(s.name);if(g!==1){if(g===0){let b=[...o.slice(o.indexOf(s.name)),s.name].join(" -> "),p=new Error(`calc: cycle: ${b}`);throw p.sapCode="E07",p.cycle=b,p}n.set(s.name,0),o.push(s.name);for(let b of s.entry.deps.state){let p=e.get(b);p&&p!==s&&i(p)}for(let b of s.entry.deps.item){let p=e.get(b);p&&p!==s&&i(p)}o.pop(),n.set(s.name,1),r.push(s)}}for(let s of t)i(s);return r}var gt={},Q=null,xe=!0,Dt=!1;function Se(){gt={}}function ke(t){let e=Dt;return Q?Xt(Q.takeRecords()):xe&&Hn(),Dt=!!Q&&t.getRootNode()===document,e}function $e(t){Dt=t}function Ft(){Q&&Xt(Q.takeRecords())}function Hn(){if(typeof document>"u"||typeof MutationObserver!="function"){xe=!1;return}Q=new MutationObserver(Xt),Q.observe(document,{attributes:!0,childList:!0,subtree:!0})}function Xt(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&&_e(r)}function _e(t){t._sapPlan&&(t._sapPlan=null);for(let e=t.firstElementChild;e;e=e.nextElementSibling)_e(e)}function V(t){if(!Dt)return Ee(t);let e=t._sapPlan;return e&&e.gen===gt?e:t._sapPlan=Ee(t)}function Ee(t){let e={gen:gt,inert:t.tagName==="TEMPLATE",template:!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;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=D(o);break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:null,entry:C(o)});break;case"show":(e.paints||(e.paints=[])).push({kind:"show",entry:C(o)});break;case"effect":(e.effects||(e.effects=[])).push({entry:C(o,!0)});break;case"invalid":(e.invalids||(e.invalids=[])).push({entry:C(o)});break}continue}let s=n.slice(0,i),g=n.slice(i+1);switch(s){case"calc":(e.calcs||(e.calcs=[])).push({name:g,entry:C(o)});break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:g,entry:C(o)});break;case"attr":(e.paints||(e.paints=[])).push({kind:"attr",arg:g,entry:C(o)});break;case"class":(e.paints||(e.paints=[])).push({kind:"class",arg:g,entry:C(o)});break;case"css":(e.paints||(e.paints=[])).push({kind:"css",arg:g,entry:C(o)});break;case"show-when":case"option":(e.paints||(e.paints=[])).push({kind:"when",match:"show",field:g,values:o.split("|")});break;case"hide-when":(e.paints||(e.paints=[])).push({kind:"when",match:"hide",field:g,values:o.split("|")});break;case"option-not":(e.paints||(e.paints=[])).push({kind:"when",match:"show-not",field:g,values:o.split("|")});break}}return e.boundary=e.scope?"scope":e.items?"items":e.detail?"detail":e.each?"each":null,zn(e)?Vn():e}var Ct=null;function Vn(){return(!Ct||Ct.gen!==gt)&&(Ct=Object.freeze({gen:gt,inert:!1,template:!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})),Ct}function zn(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 Z=new WeakMap,st=null,wt=!1;function Ne(){Z=new WeakMap}function Te(t){for(let e of t){if(e.type==="attributes"){Z.delete(e.target);continue}let r=e.target.nodeType===1?e.target:e.target.parentElement;for(let n=r;n;n=n.parentElement)Z.delete(n);for(let n of e.addedNodes||[])if(n.nodeType===1){Z.delete(n);for(let o of n.querySelectorAll("*"))Z.delete(o)}}}function Le(t){let e=wt;return!st&&typeof MutationObserver=="function"&&(st=new MutationObserver(Te),st.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),st&&Te(st.takeRecords()),wt=!!st&&t.getRootNode()===document,e}function Re(t){wt=t}function Ce(t){let e=Z.get(t);return e||Z.set(t,e={attrs:new Map,hasText:!1,text:""}),e}function De(t,e){if(!wt)return t.getAttribute(e);let r=Ce(t);return r.attrs.has(e)||r.attrs.set(e,t.getAttribute(e)),r.attrs.get(e)}function Fe(t){if(!wt)return t.textContent;let e=Ce(t);return e.hasText||(e.text=t.textContent,e.hasText=!0),e.text}function Me(t){return(t.getAttribute("type")||"text").toLowerCase()}function at(t){let e=t.tagName;if(e==="INPUT"){let r=Me(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 Pe(t,e=t){let r=t.tagName;if(r==="INPUT"){let n=Me(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(`
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
+ ${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 Mt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function R(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 Ie(){let t=R("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var Kt=["clay:mutation-ready","hyperclay:mutation-ready"],Un=["clay:sync-applied","hyperclay:livesync-applied"],Gn=["clay:ready","hyperclay:ready"],Yn=["clay:route"],Xn=["clay:modechange"];function yt(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 Oe(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function Pt(t){let e=R("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function At(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function N(t,{transient:e=!1}={}){if(e)return!0;let r=At();return typeof r?.canWrite!="function"||R("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function We(){let t=R("consent");return typeof t=="function"?t:null}function Be(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=R("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 qe(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let x=!1;for(let $ of t.apps())$.root.isConnected?t.runNow($,"platform"):x=!0;x&&t.pruneDisconnected(),t.remountIfPresent()},r=R("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:yt(document,Un,e),i=yt(document,Yn,e),s=null,g=!1,b=()=>{let x=s;s=null,x&&(x[2](),x[3]())},p=()=>{if(g)return!1;let x=R("undo"),$=At()?.state?.generation;if(s&&s[0]===x&&s[1]===$)return!0;if(b(),!x||typeof x.on!="function")return!1;let _=x.on("undo",e);if(typeof _!="function")return!1;let d=x.on("redo",e);return typeof d!="function"?(_(),!1):(s=[x,$,_,d],!0)};p();let u=[Kt,Gn,Xn].map(x=>yt(document,x,p)),E=R("ready");return E&&typeof E.then=="function"&&E.then(p,()=>{}),()=>{g=!0,typeof n=="function"&&n(),o&&o(),i();for(let x of u)x();b()}}function vt(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 Kn(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 je(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return Kn(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 He(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 Jt(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}Pt(t)||at(t)}function Jn(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function It(t,e){return je(t,e)}function Ve(t,e,r){He(t,e,r),Jt(t)}function M(t){let e=vt(t);return{el:t,kind:e,read(){return je(t,e)},write(r,n={}){He(t,e,r),n.noMirror||Jt(t),n.silent||Jn(t)},mirror(){Jt(t)}}}var z=null,Wt=!1,ut=null;function ze(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 Qn(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(Zn(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=R("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 Zn(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!Ot(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!Ot(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||Ot(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))Ot(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 Ot(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function tr(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 Ue(t){if(z)return z.suppress(t);let e=R("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function Qt(t,e){Wt=!0,z=t,t.subscribe(r=>tr(e,r))}function Zt(t){if(Wt||typeof window>"u"||typeof document>"u")return;let e=R("Mutation");if(e&&typeof e.onAnyChange=="function"){Qt(ze(e),t);return}typeof MutationObserver=="function"&&(Qt(Qn(),t),ut=yt(document,Kt,function(){let n=R("Mutation");n&&(ut(),ut=null,z&&z.teardown(),Wt=!1,Qt(ze(n),t))}))}function te(){if(z)try{z.teardown()}catch{}ut&&typeof document<"u"&&ut(),z=null,Wt=!1,ut=null}var er=new Set(et),U=[],Ye={},Xe={};function Ke(t){U.includes(t)||(U.push(t),t.boundary&&Object.assign(Ye,t.boundary),t.paintKinds&&Object.assign(Xe,t.paintKinds))}function ct(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),B(t.root,"loop");return}e.full&&(Se(),Ne());let r=ke(t.root);try{Ue(()=>nr(t,e))}finally{$e(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function nr(t,e){let r=t.root,n={},o=[],i=[],s=new Set;t.diag.errors=[];let g={root:n,state:n,item:null,ownerEl:r,projection:!1};function b(a,m,y=!1){let v=m.attr||m.name,k=y?De(a,v):a.getAttribute(v);return k==null&&(k=pt(m),i.push({el:a,name:m.name,attr:v,value:Ut(G(k,m.type),m.type)})),G(k,m.type)}function p(a,m,y,v){let k=m.decls;if(!k)return;let L=!!v.item&&!v.projection&&!v.view;for(let T of k){if(T.transient){y[T.name]=Nt(a,T);continue}if(K(a,T)){y[T.name]=a.hasAttribute(T.attr);continue}y[T.name]=b(a,T,L)}}function u(a,m,y){let v=m.bind,k=y.item||y.state,L=vt(a);L==="radio"?(v in k||(k[v]=""),a.checked&&(k[v]=a.value)):L==="leaf"&&y.item&&!y.projection&&!y.view?k[v]=Fe(a):k[v]=It(a,L),m.transient&&(a.removeAttribute("value"),a.removeAttribute("checked"))}function E(a,m,y){if(m.paints)for(let v of m.paints)v.kind==="when"&&s.add(v.field),o.push({def:v,el:a,ctx:y});for(let v of U)v.collect&&v.collect(w,a,m,y)}function x(a,m,y){Object.defineProperty(a,"$key",{value:kt(m,"row"),enumerable:!1}),Object.defineProperty(a,"$index",{value:y,enumerable:!1}),Object.defineProperty(a,"$el",{value:m,enumerable:!1})}function $(a,m,y){let v=V(a);p(a,v,m,y),a._sapScope=m,!y.projection&&v.bind!=null&&u(a,v,y),E(a,v,y),v.items?h(a,m,y):_(a,m,y)}function _(a,m,y){for(let v=a.firstElementChild;v;v=v.nextElementSibling)d(v,m,y)}function d(a,m,y){let v=V(a);if(!v.inert){if(v.boundary){v.boundary==="scope"?A(a,m,y):v.boundary==="items"?(E(a,v,y),h(a,m,y)):Ye[v.boundary](w,a,v,m,y);return}!y.projection&&!y.view&&v.bind!=null&&u(a,v,y),E(a,v,y);for(let k=a.firstElementChild;k;k=k.nextElementSibling)d(k,m,y)}}function A(a,m,y){let v=a.getAttribute("scope"),k={};m[v]=k;let L={root:y.root,state:k,item:null,ownerEl:a,projection:y.projection};$(a,k,L)}function h(a,m,y){let v=a.getAttribute("items"),k=[];m[v]=k,a._sapList=k;let L=0;for(let T=a.firstElementChild;T;T=T.nextElementSibling){let F=V(T);if(!F.item||F.template||T.hasAttribute("cms-template"))continue;let j={};x(j,T,L);let $n={root:y.root,state:y.state,item:j,ownerEl:T,projection:y.projection};$(T,j,$n),k.push(j),L++}}let w={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:b,collectEl:E,walkScope:_};for(let a of U)a.begin&&a.begin(w);let S=e.cacheReads===!1?null:Le(r);try{$(r,n,g)}finally{e.cacheReads!==!1&&Re(S)}if(t.halted)return;for(let a of U)a.afterIntake&&a.afterIntake(w);if(i.length&&s.size)for(let a of i)s.has(a.attr)&&a.el.getAttribute(a.attr)==null&&a.el.setAttribute(a.attr,a.value);for(let a of U)a.compute&&a.compute(w);let f=0;for(let a of U)a.reconcile&&(f+=a.reconcile(w));let c=0,l=f;for(let a of o){let m=or(a,t);a.ctx.view?l+=m:c+=m}for(let a of U)a.afterPaint&&a.afterPaint(w);t._state=n,t._stats={fields:Object.keys(n).filter(a=>typeof n[a]!="function").length,calcs:w.stats.calcs,paints:o.length,lists:w.stats.lists,writes:c,viewWrites:l},t._viewsChanged=l>0,t._lastPass={trigger:e.trigger||"refresh",writes:c},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${c}/${o.length}`)}function rr(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 ee(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 or(t,e){let r=t.def,n=t.el,o=Xe[r.kind];if(o)return o(t,e);if(r.kind==="when")return Ge(r,n,null);try{let i=O(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),s=Ge(r,n,i);return nt(n),s}catch(i){return e.diag.error(i.sapCode==="E22"?"E22":"E24",n,{attr:rr(r),expr:r.entry&&r.entry.src,problem:String(i.message)}),B(n,i.sapCode||"E24"),0}}function Ge(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?we(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=R("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!ee(e,t.field,t.values,!1):t.match==="show-not"?o=ee(e,t.field,t.values,!0):o=ee(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(er.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 ir=new Set(et),Je=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),sr=new Set(["show-when","hide-when","option","option-not"]),ar=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,Qe=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"]),re=[];function Ze(t){re.includes(t)||re.push(t)}function ur(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function ne(t){return t.hasAttribute("bind")}function cr(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 Bt(t,e){let r=!1,n=(s,g,b)=>{e.error(s,g,b),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 cr(t,s=>{let g=new Set;for(let p of re)p(s,n,u=>g.add(u));let b=s.closest&&s.closest("[detail]");for(let p of[...s.attributes]){let u=p.name;if(g.has(u))continue;if(u.includes(":")){let x=u.slice(0,u.indexOf(":"));if(Je.has(x)){if(sr.has(x)&&ar.test(p.value)){let $=u.slice(u.indexOf(":")+1);e.warn("W04",s,{attr:u,expr:p.value,problem:`${x}: compares the "${$}" attribute against a literal value, not a JS expression`,fix:`use show="${p.value}" for an expression, or a literal like ${x}:${$}="overview"`})}}else{let $=lt(x,[...Je]);e.warn("W03",s,{attr:u,problem:`unknown "${x}:" attribute`,didYouMean:$?`${$}:`:null})}}else if(!Qe.has(u)&&!ft.has(u)&&!ir.has(u)&&!/^(data-|aria-|on)/.test(u)&&!(u in s)){let x=lt(u,[...Qe]);x&&e.warn("W03",s,{attr:u,problem:`unknown "${u}" attribute`,didYouMean:x})}u==="attr:hidden"&&e.warn("W03",s,{attr:u,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let E=ne(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"&&ne(s)&&/\b(value|checked)\s*=[^=]/.test(p.value)&&n("E30",s,{attr:u,expr:p.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")&&ur(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 p=D(s.getAttribute("state")),u=new Set;for(let E of p){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),xt.has(E.attr)&&n("E05",s,{attr:"state",problem:`"${E.name}" is a reserved Sap word`}),ft.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 x=Gt(s,E.attr);x&&(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">'}),x&&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&&(x||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(ne(s)){if(s.hasAttribute("-"),s.tagName==="INPUT"){let p=(s.getAttribute("type")||"text").toLowerCase();p==="file"&&n("E32",s,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),p==="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 p=s.getAttribute("contenteditable");!(p!=null&&p!=="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 p=s.parentElement;(!p||!p.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")&&b&&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 p=t.querySelector(`[trigger-add="${s.getAttribute("items")}"]`);!Tt(s)&&!zt(t,s.getAttribute("items"))&&H(s).length===0&&p&&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",B(t,e.haltReason)),!r}var tn="sap-styles",en="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",oe=new WeakSet;function fr(t){if(oe.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(en),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],oe.add(t);return}catch{}if(!t.getElementById(tn)){let n=t.createElement("style");n.id=tn,n.textContent=en,(t.head||t.documentElement).appendChild(n)}oe.add(t)}var lr=0;function nn(){return typeof performance<"u"&&performance.now?performance.now():0}function ie(t){let e=t.id||t.getAttribute("sap")||`app-${lr++}`,r=new tt(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Bt(t,r))return n.halted=!0,n;fr(t.ownerDocument);for(let s of t.querySelectorAll("textarea[data-value]"))Mt(s);let i=nn();return ct(n,{trigger:"mount",full:!0}),n._mountMs=nn()-i,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ie()&&!R("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 rn=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function qt(t){return`${t.tagName.toLowerCase()}[sap]`}function dr(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(rn.test(n.name)){e++;break}for(let r of t.attributes)if(rn.test(r.name)){e++;break}return e}function on(t){function e(g){let b=g._stats||{},p=g.root;return{root:qt(p),fields:b.fields||0,calcs:b.calcs||0,paints:b.paints||0,actions:dr(p),lists:(p.hasAttribute("items")?1:0)+p.querySelectorAll("[items]").length,rows:p.querySelectorAll("[item]:not([template])").length,warnings:g.diag.warnings.length,errors:g.diag.errors.length,mountWrites:g._mountWrites||0,ms:Math.round((g._mountMs||0)*10)/10,passes:g._passes||0,lastPass:g._lastPass||null,ok:g.diag.errors.length===0&&!g.halted}}function r(){let g=t.apps().map(e);return{ok:g.every(b=>b.ok),apps:g}}function n(g){let b=e(g);return b.ok?`sap \u2713 ${b.root} \xB7 fields ${b.fields} \xB7 calcs ${b.calcs} \xB7 paints ${b.paints} \xB7 actions ${b.actions} \xB7 lists ${b.lists} \xB7 rows ${b.rows} \xB7 warnings ${b.warnings} \xB7 mount writes ${b.mountWrites} \xB7 ${b.ms}ms`:`sap \u2717 ${b.root} \xB7 errors ${b.errors} \xB7 warnings ${b.warnings} \xB7 ${b.ms}ms`}function o(){for(let g of t.apps()){let b=n(g);g.diag.errors.length||g.halted?console.error(b):console.log(b)}}function i(){let g=[],b=[];for(let p of t.apps())g.push(...p.diag.errors),b.push(...p.diag.warnings);return{ok:g.length===0,errors:g,warnings:b,counts:{errors:g.length,warnings:b.length}}}function s(g){let b=g===void 0?!0:!!g;for(let p of t.apps())p._debug=b;return console.log(`sap debug ${b?"on":"off"} \u2014 per-pass headers will ${b?"":"no longer "}log`),b}return{status:r,report:i,debug:s,greenLine:n,printGreenLines:o,REGISTRY:Vt}}var sn="0.6.0";function an({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],i=se(ct);function s(l){let a=l;for(;a;){if(a.nodeType===1&&a.hasAttribute&&a.hasAttribute("sap"))return n.get(a)||null;a=a.parentNode&&a.parentNode.host?a.parentNode.host:a.parentElement}return null}function g(){for(let l=o.length-1;l>=0;l--){let a=o[l];a.root.isConnected||(n.delete(a.root),o.splice(l,1))}}function b(l,a){if(l.moveBefore)try{l.moveBefore(a,null);return}catch{}l.appendChild(a)}function p(l,a){let m=a.parentElement;if(m){if(m.moveBefore)try{m.moveBefore(l,a);return}catch{}m.insertBefore(l,a)}}let u={apps:()=>o.slice(),appFor:s,isRegistered:l=>n.has(l),pruneDisconnected:g,schedule:(l,a)=>i.schedule(l,a),runNow:(l,a)=>i.runNow(l,a),moveInto:b,placeBefore:p,remountIfPresent:()=>S()},E=t(u),x=on(u),$=r?r(u,x):{},_=!1,d=!1,A=null;function h(){_||(_=!0,e(u,E,document),A=qe(u))}function w(){let l=R("derived");l&&typeof l.mounted=="function"&&l.mounted()}function S(l=document){if(d)return[];h(),Zt(u);let a=l.querySelectorAll("[sap]"),m=[];for(let y of a){if(n.has(y))continue;let v=ie(y);n.set(y,v),o.push(v),m.push(v)}for(let y of m){let v=x.greenLine(y);y.diag.errors.length||y.halted?console.error(v):console.log(v)}return w(),m}function f(l){if(d)return null;if(h(),Zt(u),!l)return S();let a=typeof l=="string"?document.querySelector(l):l;if(!a)return null;if(n.has(a))return n.get(a);let m=ie(a);n.set(a,m),o.push(m);let y=x.greenLine(m);return m.diag.errors.length||m.halted?console.error(y):console.log(y),m}let c=E.Sap;return c.version=sn,c.refresh=function(){for(let a of o)a.root.isConnected&&i.runNow(a,"refresh")},c.batch=Be,c.status=x.status,c.report=x.report,c.why=$.why,c.debug=x.debug,c.doctor=$.doctor,c.greenLine=x.greenLine,c.formats=it,c.serializeControlToAttributes=at,c.finalizeControlForSave=Pe,c.rehydrateControlFromAttributes=Mt,c.mount=f,c.config=function(a={}){return a.formats&&Object.assign(it,a.formats),c},c._registry=n,c._reset=function(){n.clear(),o.length=0,te()},c.unmount=function(){d=!0,n.clear(),o.length=0,te(),typeof A=="function"&&A()},{Sap:c,mountAll:S,mount:f,runtime:u}}function un(t){if(typeof document>"u")return;let e=()=>Oe(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}var pr=["for","form","list","headers","popovertarget","commandfor","anchor","aria-activedescendant","aria-controls","aria-describedby","aria-details","aria-errormessage","aria-flowto","aria-labelledby","aria-owns"];function mr(t,e){let r=null;return W(t,n=>{!r&&n.getAttribute("scope")===e&&(r=n)}),r}function cn(t,e,r){let n=P(t)||e;for(;n;){for(let o of D(n.getAttribute("state")||""))if(o.name===r)return{el:n,decl:o};if(n.hasAttribute("sap"))break;n=P(n.parentElement)}return null}function hr(t){return typeof t=="number"?"num":typeof t=="boolean"?"bool":"string"}function fn(t){function e(d){let A=t.appFor(d);if(!A)return null;let h=Y(d),w=h&&h._sapEachItem&&h._sapEachItem.$el;if(w&&w.isConnected)return{ctxEl:w,appRec:A,isRow:!0};let S=dt(d);if(S)return S._sapDetailRow?{ctxEl:S._sapDetailRow,appRec:A,isRow:!0}:{ctxEl:P(S.parentElement)||A.root,appRec:A,isRow:!1};let f=$t(d);if(f&&f.hasAttribute("item"))return{ctxEl:f,appRec:A,isRow:!0};let c=P(d)||A.root;return{ctxEl:c,appRec:A,isRow:c.hasAttribute("item")}}function r(d){let A=typeof d=="string"?document.querySelector(d):d;if(!A||A.nodeType!==1)return null;let h=e(A);return h?_(h.ctxEl,h.appRec,h.isRow):null}function n(d,A){let h=Y(d);if(!h)return r(d);let w=t.appFor(d),S=h._sapEachItem&&h._sapEachItem.$el;if(S&&S.nodeType===1&&S.hasAttribute("item")&&ot(S,A))return S.isConnected?_(S,w,!0):null;let f=h.parentElement&&h.parentElement._sapDrawnEl;return!f||!f.isConnected?null:_(f,w,f.hasAttribute("item"))}function o(d,A,h){let w=X(d,h);if(w)return M(w).read();let S=rt(d,h);if(S)return H(S).map(a=>_(a,A,!0));let f=mr(d,h);if(f)return _(f,A,!1);let c=cn(d,A.root,h);if(c)return c.decl.transient?Nt(c.el,c.decl):fe(c.el,c.decl);let l=d._sapScope;return l?l[h]:void 0}function i(d,A,h,w,S){w.transient?ht(d,w,h):mt(d,w,h),t.schedule(S,"set:"+A)}function s(d,A){let h=new Set,w=P(d)||A;for(;w;){for(let S of D(w.getAttribute("state")||""))h.add(S.name);if(w.hasAttribute("sap"))break;w=P(w.parentElement)}return W(d,S=>{let f=S.getAttribute("bind");f&&h.add(f)}),h}function g(d,A,h,w){let S=X(d,h);if(S){if(!N(S))return;M(S).write(w);return}let f=d;for(;f;){for(let L of f.attributes)if(L.name==="calc:"+h){A.diag.error("E16",f,{attr:"calc:"+h,problem:`"${h}" is a computed field; computed fields are read-only`});return}if(f.hasAttribute("sap"))break;f=f.parentElement}let c=cn(d,A.root,h);if(c){if(!N(c.el,{transient:c.decl.transient}))return;i(c.el,h,w,c.decl,A);return}let l=s(d,A.root);l.delete(h);let a=h.length>=4?lt(h,[...l]):null;if(a){A.diag.error("E12",d,{key:h,problem:`unknown state key "${h}"`,didYouMean:a});return}if(xt.has(h)||ft.has(h)){A.diag.error("E15",d,{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 m=A.root;if(!N(m))return;let y=hr(w),v=m.getAttribute("state")||"",k=y==="string"?h:`${h}:${y}`;m.setAttribute("state",v?`${v} ${k}`:k),i(m,h,w,{name:h,attr:h,type:y,transient:!1},A)}function b(d){let A=d.ownerDocument,h=new Map,w=(S,f)=>{let c=ue(A),l=S.getAttribute(f);l&&f==="id"&&h.set(l,c),S.setAttribute(f,c)};d.querySelectorAll("[id]").forEach(S=>w(S,"id")),d.querySelectorAll("[data-id]").forEach(S=>w(S,"data-id")),d.querySelectorAll("[sap-error]").forEach(S=>S.removeAttribute("sap-error")),d.removeAttribute("sap-error"),d.hasAttribute("data-id")?(d.removeAttribute("id"),w(d,"data-id")):w(d,"id");for(let S of[d,...d.querySelectorAll("*")])for(let f of pr){let c=S.getAttribute(f);if(c==null)continue;let l=c.split(/\s+/).map(a=>h.get(a)||a).join(" ");l!==c&&S.setAttribute(f,l)}}function p(d,A,h){let w=bt(A.root,d,h);if(!w)return A.diag.error("E17",d,{problem:`cannot resolve a list named "${h}" from here`}),null;if(!N(w))return null;let S=Tt(w);if(!S)return A.diag.error("E17",w,{problem:`items="${h}" has no [item template] to clone`}),null;let f=w.ownerDocument.importNode(S,!0);return f.removeAttribute("template"),b(f),w.appendChild(f),t.schedule(A,"trigger-add:"+h),_(f,A,!0)}function u(d,A){let h=D(d.getAttribute("state")||""),w=!0;W(d,S=>{S.hasAttribute("bind")&&!N(S)&&(w=!1)});for(let S of h)N(d,{transient:S.transient})||(w=!1);if(w){W(d,S=>{if(S.hasAttribute("bind")){let f=M(S),c=S.getAttribute("default");f.kind==="checkbox"||f.kind==="radio"?f.write(c!=null?c===""||c==="true"||S.value===c:S.hasAttribute("checked")):f.write(c??(S.getAttribute("value")||""))}});for(let S of h){let f=le(d,S);S.transient?ht(d,S,f):mt(d,S,f)}t.schedule(A,"trigger-reset")}}function E(d,A){if(!d.isConnected)throw new Error("stale row handle: $remove() on a removed row");N(d)&&(d.remove(),t.schedule(A,"trigger-remove"))}function x(d,A,h){if(!d.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=bt(A.root,d,h)),!w){A.diag.error("E17",d,{problem:`$move() cannot resolve target "${h}"`});return}!N(d)||!N(w)||(t.moveInto(w,d),t.schedule(A,"trigger-move"))}function $(d){let A=d.parentElement;return A?H(A).indexOf(d):-1}function _(d,A,h){let w={get $el(){return d},get $key(){return kt(d,h?"row":"scope")},get $index(){return $(d)},$add(f){return p(d,A,f)},$reset(){return u(d,A),S},$remove(){E(d,A)},$move(f){x(d,A,f)},get $appRec(){return A}},S=new Proxy(w,{get(f,c){return typeof c=="symbol"||c[0]==="$"?f[c]:o(d,A,c)},set(f,c,l){return typeof c=="string"&&c[0]==="$"?(f[c]=l,!0):(g(d,A,c,l),!0)},has(f,c){return typeof c=="string"&&c[0]==="$"?c in f:o(d,A,c)!==void 0}});return S}return{Sap:r,contextElFor:e,readField:o,writeField:g,makeProxy:_,writeTargetFor:n}}var br=["trigger-add","trigger-remove","trigger-reset"];function gr(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:")||br.includes(r))return!0}return!1}function wr(t,e){let r=t,n=e.parentElement;for(;r&&r!==n;){if(r.nodeType===1&&gr(r)&&!(r.tagName==="FORM"&&r.hasAttribute("trigger-add")))return r;r=r.parentElement}return null}function ln(t,e){let{Sap:r}=e;function n(f,c){let l=null,a=Y(f),m=dt(f);if(a)l=a._sapEachItem??null;else if(m&&m._sapDetailRow)l=m._sapDetailRow._sapScope||null;else{let k=$t(f);k&&k.hasAttribute("item")&&(l=k._sapScope||null)}return{state:(P(f)||c.root)._sapScope||c._state||{},item:l,el:f,root:c._state||{}}}function o(f,c,l){if(!f.hasAttribute("confirm")){l();return}let a=f.getAttribute("confirm"),m=a,y=C(a);if(!y.error)try{let F=J(y,n(f,c));(typeof F=="string"||typeof F=="number")&&(m=String(F))}catch{}let v=At(),k=()=>{At()===v&&l()},L=We();if(!L){window.confirm(m)&&k();return}if(f._sapGatePending)return;f._sapGatePending=!0;let T=()=>{f._sapGatePending=!1};L(m,()=>{T(),k()}).catch(T)}function i(f,c){for(let l of f.attributes){if(!l.name.startsWith("set:"))continue;let a=l.name.slice(4),m=C(l.value);if(m.error){c.diag.error("E08",f,{attr:l.name,expr:l.value,problem:String(m.error.message)});continue}let y;try{y=J(m,n(f,c))}catch(k){c.diag.error("E24",f,{attr:l.name,expr:l.value,problem:String(k.message)});continue}let v=e.writeTargetFor(f,a);v&&(v[a]=y)}}function s(f){let c=Y(f);if(!c)return f.closest("[item]");let l=c._sapEachItem&&c._sapEachItem.$el;return l&&l.nodeType===1&&l.hasAttribute("item")?l:null}function g(f,c){let l=s(f);if(!l||!N(l)||!N(l.parentElement))return;let a=H(l.parentElement),m=a.indexOf(l);c==="up"&&m>0?t.placeBefore(l,a[m-1]):c==="down"&&m<a.length-1&&t.placeBefore(a[m+1],l)}function b(f,c,l){if(c)return bt(l.root,f,c);let a=f;for(;a;){if(a.hasAttribute&&a.hasAttribute("items"))return a;a=a.parentElement}let m=P(f)||l.root,y=[];return W(m,v=>{v.hasAttribute("items")&&y.push(v)}),y[0]||null}function p(f,c){let l=f==null||f==="",a=c==null||c==="";if(l&&a)return 0;if(l)return 1;if(a)return-1;let m=Number(f),y=Number(c);return!Number.isNaN(m)&&!Number.isNaN(y)?m-y:String(f)<String(c)?-1:String(f)>String(c)?1:0}function u(f,c,l,a){let m=b(f,l,a);if(!m){a.diag.error("E17",f,{attr:"sort:"+c,problem:`no items list resolvable for sort:${c}`});return}if(!N(m))return;let y=H(m),v=F=>F._sapScope?F._sapScope[c]:void 0,k=[...y].sort((F,j)=>p(v(F),v(j))),T=k.every((F,j)=>F===y[j])?[...k].reverse():k;for(let F of T)t.moveInto(m,F);t.schedule(a,"sort:"+c)}function E(f){if(!f||f.hidden)return;let c=f.querySelector("[bind]:not([type=hidden]), [contenteditable]");c&&typeof c.focus=="function"&&c.focus()}function x(f,c){o(f,c,()=>{let l=r(f);for(let a of[...f.attributes]){let m=a.name;if(m==="trigger-remove")l&&l.$remove();else if(m==="trigger-reset")l&&l.$reset();else if(m==="trigger-add"){let y=l&&l.$add(a.value);y&&E(y.$el)}else m==="move:up"?(g(f,"up"),t.schedule(c,"move:up")):m==="move:down"?(g(f,"down"),t.schedule(c,"move:down")):m.startsWith("move:to")?l&&l.$move(a.value):m.startsWith("sort:")&&u(f,m.slice(5),a.value,c)}[...f.attributes].some(a=>a.name.startsWith("set:"))&&i(f,c)})}function $(f){let c=f.target;if(!c||c.nodeType!==1)return;let l=t.appFor(c);if(!l)return;let a=wr(c,l.root);a&&x(a,l)}function _(f){let c=M(f),l=f.getAttribute("default");c.kind==="checkbox"?c.write(l===""||l==="true"):c.write(l??"")}function d(f,c,l){let a=r(f);if(!a)return;let m=a.$add(l);if(!m)return;let y=[];W(f,v=>{v.hasAttribute("bind")&&y.push(v)});for(let v of y){if(v.type==="radio"&&!v.checked)continue;let k=v.getAttribute("bind"),L=X(m.$el,k);L?M(L).write(M(v).read()):ot(m.$el,k)&&(m[k]=M(v).read())}y.forEach(_),y.length?typeof y[0].focus=="function"&&y[0].focus():E(m.$el)}function A(f){let c=f.target;if(!c||!c.hasAttribute||!c.hasAttribute("trigger-add"))return;let l=t.appFor(c);l&&(f.preventDefault(),o(c,l,()=>d(c,l,c.getAttribute("trigger-add"))))}function h(f){let c=f.target;if(!c||c.tagName!=="DIALOG"||!c.hasAttribute("detail"))return;if(c._sapEngineClose){c._sapEngineClose=!1;return}if(c.open)return;let l=/^[\w.]+\s+by\s+state\.(\w+)\s*$/.exec(c.getAttribute("detail")||""),a=t.appFor(c);if(!l||!a)return;let m=D(c.getAttribute("state")||"").find(v=>v.name===l[1]);if(m){if(!N(c,{transient:m.transient}))return;m.transient?ht(c,m,""):mt(c,m,""),t.schedule(a,"close");return}let y=r(c.parentElement);y&&y[l[1]]!==""&&(y[l[1]]="")}function w(f,c){let l=f.hasAttribute("bind")&&_t(f);if(!l&&f.hasAttribute("bind")&&Y(f)){let m=f.getAttribute("bind"),y=f._sapViewBind?e.writeTargetFor(f,m):null;return y&&(y[m]=M(f).read()),!0}let a=dt(f);if(a&&a._sapDetailRow&&f.hasAttribute("bind")&&!l){let m=a._sapDetailRow,y=f.getAttribute("bind"),v=X(m,y);if(v&&v!==f)return N(v)&&M(v).write(M(f).read()),!0;if(!v&&D(m.getAttribute("state")||"").some(k=>k.name===y))return e.writeField(m,c,y,M(f).read()),!0}return!1}function S(f=document){f.addEventListener("click",$),f.addEventListener("submit",A),f.addEventListener("close",h,!0)}return{install:S,routeInput:w}}function dn(t){let e=[];function r(b){let p=b.target;if(!p||p.nodeType!==1)return;let u=t.appFor(p);if(u){p.hasAttribute("persist")&&!Pt(p)&&N(p)&&at(p);for(let E of e)if(E(p,u))return;t.schedule(u,b.type+" "+(p.id||p.tagName.toLowerCase()))}}function n(b){let p=b.target,u=t.appFor(p);u&&[...p.querySelectorAll("[bind]")].every(E=>N(E))&&setTimeout(()=>{p.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(b){let p=t.appFor(b.target);p&&t.schedule(p,"toggle")}function i(b){let p=b.detail||{};for(let u of[p.from,p.to,b.target]){if(!u||u.nodeType!==1)continue;let E=t.appFor(u);E&&t.schedule(E,"sorted")}}function s(b){if(b.key!=="ArrowUp"&&b.key!=="ArrowDown")return;let p=b.target;if(!p||p.nodeType!==1||p.tagName!=="INPUT"||!p.hasAttribute("bind")||!p.hasAttribute("step"))return;let u=(p.getAttribute("type")||"text").toLowerCase();if(u!=="text"&&u!=="tel"&&u!=="search"||!t.appFor(p)||!N(p))return;b.preventDefault();let x=I(p.getAttribute("step"))||1,$=b.key==="ArrowUp"?1:-1,_=I(p.value)+x*(b.shiftKey?10:1)*$,d=p.getAttribute("min"),A=p.getAttribute("max");d!==null&&d!==""&&_<I(d)&&(_=I(d)),A!==null&&A!==""&&_>I(A)&&(_=I(A)),M(p).write(String(Number(_.toFixed(2))))}function g(b=document){b.addEventListener("reset",n),b.addEventListener("toggle",o,!0),b.addEventListener("input",r),b.addEventListener("change",r),b.addEventListener("clay:sorted",i),b.addEventListener("keydown",s)}return{install:g,addRouter:b=>e.push(b)}}function pn(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 mn(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 hn(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 g=[`sap why <${s.tagName.toLowerCase()}> \u2014 ${St(s)}`],b=[...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 b)g.push(` ${u.name}="${u.value}"`);let p=s;for(;p&&!p._sapScope;)p=p.parentElement;if(p&&p._sapScope){let u=p._sapScope,E=i?[i]:Object.keys(u);g.push(" reads:");for(let x of E){let $=u[x];typeof $!="function"&&g.push(` ${x} = ${JSON.stringify(Array.isArray($)?`[${$.length} rows]`:$)}`)}}return g.push(" serialization: textContent and value/checked attributes save with the file; reads live from properties"),console.log(g.join(`
10
- `)),null}function n(){let o=[],i=0;for(let u of t.apps()){let E=u.root,x=qt(E);i++;let $=new tt(u.name);Bt(E,$);for(let w of $.errors)o.push({code:w.code,severity:"error",message:`${x}: ${w.code} ${w.slug} at ${w.el}`});for(let w of $.warnings)o.push({code:w.code,severity:"warn",message:`${x}: ${w.code} ${w.slug} at ${w.el}`});i++,ct(u,{trigger:"doctor-dryrun"});let _=u._stats?u._stats.writes:0;_>0&&o.push({code:"W30",severity:"warn",message:`${x}: dry recompute wrote ${_} cells on a quiet page; an element is stale or non-idempotent`}),i++;let d=mn(E).map(w=>w.src).join(" \0 "),A=[];for(let w of[E,...E.querySelectorAll("[state]")])for(let S of D(w.getAttribute("state")||""))A.push(S.name);for(let w of A)new RegExp(`(state|item)\\.${w}\\b`).test(d)||o.push({code:"I33",severity:"info",message:`${x}: 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,S]of h)S>1&&o.push({code:"W32",severity:"warn",message:`${x}: duplicate id "${w}" (${S} elements) \u2014 clone/edit collision`});i++;for(let w of mn(E))w.src.length>120&&o.push({code:"I33",severity:"info",message:`${x}: ${w.attr} expression is ${w.src.length} chars; consider a calc: field`});i++;for(let w of E.querySelectorAll("[text], [text\\:num]")){let S=w.textContent||"";/\.\d{5,}/.test(S)&&o.push({code:"I33",severity:"info",message:`${x}: ${St(w)} paints >4 decimals; consider text:FMT`})}}let s=o.filter(u=>u.severity==="error").length,g=o.filter(u=>u.severity==="warn").length,b=o.filter(u=>u.severity==="info").length;console.log(`sap doctor \xB7 ${t.apps().map(u=>qt(u.root)).join(", ")} \xB7 errors ${s} \xB7 warnings ${g} \xB7 info ${b} \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 yr(t,e){let r=String(t).split("."),n=i=>{for(let s of r){if(i==null)return;i=Array.isArray(i)?i.flatMap(g=>g&&g[s]!=null?g[s]:[]):i[s]}return i},o=n(e.state);return o===void 0?n(e.root):o}function Ar(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],g=i[2].trim(),b=yr(s,n),p;try{p=J(C(g),{state:r,item:n.item,el:e,root:n.root})}catch{p=void 0}let u=Array.isArray(b)&&p!=null?b.find(x=>x&&typeof x=="object"&&x.$el&&String(x.$key)===String(p)):null;if(e._sapDetailRow=u?u.$el:null,e.tagName==="DIALOG"){let x=u?String(u.$key):null;if(x!==e._sapDetailKey&&(e._sapDetailKey=x,e._sapDismissed=!1),!u){e._sapOpenedFor=null,e.open&&typeof e.close=="function"&&(e._sapEngineClose=!0,e.close());return}e.open?e._sapOpenedFor=x:(e._sapOpenedFor===x&&(e._sapDismissed=!0),e._sapOpenedFor=null,!e._sapDismissed&&e.isConnected&&typeof e.showModal=="function"&&(e.hidden&&(e.hidden=!1),e.showModal(),e._sapOpenedFor=x))}else{if(!u){e.hidden||(e.hidden=!0);return}e.hidden&&(e.hidden=!1)}Ft();let E={root:n.root,state:r,item:u,ownerEl:u.$el,projection:!0};t.collectEl(e,V(e),E),t.walkScope(e,u,E)}var bn={name:"detail",begin(t){t.deferredDetails=[]},boundary:{detail(t,e,r,n,o){for(let i of D(e.getAttribute("state")||""))i.name in n||(n[i.name]=K(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];Ar(t,r,n,o)}}};function gn(t){let e=0,r=t;for(;r&&!(r.hasAttribute&&r.hasAttribute("sap"));)r=r.parentElement,e++;return e}var wn={name:"calc",begin(t){t.calcs=[]},collect(t,e,r,n){if(!r.calcs)return;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)=>gn(i.ownerEl)-gn(o.ownerEl));for(let o of n){let i;try{i=ve(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]=O(s.entry,s.ctx.state,s.ctx.item,s.el,s.ctx.root),nt(s.el)}catch(g){s.owner[s.name]=void 0,e.diag.error("E24",s.el,{attr:"calc:"+s.name,expr:s.entry.src,problem:String(g.message)}),B(s.el,g.sapCode||"E24")}}t.stats.calcs=t.calcs.length,t.stats.lists=r.size}};function vr(t,e,r){let n=r.nextSibling;if(e.isConnected&&t.moveBefore)try{t.moveBefore(e,n);return}catch{}t.insertBefore(e,n)}function Er(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 xr(t,e,r){let n=t.app;e._sapDrawnEl=Er(t.root,e,r.state);let o=null;for(let d=e.firstElementChild;d;d=d.nextElementSibling)if(d.tagName==="TEMPLATE"){o=d;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"),g;try{g=J(C(s),{state:r.state,item:r.item,el:e,root:r.root})}catch(d){return n.diag.error("E24",e,{attr:"each",expr:s,problem:String(d.message)}),0}if(!Array.isArray(g))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 b=C(e.getAttribute("key")||"item.$key"),p=[],u=new Set;for(let d of g){let A;try{A=O(b,r.state,d,e,r.root)}catch{A=void 0}let h=A==null?"":String(A);if(h===""||u.has(h))return n.diag.error("E41",e,{attr:"key",expr:b.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),p.push(h)}let E=e._sapEach||new Map,x=new Map,$=0,_=o;p.forEach((d,A)=>{let h=E.get(d);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,$++}h.getAttribute("data-key")!==d&&h.setAttribute("data-key",d),_.nextElementSibling!==h&&(vr(e,h,_),$++),h._sapEachItem=g[A],x.set(d,h),_=h});for(let[d,A]of E)x.get(d)!==A&&A.parentElement===e&&(A.remove(),$++);return e._sapEach=x,Ft(),p.forEach((d,A)=>{let h=x.get(d),w={root:r.root,state:r.state,item:g[A],ownerEl:h,projection:!1,view:!0};t.collectEl(h,V(h),w),t.walkScope(h,{},w)}),$}var yn={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+=xr(t,t.eachList[r].el,t.eachList[r].ctx);return e}};function Sr(t,e){try{O(t.def.entry,t.ctx.state,t.ctx.item,t.el,t.ctx.root),nt(t.el)}catch(r){e.diag.error("E24",t.el,{attr:"effect",expr:t.def.entry&&t.def.entry.src,problem:String(r.message)}),B(t.el,"E24")}}var An={name:"effect",begin(t){t.effects=[]},collect(t,e,r,n){if(r.effects)for(let o of r.effects)t.effects.push({def:o,el:e,ctx:n})},afterPaint(t){for(let e of t.effects)Sr(e,t.app)}};function kr(t){let e="";try{let r=O(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 vn={name:"validation",begin(t){t.invalids=[]},collect(t,e,r,n){if(r.invalids)for(let o of r.invalids)t.invalids.push({def:o,el:e,ctx:n})},afterPaint(t){for(let e of t.invalids)kr(e)}};function En(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=vt(t),n=It(t,r),o=e??"";return String(n)!==String(o)?(Ve(t,r,o),1):0}var xn={name:"projection",collect(t,e,r,n){if(!(r.bind!=null&&(n.view||n.projection)&&!_t(e)))return;let o=r.bind,i=t.paints;n.view?ot(ce(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 En(t.el,r[e.field])}return En(t.el,t.ctx.item?t.ctx.item[e.field]:"")}}};function Sn(){for(let t of[bn,wn,yn,An,vn,xn])Ke(t)}Sn();Ze((t,e,r)=>{for(let n of t.attributes){let o=pn(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:jt,mountAll:kn,mount:$r,runtime:_r}=an({createAccessor:fn,debugExtras:hn,installInput(t,e,r){let n=dn(t),o=ln(t,e);n.addRouter(o.routeInput),n.install(r),o.install(r)}}),Et=typeof window<"u"?window.Sap:null;Et&&Et!==jt&&Et.core&&typeof Et.unmount=="function"&&Et.unmount();un(kn);typeof window<"u"&&(window.Sap=jt);var Tr=jt;return Cn(Nr);})();
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.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
+ `)),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;
13
13
  window.clay = window.clay || {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panphora/clayjs",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "type": "module",
5
5
  "description": "clayjs: malleable documents. Save lifecycle for self-saving HTML.",
6
6
  "license": "MIT-0",
@@ -1,13 +1,16 @@
1
1
  import { isEditMode, isOwner } from "./is-edit-mode.js";
2
2
  import onDomReady from "../lib/dom-ready.js";
3
- import { addDocumentTransform } from "./snapshot.js";
3
+ import { addDocumentTransform, originalSnapshotNode } from "./snapshot.js";
4
4
  import { authoredAttr, canonicalContentEditable, captureAuthored, restoreAuthoredOrder } from "./preserve-authored.js";
5
5
 
6
6
  export const SELECTOR = '[editmode\\:contenteditable]';
7
7
 
8
8
  export function disableContentEditableBeforeSave () {
9
9
  addDocumentTransform(docElem => {
10
- docElem.querySelectorAll(SELECTOR).forEach(canonicalContentEditable);
10
+ docElem.querySelectorAll(SELECTOR).forEach(el => {
11
+ canonicalContentEditable(el);
12
+ restoreAuthoredOrder(el, originalSnapshotNode(el) ?? el);
13
+ });
11
14
  });
12
15
  }
13
16
 
@@ -16,6 +16,7 @@ export function disableAdminInputsBeforeSave() {
16
16
  const live = originalSnapshotNode(input);
17
17
  const spelled = live ? authoredAttr(live, name) : null;
18
18
  input.setAttribute(name, spelled === null ? '' : spelled);
19
+ restoreAuthoredOrder(input, live ?? input);
19
20
  });
20
21
  }
21
22
  });
@@ -1,6 +1,6 @@
1
1
  import { isEditMode, isOwner } from "./is-edit-mode.js";
2
2
  import onDomReady from "../lib/dom-ready.js";
3
- import { addDocumentTransform } from "./snapshot.js";
3
+ import { addDocumentTransform, originalSnapshotNode } from "./snapshot.js";
4
4
  import { restoreAuthoredOrder } from "./preserve-authored.js";
5
5
 
6
6
  export const SELECTOR = '[editmode\\:onclick]';
@@ -16,6 +16,7 @@ export function disableOnClickBeforeSave () {
16
16
  if (originalValue === null) return;
17
17
  resource.setAttribute("inert-onclick", originalValue);
18
18
  resource.removeAttribute("onclick");
19
+ restoreAuthoredOrder(resource, originalSnapshotNode(resource) ?? resource);
19
20
  });
20
21
  });
21
22
  }
@@ -3,4 +3,5 @@
3
3
  // engine's first pass has painted the page, then releases it (loader.js,
4
4
  // mountDerivedEngine). Every other page, and any test that imports save.js
5
5
  // directly, never sets the hold.
6
- export const bootPhase = { holdSettle: false };
6
+ // servedHash: the fragment the page was served with, read at this module's evaluation.
7
+ export const bootPhase = { holdSettle: false, servedHash: typeof window === "undefined" ? "" : window.location.hash };
@@ -1,5 +1,8 @@
1
1
  import { serializeRecoveryClone, captureRecoveryPage } from "./snapshot.js";
2
2
  import { rowOf } from "./conflict-presentation.js";
3
+ import { documentName, downloadHtml } from "./download.js";
4
+
5
+ export { documentName, downloadHtml };
3
6
 
4
7
  // Download my copy: one file, openable in a browser as the page this tab had, with
5
8
  // the replaced edits listed in a JSON block for anyone (or any tool) putting them
@@ -12,14 +15,6 @@ function stamp(d = new Date()) {
12
15
  return `${d.getFullYear()}${p(d.getMonth() + 1)}${p(d.getDate())}-${p(d.getHours())}${p(d.getMinutes())}${p(d.getSeconds())}`;
13
16
  }
14
17
 
15
- export function documentName(pathname = location.pathname) {
16
- const last = pathname.split("/").filter(Boolean).pop();
17
- if (!last) return pathname.endsWith("/") || pathname === "" ? "index" : "page";
18
- let name = last;
19
- try { name = decodeURIComponent(last); } catch {}
20
- return name.replace(/\.(html?|htmlclay)$/i, "") || "page";
21
- }
22
-
23
18
  function embed(html, data) {
24
19
  const json = JSON.stringify(data).replace(/</g, "\\u003c");
25
20
  const block = `<script type="application/json" id="clay-lost-edits" clay="no-save">${json}</script>`;
@@ -67,27 +62,6 @@ export function buildRecovery(records, { refused = false } = {}) {
67
62
  };
68
63
  }
69
64
 
70
- export function downloadHtml({ html, name }) {
71
- let url = null;
72
- try {
73
- url = URL.createObjectURL(new Blob([html], { type: "text/html" }));
74
- const a = document.createElement("a");
75
- a.setAttribute("clay", "no-save no-watch no-snapshot");
76
- a.href = url;
77
- a.download = name;
78
- a.style.setProperty("display", "none", "important");
79
- document.body.appendChild(a);
80
- a.click();
81
- a.remove();
82
- // Revoked late: Safari cancels a download whose URL goes away too soon.
83
- setTimeout(() => URL.revokeObjectURL(url), 40000);
84
- return true;
85
- } catch (err) {
86
- console.error("clayjs: could not build the download", err);
87
- if (url) URL.revokeObjectURL(url);
88
- return false;
89
- }
90
- }
91
65
 
92
66
  // The review panel's own copy: the page a reload kept, when there is one, with every
93
67
  // stored row it drew listed beside it as JSON. The rows are already plain, so nothing
@@ -6,7 +6,7 @@ import { set, make } from "../lib/hostile-css.js";
6
6
  import { isSaveConflicted } from "./save.js";
7
7
  import { gateCaptureToken } from "../lib/dirty-gate.js";
8
8
  import { reloadAfterDiscard } from "./unsaved-warning.js";
9
- import { bevelButton, bevelIconButton, bevelSurface, bevelWell, bevelText, protectIcon, RUNTIME_ONLY } from "../ui/bevel-controls.js";
9
+ import { bevelButton, bevelIconButton, bevelSurface, bevelWell, bevelText, protectIcon, paintLook, RUNTIME_ONLY } from "../ui/bevel-controls.js";
10
10
  import { TOKENS, FONT_SANS, FONT_MONO, GLYPHS } from "../ui/bevel.js";
11
11
 
12
12
  // One notice for everything this tab holds that the page no longer shows: edits
@@ -114,11 +114,6 @@ function key(node, name) {
114
114
  return node;
115
115
  }
116
116
 
117
- function schemeOf() {
118
- const s = getComputedStyle(document.documentElement).colorScheme;
119
- return s === "light" || s === "dark" ? s : "light dark";
120
- }
121
-
122
117
  // A phone keyboard shrinks the visual viewport but leaves fixed elements pinned to
123
118
  // the layout viewport, which parks a bottom-anchored bar behind the keyboard at the
124
119
  // exact moment somebody is typing. Lift it by the difference instead.
@@ -185,7 +180,6 @@ function render() {
185
180
  wellEl = null;
186
181
  panelEl = null;
187
182
  root.replaceChildren();
188
- set(root, "color-scheme", schemeOf());
189
183
 
190
184
  if (toastText) {
191
185
  root.append(drawToast(toastText));
@@ -202,6 +196,7 @@ function render() {
202
196
  // A request for a control the toast is standing in for waits until the toast goes.
203
197
  if (!toastText) pendingFocus = null;
204
198
  place();
199
+ paintLook(root);
205
200
  }
206
201
 
207
202
  function dot() {
@@ -1082,6 +1077,8 @@ function init() {
1082
1077
  document.addEventListener("clay:undo-kept", onUndoKept, { signal });
1083
1078
  if (ledger()?.size) schedule();
1084
1079
  refreshRecovered();
1080
+ // The undo plugin is attached during boot, after this notice can start: ask again once it is.
1081
+ Promise.resolve(window.clay?.ready).catch(() => {}).then(() => { if (!signal.aborted) refreshRecovered(); });
1085
1082
  }
1086
1083
 
1087
1084
  // The shell (conflict-notice.js) asks for this file only when there is something to
@@ -0,0 +1,32 @@
1
+ // Saving a page as a file the browser downloads. Kept apart from the conflict copy
2
+ // builders so an editor that only offers "download this page" loads none of them.
3
+
4
+ export function documentName(pathname = location.pathname) {
5
+ const last = pathname.split("/").filter(Boolean).pop();
6
+ if (!last) return pathname.endsWith("/") || pathname === "" ? "index" : "page";
7
+ let name = last;
8
+ try { name = decodeURIComponent(last); } catch {}
9
+ return name.replace(/\.(html?|htmlclay)$/i, "") || "page";
10
+ }
11
+
12
+ export function downloadHtml({ html, name, type = "text/html" }) {
13
+ let url = null;
14
+ try {
15
+ url = URL.createObjectURL(new Blob([html], { type }));
16
+ const a = document.createElement("a");
17
+ a.setAttribute("clay", "no-save no-watch no-snapshot");
18
+ a.href = url;
19
+ a.download = name;
20
+ a.style.setProperty("display", "none", "important");
21
+ document.body.appendChild(a);
22
+ a.click();
23
+ a.remove();
24
+ // Revoked late: Safari cancels a download whose URL goes away too soon.
25
+ setTimeout(() => URL.revokeObjectURL(url), 40000);
26
+ return true;
27
+ } catch (err) {
28
+ console.error("clayjs: could not build the download", err);
29
+ if (url) URL.revokeObjectURL(url);
30
+ return false;
31
+ }
32
+ }