@panphora/clayjs 1.20.0 → 1.21.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.
@@ -3,7 +3,9 @@
3
3
  // The surface and muted ink below, per scheme, for ui/page-colour.js's tint.
4
4
  export const MENU_SURFACE = { light: [0xFF, 0xFC, 0xF6], dark: [0x1A, 0x1D, 0x2C], mutedLight: [0x6B, 0x59, 0x42], mutedDark: [0xA3, 0xA9, 0xC2] };
5
5
 
6
- export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
6
+ // The parts of the look a page may replace, through <style clay-menu-skin="1">. Everything
7
+ // else below stays: layout, hidden, focus rings, touch targets and reduced motion.
8
+ export const MENU_BASE = `.clay-menu-dock, .clay-menu-spots, .clay-seo {
7
9
  --bevel-font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
8
10
  --bevel-font-serif: Newsreader, Georgia, "Times New Roman", serif;
9
11
  --bevel-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
@@ -40,19 +42,11 @@ export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
40
42
  text-size-adjust: 100%;
41
43
  }
42
44
 
43
- /* The dock: the roster (when a page opts in) and the capsule, fixed in one corner. */
44
- .clay-menu-dock { position: fixed; z-index: 2147482000; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.4; }
45
- .clay-menu-dock[data-corner$="left"] { right: auto; left: max(12px, env(safe-area-inset-left)); flex-direction: row-reverse; }
46
- .clay-menu-dock[data-corner^="bottom"] { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
45
+ .clay-menu-dock { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 1.4; }
46
+ .clay-menu-dock[data-embedded] { position: relative; display: inline-flex; }
47
47
  .clay-menu-dock[hidden], .clay-menu-spots[hidden], .clay-menu-dock [hidden], .clay-seo [hidden] { display: none !important; }
48
48
 
49
- .clay-menu { box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 4px 0 2px; border: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-shadow); user-select: none; -webkit-user-select: none; }
50
- .clay-menu-dock[data-dragging] .clay-menu { border-color: var(--bevel-brass); cursor: grabbing; }
51
-
52
- .clay-menu-grip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 28px; margin: 0; padding: 0; border: 0; background: none; color: var(--bevel-faint); cursor: grab; touch-action: none; }
53
- .clay-menu-grip::before { content: ""; position: absolute; inset: -8px -2px -8px -10px; }
54
- .clay-menu-grip:hover { color: var(--bevel-ink-2); }
55
- .clay-menu-grip svg { display: block; width: 6px; height: 12px; fill: currentColor; }
49
+ .clay-menu { box-sizing: border-box; display: inline-flex; align-items: center; gap: 2px; user-select: none; -webkit-user-select: none; }
56
50
 
57
51
  .clay-menu-edit { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 28px; margin: 0; padding: 0 8px 0 5px; border: 0; background: none; font: 500 13px/1 var(--bevel-font-sans); color: var(--bevel-ink); cursor: pointer; }
58
52
  .clay-menu-edit::before { content: ""; position: absolute; inset: -8px 0; }
@@ -68,12 +62,8 @@ export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
68
62
 
69
63
  .clay-menu-divider { width: 1px; height: 18px; margin: 0 2px; background: var(--bevel-line-2); }
70
64
 
71
- .clay-menu-goo { position: relative; display: inline-grid; place-items: center; box-sizing: border-box; width: 28px; height: 28px; min-height: 0; border-radius: 0; margin: 0; padding: 0; border: 2px solid transparent; background: none; color: var(--bevel-ink); cursor: pointer; }
72
- .clay-menu-goo::before { content: ""; position: absolute; inset: -8px -8px -8px -4px; }
73
- .clay-menu-goo svg { display: block; width: 18px; height: auto; fill: currentColor; }
74
- .clay-menu-goo:hover svg { translate: 0 -1px; }
75
- .clay-menu-goo:active, .clay-menu-goo[aria-expanded="true"] { background: var(--bevel-face-in); border-color: var(--bevel-edge-in) var(--bevel-edge-in-hi) var(--bevel-edge-in-hi) var(--bevel-edge-in); }
76
- .clay-menu-goo:active svg, .clay-menu-goo[aria-expanded="true"] svg { translate: 1px 1px; }
65
+ .clay-menu-goo { position: relative; display: inline-grid; place-items: center; box-sizing: border-box; margin: 0; padding: 0; cursor: pointer; }
66
+ .clay-menu-goo svg { display: block; }
77
67
  .clay-menu-dot { position: absolute; top: -1px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--bevel-brass); box-shadow: 0 0 0 2px var(--bevel-surface); }
78
68
 
79
69
  .clay-menu :focus-visible, .clay-roster:focus-visible { outline: 2px solid var(--bevel-brass); outline-offset: 2px; }
@@ -98,22 +88,24 @@ export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
98
88
  .clay-avatar[data-tone="teal"] { background: var(--bevel-teal-soft); color: var(--bevel-teal); border-color: color-mix(in srgb, var(--bevel-teal) 35%, var(--bevel-teal-soft)); }
99
89
 
100
90
  /* Popovers: the menu, the people panel, the status note. Below the dock, above it in a bottom corner. */
101
- .clay-menu-list, .clay-people, .clay-menu-note { position: absolute; z-index: 1; top: calc(100% + 8px); right: 0; box-sizing: border-box; margin: 0; border: 1px solid var(--bevel-line-2); background: var(--bevel-surface); box-shadow: var(--clay-shadow); color: var(--bevel-ink); text-align: left; }
102
- .clay-menu-dock[data-corner$="left"] :is(.clay-menu-list, .clay-people, .clay-menu-note) { right: auto; left: 0; }
103
- .clay-menu-dock[data-corner^="bottom"] :is(.clay-menu-list, .clay-people, .clay-menu-note) { top: auto; bottom: calc(100% + 8px); }
91
+ .clay-menu-list, .clay-people, .clay-menu-note { position: absolute; z-index: 1; top: calc(100% + 8px); right: 0; box-sizing: border-box; margin: 0; color: var(--bevel-ink); text-align: left; }
92
+ .clay-people, .clay-menu-note { border: 1px solid var(--bevel-line-2); background: var(--bevel-surface); box-shadow: var(--clay-shadow); }
104
93
 
105
- .clay-menu-list { width: max-content; min-width: 284px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; padding: 6px; }
106
- .clay-menu-list [role="menuitem"] { box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 32px; margin: 0; padding: 5px 9px; border: 0; background: none; font: 400 13px/1.35 var(--bevel-font-sans); color: var(--bevel-ink); text-align: left; text-decoration: none; cursor: pointer; }
94
+ .clay-menu-list { width: max-content; max-width: calc(100vw - 24px); max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; }
95
+ .clay-menu-list[popover] { position: fixed; inset: auto; margin: 0; }
96
+ .clay-menu-list [role="menuitem"] { box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin: 0; border: 0; background: none; text-align: left; text-decoration: none; cursor: pointer; }
107
97
  .clay-menu-list [role="menuitem"]:hover:not([aria-disabled="true"]), .clay-menu-list [role="menuitem"]:focus-visible { outline: none; background: var(--bevel-sunk); }
108
- .clay-menu-list [role="menuitem"][aria-disabled="true"] { color: var(--bevel-faint); cursor: default; }
109
- .clay-menu-list [role="menuitem"][aria-disabled="true"] kbd { opacity: .6; }
98
+ .clay-menu-list [role="menuitem"][aria-disabled="true"] { cursor: default; }
110
99
  .clay-menu-pair { display: flex; gap: 12px; padding: 3px 9px; }
111
- .clay-menu-list .clay-menu-pair [role="menuitem"] { flex: none; width: auto; min-height: 30px; justify-content: flex-start; gap: 9px; padding: 4px 6px 4px 9px; border: 1px solid var(--bevel-line); }
112
- .clay-menu-list kbd { flex: none; font: 500 11px/1 var(--bevel-font-mono); padding: 3px 5px; border: 1px solid var(--bevel-line-2); background: var(--bevel-sunk); color: var(--bevel-muted); white-space: nowrap; }
113
- .clay-menu-sep { height: 1px; margin: 4px 2px; background: var(--bevel-line); }
100
+ .clay-menu-list .clay-menu-pair [role="menuitem"] { flex: none; width: auto; justify-content: flex-start; gap: 9px; }
101
+ .clay-menu-list kbd { flex: none; white-space: nowrap; }
102
+ .clay-menu-row { display: flex; align-items: center; gap: 2px; }
103
+ .clay-menu-list .clay-menu-row > [part~="item"] { flex: 1; width: auto; min-width: 0; }
104
+ .clay-menu-list .clay-menu-row > [part~="dismiss"] { flex: none; width: 28px; justify-content: center; padding: 0; }
105
+ .clay-menu-row > [part~="dismiss"] svg { display: block; width: 10px; height: 10px; fill: currentColor; }
114
106
  .clay-menu-upgrade { display: inline-flex; align-items: center; gap: 8px; }
115
107
  .clay-menu-upgrade::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bevel-brass); }
116
- .clay-menu-version { margin: 0; padding: 6px 9px 4px; font: 400 11.5px/1.4 var(--bevel-font-mono); color: var(--bevel-muted); }
108
+ .clay-menu-version { margin: 0; }
117
109
 
118
110
  .clay-menu-note { z-index: 2; width: max-content; max-width: 264px; padding: 8px 12px; font-size: 13px; line-height: 1.45; }
119
111
 
@@ -149,6 +141,19 @@ export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
149
141
  .clay-menu-btn-small { height: 26px; padding: 0 9px; font-size: 12px; }
150
142
  .clay-menu-btn-primary { --bevel-face: var(--bevel-ink); --bevel-edge-hi: color-mix(in srgb, var(--bevel-ink), light-dark(#FFFCF6, #FFFFFF) 22%); --bevel-edge-lo: color-mix(in srgb, var(--bevel-ink), light-dark(#0B0C13, #6A7090) 34%); color: var(--bevel-ground); }
151
143
  .clay-menu-btn-primary:hover { background: color-mix(in srgb, var(--bevel-ink), var(--bevel-ground) 12%); }
144
+ `;
145
+
146
+ export const MENU_FLOATING = `/* The dock: the roster (when a page opts in) and the capsule, fixed in one corner. */
147
+ .clay-menu-dock { position: fixed; z-index: 2147482000; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
148
+ .clay-menu-dock[data-corner$="left"] { right: auto; left: max(12px, env(safe-area-inset-left)); flex-direction: row-reverse; }
149
+ .clay-menu-dock[data-corner^="bottom"] { top: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
150
+ .clay-menu-dock[data-corner$="left"] :is(.clay-menu-list, .clay-people, .clay-menu-note) { right: auto; left: 0; }
151
+ .clay-menu-dock[data-corner^="bottom"] :is(.clay-menu-list, .clay-people, .clay-menu-note) { top: auto; bottom: calc(100% + 8px); }
152
+ .clay-menu-dock[data-dragging] .clay-menu { border-color: var(--bevel-brass); cursor: grabbing; }
153
+ .clay-menu-grip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 28px; margin: 0; padding: 0; border: 0; background: none; color: var(--bevel-faint); cursor: grab; touch-action: none; }
154
+ .clay-menu-grip::before { content: ""; position: absolute; inset: -8px -2px -8px -10px; }
155
+ .clay-menu-grip:hover { color: var(--bevel-ink-2); }
156
+ .clay-menu-grip svg { display: block; width: 6px; height: 12px; fill: currentColor; }
152
157
 
153
158
  /* Drop spots while dragging. */
154
159
  .clay-menu-spots { position: fixed; inset: 0; z-index: 2147481999; pointer-events: none; }
@@ -158,8 +163,28 @@ export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
158
163
  .clay-menu-spot[data-to$="left"] { left: 12px; }
159
164
  .clay-menu-spot[data-to$="right"] { right: 12px; }
160
165
  .clay-menu-spot[data-near] { border: 2px solid var(--bevel-brass); background: var(--bevel-brass-soft); }
166
+ `;
161
167
 
162
- @media (pointer: coarse), (max-width: 680px) {
168
+ export const MENU_SKIN = `.clay-menu { height: 34px; padding: 0 4px 0 2px; border: 1px solid var(--bevel-line-3); background: var(--bevel-surface); box-shadow: var(--clay-shadow); }
169
+ .clay-menu-goo { width: 28px; height: 28px; min-height: 0; border-radius: 0; border: 2px solid transparent; background: none; color: var(--bevel-ink); }
170
+ .clay-menu-goo::before { content: ""; position: absolute; inset: -8px -8px -8px -4px; }
171
+ .clay-menu-goo svg { width: 18px; height: auto; fill: currentColor; }
172
+ .clay-menu-goo:hover svg { translate: 0 -1px; }
173
+ .clay-menu-goo:active, .clay-menu-goo[aria-expanded="true"] { background: var(--bevel-face-in); border-color: var(--bevel-edge-in) var(--bevel-edge-in-hi) var(--bevel-edge-in-hi) var(--bevel-edge-in); }
174
+ .clay-menu-goo:active svg, .clay-menu-goo[aria-expanded="true"] svg { translate: 1px 1px; }
175
+ .clay-menu-list { min-width: 284px; padding: 6px; border: 1px solid var(--bevel-line-2); background: var(--bevel-surface); box-shadow: var(--clay-shadow); }
176
+ .clay-menu-list [role="menuitem"] { min-height: 32px; padding: 5px 9px; font: 400 13px/1.35 var(--bevel-font-sans); color: var(--bevel-ink); }
177
+ .clay-menu-list [role="menuitem"][aria-disabled="true"] { color: var(--bevel-faint); }
178
+ .clay-menu-list [role="menuitem"][aria-disabled="true"] kbd { opacity: .6; }
179
+ .clay-menu-list .clay-menu-pair [role="menuitem"] { min-height: 30px; padding: 4px 6px 4px 9px; border: 1px solid var(--bevel-line); }
180
+ .clay-menu-list kbd { font: 500 11px/1 var(--bevel-font-mono); padding: 3px 5px; border: 1px solid var(--bevel-line-2); background: var(--bevel-sunk); color: var(--bevel-muted); }
181
+ .clay-menu-list [part~="quiet"] { font-size: 12px; color: var(--bevel-muted); }
182
+ .clay-menu-sep { height: 1px; margin: 4px 2px; background: var(--bevel-line); }
183
+ .clay-menu-version { padding: 6px 9px 4px; font: 400 11.5px/1.4 var(--bevel-font-mono); color: var(--bevel-muted); }
184
+ `;
185
+
186
+ // Last, so no skin can shrink a touch target or bring motion back.
187
+ export const MENU_TOUCH = `@media (pointer: coarse), (max-width: 680px) {
163
188
  .clay-menu-list [role="menuitem"] { min-height: 44px; font-size: 15px; }
164
189
  .clay-menu-list .clay-menu-pair [role="menuitem"] { min-height: 44px; }
165
190
  :is(.clay-menu-dock, .clay-seo) :is(input, textarea, select) { font-size: 16px; }
@@ -168,4 +193,7 @@ export default `.clay-menu-dock, .clay-menu-spots, .clay-seo {
168
193
  }
169
194
  @media (prefers-reduced-motion: reduce) {
170
195
  .clay-menu-track, .clay-menu-thumb { transition: none; }
171
- }`;
196
+ }
197
+ `;
198
+
199
+ export default MENU_BASE + MENU_FLOATING + MENU_SKIN + MENU_TOUCH;
@@ -5,7 +5,7 @@ import { canEdit, isDraftMode, isEditMode, mode as startMode } from "../core/is-
5
5
  import onDomReady from "../lib/dom-ready.js";
6
6
  import CLAYGOO from "./menu/claygoo.svg.js";
7
7
  import { modeRefusalText } from "../core/mode-refusal.js";
8
- import MENU_CSS, { MENU_SURFACE } from "./menu/style.js";
8
+ import { MENU_BASE, MENU_FLOATING, MENU_SKIN, MENU_TOUCH, MENU_SURFACE } from "./menu/style.js";
9
9
  import { attachPlacement } from "./menu/placement.js";
10
10
  import { attachActions } from "./menu/actions.js";
11
11
  import { attachPeople } from "./menu/people.js";
@@ -14,6 +14,9 @@ import { followLook } from "../ui/page-colour.js";
14
14
  import { mountEditorUI } from "../ui/editor-ui.js";
15
15
 
16
16
  const SEO_ITEM = true;
17
+ const SKIN_VERSION = "1";
18
+ const EDGE_GAP = 8;
19
+ const DISMISS_ICON = '<svg viewBox="0 0 10 10" aria-hidden="true" focusable="false"><path d="M1 0 5 4l4-4 1 1-4 4 4 4-1 1-4-4-4 4-1-1 4-4-4-4z"/></svg>';
17
20
  const NOTE_MS = 6000;
18
21
  const INTRO_GAP = 12;
19
22
  const GRIP =
@@ -23,6 +26,7 @@ const GRIP =
23
26
  // Built-in items keep fixed slots, so the order never depends on which plugin
24
27
  // registered first. Any other id goes in its own section above the footer, in the
25
28
  // order it was added.
29
+ // An item may also ask for the first or the last section with `section: "start" | "end"`.
26
30
  const SECTIONS = [
27
31
  ["clay.undo", "clay.cms", "clay.ai", "clay.code"],
28
32
  ["seo", "clay.variants.keep", "clay.share", "clay.people"],
@@ -37,25 +41,51 @@ const SLOTTED = new Set(SECTIONS.flat().filter(Boolean));
37
41
  const currentMode = () =>
38
42
  window.clay && typeof window.clay.mode === "string" ? window.clay.mode : startMode;
39
43
 
44
+ // The first [clay-menu-slot] on the page holds the menu. With none, it floats in a corner.
45
+ function findSlot() {
46
+ const slots = document.querySelectorAll("[clay-menu-slot]");
47
+ if (slots.length > 1) console.warn("[clay] This page has more than one clay-menu-slot. The menu uses the first.");
48
+ return slots[0] || null;
49
+ }
50
+
51
+ // A skin the page wrote, in <style clay-menu-skin="1" media="not all">. The media keeps it
52
+ // off the page itself. An unknown version means the default skin.
53
+ function pageSkin() {
54
+ const style = document.querySelector("style[clay-menu-skin]");
55
+ if (!style) return null;
56
+ if (style.getAttribute("clay-menu-skin") !== SKIN_VERSION) {
57
+ console.warn(`[clay] This runtime reads clay-menu-skin="${SKIN_VERSION}". The menu keeps its default look.`);
58
+ return null;
59
+ }
60
+ return style.textContent;
61
+ }
62
+
40
63
  function mount() {
41
64
  if (document.querySelector('clay-editor-ui[data-clay-ui="menu"]')) return;
42
65
 
66
+ const slot = findSlot();
67
+ const embedded = Boolean(slot);
68
+ const skin = embedded ? pageSkin() : null;
69
+ const hideSwitch = embedded && slot.hasAttribute("no-edit-switch");
70
+
43
71
  const root = document.createElement("div");
44
72
  root.className = "clay-menu-dock";
45
73
  root.setAttribute("clay", "editor-ui");
74
+ root.setAttribute("part", "dock");
75
+ if (embedded) root.dataset.embedded = "";
46
76
  root.dataset.corner = "top-right";
47
77
  root.innerHTML =
48
- `<div class="clay-menu" clay="editor-ui">` +
78
+ `<div class="clay-menu" part="capsule" clay="editor-ui">` +
49
79
  `<button type="button" class="clay-menu-grip" aria-label="Move the menu. Drag it, or use the arrow keys to move it to another corner.">${GRIP}</button>` +
50
- `<button type="button" class="clay-menu-edit" role="switch" aria-checked="false">` +
80
+ `<button type="button" class="clay-menu-edit" part="edit" role="switch" aria-checked="false">` +
51
81
  `<span class="clay-menu-track" aria-hidden="true"><span class="clay-menu-thumb"></span></span>` +
52
82
  `<span class="clay-menu-label">Edit</span>` +
53
83
  `</button>` +
54
84
  `<span class="clay-menu-divider" aria-hidden="true"></span>` +
55
- `<button type="button" class="clay-menu-goo" aria-haspopup="menu" aria-expanded="false" aria-label="Clay menu">${CLAYGOO}</button>` +
85
+ `<button type="button" class="clay-menu-goo" part="button" aria-haspopup="menu" aria-expanded="false" aria-label="Clay menu">${CLAYGOO}</button>` +
56
86
  `</div>` +
57
- `<div class="clay-menu-list" role="menu" aria-label="Clay menu" hidden></div>` +
58
- `<div class="clay-menu-note" role="status" hidden></div>`;
87
+ `<div class="clay-menu-list" part="list" role="menu" aria-label="Clay menu" hidden></div>` +
88
+ `<div class="clay-menu-note" part="note" role="status" hidden></div>`;
59
89
 
60
90
  const grip = root.querySelector(".clay-menu-grip");
61
91
  const edit = root.querySelector(".clay-menu-edit");
@@ -64,6 +94,36 @@ function mount() {
64
94
  const noteEl = root.querySelector(".clay-menu-note");
65
95
  const items = new Map();
66
96
 
97
+ if (embedded) {
98
+ grip.hidden = true;
99
+ const icon = slot.querySelector("template[clay-menu-icon]");
100
+ if (icon) goo.replaceChildren(icon.content.cloneNode(true));
101
+ const name = slot.getAttribute("clay-menu-label");
102
+ if (name) {
103
+ goo.setAttribute("aria-label", name);
104
+ goo.title = name;
105
+ list.setAttribute("aria-label", name);
106
+ }
107
+ if (hideSwitch) {
108
+ edit.hidden = true;
109
+ root.querySelector(".clay-menu-divider").hidden = true;
110
+ }
111
+ }
112
+
113
+ // Embedded, the list opens in the top layer, so a header's overflow cannot clip it.
114
+ const topLayer = embedded && typeof list.showPopover === "function";
115
+ if (topLayer) list.setAttribute("popover", "manual");
116
+
117
+ function placeList() {
118
+ const anchor = goo.getBoundingClientRect();
119
+ const { offsetWidth: width, offsetHeight: height } = list;
120
+ const left = Math.max(EDGE_GAP, Math.min(anchor.right - width, window.innerWidth - width - EDGE_GAP));
121
+ const below = anchor.bottom + EDGE_GAP;
122
+ const top = below + height > window.innerHeight - EDGE_GAP ? Math.max(EDGE_GAP, anchor.top - height - EDGE_GAP) : below;
123
+ list.style.left = `${Math.round(left)}px`;
124
+ list.style.top = `${Math.round(top)}px`;
125
+ }
126
+
67
127
  // Focus inside the shadow root: document.activeElement only ever names the host.
68
128
  const focusedEl = () => root.getRootNode().activeElement || null;
69
129
  const isOpen = () => !list.hidden;
@@ -71,6 +131,13 @@ function mount() {
71
131
  function setExpanded(open) {
72
132
  list.hidden = !open;
73
133
  goo.setAttribute("aria-expanded", open ? "true" : "false");
134
+ if (!topLayer) return;
135
+ if (open) {
136
+ list.showPopover();
137
+ placeList();
138
+ } else if (list.matches(":popover-open")) {
139
+ list.hidePopover();
140
+ }
74
141
  }
75
142
 
76
143
  const buttons = () => [...list.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')];
@@ -108,6 +175,7 @@ function mount() {
108
175
  button.type = "button";
109
176
  }
110
177
  button.setAttribute("role", "menuitem");
178
+ button.setAttribute("part", item.quiet ? "item quiet" : "item");
111
179
  button.dataset.menuId = item.id;
112
180
  if (item.badge && item.id === "upgrade") {
113
181
  const label = document.createElement("span");
@@ -126,7 +194,7 @@ function mount() {
126
194
  button.addEventListener("click", () => {
127
195
  if (item.disabled) return;
128
196
  close();
129
- if (item.run) item.run();
197
+ if (item.run) item.run({ anchor: goo });
130
198
  });
131
199
  return button;
132
200
  }
@@ -135,6 +203,7 @@ function mount() {
135
203
  if (item.text) {
136
204
  const line = document.createElement("p");
137
205
  line.className = "clay-menu-version";
206
+ line.setAttribute("part", "text");
138
207
  line.dataset.menuId = item.id;
139
208
  line.textContent = item.label;
140
209
  return line;
@@ -146,12 +215,35 @@ function mount() {
146
215
  for (const part of item.pair) pair.append(itemButton(part));
147
216
  return pair;
148
217
  }
218
+ if (item.dismiss) return dismissibleRow(item);
149
219
  return itemButton(item);
150
220
  }
151
221
 
222
+ function dismissibleRow(item) {
223
+ const row = document.createElement("div");
224
+ row.className = "clay-menu-row";
225
+ row.dataset.menuId = item.id;
226
+ const dismiss = document.createElement("button");
227
+ dismiss.type = "button";
228
+ dismiss.setAttribute("role", "menuitem");
229
+ dismiss.setAttribute("part", "dismiss");
230
+ dismiss.dataset.menuId = `${item.id}.dismiss`;
231
+ dismiss.setAttribute("aria-label", item.dismiss.label);
232
+ dismiss.title = item.dismiss.label;
233
+ dismiss.innerHTML = DISMISS_ICON;
234
+ dismiss.addEventListener("click", () => {
235
+ removeItem(item.id);
236
+ item.dismiss.run?.();
237
+ });
238
+ row.append(itemButton(item), dismiss);
239
+ return row;
240
+ }
241
+
152
242
  function sections() {
153
- const extra = [...items.keys()].filter((id) => !SLOTTED.has(id));
154
- return SECTIONS.map((ids) => (ids || extra).map((id) => items.get(id)).filter(Boolean)).filter((group) => group.length);
243
+ const inSection = (name) => [...items.values()].filter((item) => item.section === name);
244
+ const extra = [...items.keys()].filter((id) => !SLOTTED.has(id) && !items.get(id).section);
245
+ const fixed = SECTIONS.map((ids) => (ids || extra).map((id) => items.get(id)).filter(Boolean));
246
+ return [inSection("start"), ...fixed, inSection("end")].filter((group) => group.length);
155
247
  }
156
248
 
157
249
  function render() {
@@ -163,6 +255,7 @@ function mount() {
163
255
  const sep = document.createElement("div");
164
256
  sep.className = "clay-menu-sep";
165
257
  sep.setAttribute("role", "separator");
258
+ sep.setAttribute("part", "separator");
166
259
  list.append(sep);
167
260
  }
168
261
  for (const item of group) list.append(itemNode(item));
@@ -194,11 +287,14 @@ function mount() {
194
287
  disabled: Boolean(disabled),
195
288
  });
196
289
 
197
- function addItem({ id, label, run, badge, keys, disabled, text, pair, href } = {}) {
290
+ function addItem({ id, label, run, badge, keys, disabled, text, pair, href, section, quiet, dismiss } = {}) {
198
291
  if (!id) return null;
199
292
  const item = clean({ id, label, run, badge, keys, disabled, href });
200
293
  if (text) item.text = true;
201
294
  if (Array.isArray(pair)) item.pair = pair.map(clean);
295
+ if (section === "start" || section === "end") item.section = section;
296
+ if (quiet) item.quiet = true;
297
+ if (dismiss) item.dismiss = { label: String(dismiss.label || "Dismiss"), run: typeof dismiss.run === "function" ? dismiss.run : null };
202
298
  items.set(id, item);
203
299
  render();
204
300
  return id;
@@ -228,6 +324,7 @@ function mount() {
228
324
 
229
325
  function setChecked() {
230
326
  edit.setAttribute("aria-checked", currentMode() === "edit" ? "true" : "false");
327
+ if (hideSwitch) addItem({ id: "clay.mode", label: currentMode() === "edit" ? "View mode" : "Edit mode", section: "start", run: () => edit.click() });
231
328
  }
232
329
  setChecked();
233
330
 
@@ -360,24 +457,30 @@ function mount() {
360
457
  `:root { --clay-menu-width: ${Math.ceil(rect.width)}px; --clay-menu-height: ${Math.ceil(rect.height)}px; }`;
361
458
  }
362
459
 
363
- const ui = mountEditorUI({ name: "menu", content: root, css: [MENU_CSS], attributes: { "clay-mode-toggle": "" } });
364
- attachPlacement({
365
- dock: root,
366
- container: ui.shadow,
367
- grip,
368
- storage: window.clay.storage && window.clay.storage.local,
369
- onMove: replace,
370
- onDragStart: () => {
371
- close();
372
- people?.close({ restore: false });
373
- },
374
- });
375
- reserveSpace();
376
- if (typeof ResizeObserver === "function") new ResizeObserver(reserveSpace).observe(root);
460
+ const css = embedded ? [MENU_BASE, skin ?? MENU_SKIN, MENU_TOUCH] : [MENU_BASE, MENU_FLOATING, MENU_SKIN, MENU_TOUCH];
461
+ const ui = mountEditorUI({ name: "menu", content: root, css, parent: slot || document.body, attributes: { "clay-mode-toggle": "" } });
462
+ if (embedded) {
463
+ window.addEventListener("resize", close);
464
+ window.addEventListener("scroll", () => { if (topLayer && isOpen()) placeList(); }, { capture: true, passive: true });
465
+ } else {
466
+ attachPlacement({
467
+ dock: root,
468
+ container: ui.shadow,
469
+ grip,
470
+ storage: window.clay.storage && window.clay.storage.local,
471
+ onMove: replace,
472
+ onDragStart: () => {
473
+ close();
474
+ people?.close({ restore: false });
475
+ },
476
+ });
477
+ reserveSpace();
478
+ if (typeof ResizeObserver === "function") new ResizeObserver(reserveSpace).observe(root);
377
479
 
378
- new MutationObserver(watchIntro).observe(doc.body, { childList: true });
379
- watchIntro();
380
- followLook(root, root.querySelector(".clay-menu"), MENU_SURFACE);
480
+ new MutationObserver(watchIntro).observe(doc.body, { childList: true });
481
+ watchIntro();
482
+ }
483
+ if (!skin) followLook(root, root.querySelector(".clay-menu"), MENU_SURFACE);
381
484
 
382
485
  const openSeo = () => import("./menu/seo.js").then((m) => m.open({ returnFocus: goo }));
383
486
 
@@ -404,7 +507,7 @@ function mount() {
404
507
  followCapability = applyHidden;
405
508
  if (currentMode() !== "edit") import("../core/host-permission.js").then((m) => m.checkHostPermission()).catch(() => {});
406
509
 
407
- window.clay.menu = { addItem, removeItem, open, close, note: showNote };
510
+ window.clay.menu = { addItem, removeItem, open, close, note: showNote, embedded, button: goo };
408
511
  document.dispatchEvent(new CustomEvent("clay:menu-ready"));
409
512
  }
410
513
 
@@ -5,5 +5,5 @@ var SapCoreBundle=(()=>{var At=Object.defineProperty;var rn=Object.getOwnPropert
5
5
  `)),s}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 zt(t){t&&t.hasAttribute("sap-error")&&t.removeAttribute("sap-error")}function vt(t,e){let r=null,n=3;for(let o of e){let s=fn(t,o);s<n&&(n=s,r=o)}return r}function fn(t,e){let r=t.length,n=e.length,o=Array.from({length:r+1},(s,i)=>[i,...new Array(n).fill(0)]);for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let i=1;i<=n;i++)o[s][i]=Math.min(o[s-1][i]+1,o[s][i-1]+1,o[s-1][i-1]+(t[s-1]===e[i-1]?0:1));return o[r][n]}var dn=new Set(z),pn={readonly:"readOnly",novalidate:"noValidate"},mn=0,Ut=new WeakMap;function qt(t,e="sap"){let r=t.getAttribute("data-id");if(r)return r;if(t.id)return t.id;let n=Ut.get(t);return n||(n=`${e}-${(mn++).toString(36)}`,Ut.set(t,n)),n}function Vt(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 St(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 Yt(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.hasAttribute("item")&&e.hasAttribute("template"))return e;return St(t.closest("[sap]"),t.getAttribute("items"))}function it(t){let e=[];if(!t)return e;for(let r of t.trim().split(/\s+/)){if(!r)continue;let n=r,o,s=n.indexOf("=");s>=0&&(o=n.slice(s+1),n=n.slice(0,s));let i=n.split(":"),f=i[0],c="string",l=!1;for(let p of i.slice(1))p==="num"?c="num":p==="bool"?c="bool":p==="presence"?c="presence":p==="transient"&&(l=!0);let a=f,d=a.startsWith("data-")&&a.length>5?a.slice(5).replace(/-([a-z])/g,(p,v)=>v.toUpperCase()):a;e.push({name:d,attr:a,type:c,default:o,transient:l})}return e}function st(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 Gt(t,e){return e==="bool"?t?"true":"false":t==null?"":String(t)}function kt(t,e){return dn.has(e)&&typeof t[pn[e]||e]=="boolean"}function Nt(t,e){return e.type==="presence"||e.type!=="num"&&kt(t,e.attr||e.name)}function Tt(t){return t.default!=null?t.default:t.type==="num"?"0":t.type==="bool"?"false":""}function Xt(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=Tt(e)),n[e.name]=st(o,e.type)}return t.hasAttribute(r)&&t.removeAttribute(r),n[e.name]}function P(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 at(t,e){return Array.isArray(t)?e==null?t:t.map(r=>typeof e=="function"?e(r):r?.[e]):[]}function Rt(t,e){return at(t,e).reduce((r,n)=>r+P(n),0)}function Kt(t,e){return Array.isArray(t)?e==null?t.length:t.reduce((r,n)=>r+(e(n)?1:0),0):0}function Jt(t,e){let r=at(t,e);return r.length?Rt(t,e)/r.length:0}function Qt(t,e){let r=at(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 Zt(t,e){let r=at(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 te(t,e,r){let n=P(t)===1?e:r??e+"s";return`${t} ${n}`}function ee(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 O(t){return typeof t=="number"?t:Number(t)}var U={usd:t=>"$"+O(t).toLocaleString("en-US",{maximumFractionDigits:0}),usd2:t=>"$"+O(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),pct:t=>Math.round(O(t))+"%",pct1:t=>O(t).toFixed(1)+"%",int:t=>Math.round(O(t)).toLocaleString("en-US"),num:t=>O(t).toLocaleString("en-US"),num2:t=>O(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),compact:t=>O(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=O(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}`}},hn=new Set(["usd","usd2","pct","pct1","int","num","num2","compact","clock"]);function ne(t,e){if(!t)return e==null?"":String(e);let r=U[t];if(typeof r!="function"){let n=new Error(`unknown format "${t}"`);throw n.sapCode="E22",n}if(hn.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 bn=["state","item","el","root","fmt","num","sum","count","avg","min","max","plural","days"],ut=new Map,re=/\bstate\.([a-z][a-z0-9_]*)/g,oe=/\bitem\.([a-z][a-z0-9_]*)/g;function gn(t){let e=new Set,r=new Set,n;for(re.lastIndex=0;n=re.exec(t);)e.add(n[1]);for(oe.lastIndex=0;n=oe.exec(t);)r.add(n[1]);return{state:e,item:r}}function M(t,e=!1){let r=(e?"!":"")+t,n=ut.get(r);if(n)return n;ut.size>512&&ut.clear();try{let o=e?`"use strict";
6
6
  ${t}`:`"use strict"; return (${t});`;n={fn:new Function(...bn,o),src:t,statement:e,deps:gn(t),error:null}}catch(o){n={fn:null,src:t,statement:e,deps:{state:new Set,item:new Set},error:o}}return ut.set(r,n),n}function ie(t,e,r,n,o){if(t.error)throw t.error;return t.fn(e,r,n,o,U,P,Rt,Kt,Jt,Qt,Zt,te,ee)}var J={},K=null,ae=!0,lt=!1;function ue(){J={}}function ce(t){let e=lt;return K?fe(K.takeRecords()):ae&&yn(),lt=!!K&&t.getRootNode()===document,e}function le(t){lt=t}function yn(){if(typeof document>"u"||typeof MutationObserver!="function"){ae=!1;return}K=new MutationObserver(fe),K.observe(document,{attributes:!0,childList:!0,subtree:!0})}function fe(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&&de(r)}function de(t){t._sapPlan&&(t._sapPlan=null);for(let e=t.firstElementChild;e;e=e.nextElementSibling)de(e)}function ft(t){if(!lt)return se(t);let e=t._sapPlan;return e&&e.gen===J?e:t._sapPlan=se(t)}function se(t){let e={gen:J,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,s=n.indexOf(":");if(s<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=it(o);break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:null,entry:M(o)});break;case"show":(e.paints||(e.paints=[])).push({kind:"show",entry:M(o)});break;case"effect":(e.effects||(e.effects=[])).push({entry:M(o,!0)});break;case"invalid":(e.invalids||(e.invalids=[])).push({entry:M(o)});break}continue}let i=n.slice(0,s),f=n.slice(s+1);switch(i){case"calc":(e.calcs||(e.calcs=[])).push({name:f,entry:M(o)});break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:f,entry:M(o)});break;case"attr":(e.paints||(e.paints=[])).push({kind:"attr",arg:f,entry:M(o)});break;case"class":(e.paints||(e.paints=[])).push({kind:"class",arg:f,entry:M(o)});break;case"css":(e.paints||(e.paints=[])).push({kind:"css",arg:f,entry:M(o)});break;case"show-when":case"option":(e.paints||(e.paints=[])).push({kind:"when",match:"show",field:f,values:o.split("|")});break;case"hide-when":(e.paints||(e.paints=[])).push({kind:"when",match:"hide",field:f,values:o.split("|")});break;case"option-not":(e.paints||(e.paints=[])).push({kind:"when",match:"show-not",field:f,values:o.split("|")});break}}return e.boundary=e.scope?"scope":e.items?"items":e.detail?"detail":e.each?"each":null,An(e)?wn():e}var ct=null;function wn(){return(!ct||ct.gen!==J)&&(ct=Object.freeze({gen:J,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})),ct}function An(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 F=new WeakMap,j=new WeakMap,q=null,D=!1;function me(){F=new WeakMap,j=new WeakMap}function pe(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)j.delete(n);if(e.type==="attributes"){F.delete(e.target);continue}for(let n=r;n;n=n.parentElement)F.delete(n);for(let n of e.addedNodes||[])if(n.nodeType===1){F.delete(n),j.delete(n);for(let o of n.querySelectorAll("*"))F.delete(o),j.delete(o)}}}function he(){return D}function be(t){return D?j.get(t):void 0}function ge(t,e){D&&j.set(t,e)}function ye(t){j.delete(t)}function we(t){let e=D;return!q&&typeof MutationObserver=="function"&&(q=new MutationObserver(pe),q.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),q&&pe(q.takeRecords()),D=!!q&&t.getRootNode()===document,e}function Ae(t){D=t}function Ee(t){let e=F.get(t);return e||F.set(t,e={attrs:new Map,hasText:!1,text:""}),e}function xe(t,e){if(!D)return t.getAttribute(e);let r=Ee(t);return r.attrs.has(e)||r.attrs.set(e,t.getAttribute(e)),r.attrs.get(e)}function ve(t){if(!D)return t.textContent;let e=Ee(t);return e.hasText||(e.text=t.textContent,e.hasText=!0),e.text}function Se(t){return(t.getAttribute("type")||"text").toLowerCase()}function V(t){let e=t.tagName;if(e==="INPUT"){let r=Se(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 ke(t,e=t){let r=t.tagName;if(r==="INPUT"){let n=Se(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(`
7
7
  `)?`
8
- `+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 s=0;s<n.length;s++)o[s]&&o[s].selected?n[s].hasAttribute("selected")||n[s].setAttribute("selected",""):n[s].removeAttribute("selected")}}function dt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function T(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 Ne(){let t=T("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var Lt=["clay:mutation-ready","hyperclay:mutation-ready"],En=["clay:sync-applied","hyperclay:livesync-applied"],xn=["clay:ready","hyperclay:ready"],vn=["clay:route"],Sn=["clay:modechange"];function Q(t,e,r){let n=null,o=s=>{n!==null&&n!==s.type||(n=s.type,queueMicrotask(()=>{n=null}),r(s))};for(let s of e)t.addEventListener(s,o);return()=>{for(let s of e)t.removeEventListener(s,o)}}function Te(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=T("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function Re(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function mt(t,{transient:e=!1}={}){if(e)return!0;let r=Re();return typeof r?.canWrite!="function"||T("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Le(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=T("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 _e(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let p=!1;for(let v of t.apps())v.root.isConnected?t.runNow(v,"platform"):p=!0;p&&t.pruneDisconnected(),t.remountIfPresent()},r=T("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:Q(document,En,e),s=Q(document,vn,e),i=null,f=!1,c=()=>{let p=i;i=null,p&&(p[2](),p[3]())},l=()=>{if(f)return!1;let p=T("undo"),v=Re()?.state?.generation;if(i&&i[0]===p&&i[1]===v)return!0;if(c(),!p||typeof p.on!="function")return!1;let R=p.on("undo",e);if(typeof R!="function")return!1;let _=p.on("redo",e);return typeof _!="function"?(R(),!1):(i=[p,v,R,_],!0)};l();let a=[Lt,xn,Sn].map(p=>Q(document,p,l)),d=T("ready");return d&&typeof d.then=="function"&&d.then(l,()=>{}),()=>{f=!0,typeof n=="function"&&n(),o&&o(),s();for(let p of a)p();c()}}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 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 $e(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 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 Ce(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}pt(t)||V(t)}function Tn(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Pe(t,e){return $e(t,e)}function Me(t){let e=_t(t);return{el:t,kind:e,read(){return $e(t,e)},write(r,n={}){Nn(t,e,r),n.noMirror||Ce(t),n.silent||Tn(t)},mirror(){Ce(t)}}}var I=null,bt=!1,Y=null;function Oe(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 Rn(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(Ln(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=T("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 Ln(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!ht(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!ht(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||ht(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))ht(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 ht(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function _n(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let s=o.type==="remove"?o.parent:o.element,i=s&&t.appFor(s);i&&r.add(i),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 De(t){if(I)return I.suppress(t);let e=T("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function Ct(t,e){bt=!0,I=t,t.subscribe(r=>_n(e,r))}function $t(t){if(bt||typeof window>"u"||typeof document>"u")return;let e=T("Mutation");if(e&&typeof e.onAnyChange=="function"){Ct(Oe(e),t);return}typeof MutationObserver=="function"&&(Ct(Rn(),t),Y=Q(document,Lt,function(){let n=T("Mutation");n&&(Y(),Y=null,I&&I.teardown(),bt=!1,Ct(Oe(n),t))}))}function Pt(){if(I)try{I.teardown()}catch{}Y&&typeof document<"u"&&Y(),I=null,bt=!1,Y=null}var Cn=new Set(z),gt=Object.freeze([]),W=[],We={},Be={};function Fe(t){W.includes(t)||(W.push(t),t.boundary&&Object.assign(We,t.boundary),t.paintKinds&&Object.assign(Be,t.paintKinds))}function yt(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&&(ue(),me());let r=ce(t.root);try{De(()=>$n(t,e))}finally{le(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function $n(t,e){let r=t.root,n={},o=[],s=[],i=new Set;t.diag.errors=[];let f={root:n,state:n,item:null,ownerEl:r,projection:!1},c=null;function l(u,h,b=!1){let m=h.attr||h.name,g=b?xe(u,m):u.getAttribute(m);return g==null&&(g=Tt(h),s.push({el:u,name:h.name,attr:m,value:Gt(st(g,h.type),h.type)})),st(g,h.type)}function a(u,h,b,m){let g=h.decls;if(!g)return;let E=!!m.item&&!m.projection&&!m.view;for(let k of g){if(k.transient){c&&(c.pure=!1),b[k.name]=Xt(u,k);continue}if(Nt(u,k)){b[k.name]=u.hasAttribute(k.attr);continue}b[k.name]=l(u,k,E)}}function d(u,h,b){let m=h.bind,g=b.item||b.state,E=_t(u);c&&(E!=="leaf"||h.transient)&&(c.pure=!1),E==="radio"?(m in g||(g[m]=""),u.checked&&(g[m]=u.value)):E==="leaf"&&b.item&&!b.projection&&!b.view?g[m]=ve(u):g[m]=Pe(u,E),h.transient&&(u.removeAttribute("value"),u.removeAttribute("checked"))}function p(u,h,b){let m=!1;if(h.paints){m=!0;for(let g of h.paints)g.kind==="when"&&i.add(g.field),o.push({def:g,el:u,ctx:b})}for(let g of W)g.collect&&g.collect(A,u,h,b)!==!1&&(m=!0);c&&m&&(h.calcs&&(c.pure=!1),c.collects.push(u,h))}function v(u,h,b){Object.defineProperty(u,"$key",{value:qt(h,"row"),enumerable:!1}),Object.defineProperty(u,"$index",{value:b,enumerable:!1,configurable:!0}),Object.defineProperty(u,"$el",{value:h,enumerable:!1})}function R(u,h,b){let m=ft(u);a(u,m,h,b),u._sapScope=h,!b.projection&&m.bind!=null&&d(u,m,b),p(u,m,b),m.items?nt(u,h,b):_(u,h,b)}function _(u,h,b){for(let m=u.firstElementChild;m;m=m.nextElementSibling)$(m,h,b)}function $(u,h,b){let m=ft(u);if(!m.inert){if(m.boundary){c&&(c.pure=!1),m.boundary==="scope"?et(u,h,b):m.boundary==="items"?(p(u,m,b),nt(u,h,b)):We[m.boundary](A,u,m,h,b);return}!b.projection&&!b.view&&m.bind!=null&&d(u,m,b),p(u,m,b);for(let g=u.firstElementChild;g;g=g.nextElementSibling)$(g,h,b)}}function et(u,h,b){let m=u.getAttribute("scope"),g={};h[m]=g;let E={root:b.root,state:g,item:null,ownerEl:u,projection:b.projection};R(u,g,E)}function nt(u,h,b){c&&(c.pure=!1);let m=u.getAttribute("items"),g=[];h[m]=g,u._sapList=g;let E=!b.projection&&!b.view&&he(),k=0;for(let N=u.firstElementChild;N;N=N.nextElementSibling){let x=ft(N);if(!x.item||x.template||x.cms)continue;let L=E?be(N):void 0;g.push(L&&L.plan===x&&Object.isExtensible(L.obj)&&rt(L,N,k,b)||X(N,x,k,b,E)),k++}}function X(u,h,b,m,g){let E={};v(E,u,b);let k={root:m.root,state:m.state,item:E,ownerEl:u,projection:m.projection};if(!g)return R(u,E,k),E;let N=c,x={plan:h,obj:E,fields:null,presence:gt,pending:gt,collects:[],pure:!0},L=s.length,nn=t.diag.errors.length;c=x;try{R(u,E,k)}finally{c=N}if(!x.pure||t.halted||t.diag.errors.length!==nn)return E;let Ft=[];for(let H of Object.keys(E)){let wt=E[H];if(wt!==null&&typeof wt=="object")return E;Ft.push(H,wt)}if(h.decls)for(let H of h.decls)Nt(u,H)&&(x.presence===gt?x.presence=[]:x.presence).push(H.name,H.attr);return s.length>L&&(x.pending=s.slice(L)),x.collects.length||(x.collects=gt),x.fields=Ft,ge(u,x),E}function rt(u,h,b,m){let g=u.obj;try{g.$index!==b&&Object.defineProperty(g,"$index",{value:b,enumerable:!1,configurable:!0});let N=u.presence;for(let L=0;L<N.length;L+=2)g[N[L]]=h.hasAttribute(N[L+1]);let x=u.fields;for(let L=0;L<x.length;L+=2)g[x[L]]=x[L+1]}catch{return ye(h),null}h._sapScope=g;let E=u.pending;for(let N=0;N<E.length;N++)s.push(E[N]);let k=u.collects;if(k.length){let N={root:m.root,state:m.state,item:g,ownerEl:h,projection:m.projection};for(let x=0;x<k.length;x+=2)p(k[x],k[x+1],N)}return g}let A={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:l,collectEl:p,walkScope:_};for(let u of W)u.begin&&u.begin(A);let w=e.cacheReads===!1?null:we(r);try{R(r,n,f)}finally{e.cacheReads!==!1&&Ae(w)}if(t.halted)return;for(let u of W)u.afterIntake&&u.afterIntake(A);if(s.length&&i.size)for(let u of s)i.has(u.attr)&&u.el.getAttribute(u.attr)==null&&u.el.setAttribute(u.attr,u.value);for(let u of W)u.compute&&u.compute(A);let y=0;for(let u of W)u.reconcile&&(y+=u.reconcile(A));let S=0,C=y;for(let u of o){let h=Mn(u,t);u.ctx.view?C+=h:S+=h}for(let u of W)u.afterPaint&&u.afterPaint(A);t._state=n,t._stats={fields:Object.keys(n).filter(u=>typeof n[u]!="function").length,calcs:A.stats.calcs,paints:o.length,lists:A.stats.lists,writes:S,viewWrites:C},t._viewsChanged=C>0,t._lastPass={trigger:e.trigger||"refresh",writes:S},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${S}/${o.length}`)}function Pn(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 Mt(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let s=r.includes(o.getAttribute(e));if(n?!s:s)return!0}o=o.parentElement}return!1}function Mn(t,e){let r=t.def,n=t.el,o=Be[r.kind];if(o)return o(t,e);if(r.kind==="when")return Ie(r,n,null);try{let s=ie(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),i=Ie(r,n,s);return zt(n),i}catch(s){return e.diag.error(s.sapCode==="E22"?"E22":"E24",n,{attr:Pn(r),expr:r.entry&&r.entry.src,problem:String(s.message)}),B(n,s.sapCode||"E24"),0}}function Ie(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?ne(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=T("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!Mt(e,t.field,t.values,!1):t.match==="show-not"?o=Mt(e,t.field,t.values,!0):o=Mt(e,t.field,t.values,!1),e._sapWhen=!0;let s=!o;return e.hidden!==s?(e.hidden=s,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 s=0;return e[n]!==!!r&&(e[n]=!!r,s=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),s=1),s}if(Cn.has(n)){let s=e.hasAttribute(n);return r&&!s?(e.setAttribute(n,""),1):!r&&s?(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 On=new Set(z),je=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),Dn=new Set(["show-when","hide-when","option","option-not"]),In=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,He=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"]),Dt=[];function ze(t){Dt.includes(t)||Dt.push(t)}function Wn(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function Ot(t){return t.hasAttribute("bind")}function Bn(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 Ue(t,e){let r=!1,n=(i,f,c)=>{e.error(i,f,c),r=!0},o=t.ownerDocument.createTreeWalker(t,4),s;for(;s=o.nextNode();)if(/\{\{.*\}\}/.test(s.nodeValue||"")){n("E02",s.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Bn(t,i=>{let f=new Set;for(let l of Dt)l(i,n,a=>f.add(a));let c=i.closest&&i.closest("[detail]");for(let l of[...i.attributes]){let a=l.name;if(f.has(a))continue;if(a.includes(":")){let p=a.slice(0,a.indexOf(":"));if(je.has(p)){if(Dn.has(p)&&In.test(l.value)){let v=a.slice(a.indexOf(":")+1);e.warn("W04",i,{attr:a,expr:l.value,problem:`${p}: compares the "${v}" attribute against a literal value, not a JS expression`,fix:`use show="${l.value}" for an expression, or a literal like ${p}:${v}="overview"`})}}else{let v=vt(p,[...je]);e.warn("W03",i,{attr:a,problem:`unknown "${p}:" attribute`,didYouMean:v?`${v}:`:null})}}else if(!He.has(a)&&!xt.has(a)&&!On.has(a)&&!/^(data-|aria-|on)/.test(a)&&!(a in i)){let p=vt(a,[...He]);p&&e.warn("W03",i,{attr:a,problem:`unknown "${a}" attribute`,didYouMean:p})}a==="attr:hidden"&&e.warn("W03",i,{attr:a,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let d=Ot(i)||a==="attr:selected"&&i.tagName==="OPTION"&&!!i.closest("select[bind]");(a==="attr:value"||a==="attr:checked"||a==="attr:selected")&&d&&n("E30",i,{attr:a,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),a==="effect"&&Ot(i)&&/\b(value|checked)\s*=[^=]/.test(l.value)&&n("E30",i,{attr:a,expr:l.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"}),(a==="text"||a.startsWith("text:")||a==="show")&&Wn(i)&&(a==="show"||n("E18",i,{attr:a,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(i.hasAttribute("state")){let l=it(i.getAttribute("state")),a=new Set;for(let d of l){d.name.includes("-")&&n("E08",i,{attr:"state",problem:`field "${d.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${d.name.replace(/-/g,"")}`}),a.has(d.name)&&n("E04",i,{attr:"state",problem:`field "${d.name}" is declared twice in one scope`}),a.add(d.name),Ht.has(d.attr)&&n("E05",i,{attr:"state",problem:`"${d.name}" is a reserved Sap word`}),xt.has(d.attr)&&n("E06",i,{attr:"state",problem:`"${d.name}" is a global HTML attribute name; pick another field name`}),d.name==="open"&&i.tagName==="DIALOG"&&n("E33",i,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=kt(i,d.attr);p&&(d.attr==="checked"||d.attr==="selected")&&n("E35",i,{attr:"state",problem:`"${d.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">'}),p&&d.type==="num"&&n("E35",i,{attr:"state",problem:`"${d.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${d.attr}"`}),d.transient&&(p||d.type==="presence")&&n("E35",i,{attr:"state",problem:`"${d.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(Ot(i)){if(i.hasAttribute("-"),i.tagName==="INPUT"){let l=(i.getAttribute("type")||"text").toLowerCase();l==="file"&&n("E32",i,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),l==="password"&&!i.hasAttribute("transient")&&n("E31",i,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"){let l=i.getAttribute("contenteditable");!(l!=null&&l!=="false")&&i.children.length>0&&n("E20",i,{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(i.hasAttribute("transient")&&i.hasAttribute("persist")&&n("E34",i,{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"}),i.tagName==="DIALOG"&&i.hasAttribute("detail")&&!(i.parentElement&&i.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",i,{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'}),i.hasAttribute("item")&&!i.hasAttribute("template")&&i.parentNode&&i.parentNode.nodeType===1){let l=i.parentElement;(!l||!l.hasAttribute("items"))&&n("E10",i,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(i.hasAttribute("items")&&c&&n("E17",i,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),i.hasAttribute("items")){let l=t.querySelector(`[trigger-add="${i.getAttribute("items")}"]`);!Yt(i)&&!St(t,i.getAttribute("items"))&&Vt(i).length===0&&l&&n("E17",i,{attr:"items",problem:`trigger-add targets items="${i.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 qe="sap-styles",Ve="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",It=new WeakSet;function Fn(t){if(It.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(Ve),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],It.add(t);return}catch{}if(!t.getElementById(qe)){let n=t.createElement("style");n.id=qe,n.textContent=Ve,(t.head||t.documentElement).appendChild(n)}It.add(t)}var jn=0;function Ye(){return typeof performance<"u"&&performance.now?performance.now():0}function Wt(t){let e=t.id||t.getAttribute("sap")||`app-${jn++}`,r=new ot(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Ue(t,r))return n.halted=!0,n;Fn(t.ownerDocument);for(let i of t.querySelectorAll("textarea[data-value]"))dt(i);let s=Ye();return yt(n,{trigger:"mount",full:!0}),n._mountMs=Ye()-s,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ne()&&!T("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 Ge=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Hn(t){return`${t.tagName.toLowerCase()}[sap]`}function zn(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(Ge.test(n.name)){e++;break}for(let r of t.attributes)if(Ge.test(r.name)){e++;break}return e}function Xe(t){function e(f){let c=f._stats||{},l=f.root;return{root:Hn(l),fields:c.fields||0,calcs:c.calcs||0,paints:c.paints||0,actions:zn(l),lists:(l.hasAttribute("items")?1:0)+l.querySelectorAll("[items]").length,rows:l.querySelectorAll("[item]:not([template])").length,warnings:f.diag.warnings.length,errors:f.diag.errors.length,mountWrites:f._mountWrites||0,ms:Math.round((f._mountMs||0)*10)/10,passes:f._passes||0,lastPass:f._lastPass||null,ok:f.diag.errors.length===0&&!f.halted}}function r(){let f=t.apps().map(e);return{ok:f.every(c=>c.ok),apps:f}}function n(f){let c=e(f);return c.ok?`sap \u2713 ${c.root} \xB7 fields ${c.fields} \xB7 calcs ${c.calcs} \xB7 paints ${c.paints} \xB7 actions ${c.actions} \xB7 lists ${c.lists} \xB7 rows ${c.rows} \xB7 warnings ${c.warnings} \xB7 mount writes ${c.mountWrites} \xB7 ${c.ms}ms`:`sap \u2717 ${c.root} \xB7 errors ${c.errors} \xB7 warnings ${c.warnings} \xB7 ${c.ms}ms`}function o(){for(let f of t.apps()){let c=n(f);f.diag.errors.length||f.halted?console.error(c):console.log(c)}}function s(){let f=[],c=[];for(let l of t.apps())f.push(...l.diag.errors),c.push(...l.diag.warnings);return{ok:f.length===0,errors:f,warnings:c,counts:{errors:f.length,warnings:c.length}}}function i(f){let c=f===void 0?!0:!!f;for(let l of t.apps())l._debug=c;return console.log(`sap debug ${c?"on":"off"} \u2014 per-pass headers will ${c?"":"no longer "}log`),c}return{status:r,report:s,debug:i,greenLine:n,printGreenLines:o,REGISTRY:Et}}var Ke="0.7.0";function Je({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],s=jt(yt);function i(w){let y=w;for(;y;){if(y.nodeType===1&&y.hasAttribute&&y.hasAttribute("sap"))return n.get(y)||null;y=y.parentNode&&y.parentNode.host?y.parentNode.host:y.parentElement}return null}function f(){for(let w=o.length-1;w>=0;w--){let y=o[w];y.root.isConnected||(n.delete(y.root),o.splice(w,1))}}function c(w,y){if(w.moveBefore)try{w.moveBefore(y,null);return}catch{}w.appendChild(y)}function l(w,y){let S=y.parentElement;if(S){if(S.moveBefore)try{S.moveBefore(w,y);return}catch{}S.insertBefore(w,y)}}let a={apps:()=>o.slice(),appFor:i,isRegistered:w=>n.has(w),pruneDisconnected:f,schedule:(w,y)=>s.schedule(w,y),runNow:(w,y)=>s.runNow(w,y),moveInto:c,placeBefore:l,remountIfPresent:()=>X()},d=t(a),p=Xe(a),v=r?r(a,p):{},R=!1,_=!1,$=null;function et(){R||(R=!0,e(a,d,document),$=_e(a))}function nt(){let w=T("derived");w&&typeof w.mounted=="function"&&w.mounted()}function X(w=document){if(_)return[];et(),$t(a);let y=w.querySelectorAll("[sap]"),S=[];for(let C of y){if(n.has(C))continue;let u=Wt(C);n.set(C,u),o.push(u),S.push(u)}for(let C of S){let u=p.greenLine(C);C.diag.errors.length||C.halted?console.error(u):console.log(u)}return nt(),S}function rt(w){if(_)return null;if(et(),$t(a),!w)return X();let y=typeof w=="string"?document.querySelector(w):w;if(!y)return null;if(n.has(y))return n.get(y);let S=Wt(y);n.set(y,S),o.push(S);let C=p.greenLine(S);return S.diag.errors.length||S.halted?console.error(C):console.log(C),S}let A=d.Sap;return A.version=Ke,A.refresh=function(){for(let y of o)y.root.isConnected&&s.runNow(y,"refresh")},A.batch=Le,A.status=p.status,A.report=p.report,A.why=v.why,A.debug=p.debug,A.doctor=v.doctor,A.greenLine=p.greenLine,A.formats=U,A.serializeControlToAttributes=V,A.finalizeControlForSave=ke,A.rehydrateControlFromAttributes=dt,A.mount=rt,A.config=function(y={}){return y.formats&&Object.assign(U,y.formats),A},A._registry=n,A._reset=function(){n.clear(),o.length=0,Pt()},A.unmount=function(){_=!0,n.clear(),o.length=0,Pt(),typeof $=="function"&&$()},{Sap:A,mountAll:X,mount:rt,runtime:a}}function Qe(t){if(typeof document>"u")return;let e=()=>Te(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}function Ze(t){let e=[];function r(c){let l=c.target;if(!l||l.nodeType!==1)return;let a=t.appFor(l);if(a){l.hasAttribute("persist")&&!pt(l)&&mt(l)&&V(l);for(let d of e)if(d(l,a))return;t.schedule(a,c.type+" "+(l.id||l.tagName.toLowerCase()))}}function n(c){let l=c.target,a=t.appFor(l);a&&[...l.querySelectorAll("[bind]")].every(d=>mt(d))&&setTimeout(()=>{l.querySelectorAll("[bind]").forEach(d=>{d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(a,"reset")},0)}function o(c){let l=t.appFor(c.target);l&&t.schedule(l,"toggle")}function s(c){let l=c.detail||{};for(let a of[l.from,l.to,c.target]){if(!a||a.nodeType!==1)continue;let d=t.appFor(a);d&&t.schedule(d,"sorted")}}function i(c){if(c.key!=="ArrowUp"&&c.key!=="ArrowDown")return;let l=c.target;if(!l||l.nodeType!==1||l.tagName!=="INPUT"||!l.hasAttribute("bind")||!l.hasAttribute("step"))return;let a=(l.getAttribute("type")||"text").toLowerCase();if(a!=="text"&&a!=="tel"&&a!=="search"||!t.appFor(l)||!mt(l))return;c.preventDefault();let p=P(l.getAttribute("step"))||1,v=c.key==="ArrowUp"?1:-1,R=P(l.value)+p*(c.shiftKey?10:1)*v,_=l.getAttribute("min"),$=l.getAttribute("max");_!==null&&_!==""&&R<P(_)&&(R=P(_)),$!==null&&$!==""&&R>P($)&&(R=P($)),Me(l).write(String(Number(R.toFixed(2))))}function f(c=document){c.addEventListener("reset",n),c.addEventListener("toggle",o,!0),c.addEventListener("input",r),c.addEventListener("change",r),c.addEventListener("clay:sorted",s),c.addEventListener("keydown",i)}return{install:f,addRouter:c=>e.push(c)}}var Z="https://clayjs.com/v1/sap.js",Un=/^(calc|set|move|sort):/,qn=new Set(["each","detail","effect","invalid","confirm","trigger-add","trigger-remove","trigger-reset"]);function Bt(t){return Un.test(t)||qn.has(t)}ze((t,e)=>{for(let r of t.attributes)Bt(r.name)&&e("E50",t,{attr:r.name,expr:r.value,problem:`${r.name} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`})});function G(t,e,r){t.app.diag.error("E50",e,{attr:r,problem:`${r} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`}),B(e,"E50"),t.app.halted=!0}Fe({name:"core-only",collect(t,e,r){r.calcs&&G(t,e,"calc:"+r.calcs[0].name),r.effects&&G(t,e,"effect"),r.invalids&&G(t,e,"invalid");for(let n of e.attributes)Bt(n.name)&&(n.name.startsWith("calc:")&&r.calcs||n.name==="effect"&&r.effects||n.name==="invalid"&&r.invalids||G(t,e,n.name));return!1},boundary:{each(t,e){G(t,e,"each")},detail(t,e){G(t,e,"detail")}}});function Vn(){return{Sap:function(){throw new Error(`Sap(el) is full sapjs; load ${Z}`)}}}var tn=t=>()=>(console.warn(`Sap.${t} is full sapjs; load ${Z}`),null),{Sap:tt,mountAll:en,mount:Yn,runtime:Gn}=Je({createAccessor:Vn,debugExtras:()=>({why:tn("why"),doctor:tn("doctor")}),installInput(t,e,r){Ze(t).install(r)}});tt.core=!0;var Xn=typeof window<"u"&&window.Sap&&!window.Sap.core;Xn?tt.unmount():Qe(en);typeof window<"u"&&!window.Sap&&(window.Sap=tt);var Kn=tt;return cn(Jn);})();
8
+ `+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 s=0;s<n.length;s++)o[s]&&o[s].selected?n[s].hasAttribute("selected")||n[s].setAttribute("selected",""):n[s].removeAttribute("selected")}}function dt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function T(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 Ne(){let t=T("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var Lt=["clay:mutation-ready","hyperclay:mutation-ready"],En=["clay:sync-applied","hyperclay:livesync-applied"],xn=["clay:ready","hyperclay:ready"],vn=["clay:route"],Sn=["clay:modechange"];function Q(t,e,r){let n=null,o=s=>{n!==null&&n!==s.type||(n=s.type,queueMicrotask(()=>{n=null}),r(s))};for(let s of e)t.addEventListener(s,o);return()=>{for(let s of e)t.removeEventListener(s,o)}}function Te(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=T("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function Re(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function mt(t,{transient:e=!1}={}){if(e)return!0;let r=Re();return typeof r?.canWrite!="function"||T("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Le(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=T("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 _e(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let p=!1;for(let v of t.apps())v.root.isConnected?t.runNow(v,"platform"):p=!0;p&&t.pruneDisconnected(),t.remountIfPresent()},r=T("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:Q(document,En,e),s=Q(document,vn,e),i=null,f=!1,c=()=>{let p=i;i=null,p&&(p[2](),p[3]())},l=()=>{if(f)return!1;let p=T("undo"),v=Re()?.state?.generation;if(i&&i[0]===p&&i[1]===v)return!0;if(c(),!p||typeof p.on!="function")return!1;let R=p.on("undo",e);if(typeof R!="function")return!1;let _=p.on("redo",e);return typeof _!="function"?(R(),!1):(i=[p,v,R,_],!0)};l();let a=[Lt,xn,Sn].map(p=>Q(document,p,l)),d=T("ready");return d&&typeof d.then=="function"&&d.then(l,()=>{}),()=>{f=!0,typeof n=="function"&&n(),o&&o(),s();for(let p of a)p();c()}}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 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 $e(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 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 Ce(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}pt(t)||V(t)}function Tn(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Pe(t,e){return $e(t,e)}function Me(t){let e=_t(t);return{el:t,kind:e,read(){return $e(t,e)},write(r,n={}){Nn(t,e,r),n.noMirror||Ce(t),n.silent||Tn(t)},mirror(){Ce(t)}}}var I=null,bt=!1,Y=null;function Oe(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 Rn(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(Ln(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=T("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 Ln(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!ht(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!ht(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||ht(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))ht(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 ht(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function _n(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let s=o.type==="remove"?o.parent:o.element,i=s&&t.appFor(s);i&&r.add(i),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 De(t){if(I)return I.suppress(t);let e=T("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function Ct(t,e){bt=!0,I=t,t.subscribe(r=>_n(e,r))}function $t(t){if(bt||typeof window>"u"||typeof document>"u")return;let e=T("Mutation");if(e&&typeof e.onAnyChange=="function"){Ct(Oe(e),t);return}typeof MutationObserver=="function"&&(Ct(Rn(),t),Y=Q(document,Lt,function(){let n=T("Mutation");n&&(Y(),Y=null,I&&I.teardown(),bt=!1,Ct(Oe(n),t))}))}function Pt(){if(I)try{I.teardown()}catch{}Y&&typeof document<"u"&&Y(),I=null,bt=!1,Y=null}var Cn=new Set(z),gt=Object.freeze([]),W=[],We={},Be={};function Fe(t){W.includes(t)||(W.push(t),t.boundary&&Object.assign(We,t.boundary),t.paintKinds&&Object.assign(Be,t.paintKinds))}function yt(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&&(ue(),me());let r=ce(t.root);try{De(()=>$n(t,e))}finally{le(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function $n(t,e){let r=t.root,n={},o=[],s=[],i=new Set;t.diag.errors=[];let f={root:n,state:n,item:null,ownerEl:r,projection:!1},c=null;function l(u,h,b=!1){let m=h.attr||h.name,g=b?xe(u,m):u.getAttribute(m);return g==null&&(g=Tt(h),s.push({el:u,name:h.name,attr:m,value:Gt(st(g,h.type),h.type)})),st(g,h.type)}function a(u,h,b,m){let g=h.decls;if(!g)return;let E=!!m.item&&!m.projection&&!m.view;for(let k of g){if(k.transient){c&&(c.pure=!1),b[k.name]=Xt(u,k);continue}if(Nt(u,k)){b[k.name]=u.hasAttribute(k.attr);continue}b[k.name]=l(u,k,E)}}function d(u,h,b){let m=h.bind,g=b.item||b.state,E=_t(u);c&&(E!=="leaf"||h.transient)&&(c.pure=!1),E==="radio"?(m in g||(g[m]=""),u.checked&&(g[m]=u.value)):E==="leaf"&&b.item&&!b.projection&&!b.view?g[m]=ve(u):g[m]=Pe(u,E),h.transient&&(u.removeAttribute("value"),u.removeAttribute("checked"))}function p(u,h,b){let m=!1;if(h.paints){m=!0;for(let g of h.paints)g.kind==="when"&&i.add(g.field),o.push({def:g,el:u,ctx:b})}for(let g of W)g.collect&&g.collect(A,u,h,b)!==!1&&(m=!0);c&&m&&(h.calcs&&(c.pure=!1),c.collects.push(u,h))}function v(u,h,b){Object.defineProperty(u,"$key",{value:qt(h,"row"),enumerable:!1}),Object.defineProperty(u,"$index",{value:b,enumerable:!1,configurable:!0}),Object.defineProperty(u,"$el",{value:h,enumerable:!1})}function R(u,h,b){let m=ft(u);a(u,m,h,b),u._sapScope=h,!b.projection&&m.bind!=null&&d(u,m,b),p(u,m,b),m.items?nt(u,h,b):_(u,h,b)}function _(u,h,b){for(let m=u.firstElementChild;m;m=m.nextElementSibling)$(m,h,b)}function $(u,h,b){let m=ft(u);if(!m.inert){if(m.boundary){c&&(c.pure=!1),m.boundary==="scope"?et(u,h,b):m.boundary==="items"?(p(u,m,b),nt(u,h,b)):We[m.boundary](A,u,m,h,b);return}!b.projection&&!b.view&&m.bind!=null&&d(u,m,b),p(u,m,b);for(let g=u.firstElementChild;g;g=g.nextElementSibling)$(g,h,b)}}function et(u,h,b){let m=u.getAttribute("scope"),g={};h[m]=g;let E={root:b.root,state:g,item:null,ownerEl:u,projection:b.projection};R(u,g,E)}function nt(u,h,b){c&&(c.pure=!1);let m=u.getAttribute("items"),g=[];h[m]=g,u._sapList=g;let E=!b.projection&&!b.view&&he(),k=0;for(let N=u.firstElementChild;N;N=N.nextElementSibling){let x=ft(N);if(!x.item||x.template||x.cms)continue;let L=E?be(N):void 0;g.push(L&&L.plan===x&&Object.isExtensible(L.obj)&&rt(L,N,k,b)||X(N,x,k,b,E)),k++}}function X(u,h,b,m,g){let E={};v(E,u,b);let k={root:m.root,state:m.state,item:E,ownerEl:u,projection:m.projection};if(!g)return R(u,E,k),E;let N=c,x={plan:h,obj:E,fields:null,presence:gt,pending:gt,collects:[],pure:!0},L=s.length,nn=t.diag.errors.length;c=x;try{R(u,E,k)}finally{c=N}if(!x.pure||t.halted||t.diag.errors.length!==nn)return E;let Ft=[];for(let H of Object.keys(E)){let wt=E[H];if(wt!==null&&typeof wt=="object")return E;Ft.push(H,wt)}if(h.decls)for(let H of h.decls)Nt(u,H)&&(x.presence===gt?x.presence=[]:x.presence).push(H.name,H.attr);return s.length>L&&(x.pending=s.slice(L)),x.collects.length||(x.collects=gt),x.fields=Ft,ge(u,x),E}function rt(u,h,b,m){let g=u.obj;try{g.$index!==b&&Object.defineProperty(g,"$index",{value:b,enumerable:!1,configurable:!0});let N=u.presence;for(let L=0;L<N.length;L+=2)g[N[L]]=h.hasAttribute(N[L+1]);let x=u.fields;for(let L=0;L<x.length;L+=2)g[x[L]]=x[L+1]}catch{return ye(h),null}h._sapScope=g;let E=u.pending;for(let N=0;N<E.length;N++)s.push(E[N]);let k=u.collects;if(k.length){let N={root:m.root,state:m.state,item:g,ownerEl:h,projection:m.projection};for(let x=0;x<k.length;x+=2)p(k[x],k[x+1],N)}return g}let A={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:l,collectEl:p,walkScope:_};for(let u of W)u.begin&&u.begin(A);let w=e.cacheReads===!1?null:we(r);try{R(r,n,f)}finally{e.cacheReads!==!1&&Ae(w)}if(t.halted)return;for(let u of W)u.afterIntake&&u.afterIntake(A);if(s.length&&i.size)for(let u of s)i.has(u.attr)&&u.el.getAttribute(u.attr)==null&&u.el.setAttribute(u.attr,u.value);for(let u of W)u.compute&&u.compute(A);let y=0;for(let u of W)u.reconcile&&(y+=u.reconcile(A));let S=0,C=y;for(let u of o){let h=Mn(u,t);u.ctx.view?C+=h:S+=h}for(let u of W)u.afterPaint&&u.afterPaint(A);t._state=n,t._stats={fields:Object.keys(n).filter(u=>typeof n[u]!="function").length,calcs:A.stats.calcs,paints:o.length,lists:A.stats.lists,writes:S,viewWrites:C},t._viewsChanged=C>0,t._lastPass={trigger:e.trigger||"refresh",writes:S},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${S}/${o.length}`)}function Pn(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 Mt(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let s=r.includes(o.getAttribute(e));if(n?!s:s)return!0}o=o.parentElement}return!1}function Mn(t,e){let r=t.def,n=t.el,o=Be[r.kind];if(o)return o(t,e);if(r.kind==="when")return Ie(r,n,null);try{let s=ie(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),i=Ie(r,n,s);return zt(n),i}catch(s){return e.diag.error(s.sapCode==="E22"?"E22":"E24",n,{attr:Pn(r),expr:r.entry&&r.entry.src,problem:String(s.message)}),B(n,s.sapCode||"E24"),0}}function Ie(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?ne(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=T("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!Mt(e,t.field,t.values,!1):t.match==="show-not"?o=Mt(e,t.field,t.values,!0):o=Mt(e,t.field,t.values,!1),e._sapWhen=!0;let s=!o;return e.hidden!==s?(e.hidden=s,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 s=0;return e[n]!==!!r&&(e[n]=!!r,s=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),s=1),s}if(Cn.has(n)){let s=e.hasAttribute(n);return r&&!s?(e.setAttribute(n,""),1):!r&&s?(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 On=new Set(z),je=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),Dn=new Set(["show-when","hide-when","option","option-not"]),In=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,He=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"]),Dt=[];function ze(t){Dt.includes(t)||Dt.push(t)}function Wn(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function Ot(t){return t.hasAttribute("bind")}function Bn(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 Ue(t,e){let r=!1,n=(i,f,c)=>{e.error(i,f,c),r=!0},o=t.ownerDocument.createTreeWalker(t,4),s;for(;s=o.nextNode();)if(/\{\{.*\}\}/.test(s.nodeValue||"")){n("E02",s.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Bn(t,i=>{let f=new Set;for(let l of Dt)l(i,n,a=>f.add(a));let c=i.closest&&i.closest("[detail]");for(let l of[...i.attributes]){let a=l.name;if(f.has(a))continue;if(a.includes(":")){let p=a.slice(0,a.indexOf(":"));if(je.has(p)){if(Dn.has(p)&&In.test(l.value)){let v=a.slice(a.indexOf(":")+1);e.warn("W04",i,{attr:a,expr:l.value,problem:`${p}: compares the "${v}" attribute against a literal value, not a JS expression`,fix:`use show="${l.value}" for an expression, or a literal like ${p}:${v}="overview"`})}}else{let v=vt(p,[...je]);e.warn("W03",i,{attr:a,problem:`unknown "${p}:" attribute`,didYouMean:v?`${v}:`:null})}}else if(!He.has(a)&&!xt.has(a)&&!On.has(a)&&!/^(data-|aria-|on)/.test(a)&&!(a in i)){let p=vt(a,[...He]);p&&e.warn("W03",i,{attr:a,problem:`unknown "${a}" attribute`,didYouMean:p})}a==="attr:hidden"&&e.warn("W03",i,{attr:a,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let d=Ot(i)||a==="attr:selected"&&i.tagName==="OPTION"&&!!i.closest("select[bind]");(a==="attr:value"||a==="attr:checked"||a==="attr:selected")&&d&&n("E30",i,{attr:a,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),a==="effect"&&Ot(i)&&/\b(value|checked)\s*=[^=]/.test(l.value)&&n("E30",i,{attr:a,expr:l.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"}),(a==="text"||a.startsWith("text:")||a==="show")&&Wn(i)&&(a==="show"||n("E18",i,{attr:a,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(i.hasAttribute("state")){let l=it(i.getAttribute("state")),a=new Set;for(let d of l){d.name.includes("-")&&n("E08",i,{attr:"state",problem:`field "${d.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${d.name.replace(/-/g,"")}`}),a.has(d.name)&&n("E04",i,{attr:"state",problem:`field "${d.name}" is declared twice in one scope`}),a.add(d.name),Ht.has(d.attr)&&n("E05",i,{attr:"state",problem:`"${d.name}" is a reserved Sap word`}),xt.has(d.attr)&&n("E06",i,{attr:"state",problem:`"${d.name}" is a global HTML attribute name; pick another field name`}),d.name==="open"&&i.tagName==="DIALOG"&&n("E33",i,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=kt(i,d.attr);p&&(d.attr==="checked"||d.attr==="selected")&&n("E35",i,{attr:"state",problem:`"${d.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">'}),p&&d.type==="num"&&n("E35",i,{attr:"state",problem:`"${d.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${d.attr}"`}),d.transient&&(p||d.type==="presence")&&n("E35",i,{attr:"state",problem:`"${d.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(Ot(i)){if(i.hasAttribute("-"),i.tagName==="INPUT"){let l=(i.getAttribute("type")||"text").toLowerCase();l==="file"&&n("E32",i,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),l==="password"&&!i.hasAttribute("transient")&&n("E31",i,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"){let l=i.getAttribute("contenteditable");!(l!=null&&l!=="false")&&i.children.length>0&&n("E20",i,{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(i.hasAttribute("transient")&&i.hasAttribute("persist")&&n("E34",i,{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"}),i.tagName==="DIALOG"&&i.hasAttribute("detail")&&!(i.parentElement&&i.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",i,{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'}),i.hasAttribute("item")&&!i.hasAttribute("template")&&i.parentNode&&i.parentNode.nodeType===1){let l=i.parentElement;(!l||!l.hasAttribute("items"))&&n("E10",i,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(i.hasAttribute("items")&&c&&n("E17",i,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),i.hasAttribute("items")){let l=t.querySelector(`[trigger-add="${i.getAttribute("items")}"]`);!Yt(i)&&!St(t,i.getAttribute("items"))&&Vt(i).length===0&&l&&n("E17",i,{attr:"items",problem:`trigger-add targets items="${i.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 qe="sap-styles",Ve="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",It=new WeakSet;function Fn(t){if(It.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(Ve),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],It.add(t);return}catch{}if(!t.getElementById(qe)){let n=t.createElement("style");n.id=qe,n.textContent=Ve,(t.head||t.documentElement).appendChild(n)}It.add(t)}var jn=0;function Ye(){return typeof performance<"u"&&performance.now?performance.now():0}function Wt(t){let e=t.id||t.getAttribute("sap")||`app-${jn++}`,r=new ot(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Ue(t,r))return n.halted=!0,n;Fn(t.ownerDocument);for(let i of t.querySelectorAll("textarea[data-value]"))dt(i);let s=Ye();return yt(n,{trigger:"mount",full:!0}),n._mountMs=Ye()-s,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ne()&&!T("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 Ge=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Hn(t){return`${t.tagName.toLowerCase()}[sap]`}function zn(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(Ge.test(n.name)){e++;break}for(let r of t.attributes)if(Ge.test(r.name)){e++;break}return e}function Xe(t){function e(f){let c=f._stats||{},l=f.root;return{root:Hn(l),fields:c.fields||0,calcs:c.calcs||0,paints:c.paints||0,actions:zn(l),lists:(l.hasAttribute("items")?1:0)+l.querySelectorAll("[items]").length,rows:l.querySelectorAll("[item]:not([template])").length,warnings:f.diag.warnings.length,errors:f.diag.errors.length,mountWrites:f._mountWrites||0,ms:Math.round((f._mountMs||0)*10)/10,passes:f._passes||0,lastPass:f._lastPass||null,ok:f.diag.errors.length===0&&!f.halted}}function r(){let f=t.apps().map(e);return{ok:f.every(c=>c.ok),apps:f}}function n(f){let c=e(f);return c.ok?`sap \u2713 ${c.root} \xB7 fields ${c.fields} \xB7 calcs ${c.calcs} \xB7 paints ${c.paints} \xB7 actions ${c.actions} \xB7 lists ${c.lists} \xB7 rows ${c.rows} \xB7 warnings ${c.warnings} \xB7 mount writes ${c.mountWrites} \xB7 ${c.ms}ms`:`sap \u2717 ${c.root} \xB7 errors ${c.errors} \xB7 warnings ${c.warnings} \xB7 ${c.ms}ms`}function o(){for(let f of t.apps()){let c=n(f);f.diag.errors.length||f.halted?console.error(c):console.log(c)}}function s(){let f=[],c=[];for(let l of t.apps())f.push(...l.diag.errors),c.push(...l.diag.warnings);return{ok:f.length===0,errors:f,warnings:c,counts:{errors:f.length,warnings:c.length}}}function i(f){let c=f===void 0?!0:!!f;for(let l of t.apps())l._debug=c;return console.log(`sap debug ${c?"on":"off"} \u2014 per-pass headers will ${c?"":"no longer "}log`),c}return{status:r,report:s,debug:i,greenLine:n,printGreenLines:o,REGISTRY:Et}}var Ke="0.7.1";function Je({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],s=jt(yt);function i(w){let y=w;for(;y;){if(y.nodeType===1&&y.hasAttribute&&y.hasAttribute("sap"))return n.get(y)||null;y=y.parentNode&&y.parentNode.host?y.parentNode.host:y.parentElement}return null}function f(){for(let w=o.length-1;w>=0;w--){let y=o[w];y.root.isConnected||(n.delete(y.root),o.splice(w,1))}}function c(w,y){if(w.moveBefore)try{w.moveBefore(y,null);return}catch{}w.appendChild(y)}function l(w,y){let S=y.parentElement;if(S){if(S.moveBefore)try{S.moveBefore(w,y);return}catch{}S.insertBefore(w,y)}}let a={apps:()=>o.slice(),appFor:i,isRegistered:w=>n.has(w),pruneDisconnected:f,schedule:(w,y)=>s.schedule(w,y),runNow:(w,y)=>s.runNow(w,y),moveInto:c,placeBefore:l,remountIfPresent:()=>X()},d=t(a),p=Xe(a),v=r?r(a,p):{},R=!1,_=!1,$=null;function et(){R||(R=!0,e(a,d,document),$=_e(a))}function nt(){let w=T("derived");w&&typeof w.mounted=="function"&&w.mounted()}function X(w=document){if(_)return[];et(),$t(a);let y=w.querySelectorAll("[sap]"),S=[];for(let C of y){if(n.has(C))continue;let u=Wt(C);n.set(C,u),o.push(u),S.push(u)}for(let C of S){let u=p.greenLine(C);C.diag.errors.length||C.halted?console.error(u):console.log(u)}return nt(),S}function rt(w){if(_)return null;if(et(),$t(a),!w)return X();let y=typeof w=="string"?document.querySelector(w):w;if(!y)return null;if(n.has(y))return n.get(y);let S=Wt(y);n.set(y,S),o.push(S);let C=p.greenLine(S);return S.diag.errors.length||S.halted?console.error(C):console.log(C),S}let A=d.Sap;return A.version=Ke,A.refresh=function(){for(let y of o)y.root.isConnected&&s.runNow(y,"refresh")},A.batch=Le,A.status=p.status,A.report=p.report,A.why=v.why,A.debug=p.debug,A.doctor=v.doctor,A.greenLine=p.greenLine,A.formats=U,A.serializeControlToAttributes=V,A.finalizeControlForSave=ke,A.rehydrateControlFromAttributes=dt,A.mount=rt,A.config=function(y={}){return y.formats&&Object.assign(U,y.formats),A},A._registry=n,A._reset=function(){n.clear(),o.length=0,Pt()},A.unmount=function(){_=!0,n.clear(),o.length=0,Pt(),typeof $=="function"&&$()},{Sap:A,mountAll:X,mount:rt,runtime:a}}function Qe(t){if(typeof document>"u")return;let e=()=>Te(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}function Ze(t){let e=[];function r(c){let l=c.target;if(!l||l.nodeType!==1)return;let a=t.appFor(l);if(a){l.hasAttribute("persist")&&!pt(l)&&mt(l)&&V(l);for(let d of e)if(d(l,a))return;t.schedule(a,c.type+" "+(l.id||l.tagName.toLowerCase()))}}function n(c){let l=c.target,a=t.appFor(l);a&&[...l.querySelectorAll("[bind]")].every(d=>mt(d))&&setTimeout(()=>{l.querySelectorAll("[bind]").forEach(d=>{d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(a,"reset")},0)}function o(c){let l=t.appFor(c.target);l&&t.schedule(l,"toggle")}function s(c){let l=c.detail||{};for(let a of[l.from,l.to,c.target]){if(!a||a.nodeType!==1)continue;let d=t.appFor(a);d&&t.schedule(d,"sorted")}}function i(c){if(c.key!=="ArrowUp"&&c.key!=="ArrowDown")return;let l=c.target;if(!l||l.nodeType!==1||l.tagName!=="INPUT"||!l.hasAttribute("bind")||!l.hasAttribute("step"))return;let a=(l.getAttribute("type")||"text").toLowerCase();if(a!=="text"&&a!=="tel"&&a!=="search"||!t.appFor(l)||!mt(l))return;c.preventDefault();let p=P(l.getAttribute("step"))||1,v=c.key==="ArrowUp"?1:-1,R=P(l.value)+p*(c.shiftKey?10:1)*v,_=l.getAttribute("min"),$=l.getAttribute("max");_!==null&&_!==""&&R<P(_)&&(R=P(_)),$!==null&&$!==""&&R>P($)&&(R=P($)),Me(l).write(String(Number(R.toFixed(2))))}function f(c=document){c.addEventListener("reset",n),c.addEventListener("toggle",o,!0),c.addEventListener("input",r),c.addEventListener("change",r),c.addEventListener("clay:sorted",s),c.addEventListener("keydown",i)}return{install:f,addRouter:c=>e.push(c)}}var Z="https://clayjs.com/v1/sap.js",Un=/^(calc|set|move|sort):/,qn=new Set(["each","detail","effect","invalid","confirm","trigger-add","trigger-remove","trigger-reset"]);function Bt(t){return Un.test(t)||qn.has(t)}ze((t,e)=>{for(let r of t.attributes)Bt(r.name)&&e("E50",t,{attr:r.name,expr:r.value,problem:`${r.name} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`})});function G(t,e,r){t.app.diag.error("E50",e,{attr:r,problem:`${r} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`}),B(e,"E50"),t.app.halted=!0}Fe({name:"core-only",collect(t,e,r){r.calcs&&G(t,e,"calc:"+r.calcs[0].name),r.effects&&G(t,e,"effect"),r.invalids&&G(t,e,"invalid");for(let n of e.attributes)Bt(n.name)&&(n.name.startsWith("calc:")&&r.calcs||n.name==="effect"&&r.effects||n.name==="invalid"&&r.invalids||G(t,e,n.name));return!1},boundary:{each(t,e){G(t,e,"each")},detail(t,e){G(t,e,"detail")}}});function Vn(){return{Sap:function(){throw new Error(`Sap(el) is full sapjs; load ${Z}`)}}}var tn=t=>()=>(console.warn(`Sap.${t} is full sapjs; load ${Z}`),null),{Sap:tt,mountAll:en,mount:Yn,runtime:Gn}=Je({createAccessor:Vn,debugExtras:()=>({why:tn("why"),doctor:tn("doctor")}),installInput(t,e,r){Ze(t).install(r)}});tt.core=!0;var Xn=typeof window<"u"&&window.Sap&&!window.Sap.core;Xn?tt.unmount():Qe(en);typeof window<"u"&&!window.Sap&&(window.Sap=tt);var Kn=tt;return cn(Jn);})();
9
9
  export default SapCoreBundle.default;