base-screen 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +12 -5
  2. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-callbacks.d.ts +2 -0
  3. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-controller.d.ts +73 -16
  4. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-panel.d.ts +41 -0
  5. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-panel-controller.d.ts +62 -0
  6. package/dist/_internal/engine/browser/controllers/designer-size-tier-controller.d.ts +60 -0
  7. package/dist/_internal/engine/browser/controllers/panel/designer-material-group-navigation-controller.d.ts +2 -0
  8. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller.d.ts +2 -0
  9. package/dist/_internal/engine/browser/controllers/panel/designer-panel-inspector-controller.d.ts +6 -0
  10. package/dist/_internal/engine/browser/controllers/panel/designer-panel-material-controller.d.ts +1 -0
  11. package/dist/_internal/engine/browser/controllers/workbench/designer-panel-layout-controller.d.ts +22 -1
  12. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +5 -0
  13. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-tabs-controller.d.ts +1 -0
  14. package/dist/_internal/engine/browser/dom/workspace/designer-workspace-markup.d.ts +2 -0
  15. package/dist/_internal/engine/browser/dom/workspace/designer-workspace-skeleton.d.ts +7 -0
  16. package/dist/_internal/engine/browser/dom/workspace/designer-workspace.d.ts +1 -1
  17. package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +1 -0
  18. package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +5 -1
  19. package/dist/_internal/engine/designer-blueprint-workbench-panel-C2MoZwKA.js +3548 -0
  20. package/dist/_internal/engine/designer-dataset-controller-CPytVNBK.js +4426 -0
  21. package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +7 -0
  22. package/dist/_internal/engine/designer-element/runtime/designer-element-skeleton.d.ts +14 -0
  23. package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +12 -2
  24. package/dist/_internal/engine/designer-left-panel-groups-dom-WMsH33zw.js +573 -0
  25. package/dist/_internal/engine/designer-ui-primitives-CH4RNiMa.js +2155 -0
  26. package/dist/_internal/engine/host-resource-selection-5Cf_gclK.js +2188 -0
  27. package/dist/_internal/engine/index.js +4944 -17147
  28. package/dist/_internal/renderer/index.js +266 -216
  29. package/dist/_internal/renderer/viewer/viewer-skeleton.d.ts +10 -0
  30. package/dist/_internal/renderer/viewer/viewer-variable-controller.d.ts +2 -0
  31. package/dist/_internal/renderer/viewer/viewer.d.ts +8 -0
  32. package/dist/_internal/sdk/auto-register.js +7 -7
  33. package/dist/_internal/sdk/designer-auto-register.js +2 -2
  34. package/dist/_internal/sdk/designer.d.ts +6 -0
  35. package/dist/_internal/sdk/designer.js +11 -1
  36. package/dist/_internal/sdk/index.d.ts +1 -1
  37. package/dist/_internal/sdk/index.js +6 -6
  38. package/dist/authoring-EcyK2YVN.js +103 -0
  39. package/dist/authoring-EcyK2YVN.js.map +1 -0
  40. package/dist/auto-register.js +12 -10
  41. package/dist/auto-register.js.map +1 -1
  42. package/dist/contracts.js +5 -4
  43. package/dist/contracts.js.map +1 -1
  44. package/dist/{contrast-B4TH-dvm.js → contrast-CZFqj1I5.js} +23 -23
  45. package/dist/{contrast-B4TH-dvm.js.map → contrast-CZFqj1I5.js.map} +1 -1
  46. package/dist/core.js +10 -8
  47. package/dist/core.js.map +1 -1
  48. package/dist/designer-Byw45cUM.js +21 -0
  49. package/dist/designer-Byw45cUM.js.map +1 -0
  50. package/dist/designer-auto-register.js +5 -3
  51. package/dist/designer-auto-register.js.map +1 -1
  52. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js +3517 -0
  53. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js.map +1 -0
  54. package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js +4354 -0
  55. package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js.map +1 -0
  56. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js +557 -0
  57. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js.map +1 -0
  58. package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js +2146 -0
  59. package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js.map +1 -0
  60. package/dist/designer.js +5 -3
  61. package/dist/{dist-CR13A2Yb.js → dist-BHTClwId.js} +4785 -16808
  62. package/dist/dist-BHTClwId.js.map +1 -0
  63. package/dist/{dist-CAdGDmU3.js → dist-DfAV2jGI.js} +277 -227
  64. package/dist/dist-DfAV2jGI.js.map +1 -0
  65. package/dist/editor-descriptor-schema-Be30Wv8w.js +190 -0
  66. package/dist/editor-descriptor-schema-Be30Wv8w.js.map +1 -0
  67. package/dist/engine.js +4 -2
  68. package/dist/hierarchy-BQZrZWbC.js +86 -0
  69. package/dist/hierarchy-BQZrZWbC.js.map +1 -0
  70. package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js +2141 -0
  71. package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js.map +1 -0
  72. package/dist/index.js +11 -9
  73. package/dist/{manager-Bhqi_KmD.js → manager-B2CZ2b5I.js} +2 -2
  74. package/dist/{manager-Bhqi_KmD.js.map → manager-B2CZ2b5I.js.map} +1 -1
  75. package/dist/material-BPlvEmDi.js +12 -0
  76. package/dist/material-BPlvEmDi.js.map +1 -0
  77. package/dist/material-auto-register.d.ts +1 -0
  78. package/dist/material-auto-register.js +16 -0
  79. package/dist/material-auto-register.js.map +1 -0
  80. package/dist/{material-definition-BJ4ujhuj.js → material-definition-B9xCZcD-.js} +2 -2
  81. package/dist/{material-definition-BJ4ujhuj.js.map → material-definition-B9xCZcD-.js.map} +1 -1
  82. package/dist/{material-manifest-LdgIkzgH.js → material-manifest-bsGl6vZZ.js} +70 -256
  83. package/dist/material-manifest-bsGl6vZZ.js.map +1 -0
  84. package/dist/material.js +3 -2
  85. package/dist/parse-B0hwp_yj.js +264 -0
  86. package/dist/parse-B0hwp_yj.js.map +1 -0
  87. package/dist/plugin-core.js +3 -2
  88. package/dist/plugin-manager.js +1 -1
  89. package/dist/{plugin-package-BfZLl3ru.js → plugin-package-BT-pCoTt.js} +3 -3
  90. package/dist/{plugin-package-BfZLl3ru.js.map → plugin-package-BT-pCoTt.js.map} +1 -1
  91. package/dist/{plugin-registration-CYtTqIxF.js → plugin-registration-BjS_CXJU.js} +2 -2
  92. package/dist/{plugin-registration-CYtTqIxF.js.map → plugin-registration-BjS_CXJU.js.map} +1 -1
  93. package/dist/plugin-sdk.js +3 -3
  94. package/dist/{plugins-DRaykV9c.js → plugins-B9bwk-t6.js} +2 -2
  95. package/dist/{plugins-DRaykV9c.js.map → plugins-B9bwk-t6.js.map} +1 -1
  96. package/dist/plugins.js +5 -5
  97. package/dist/renderer.js +1 -1
  98. package/dist/runtime-dispatch-Dt9fhcI5.js +360 -0
  99. package/dist/runtime-dispatch-Dt9fhcI5.js.map +1 -0
  100. package/dist/{src-Bm7u11mN-BPS5TRsq.js → src-Bm7u11mN-BMeb9fvV.js} +40 -39
  101. package/dist/{src-Bm7u11mN-BPS5TRsq.js.map → src-Bm7u11mN-BMeb9fvV.js.map} +1 -1
  102. package/dist/{material-2XmHe-aH.js → text-BVzTcUas.js} +44 -52
  103. package/dist/text-BVzTcUas.js.map +1 -0
  104. package/dist/value-ref-y4_YKUP5.js +278 -0
  105. package/dist/value-ref-y4_YKUP5.js.map +1 -0
  106. package/dist/{viewer-CrJupI8I-D2BtwLsA.js → viewer-CrJupI8I-DZZfdHXr.js} +5 -5
  107. package/dist/{viewer-CrJupI8I-D2BtwLsA.js.map → viewer-CrJupI8I-DZZfdHXr.js.map} +1 -1
  108. package/dist/viewer-auto-register.js +2 -2
  109. package/dist/viewer.js +2 -2
  110. package/package.json +17 -18
  111. package/dist/_internal/react/components.d.ts +0 -32
  112. package/dist/_internal/react/index.d.ts +0 -14
  113. package/dist/_internal/react/index.js +0 -215
  114. package/dist/_internal/vue/components.d.ts +0 -36
  115. package/dist/_internal/vue/global-styles.d.ts +0 -10
  116. package/dist/_internal/vue/index.d.ts +0 -14
  117. package/dist/_internal/vue/index.js +0 -290
  118. package/dist/designer-xtN0h7PL.js +0 -11
  119. package/dist/designer-xtN0h7PL.js.map +0 -1
  120. package/dist/dist-CAdGDmU3.js.map +0 -1
  121. package/dist/dist-CR13A2Yb.js.map +0 -1
  122. package/dist/material-2XmHe-aH.js.map +0 -1
  123. package/dist/material-manifest-LdgIkzgH.js.map +0 -1
  124. package/dist/parse-CYwxTDJU.js +0 -364
  125. package/dist/parse-CYwxTDJU.js.map +0 -1
  126. package/dist/react.d.ts +0 -1
  127. package/dist/react.js +0 -213
  128. package/dist/react.js.map +0 -1
  129. package/dist/value-ref-Z0o70Vy6.js +0 -716
  130. package/dist/value-ref-Z0o70Vy6.js.map +0 -1
  131. package/dist/vue.d.ts +0 -1
  132. package/dist/vue.js +0 -288
  133. package/dist/vue.js.map +0 -1
@@ -0,0 +1,2141 @@
1
+ import { i as e, r as t, t as n } from "./image-url-D6mUcjY1.js";
2
+ import { t as r } from "./parse-BQw3u9_4.js";
3
+ import { i, r as a } from "./read-data-value-WmMKWshv.js";
4
+ import "./authoring-EcyK2YVN.js";
5
+ import { a as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, o as m, r as h, s as g, t as _ } from "./designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js";
6
+ import { t as v } from "./editor-descriptor-schema-Be30Wv8w.js";
7
+ //#region ../engine/dist/host-resource-selection-5Cf_gclK.js
8
+ function y(e) {
9
+ return Math.round(e * 100) / 100;
10
+ }
11
+ function b(e) {
12
+ let t = Math.round(e);
13
+ return Object.is(t, -0) ? 0 : t;
14
+ }
15
+ function x(e) {
16
+ return Math.max(-1e6, Math.min(1e6, e));
17
+ }
18
+ function S(e) {
19
+ return Math.max(1, Math.min(1e6, e));
20
+ }
21
+ function C(e, t) {
22
+ let n = e.ownerDocument.createElement("span");
23
+ n.className = o("designer-badge", t.className), n.textContent = t.text, n.dataset.tone = t.tone ?? "neutral", t.title !== void 0 && (n.title = t.title), t.ariaLabel !== void 0 && n.setAttribute("aria-label", t.ariaLabel);
24
+ for (let [e, r] of Object.entries(t.dataset ?? {})) n.dataset[e] = r;
25
+ return e.appendChild(n), n;
26
+ }
27
+ function w(e, t) {
28
+ let n = e.ownerDocument, r = n.createElement("div");
29
+ if (r.className = o("designer-empty", t.className), t.tone === "success" && (r.dataset.tone = "success"), t.role !== void 0 && r.setAttribute("role", t.role), t.live !== void 0 && (r.ariaLive = t.live), t.icon !== void 0) {
30
+ let e = n.createElement("span");
31
+ e.className = "designer-empty-icon", e.setAttribute("aria-hidden", "true"), e.innerHTML = c(t.icon), r.appendChild(e);
32
+ }
33
+ let i = n.createElement("p");
34
+ if (i.className = "designer-empty-title", i.textContent = t.title, r.appendChild(i), t.hint !== void 0) {
35
+ let e = n.createElement("p");
36
+ e.className = "designer-empty-hint", e.textContent = t.hint, r.appendChild(e);
37
+ }
38
+ let a = [];
39
+ if (t.actions !== void 0 && t.actions.length > 0) {
40
+ let e = n.createElement("div");
41
+ e.className = "designer-empty-actions";
42
+ for (let r of t.actions) {
43
+ let t = f(n, {
44
+ className: "designer-empty-action",
45
+ text: r.label,
46
+ ...r.ariaLabel === void 0 ? {} : { ariaLabel: r.ariaLabel },
47
+ ...r.variant === void 0 ? {} : { variant: r.variant }
48
+ });
49
+ for (let [e, n] of Object.entries(r.dataset ?? {})) t.dataset[e] = n;
50
+ e.appendChild(t), a.push(t);
51
+ }
52
+ r.appendChild(e);
53
+ }
54
+ return e.appendChild(r), {
55
+ element: r,
56
+ actionButtons: a
57
+ };
58
+ }
59
+ function T(e, t) {
60
+ let n = e.ownerDocument, r = t.collapsible ?? !0, i = n.createElement(r ? "details" : "section");
61
+ i.className = o("designer-panel-section designer-inspector-section", t.className), r && (i.open = t.open ?? !0, i.classList.add("designer-inspector-disclosure")), t.advanced === !0 && (i.dataset.inspectorAdvanced = "true");
62
+ let a = n.createElement(r ? "summary" : "h3");
63
+ if (a.className = "designer-panel-section-title designer-inspector-section-title", r && a.classList.add("designer-inspector-section-summary", "designer-panel-section-summary"), a.textContent = t.title, r) {
64
+ let e = n.createElement("span");
65
+ e.className = "designer-panel-section-disclosure designer-inspector-section-disclosure", e.setAttribute("aria-hidden", "true"), e.innerHTML = c("chevron-down"), a.appendChild(e);
66
+ }
67
+ i.appendChild(a);
68
+ let s = null;
69
+ if (t.actions !== void 0 && t.actions.length > 0) {
70
+ s = n.createElement("div"), s.className = "designer-panel-section-actions";
71
+ for (let e of t.actions) s.appendChild(e);
72
+ r && s.addEventListener("click", (e) => e.stopPropagation()), i.appendChild(s);
73
+ }
74
+ return e.appendChild(i), {
75
+ element: i,
76
+ title: a,
77
+ actions: s
78
+ };
79
+ }
80
+ function E(e, t) {
81
+ return typeof e == "string" && /\S/.test(e) && !/[\u0000-\u001f\u007f-\u009f]/u.test(e) && [...e].length <= t;
82
+ }
83
+ var D = /* @__PURE__ */ new Set([
84
+ "materialType",
85
+ "name",
86
+ "position"
87
+ ]), O = /* @__PURE__ */ new Set(["x", "y"]), k = 256;
88
+ function ee(e) {
89
+ return e?.defaultData === void 0 ? null : {
90
+ type: "static",
91
+ value: e.defaultData,
92
+ ...e.staticData?.kind === "tabular" ? { binding: e.staticData.defaultBinding } : {}
93
+ };
94
+ }
95
+ function te(e, t, n) {
96
+ let r = t.replace(/[^A-Za-z0-9]+/g, "-"), i = e.components.length + 1, a = new Set(e.components.map((e) => e.id));
97
+ if (n !== void 0) for (let e of n) a.add(e);
98
+ for (; a.has(`${r}-${i}`);) i++;
99
+ return `${r}-${i}`;
100
+ }
101
+ function ne(e, t) {
102
+ let n = e.components.map((e) => e.zIndex);
103
+ return t !== void 0 && n.push(...t), n.reduce((e, t) => Math.max(e, t), -1) + 1;
104
+ }
105
+ function re(e, t, n) {
106
+ return {
107
+ id: n.id ?? te(e, t.type),
108
+ type: t.type,
109
+ name: n.name ?? t.name,
110
+ parentId: n.parentId ?? null,
111
+ position: n.position,
112
+ size: t.defaultSize,
113
+ rotation: 0,
114
+ zIndex: n.zIndex ?? ne(e),
115
+ status: {
116
+ locked: !1,
117
+ hidden: !1
118
+ },
119
+ props: t.defaultProps,
120
+ style: t.defaultStyle,
121
+ dataSource: n.dataSource === void 0 ? ee(t) : n.dataSource
122
+ };
123
+ }
124
+ function ie(e, t, n) {
125
+ return {
126
+ x: y(Math.max(0, Math.min(n.x, Math.max(0, e.canvas.width - t.defaultSize.width)))),
127
+ y: y(Math.max(0, Math.min(n.y, Math.max(0, e.canvas.height - t.defaultSize.height))))
128
+ };
129
+ }
130
+ function ae(e) {
131
+ if (!le(e) || !ue(e, D)) return A("AUTHORING_PAYLOAD_INVALID", "Component insertion intent must be a strict object.");
132
+ if (!t(e.materialType)) return A("AUTHORING_SOURCE_INVALID", "Component insertion materialType must be a canonical material type.", ["materialType"]);
133
+ if (e.name !== void 0 && !E(e.name, k)) return A("AUTHORING_PAYLOAD_INVALID", `Component name must contain 1 to ${k} code points without control characters.`, ["name"]);
134
+ let n = oe(e.position);
135
+ return n !== void 0 && "diagnostics" in n ? n : {
136
+ ok: !0,
137
+ value: {
138
+ materialType: e.materialType,
139
+ ...e.name === void 0 ? {} : { name: e.name },
140
+ ...n === void 0 ? {} : { position: n }
141
+ },
142
+ diagnostics: []
143
+ };
144
+ }
145
+ function oe(e) {
146
+ if (e !== void 0) return !le(e) || !ue(e, O) || !ce(e.x) || !ce(e.y) ? A("AUTHORING_PAYLOAD_INVALID", "Component insertion position must be finite canvas coordinates.", ["position"]) : {
147
+ x: e.x,
148
+ y: e.y
149
+ };
150
+ }
151
+ function se(e, t) {
152
+ return e === void 0 || e.type !== t.materialType || e.libraryVisible === !1 ? A("AUTHORING_SOURCE_INVALID", "Component material is not available in the configured catalog.", ["materialType"]) : {
153
+ ok: !0,
154
+ value: e,
155
+ diagnostics: []
156
+ };
157
+ }
158
+ function ce(e) {
159
+ return typeof e == "number" && Number.isFinite(e);
160
+ }
161
+ function le(e) {
162
+ return typeof e == "object" && !!e && !Array.isArray(e);
163
+ }
164
+ function ue(e, t) {
165
+ return Object.keys(e).every((e) => t.has(e));
166
+ }
167
+ function A(e, t, n = []) {
168
+ return {
169
+ ok: !1,
170
+ diagnostics: [{
171
+ severity: "error",
172
+ code: e,
173
+ path: n,
174
+ message: t
175
+ }]
176
+ };
177
+ }
178
+ var de = "application/x-base-screen-host-resource", fe = 8192, pe = /* @__PURE__ */ new Set([
179
+ "materialType",
180
+ "dataSource",
181
+ "name"
182
+ ]), me = 256, he = /(url|token|headers?)/i, ge = /^\s*(?:[a-z][a-z\d+.-]*:\/\/|https?:|data:|blob:|file:|javascript:|\.{0,2}\/)/i;
183
+ function _e(e) {
184
+ let n = Ee(e);
185
+ if (!n.ok) return n;
186
+ if (e = n.value, !we(e) || !Te(e, pe)) return j("AUTHORING_PAYLOAD_INVALID", "Host resource authoring intent must be a strict object.");
187
+ if (!t(e.materialType)) return j("AUTHORING_SOURCE_INVALID", "Host resource materialType must be a canonical material type.", ["materialType"]);
188
+ if (e.name !== void 0 && !E(e.name, me)) return j("AUTHORING_PAYLOAD_INVALID", `Host resource name must contain 1 to ${me} code points without control characters.`, ["name"]);
189
+ if (Ce(e)) return j("AUTHORING_SOURCE_INVALID", "Host resource intent must not contain URLs, tokens, or headers.");
190
+ let i = r(e.dataSource, { componentType: e.materialType });
191
+ if (!i.ok) return j("AUTHORING_PAYLOAD_INVALID", "Host resource dataSource does not match the canonical document contract.", ["dataSource"]);
192
+ let a = i.value;
193
+ return a?.type === "host-resource" ? {
194
+ ok: !0,
195
+ value: {
196
+ materialType: e.materialType,
197
+ dataSource: a,
198
+ ...e.name === void 0 ? {} : { name: e.name }
199
+ },
200
+ diagnostics: []
201
+ } : j("AUTHORING_PAYLOAD_INVALID", "Host resource dataSource must use type \"host-resource\".", ["dataSource", "type"]);
202
+ }
203
+ function ve(e) {
204
+ if (typeof e != "string" || e.length === 0) return j("AUTHORING_PAYLOAD_INVALID", "Host resource drag payload must be nonempty JSON.");
205
+ if (De(e) > 8192) return j("AUTHORING_LIMIT_EXCEEDED", "Host resource drag payload exceeds its byte limit.");
206
+ try {
207
+ return _e(JSON.parse(e));
208
+ } catch {
209
+ return j("AUTHORING_PAYLOAD_INVALID", "Host resource drag payload is not valid JSON.");
210
+ }
211
+ }
212
+ function ye(e, t) {
213
+ let n = _e(t);
214
+ if (!n.ok) return n;
215
+ let r = JSON.stringify(n.value);
216
+ if (De(r) > 8192) return j("AUTHORING_LIMIT_EXCEEDED", "Host resource drag payload exceeds 8 KiB.");
217
+ try {
218
+ return e.setData(de, r), e.effectAllowed = "copy", {
219
+ ok: !0,
220
+ value: null,
221
+ diagnostics: []
222
+ };
223
+ } catch {
224
+ return j("AUTHORING_PAYLOAD_INVALID", "Host resource drag payload could not be written.");
225
+ }
226
+ }
227
+ function be(e, t) {
228
+ return e === void 0 || e.type !== t.materialType || e.libraryVisible === !1 ? j("AUTHORING_SOURCE_INVALID", "Host resource material is not available in the configured catalog.", ["materialType"]) : e.dataCapabilities.includes("host-resource") ? {
229
+ ok: !0,
230
+ value: e,
231
+ diagnostics: []
232
+ } : j("AUTHORING_SOURCE_INVALID", "Host resource material does not declare the host-resource capability.", ["materialType"]);
233
+ }
234
+ function xe(e, t, n, r) {
235
+ return re(e, t, {
236
+ position: ie(e, t, r),
237
+ ...n.name === void 0 ? {} : { name: n.name },
238
+ dataSource: n.dataSource
239
+ });
240
+ }
241
+ function Se(e, t, n) {
242
+ return ie(e, t, {
243
+ x: n.x - t.defaultSize.width / 2,
244
+ y: n.y - t.defaultSize.height / 2
245
+ });
246
+ }
247
+ function Ce(e) {
248
+ return typeof e == "string" ? ge.test(e) : Array.isArray(e) ? e.some(Ce) : we(e) ? Object.entries(e).some(([e, t]) => he.test(e) || Ce(t)) : !1;
249
+ }
250
+ function we(e) {
251
+ return typeof e == "object" && !!e && !Array.isArray(e);
252
+ }
253
+ function Te(e, t) {
254
+ return Object.keys(e).every((e) => t.has(e));
255
+ }
256
+ function Ee(t) {
257
+ try {
258
+ let n = e(t, {
259
+ maxBytes: fe,
260
+ maxStringBytes: fe
261
+ });
262
+ return n.ok ? n : n.diagnostics.some((e) => e.code === "JSON_LIMIT_EXCEEDED") ? j("AUTHORING_LIMIT_EXCEEDED", "Host resource authoring intent exceeds its JSON limits.") : j("AUTHORING_PAYLOAD_INVALID", "Host resource authoring intent is not JSON-safe.");
263
+ } catch {
264
+ return j("AUTHORING_PAYLOAD_INVALID", "Host resource authoring intent is not JSON-safe.");
265
+ }
266
+ }
267
+ function De(e) {
268
+ let t = 0;
269
+ for (let n of e) {
270
+ let e = n.codePointAt(0) ?? 0;
271
+ t += e <= 127 ? 1 : e <= 2047 ? 2 : e <= 65535 ? 3 : 4;
272
+ }
273
+ return t;
274
+ }
275
+ function j(e, t, n = []) {
276
+ return {
277
+ ok: !1,
278
+ diagnostics: [{
279
+ severity: "error",
280
+ code: e,
281
+ path: n,
282
+ message: t
283
+ }]
284
+ };
285
+ }
286
+ var Oe = "#000000", M = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map(), F = /* @__PURE__ */ new Map();
287
+ function ke(e, t) {
288
+ if (M.size >= 32) {
289
+ let e = M.keys().next().value;
290
+ e !== void 0 && (M.delete(e), N.delete(e), P.delete(e), F.delete(e));
291
+ }
292
+ M.set(e, t);
293
+ }
294
+ function Ae(e, t) {
295
+ if (N.size >= 32) {
296
+ let e = N.keys().next().value;
297
+ e !== void 0 && N.delete(e);
298
+ }
299
+ N.set(e, t);
300
+ }
301
+ function je(e, t, n) {
302
+ if (!P.has(e) && P.size >= 32) {
303
+ let e = P.keys().next().value;
304
+ e !== void 0 && P.delete(e);
305
+ }
306
+ P.set(e, {
307
+ hue: t,
308
+ color: n.toLowerCase()
309
+ });
310
+ }
311
+ function Me(e, t, n, r) {
312
+ if (!F.has(e) && F.size >= 32) {
313
+ let e = F.keys().next().value;
314
+ e !== void 0 && F.delete(e);
315
+ }
316
+ F.set(e, {
317
+ saturation: t,
318
+ value: n,
319
+ color: r.toLowerCase()
320
+ });
321
+ }
322
+ function Ne(e) {
323
+ return M.get(e);
324
+ }
325
+ function Pe(e) {
326
+ return N.get(e);
327
+ }
328
+ function Fe(e) {
329
+ return P.get(e);
330
+ }
331
+ function Ie(e) {
332
+ return F.get(e);
333
+ }
334
+ var Le = "#ffffff", Re = /^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|transparent)$/i;
335
+ function ze(e) {
336
+ let t = {
337
+ solid: L(e) ? e : Oe,
338
+ stops: [{
339
+ color: Oe,
340
+ position: 0
341
+ }, {
342
+ color: Le,
343
+ position: 100
344
+ }],
345
+ angle: 90,
346
+ x: 50,
347
+ y: 50
348
+ }, n = Ke(e, "linear-gradient");
349
+ if (n !== void 0) return {
350
+ mode: "linear-gradient",
351
+ ...t,
352
+ angle: n.angle,
353
+ stops: n.stops
354
+ };
355
+ let r = Ke(e, "radial-gradient");
356
+ return r === void 0 ? {
357
+ mode: "solid",
358
+ ...t
359
+ } : {
360
+ mode: "radial-gradient",
361
+ ...t,
362
+ x: r.x,
363
+ y: r.y,
364
+ stops: r.stops
365
+ };
366
+ }
367
+ function I(e) {
368
+ if (e.mode === "solid") return e.solid;
369
+ let t = e.stops.map((e) => `${e.color} ${e.position}%`).join(", ");
370
+ return e.mode === "linear-gradient" ? `linear-gradient(${e.angle}deg, ${t})` : `radial-gradient(circle at ${e.x}% ${e.y}%, ${t})`;
371
+ }
372
+ function Be(e) {
373
+ if (e.stops.length >= 8) return;
374
+ let t = Je(e.stops);
375
+ if (t === void 0) return;
376
+ let n = [...e.stops], r = {
377
+ color: Le,
378
+ position: t.position
379
+ };
380
+ return n.splice(t.index, 0, r), {
381
+ ...e,
382
+ stops: n
383
+ };
384
+ }
385
+ function Ve(e, t) {
386
+ if (!(e.stops.length <= 2 || e.stops[t] === void 0)) return {
387
+ ...e,
388
+ stops: e.stops.filter((e, n) => n !== t)
389
+ };
390
+ }
391
+ function He(e, t, n, r = 0) {
392
+ if (t !== "solid" && n === "solid" && Ye(e.stops)) {
393
+ let n = We(e.solid);
394
+ if (n !== void 0) return {
395
+ ...e,
396
+ mode: t,
397
+ stops: n
398
+ };
399
+ }
400
+ if (t === "solid" && n !== "solid") {
401
+ let t = Ue(e, r);
402
+ if (t !== void 0) return {
403
+ ...e,
404
+ mode: "solid",
405
+ solid: t
406
+ };
407
+ }
408
+ return {
409
+ ...e,
410
+ mode: t
411
+ };
412
+ }
413
+ function Ue(e, t) {
414
+ if (e.stops.length === 0) return;
415
+ let n = Math.min(Math.max(Number.isInteger(t) ? t : 0, 0), e.stops.length - 1), r = e.stops[n]?.color;
416
+ return r !== void 0 && r.toLowerCase() !== "transparent" && L(r) ? r : void 0;
417
+ }
418
+ function We(e) {
419
+ let t = Xe(e);
420
+ if (t === void 0) return;
421
+ let n = t.alpha === void 0 ? "" : t.alpha, r = `${Qe(t.r, t.g, t.b)}${n}`, i = `${$e(t, 255, .45)}${n}`, a = i === r ? `${$e(t, 0, .35)}${n}` : i;
422
+ return [{
423
+ color: r,
424
+ position: 0
425
+ }, {
426
+ color: a,
427
+ position: 100
428
+ }];
429
+ }
430
+ function Ge(e) {
431
+ return e === "solid" || e === "linear-gradient" || e === "radial-gradient";
432
+ }
433
+ function Ke(e, t) {
434
+ if (e === void 0) return;
435
+ let n = t === "linear-gradient" ? e.match(/^linear-gradient\((\d+(?:\.\d+)?)deg,\s*(.+)\)$/i) : null;
436
+ if (n != null) {
437
+ let e = qe(n[2]);
438
+ if (e === void 0) return;
439
+ let t = Number(n[1]);
440
+ return Number.isFinite(t) && t >= 0 && t <= 360 ? {
441
+ angle: t,
442
+ stops: e
443
+ } : void 0;
444
+ }
445
+ let r = t === "radial-gradient" ? e.match(/^radial-gradient\(circle at (\d+(?:\.\d+)?)% (\d+(?:\.\d+)?)%,\s*(.+)\)$/i) : null;
446
+ if (r != null) {
447
+ let e = qe(r[3]);
448
+ if (e === void 0) return;
449
+ let t = Number(r[1]), n = Number(r[2]);
450
+ return Number.isFinite(t) && Number.isFinite(n) && t >= 0 && t <= 100 && n >= 0 && n <= 100 ? {
451
+ x: t,
452
+ y: n,
453
+ stops: e
454
+ } : void 0;
455
+ }
456
+ }
457
+ function qe(e) {
458
+ let t = e.split(",").map((e) => e.trim());
459
+ if (t.length < 2 || t.length > 8) return;
460
+ let n = [];
461
+ for (let e of t) {
462
+ let t = e.match(/^(#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|transparent)\s+(\d+(?:\.\d+)?)%$/i);
463
+ if (t === null) return;
464
+ let r = Number(t[2]);
465
+ if (!Number.isInteger(r) || r < 0 || r > 100) return;
466
+ n.push({
467
+ color: t[1].toLowerCase(),
468
+ position: r
469
+ });
470
+ }
471
+ if (n.every((e, t) => t === 0 || n[t - 1].position < e.position)) return n;
472
+ }
473
+ function Je(e) {
474
+ let t = [
475
+ 0,
476
+ ...e.map((e) => e.position),
477
+ 100
478
+ ], n;
479
+ for (let e = 0; e < t.length - 1; e++) {
480
+ let r = t[e], i = t[e + 1];
481
+ if (i - r < 2) continue;
482
+ let a = Math.floor((r + i) / 2);
483
+ (n === void 0 || i - r > n.size) && (n = {
484
+ index: e,
485
+ position: a,
486
+ size: i - r
487
+ });
488
+ }
489
+ return n === void 0 ? void 0 : {
490
+ index: n.index,
491
+ position: n.position
492
+ };
493
+ }
494
+ function L(e) {
495
+ return e !== void 0 && Re.test(e);
496
+ }
497
+ function Ye(e) {
498
+ return e.length === 2 && e[0]?.color === "#000000" && e[0]?.position === 0 && e[1]?.color === Le && e[1]?.position === 100;
499
+ }
500
+ function Xe(e) {
501
+ if (e === void 0) return;
502
+ let t = e.toLowerCase().match(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/);
503
+ if (t == null) return;
504
+ let n = t[1];
505
+ (n.length === 3 || n.length === 4) && (n = [...n].map((e) => `${e}${e}`).join(""));
506
+ let r = Number.parseInt(n.slice(0, 2), 16), i = Number.parseInt(n.slice(2, 4), 16), a = Number.parseInt(n.slice(4, 6), 16), o = n.length === 8 ? n.slice(6, 8) : void 0;
507
+ return o === void 0 ? {
508
+ r,
509
+ g: i,
510
+ b: a
511
+ } : {
512
+ r,
513
+ g: i,
514
+ b: a,
515
+ alpha: o
516
+ };
517
+ }
518
+ function Ze(e, t, n) {
519
+ return Math.round(e + (t - e) * n);
520
+ }
521
+ function Qe(e, t, n) {
522
+ return `#${[
523
+ e,
524
+ t,
525
+ n
526
+ ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
527
+ }
528
+ function $e(e, t, n) {
529
+ return Qe(Ze(e.r, t, n), Ze(e.g, t, n), Ze(e.b, t, n));
530
+ }
531
+ function et(e, t) {
532
+ let n = e.style;
533
+ n !== void 0 && (n.left = `${t}%`);
534
+ }
535
+ function tt(e, t) {
536
+ e.style?.setProperty?.("--designer-color-palette-stop-color", t);
537
+ }
538
+ function nt(e, t, n, r) {
539
+ let i = n === 0 ? 0 : t[n - 1].position + 1, a = n === t.length - 1 ? 100 : t[n + 1].position - 1, o = n === r;
540
+ e.dataset.colorPaletteStopMin = String(i), e.dataset.colorPaletteStopMax = String(a), e.dataset.colorPaletteStopSelected = String(o), e.setAttribute("aria-valuemin", String(i)), e.setAttribute("aria-valuemax", String(a)), e.setAttribute("aria-valuenow", String(t[n].position)), e.setAttribute("aria-pressed", String(o));
541
+ let s = e.className.split(/\s+/).filter((e) => e.length > 0 && e !== "is-selected");
542
+ o && s.push("is-selected"), e.className = s.join(" ");
543
+ }
544
+ function R(e) {
545
+ return [...e.querySelectorAll("[data-color-palette-stop-handle]")];
546
+ }
547
+ function z(e) {
548
+ let t = [];
549
+ for (let n of e) {
550
+ let e = n.dataset.colorPaletteStopColor, r = Number(n.dataset.colorPaletteStopPosition);
551
+ if (!L(e) || !Number.isInteger(r) || r < 0 || r > 100) return;
552
+ t.push({
553
+ color: e,
554
+ position: r
555
+ });
556
+ }
557
+ return t.every((e, n) => n === 0 || t[n - 1].position < e.position) ? t : void 0;
558
+ }
559
+ function B(e, t) {
560
+ return rt(Number(e.dataset.colorPaletteSelectedStop), t);
561
+ }
562
+ function rt(e, t) {
563
+ return e !== void 0 && Number.isInteger(e) && e >= 0 && e < t ? e : 0;
564
+ }
565
+ function it(e, t) {
566
+ for (let n = 0; n < t.length; n++) {
567
+ let r = e[n], i = t[n];
568
+ if (r?.color !== i.color || r.position !== i.position) return n;
569
+ }
570
+ return Math.max(0, t.length - 1);
571
+ }
572
+ function at(e, t, n) {
573
+ let r = h(e, { appearance: "color" });
574
+ return ot(r, t), r.dataset.colorPaletteField = n, r;
575
+ }
576
+ function ot(e, t) {
577
+ if (t.toLowerCase() === "transparent") {
578
+ e.value = Oe, delete e.dataset.colorPaletteAlpha, e.dataset.colorPaletteTransparent = "true";
579
+ return;
580
+ }
581
+ let n = Xe(t);
582
+ e.value = n === void 0 ? Oe : Qe(n.r, n.g, n.b), n?.alpha === void 0 ? delete e.dataset.colorPaletteAlpha : e.dataset.colorPaletteAlpha = n.alpha, delete e.dataset.colorPaletteTransparent;
583
+ }
584
+ function st(e) {
585
+ if (e.dataset?.colorPaletteTransparent === "true") return "transparent";
586
+ let t = e.dataset?.colorPaletteAlpha;
587
+ return t === void 0 || t === "ff" ? e.value : `${e.value}${t}`;
588
+ }
589
+ function ct(e) {
590
+ let t = e.trim();
591
+ if (t.toLowerCase() === "transparent") return "transparent";
592
+ let n = Xe(t);
593
+ return n === void 0 ? void 0 : `${Qe(n.r, n.g, n.b)}${n.alpha ?? ""}`;
594
+ }
595
+ function lt(e) {
596
+ return e === "solid-value" || e === "stop-value";
597
+ }
598
+ function ut(e) {
599
+ e.setAttribute("aria-invalid", String(ct(e.value) === void 0));
600
+ }
601
+ function dt(e) {
602
+ return e !== null && ct(e.value) !== void 0;
603
+ }
604
+ function ft(e) {
605
+ let t = Xe(e);
606
+ return t?.alpha === void 0 ? 100 : Math.round(Number.parseInt(t.alpha, 16) * 100 / 255);
607
+ }
608
+ function pt(e) {
609
+ return Math.round(Math.min(100, Math.max(0, e)) * 255 / 100).toString(16).padStart(2, "0");
610
+ }
611
+ function V(e, t) {
612
+ e.value = st(t).toUpperCase(), e.setAttribute("aria-invalid", "false");
613
+ }
614
+ function mt(e, t, n) {
615
+ let r = at(e, t, n);
616
+ r.setAttribute("aria-label", l.propertiesPanel.gradientStopColor);
617
+ let i = e.createElement("span");
618
+ i.className = "designer-color-palette-color-control";
619
+ let a = h(e, { className: "designer-color-palette-color-value" });
620
+ return a.dataset.colorPaletteField = n === "solid" ? "solid-value" : "stop-value", a.setAttribute("aria-label", l.propertiesPanel.gradientStopHexValue), a.setAttribute("autocomplete", "off"), a.setAttribute("spellcheck", "false"), V(a, r), r.addEventListener("input", () => {
621
+ delete r.dataset.colorPaletteTransparent, V(a, r);
622
+ }), i.appendChild(r), i.appendChild(a), {
623
+ element: i,
624
+ input: r,
625
+ value: a
626
+ };
627
+ }
628
+ function ht(e, t, n) {
629
+ let r = e.createElement("span");
630
+ r.className = "designer-color-palette-alpha";
631
+ let i = e.createElement("span");
632
+ i.className = "designer-color-palette-alpha-label", i.textContent = l.propertiesPanel.gradientStopOpacity;
633
+ let a = h(e, {
634
+ appearance: "range",
635
+ className: "designer-color-palette-alpha-input",
636
+ min: 0,
637
+ max: 100,
638
+ step: 1,
639
+ value: String(ft(t)),
640
+ ariaLabel: l.propertiesPanel.gradientStopOpacity
641
+ });
642
+ a.dataset.colorPaletteField = n;
643
+ let o = e.createElement("span");
644
+ return o.className = "designer-color-palette-alpha-value", o.textContent = `${a.value}%`, a.addEventListener("input", () => {
645
+ o.textContent = `${a.value}%`;
646
+ }), r.appendChild(i), r.appendChild(a), r.appendChild(o), {
647
+ element: r,
648
+ input: a
649
+ };
650
+ }
651
+ function gt(e, t, n, r, i) {
652
+ let a = h(e, {
653
+ appearance: "number",
654
+ min: r,
655
+ max: i,
656
+ step: 1,
657
+ value: String(t)
658
+ });
659
+ return a.dataset.colorPaletteField = n, a;
660
+ }
661
+ function _t(e, t, n, r, i, a, o = t) {
662
+ let s = gt(e, n, r, i, a);
663
+ s.setAttribute("aria-label", t);
664
+ let c = e.createElement("span");
665
+ c.className = "designer-color-palette-field-inline";
666
+ let l = e.createElement("span");
667
+ return l.className = "designer-color-palette-field-inline-label", l.textContent = o, c.appendChild(l), c.appendChild(s), {
668
+ element: c,
669
+ input: s
670
+ };
671
+ }
672
+ function vt(e) {
673
+ return e.mode === "solid" ? e.solid.toUpperCase() : e.mode === "linear-gradient" ? l.propertiesPanel.colorPickerLinearSummary(e.stops.length) : l.propertiesPanel.colorPickerRadialSummary(e.stops.length);
674
+ }
675
+ function H(e) {
676
+ let t = e.querySelector("[data-color-palette-field=\"mode\"]:checked")?.value, n = Ge(t) ? t : Ge(e.dataset.colorPaletteMode) ? e.dataset.colorPaletteMode : void 0, r = e.querySelector("[data-color-palette-field=\"solid\"]"), i = r === null ? void 0 : st(r), a = e.querySelector("[data-color-palette-field=\"solid-value\"]"), o = e.querySelector("[data-color-palette-field=\"stop-value\"]"), s = z(R(e));
677
+ if (n === void 0 || i === void 0 || !L(i) || !dt(a) || !dt(o) || s === void 0 || s.length < 2 || s.length > 8) return;
678
+ let c = yt(e, "angle"), l = yt(e, "x"), u = yt(e, "y");
679
+ if (c !== void 0 && l !== void 0 && u !== void 0) return {
680
+ mode: n,
681
+ solid: i,
682
+ stops: s,
683
+ angle: c,
684
+ x: l,
685
+ y: u
686
+ };
687
+ }
688
+ function yt(e, t) {
689
+ let n = Number(e.querySelector(`[data-color-palette-field="${t}"]`)?.value);
690
+ if (!Number.isFinite(n)) return;
691
+ let [r, i] = t === "angle" ? [0, 360] : [0, 100];
692
+ return n >= r && n <= i ? n : void 0;
693
+ }
694
+ function U(e, t, n) {
695
+ return Math.min(n, Math.max(t, e));
696
+ }
697
+ function bt(e) {
698
+ if (e.trim().toLowerCase() === "transparent") return {
699
+ r: 0,
700
+ g: 0,
701
+ b: 0,
702
+ a: 0
703
+ };
704
+ let t = e.trim().replace(/^#/, "");
705
+ if (![
706
+ 3,
707
+ 4,
708
+ 6,
709
+ 8
710
+ ].includes(t.length) || !/^[\da-f]+$/i.test(t)) return;
711
+ let n = t.length <= 4 ? [...t].map((e) => e.repeat(2)).join("") : t.toLowerCase(), r = n.length === 6 ? `${n}ff` : n;
712
+ return {
713
+ r: Number.parseInt(r.slice(0, 2), 16),
714
+ g: Number.parseInt(r.slice(2, 4), 16),
715
+ b: Number.parseInt(r.slice(4, 6), 16),
716
+ a: Number.parseInt(r.slice(6, 8), 16) / 255
717
+ };
718
+ }
719
+ function xt(e, t = e.a < .999) {
720
+ let n = [
721
+ e.r,
722
+ e.g,
723
+ e.b
724
+ ].map((e) => Math.round(U(e, 0, 255)).toString(16).padStart(2, "0"));
725
+ return t && n.push(Math.round(U(e.a, 0, 1) * 255).toString(16).padStart(2, "0")), `#${n.join("")}`;
726
+ }
727
+ function W(e) {
728
+ let t = U(e.r, 0, 255) / 255, n = U(e.g, 0, 255) / 255, r = U(e.b, 0, 255) / 255, i = Math.max(t, n, r), a = i - Math.min(t, n, r), o = 0;
729
+ return a !== 0 && (i === t && (o = 60 * ((n - r) / a % 6)), i === n && (o = 60 * ((r - t) / a + 2)), i === r && (o = 60 * ((t - n) / a + 4))), {
730
+ h: o < 0 ? o + 360 : o,
731
+ s: i === 0 ? 0 : a / i * 100,
732
+ v: i * 100,
733
+ a: U(e.a, 0, 1)
734
+ };
735
+ }
736
+ function St(e, t = 0) {
737
+ let n = W(e);
738
+ return n.s > 0 && n.v > 0 ? n.h : U(t, 0, 360);
739
+ }
740
+ function Ct(e) {
741
+ let t = (e.h % 360 + 360) % 360, n = U(e.s, 0, 100) / 100, r = U(e.v, 0, 100) / 100, i = r * n, a = i * (1 - Math.abs(t / 60 % 2 - 1)), o = r - i, [s, c, l] = t < 60 ? [
742
+ i,
743
+ a,
744
+ 0
745
+ ] : t < 120 ? [
746
+ a,
747
+ i,
748
+ 0
749
+ ] : t < 180 ? [
750
+ 0,
751
+ i,
752
+ a
753
+ ] : t < 240 ? [
754
+ 0,
755
+ a,
756
+ i
757
+ ] : t < 300 ? [
758
+ a,
759
+ 0,
760
+ i
761
+ ] : [
762
+ i,
763
+ 0,
764
+ a
765
+ ];
766
+ return {
767
+ r: Math.round((s + o) * 255),
768
+ g: Math.round((c + o) * 255),
769
+ b: Math.round((l + o) * 255),
770
+ a: U(e.a, 0, 1)
771
+ };
772
+ }
773
+ function G(e) {
774
+ return xt(e.color);
775
+ }
776
+ function wt(e, t) {
777
+ let n = xt({
778
+ ...t.color,
779
+ a: 1
780
+ }, !1);
781
+ e.setAttribute("style", `--designer-fill-hue:${t.hueValue};--designer-fill-saturation:${t.planeSaturation};--designer-fill-value:${t.planeValue};--designer-fill-color:${G(t)};--designer-fill-opaque:${n}`), t.plane.setAttribute("aria-valuetext", l.propertiesPanel.colorPickerPlaneValue(Math.round(t.planeSaturation), Math.round(t.planeValue))), t.hue.value = String(Math.round(t.hueValue)), t.alpha.value = String(Math.round(t.color.a * 100)), t.channels.hex.value = xt(t.color, !1), t.channels.r.value = String(Math.round(t.color.r)), t.channels.g.value = String(Math.round(t.color.g)), t.channels.b.value = String(Math.round(t.color.b)), t.channels.a.value = String(Math.round(t.color.a * 100));
782
+ }
783
+ function Tt(e, t, n) {
784
+ let r = (n, r) => {
785
+ let i = t.plane.getBoundingClientRect();
786
+ if (i.width <= 0 || i.height <= 0) return;
787
+ let a = U((n.clientX - i.left) / i.width * 100, 0, 100), o = U(100 - (n.clientY - i.top) / i.height * 100, 0, 100);
788
+ Ot(e, t, Ct({
789
+ ...W(t.color),
790
+ h: t.hueValue,
791
+ s: a,
792
+ v: o
793
+ }), r, t.hueValue, {
794
+ s: a,
795
+ v: o
796
+ });
797
+ }, i, a = (e) => {
798
+ i = void 0;
799
+ let n = t.plane;
800
+ n.hasPointerCapture?.(e) === !0 && n.releasePointerCapture?.(e);
801
+ };
802
+ t.plane.addEventListener("pointerdown", (e) => {
803
+ e.button === 0 && e.isPrimary !== !1 && (e.preventDefault(), i = e.pointerId, t.plane.setPointerCapture?.(e.pointerId), r(e, !1));
804
+ }), t.plane.addEventListener("pointermove", (e) => {
805
+ i === e.pointerId && r(e, !1);
806
+ }), t.plane.addEventListener("pointerup", (e) => {
807
+ i === e.pointerId && (r(e, !0), a(e.pointerId));
808
+ }), t.plane.addEventListener("pointercancel", (e) => {
809
+ i === e.pointerId && (t.callbacks.change(G(t)), a(e.pointerId));
810
+ }), t.plane.addEventListener("lostpointercapture", (e) => {
811
+ i === e.pointerId && (i = void 0, t.callbacks.change(G(t)));
812
+ }), t.plane.addEventListener("keydown", (n) => {
813
+ let r = n;
814
+ if (![
815
+ "ArrowLeft",
816
+ "ArrowRight",
817
+ "ArrowUp",
818
+ "ArrowDown"
819
+ ].includes(r.key)) return;
820
+ n.preventDefault();
821
+ let i = r.shiftKey ? 10 : 1, a = W(t.color), o = t.planeSaturation + (r.key === "ArrowRight" ? i : r.key === "ArrowLeft" ? -i : 0), s = t.planeValue + (r.key === "ArrowUp" ? i : r.key === "ArrowDown" ? -i : 0);
822
+ Ot(e, t, Ct({
823
+ ...a,
824
+ h: t.hueValue,
825
+ s: o,
826
+ v: s
827
+ }), !0, t.hueValue, {
828
+ s: o,
829
+ v: s
830
+ });
831
+ });
832
+ for (let n of [t.hue, t.alpha]) n.addEventListener("input", () => Et(e, t, !1)), n.addEventListener("change", () => t.callbacks.change(G(t)));
833
+ for (let n of Object.values(t.channels)) n.addEventListener("change", () => Dt(e, t, n));
834
+ for (let r of n) r.addEventListener("click", () => {
835
+ let n = bt(r.dataset.fillColorQuick ?? "");
836
+ n !== void 0 && Ot(e, t, n, !0);
837
+ });
838
+ }
839
+ function Et(e, t, n) {
840
+ let r = W(t.color), i = Number(t.hue.value);
841
+ Ot(e, t, Ct({
842
+ ...r,
843
+ h: i,
844
+ s: t.planeSaturation,
845
+ v: t.planeValue,
846
+ a: Number(t.alpha.value) / 100
847
+ }), n, i);
848
+ }
849
+ function Dt(e, t, n) {
850
+ let r = n.dataset.fillColorChannel, i;
851
+ if (r === "hex" && (i = bt(n.value)), r === "r" || r === "g" || r === "b" || r === "a") {
852
+ let e = Number(n.value), a = r === "a" ? 100 : 255;
853
+ Number.isFinite(e) && e >= 0 && e <= a && (i = r === "a" ? {
854
+ ...t.color,
855
+ a: e / 100
856
+ } : {
857
+ ...t.color,
858
+ [r]: Math.round(e)
859
+ });
860
+ }
861
+ if (i === void 0) {
862
+ n.setAttribute("aria-invalid", "true"), t.message.textContent = l.propertiesPanel.colorPickerHexInvalid;
863
+ return;
864
+ }
865
+ n.removeAttribute("aria-invalid"), t.message.textContent = "", Ot(e, t, i, !0);
866
+ }
867
+ function Ot(e, t, n, r, i, a) {
868
+ if (t.color = {
869
+ r: U(n.r, 0, 255),
870
+ g: U(n.g, 0, 255),
871
+ b: U(n.b, 0, 255),
872
+ a: U(n.a, 0, 1)
873
+ }, t.hueValue = i === void 0 ? St(t.color, t.hueValue) : U(i, 0, 360), a === void 0) {
874
+ let e = W(t.color);
875
+ t.planeSaturation = e.s, t.planeValue = e.v;
876
+ } else t.planeSaturation = U(a.s, 0, 100), t.planeValue = U(a.v, 0, 100);
877
+ t.callbacks.hueChange?.(t.hueValue, G(t)), t.callbacks.planeChange?.(t.planeSaturation, t.planeValue, G(t)), wt(e, t), t.callbacks.input(G(t)), r && t.callbacks.change(G(t));
878
+ }
879
+ var kt = [
880
+ "#2483ff",
881
+ "#39c5bb",
882
+ "#00c9a7",
883
+ "#7c6cff",
884
+ "#f0b94b",
885
+ "#ff765c",
886
+ "#ed5f82",
887
+ "#d9e0e8",
888
+ "#18222e"
889
+ ], At = /* @__PURE__ */ new WeakMap();
890
+ function jt(e, t, n, r, i) {
891
+ let a = e.createElement("section");
892
+ a.className = "designer-fill-color-picker", a.dataset.designerFillColorPicker = "";
893
+ let o = e.createElement("button");
894
+ o.type = "button", o.className = "designer-fill-color-plane", o.setAttribute("aria-label", l.propertiesPanel.colorPickerPlane);
895
+ let s = e.createElement("span");
896
+ s.className = "designer-fill-color-plane-thumb", o.appendChild(s), a.appendChild(o);
897
+ let c = e.createElement("div");
898
+ c.className = "designer-fill-color-slider-row";
899
+ let u = e.createElement("div");
900
+ u.className = "designer-fill-color-sliders";
901
+ let d = Pt(e, "designer-fill-color-hue", 0, 360, l.propertiesPanel.colorPickerHue), f = e.createElement("label");
902
+ f.className = "designer-fill-color-hue-track", f.appendChild(d);
903
+ let p = Pt(e, "designer-fill-color-alpha", 0, 100, l.propertiesPanel.gradientStopOpacity), m = e.createElement("label");
904
+ m.className = "designer-fill-color-alpha-track designer-fill-color-checkerboard", m.appendChild(p), u.appendChild(f), u.appendChild(m);
905
+ let g = e.createElement("span");
906
+ g.className = "designer-fill-color-current designer-fill-color-checkerboard", g.setAttribute("aria-hidden", "true"), c.appendChild(u), c.appendChild(g), a.appendChild(c);
907
+ let _ = e.createElement("div");
908
+ _.className = "designer-fill-color-channel-grid";
909
+ let v = {};
910
+ for (let t of [
911
+ "hex",
912
+ "r",
913
+ "g",
914
+ "b",
915
+ "a"
916
+ ]) {
917
+ let n = e.createElement("label");
918
+ n.className = `designer-fill-color-channel designer-fill-color-channel-${t}`;
919
+ let r = h(e, {
920
+ type: t === "hex" ? "text" : "number",
921
+ ariaLabel: t === "hex" ? "Hex" : t.toUpperCase()
922
+ });
923
+ r.dataset.fillColorChannel = t, t === "hex" ? (r.setAttribute("autocomplete", "off"), r.setAttribute("spellcheck", "false"), r.maxLength = 9) : (r.min = "0", r.max = t === "a" ? "100" : "255", r.step = "1");
924
+ let i = e.createElement("span");
925
+ i.textContent = t === "hex" ? "Hex" : t.toUpperCase(), n.appendChild(r), n.appendChild(i), _.appendChild(n), v[t] = r;
926
+ }
927
+ a.appendChild(_);
928
+ let y = e.createElement("p");
929
+ y.className = "designer-fill-color-message", y.setAttribute("aria-live", "polite"), a.appendChild(y);
930
+ let b = e.createElement("section");
931
+ b.className = "designer-fill-color-quick";
932
+ let x = e.createElement("span");
933
+ x.textContent = l.propertiesPanel.colorPickerQuickColors, b.appendChild(x);
934
+ let S = e.createElement("div"), C = [];
935
+ for (let t of kt) {
936
+ let n = e.createElement("button");
937
+ n.type = "button", n.className = "designer-fill-color-swatch", n.dataset.fillColorQuick = t, n.setAttribute("style", `--designer-fill-swatch:${t}`), n.setAttribute("aria-label", l.propertiesPanel.colorPickerQuickColor(t)), S.appendChild(n), C.push(n);
938
+ }
939
+ b.appendChild(S), a.appendChild(b);
940
+ let w = bt(t) ?? {
941
+ r: 0,
942
+ g: 0,
943
+ b: 0,
944
+ a: 1
945
+ }, T = W(w), E = {
946
+ color: w,
947
+ hueValue: r === void 0 ? St(w) : U(r, 0, 360),
948
+ planeSaturation: U(i?.s ?? T.s, 0, 100),
949
+ planeValue: U(i?.v ?? T.v, 0, 100),
950
+ callbacks: n,
951
+ plane: o,
952
+ hue: d,
953
+ alpha: p,
954
+ channels: v,
955
+ message: y,
956
+ controls: [
957
+ o,
958
+ d,
959
+ p,
960
+ ...Object.values(v),
961
+ ...C
962
+ ]
963
+ };
964
+ return At.set(a, E), Tt(a, E, C), wt(a, E), a;
965
+ }
966
+ function Mt(e, t) {
967
+ let n = At.get(e), r = bt(t);
968
+ if (n === void 0 || r === void 0) return;
969
+ let i = W(r);
970
+ n.hueValue = St(r, n.hueValue), n.planeSaturation = i.s, n.planeValue = i.v, n.color = r, n.message.textContent = "", wt(e, n);
971
+ }
972
+ function Nt(e, t) {
973
+ let n = At.get(e);
974
+ if (n !== void 0) for (let e of n.controls) e.disabled !== t && (e.disabled = t);
975
+ }
976
+ function Pt(e, t, n, r, i) {
977
+ let a = h(e, {
978
+ appearance: "range",
979
+ className: t,
980
+ max: r,
981
+ min: n,
982
+ step: 1
983
+ });
984
+ return a.setAttribute("aria-label", i), a;
985
+ }
986
+ var Ft = /* @__PURE__ */ new WeakSet();
987
+ function It(e) {
988
+ return Ft.has(e);
989
+ }
990
+ function K(e, t = !0) {
991
+ let n = H(e);
992
+ if (n === void 0) return;
993
+ let r = I(n), i = e.querySelector("[data-color-palette-action=\"toggle\"]"), a = e.querySelector("[data-color-palette-trigger-swatch]"), o = e.querySelector("[data-color-palette-trigger-value]");
994
+ i !== null && (i.setAttribute("aria-label", l.propertiesPanel.colorPickerTrigger(r)), i.setAttribute("data-tip", r)), a !== null && a.setAttribute("style", `--designer-color-palette-value:${r}`), o !== null && (o.textContent = vt(n));
995
+ let s = e.querySelector("[data-designer-fill-color-picker]");
996
+ s !== null && t && Mt(s, Lt(n, e));
997
+ }
998
+ function Lt(e, t) {
999
+ return e.mode === "solid" ? e.solid : e.stops[B(t, e.stops.length)]?.color ?? e.solid;
1000
+ }
1001
+ function Rt(e, t, n) {
1002
+ let r = e.dataset.colorPaletteMode, i = r === "solid" ? "solid-value" : "stop-value", a = e.querySelector(`[data-color-palette-field="${i}"]`), o = e.querySelector(`[data-color-palette-field="${r === "solid" ? "solid" : "stop-color"}"]`);
1003
+ if (a !== null && o !== null) {
1004
+ Ft.add(e);
1005
+ try {
1006
+ a.value = t, Vt(e, a, i), o.dispatchEvent(new Event(n, { bubbles: !0 }));
1007
+ } finally {
1008
+ Ft.delete(e);
1009
+ }
1010
+ }
1011
+ }
1012
+ function zt(e, t) {
1013
+ let n = R(e);
1014
+ if (!Number.isInteger(t) || n[t] === void 0) return;
1015
+ let r = z(n);
1016
+ if (r === void 0) return;
1017
+ e.dataset.colorPaletteSelectedStop = String(t);
1018
+ let i = e.dataset.colorPaletteKey;
1019
+ i !== void 0 && Ae(i, t);
1020
+ for (let e = 0; e < n.length; e++) nt(n[e], r, e, t);
1021
+ let a = e.querySelector("[data-color-palette-stop-editor]"), o = e.querySelector("[data-color-palette-field=\"stop-color\"]"), s = e.querySelector("[data-color-palette-field=\"stop-position\"]"), c = e.querySelector("[data-color-palette-action=\"remove-stop\"]");
1022
+ if (a !== null && (a.dataset.colorPaletteStopEditor = String(t)), o !== null) {
1023
+ o.dataset.colorPaletteStopIndex = String(t), ot(o, r[t].color);
1024
+ let n = o.closest(".designer-color-palette-color-control")?.querySelector(".designer-color-palette-color-value");
1025
+ n != null && (n.dataset.colorPaletteStopIndex = String(t), V(n, o));
1026
+ let i = e.querySelector("[data-color-palette-field=\"stop-alpha\"]");
1027
+ if (i !== null) {
1028
+ i.dataset.colorPaletteStopIndex = String(t), i.value = String(ft(r[t].color));
1029
+ let e = i.closest(".designer-color-palette-alpha")?.querySelector(".designer-color-palette-alpha-value");
1030
+ e != null && (e.textContent = `${i.value}%`);
1031
+ }
1032
+ }
1033
+ s !== null && (s.dataset.colorPaletteStopIndex = String(t), s.value = String(r[t].position), s.min = String(t === 0 ? 0 : r[t - 1].position + 1), s.max = String(t === r.length - 1 ? 100 : r[t + 1].position - 1)), c !== null && (c.dataset.colorPaletteStopIndex = String(t)), K(e);
1034
+ }
1035
+ function Bt(e, t, n) {
1036
+ let r = n === "solid-alpha" ? e.querySelector("[data-color-palette-field=\"solid\"]") : e.querySelector("[data-color-palette-field=\"stop-color\"]");
1037
+ if (r == null) return;
1038
+ delete r.dataset.colorPaletteTransparent, r.dataset.colorPaletteAlpha = pt(Number(t.value));
1039
+ let i = r.closest(".designer-color-palette-color-control")?.querySelector(".designer-color-palette-color-value");
1040
+ i != null && V(i, r), n === "stop-alpha" && Ht(e, r), Yt(e);
1041
+ }
1042
+ function Vt(e, t, n) {
1043
+ let r = ct(t.value);
1044
+ if (r === void 0) {
1045
+ ut(t);
1046
+ return;
1047
+ }
1048
+ let i = n === "solid-value" ? e.querySelector("[data-color-palette-field=\"solid\"]") : e.querySelector("[data-color-palette-field=\"stop-color\"]");
1049
+ if (i == null) return;
1050
+ ot(i, r), V(t, i);
1051
+ let a = n === "solid-value" ? "solid-alpha" : "stop-alpha", o = e.querySelector(`[data-color-palette-field="${a}"]`);
1052
+ if (o !== null) {
1053
+ o.value = String(ft(r));
1054
+ let e = o.closest(".designer-color-palette-alpha")?.querySelector(".designer-color-palette-alpha-value");
1055
+ e != null && (e.textContent = `${o.value}%`);
1056
+ }
1057
+ n === "stop-value" && Ht(e, i), Yt(e);
1058
+ }
1059
+ function Ht(e, t) {
1060
+ let n = Number(t.dataset.colorPaletteStopIndex), r = R(e)[n];
1061
+ if (!Number.isInteger(n) || r === void 0) return;
1062
+ let i = st(t);
1063
+ L(i) && (r.dataset.colorPaletteStopColor = i, tt(r, i));
1064
+ }
1065
+ function Ut(e, t, n) {
1066
+ let r = Number(t.dataset.colorPaletteStopIndex), i = R(e), a = i[r];
1067
+ if (!Number.isInteger(r) || a === void 0) return;
1068
+ if (n === "stop-color") {
1069
+ Ht(e, t);
1070
+ return;
1071
+ }
1072
+ let o = Number(t.value), s = Number(t.min), c = Number(t.max);
1073
+ if (!Number.isInteger(o) || o < s || o > c) return;
1074
+ a.dataset.colorPaletteStopPosition = String(o), et(a, o);
1075
+ let l = z(i);
1076
+ if (l !== void 0) for (let t = 0; t < i.length; t++) nt(i[t], l, t, B(e, l.length));
1077
+ }
1078
+ function Wt(e, t) {
1079
+ let n = e.closest("[data-designer-color-palette]");
1080
+ if (n === null) return;
1081
+ let r = Number(e.dataset.colorPaletteStopHandle);
1082
+ if (!Number.isInteger(r)) return;
1083
+ t.preventDefault(), t.stopPropagation(), zt(n, r), e.setPointerCapture?.(t.pointerId);
1084
+ let i = !1, a = (e) => {
1085
+ i = Kt(n, r, e.clientX) || i;
1086
+ }, o = (t) => {
1087
+ e.removeEventListener("pointermove", a), e.removeEventListener("pointerup", o), e.removeEventListener("pointercancel", o), e.hasPointerCapture?.(t.pointerId) && e.releasePointerCapture(t.pointerId), i && Jt(n);
1088
+ };
1089
+ e.addEventListener("pointermove", a), e.addEventListener("pointerup", o), e.addEventListener("pointercancel", o);
1090
+ }
1091
+ function Gt(e, t) {
1092
+ let n = e.closest("[data-designer-color-palette]");
1093
+ if (n === null) return;
1094
+ let r = Number(e.dataset.colorPaletteStopHandle), i = Number(e.dataset.colorPaletteStopPosition), a = z(R(n));
1095
+ if (!Number.isInteger(r) || !Number.isInteger(i) || a === void 0) return;
1096
+ let o = r === 0 ? 0 : a[r - 1].position + 1, s = r === a.length - 1 ? 100 : a[r + 1].position - 1, c = t.shiftKey ? 10 : 1, l = t.key === "ArrowLeft" || t.key === "ArrowDown" ? i - c : t.key === "ArrowRight" || t.key === "ArrowUp" ? i + c : t.key === "Home" ? o : t.key === "End" ? s : void 0;
1097
+ l !== void 0 && (t.preventDefault(), t.stopPropagation(), zt(n, r), qt(n, r, Math.min(Math.max(l, o), s)) && Jt(n));
1098
+ }
1099
+ function Kt(e, t, n) {
1100
+ let r = e.querySelector("[data-color-palette-stop-slider]");
1101
+ if (r === null) return !1;
1102
+ let i = r.getBoundingClientRect();
1103
+ if (i.width <= 0) return !1;
1104
+ let a = Math.round((n - i.left) / i.width * 100), o = z(R(e));
1105
+ if (o === void 0 || o[t] === void 0) return !1;
1106
+ let s = t === 0 ? 0 : o[t - 1].position + 1, c = t === o.length - 1 ? 100 : o[t + 1].position - 1;
1107
+ return qt(e, t, Math.min(Math.max(a, s), c));
1108
+ }
1109
+ function qt(e, t, n) {
1110
+ let r = R(e), i = r[t];
1111
+ if (i === void 0 || Number(i.dataset.colorPaletteStopPosition) === n) return !1;
1112
+ i.dataset.colorPaletteStopPosition = String(n), et(i, n);
1113
+ let a = e.querySelector("[data-color-palette-field=\"stop-position\"]");
1114
+ a !== null && Number(a.dataset.colorPaletteStopIndex) === t && (a.value = String(n));
1115
+ let o = z(r);
1116
+ if (o === void 0) return !1;
1117
+ for (let e = 0; e < r.length; e++) nt(r[e], o, e, t);
1118
+ return Yt(e), !0;
1119
+ }
1120
+ function Jt(e) {
1121
+ e.querySelector("[data-color-palette-field=\"stop-position\"]")?.dispatchEvent(new Event("change", { bubbles: !0 }));
1122
+ }
1123
+ function Yt(e) {
1124
+ let t = H(e), n = e.querySelector(".designer-color-palette-preview");
1125
+ t !== void 0 && n !== null && Xt(n, t), t !== void 0 && K(e, !Ft.has(e));
1126
+ }
1127
+ function Xt(e, t) {
1128
+ let n = e.style;
1129
+ n !== void 0 && (n.background = I({
1130
+ ...t,
1131
+ mode: t.mode === "solid" ? "linear-gradient" : t.mode
1132
+ }));
1133
+ }
1134
+ function Zt(e, t, n, r) {
1135
+ t.replaceChildren();
1136
+ let i = t.ownerDocument, a = Math.min(Math.max(r, 0), n.stops.length - 1), o = e.dataset.colorPaletteKey, s = n.mode === "solid" ? n.solid : n.stops[a].color, c = o === void 0 ? void 0 : Fe(o), u = c?.color === s.toLowerCase() ? c.hue : void 0, d = o === void 0 ? void 0 : Ie(o), f = d?.color === s.toLowerCase() ? {
1137
+ s: d.saturation,
1138
+ v: d.value
1139
+ } : void 0, p = mt(i, n.solid, "solid"), m = p.input, h = p.value;
1140
+ m.className += " designer-color-palette-solid";
1141
+ let g = ht(i, n.solid, "solid-alpha"), _ = i.createElement("div");
1142
+ _.className = "designer-color-palette-solid-field", _.appendChild(p.element), _.appendChild(g.element), t.appendChild(_);
1143
+ let v = i.createElement("div");
1144
+ v.className = "designer-color-palette-gradient";
1145
+ let y = i.createElement("div");
1146
+ y.className = "designer-color-palette-preview", Xt(y, n), v.appendChild(Qt(i, y, n, a));
1147
+ let b = $t(i, n, a), x = ht(i, n.stops[a].color, "stop-alpha");
1148
+ x.input.dataset.colorPaletteStopIndex = String(a);
1149
+ let S = i.createElement("div");
1150
+ S.className = "designer-color-palette-tools";
1151
+ let C = en(i, "add-stop", l.propertiesPanel.gradientAddStop, "plus");
1152
+ C.disabled = n.stops.length >= 8, S.appendChild(C);
1153
+ let w = en(i, "remove-stop", l.propertiesPanel.gradientRemoveStop, "trash");
1154
+ w.disabled = n.stops.length <= 2, w.dataset.colorPaletteStopIndex = String(a), S.appendChild(w);
1155
+ let T = i.createElement("div");
1156
+ T.className = "designer-color-palette-parameters";
1157
+ let E = _t(i, l.propertiesPanel.gradientAngle, n.angle, "angle", 0, 360);
1158
+ E.input.className += " designer-color-palette-linear", E.element.className += " designer-color-palette-linear", T.appendChild(E.element);
1159
+ let D = _t(i, l.propertiesPanel.gradientCenterX, n.x, "x", 0, 100, l.propertiesPanel.x);
1160
+ D.input.className += " designer-color-palette-radial", D.element.className += " designer-color-palette-radial", T.appendChild(D.element);
1161
+ let O = _t(i, l.propertiesPanel.gradientCenterY, n.y, "y", 0, 100, l.propertiesPanel.y);
1162
+ O.input.className += " designer-color-palette-radial", O.element.className += " designer-color-palette-radial", T.appendChild(O.element);
1163
+ let k = i.createElement("div");
1164
+ return k.className = "designer-color-palette-stop-bar", k.appendChild(b.element), k.appendChild(x.element), k.appendChild(T), k.appendChild(S), v.appendChild(k), t.appendChild(v), t.appendChild(jt(i, s, {
1165
+ input: (t) => Rt(e, t, "input"),
1166
+ change: (t) => Rt(e, t, "change"),
1167
+ hueChange: (e, t) => {
1168
+ o !== void 0 && je(o, e, t);
1169
+ },
1170
+ planeChange: (e, t, n) => {
1171
+ o !== void 0 && Me(o, e, t, n);
1172
+ }
1173
+ }, u, f)), {
1174
+ solid: m,
1175
+ solidValue: h,
1176
+ solidAlpha: g.input,
1177
+ stops: [
1178
+ b.color,
1179
+ b.value,
1180
+ x.input,
1181
+ b.position
1182
+ ],
1183
+ gradientInputs: [
1184
+ E.input,
1185
+ D.input,
1186
+ O.input
1187
+ ]
1188
+ };
1189
+ }
1190
+ function Qt(e, t, n, r) {
1191
+ let i = e.createElement("div");
1192
+ i.className = "designer-color-palette-stop-slider", i.dataset.colorPaletteStopSlider = "", i.appendChild(t);
1193
+ for (let t = 0; t < n.stops.length; t++) {
1194
+ let a = n.stops[t], o = e.createElement("button");
1195
+ o.type = "button", o.className = "designer-color-palette-stop-handle", o.dataset.colorPaletteStopHandle = String(t), o.dataset.colorPaletteStopColor = a.color, o.dataset.colorPaletteStopPosition = String(a.position), tt(o, a.color), o.setAttribute("aria-label", `${l.propertiesPanel.gradientStopPosition} ${t + 1}`), nt(o, n.stops, t, r), et(o, a.position), o.addEventListener("pointerdown", (e) => Wt(o, e)), o.addEventListener("keydown", (e) => Gt(o, e)), i.appendChild(o);
1196
+ }
1197
+ return i;
1198
+ }
1199
+ function $t(e, t, n) {
1200
+ let r = t.stops[n], i = e.createElement("div");
1201
+ i.className = "designer-color-palette-stop-editor", i.dataset.colorPaletteStopEditor = String(n);
1202
+ let a = mt(e, r.color, "stop-color"), o = a.input, s = a.value;
1203
+ o.dataset.colorPaletteStopIndex = String(n), s.dataset.colorPaletteStopIndex = String(n), i.appendChild(a.element);
1204
+ let c = _t(e, l.propertiesPanel.gradientStopPosition, r.position, "stop-position", n === 0 ? 0 : t.stops[n - 1].position + 1, n === t.stops.length - 1 ? 100 : t.stops[n + 1].position - 1);
1205
+ return c.input.dataset.colorPaletteStopIndex = String(n), i.appendChild(c.element), {
1206
+ element: i,
1207
+ color: o,
1208
+ value: s,
1209
+ position: c.input
1210
+ };
1211
+ }
1212
+ function en(e, t, n, r) {
1213
+ let i = d(e, {
1214
+ className: "designer-color-palette-action",
1215
+ icon: r,
1216
+ label: n
1217
+ });
1218
+ return i.dataset.colorPaletteAction = t, i;
1219
+ }
1220
+ var tn = 6, q = 8, nn = 280, rn = 560, an = 120, J = /* @__PURE__ */ new WeakMap(), on = /* @__PURE__ */ new WeakMap(), sn = /* @__PURE__ */ new WeakSet(), cn = /* @__PURE__ */ new WeakSet(), Y = /* @__PURE__ */ new WeakMap(), ln = /* @__PURE__ */ new WeakMap();
1221
+ function X(e, t) {
1222
+ let n = e.ownerDocument, r = e.dataset.colorPaletteKey;
1223
+ if (t) {
1224
+ let t = J.get(n);
1225
+ t !== void 0 && t !== e && (xn(n), yn(t, !1)), J.set(n, e), r !== void 0 && on.set(n, r), bn(e);
1226
+ } else J.get(n) === e && (J.delete(n), xn(n), r !== void 0 && on.get(n) === r && on.delete(n));
1227
+ yn(e, t);
1228
+ }
1229
+ function un(e) {
1230
+ let t = e.dataset.colorPaletteKey;
1231
+ t !== void 0 && on.get(e.ownerDocument) === t && X(e, !0);
1232
+ }
1233
+ function dn(e) {
1234
+ Tn(e, () => {
1235
+ let t = e.querySelector("[data-color-palette-field=\"mode\"]:checked"), n = e.querySelector("[data-color-palette-action=\"close\"]");
1236
+ (t ?? n)?.focus();
1237
+ });
1238
+ }
1239
+ function fn(e) {
1240
+ if (sn.has(e)) return;
1241
+ sn.add(e);
1242
+ let t = e;
1243
+ t.addEventListener?.("pointerdown", (t) => {
1244
+ _n(e);
1245
+ let n = J.get(e), r = t.target, i = t.composedPath?.() ?? [];
1246
+ n !== void 0 && r !== null && !i.includes(n) && !n.contains(r) && (pn(e, t), X(n, !1));
1247
+ }, !0), t.addEventListener?.("pointerup", (t) => mn(e, t), !0), t.addEventListener?.("pointercancel", (t) => hn(e, t), !0);
1248
+ for (let n of [
1249
+ "click",
1250
+ "auxclick",
1251
+ "contextmenu"
1252
+ ]) t.addEventListener?.(n, (t) => gn(e, t), !0);
1253
+ t.addEventListener?.("keydown", (t) => {
1254
+ let n = t, r = J.get(e);
1255
+ n.key === "Escape" && r !== void 0 && (n.preventDefault(), X(r, !1), r.querySelector("[data-color-palette-action=\"toggle\"]")?.focus());
1256
+ }, !0), t.addEventListener?.("scroll", (t) => {
1257
+ let n = J.get(e);
1258
+ if (n === void 0) return;
1259
+ let r = n.querySelector("[data-color-palette-popover]"), i = t.composedPath?.() ?? [];
1260
+ if (r !== null && (i.includes(r) || r.contains(t.target))) return;
1261
+ let a = n.closest("[data-inspector-pane]");
1262
+ if (a !== null && (i.includes(a) || a.contains(t.target))) {
1263
+ Cn(n);
1264
+ return;
1265
+ }
1266
+ X(n, !1);
1267
+ }, !0), e.defaultView?.addEventListener("resize", () => {
1268
+ let t = J.get(e);
1269
+ t !== void 0 && Cn(t);
1270
+ });
1271
+ }
1272
+ function pn(e, t) {
1273
+ let n = {
1274
+ pointerId: t.pointerId,
1275
+ released: !1
1276
+ };
1277
+ Y.set(e, n), vn(t);
1278
+ }
1279
+ function mn(e, t) {
1280
+ let n = Y.get(e);
1281
+ if (n === void 0 || n.pointerId !== t.pointerId) return;
1282
+ n.released = !0, vn(t);
1283
+ let r = e.defaultView;
1284
+ r != null && (n.clearTimer = r.setTimeout(() => {
1285
+ Y.get(e) === n && Y.delete(e);
1286
+ }, 0));
1287
+ }
1288
+ function hn(e, t) {
1289
+ let n = Y.get(e);
1290
+ n !== void 0 && n.pointerId === t.pointerId && (vn(t), _n(e));
1291
+ }
1292
+ function gn(e, t) {
1293
+ let n = Y.get(e);
1294
+ n === void 0 || !n.released || (vn(t), _n(e));
1295
+ }
1296
+ function _n(e) {
1297
+ let t = Y.get(e);
1298
+ t?.clearTimer !== void 0 && e.defaultView?.clearTimeout(t.clearTimer), Y.delete(e);
1299
+ }
1300
+ function vn(e) {
1301
+ e.preventDefault(), e.stopImmediatePropagation();
1302
+ }
1303
+ function yn(e, t) {
1304
+ e.dataset.colorPaletteOpen = String(t);
1305
+ let n = e.querySelector("[data-color-palette-action=\"toggle\"]"), r = e.querySelector("[data-color-palette-popover]");
1306
+ n !== null && n.setAttribute("aria-expanded", String(t)), r !== null && (r.hidden = !t, t && (Sn(e), Tn(e, () => {
1307
+ bn(e), Sn(e);
1308
+ })));
1309
+ }
1310
+ function bn(e) {
1311
+ let t = e.ownerDocument, n = e.closest("[data-inspector-pane]");
1312
+ if (ln.get(t)?.target === n || (xn(t), n === null)) return;
1313
+ let r = () => {
1314
+ J.get(t) === e && Cn(e);
1315
+ };
1316
+ n.addEventListener("scroll", r), ln.set(t, {
1317
+ target: n,
1318
+ listener: r
1319
+ });
1320
+ }
1321
+ function xn(e) {
1322
+ let t = ln.get(e);
1323
+ t !== void 0 && (t.target.removeEventListener("scroll", t.listener), ln.delete(e));
1324
+ }
1325
+ function Sn(e) {
1326
+ if (e.dataset.colorPaletteOpen !== "true") return;
1327
+ let t = e.querySelector("[data-color-palette-action=\"toggle\"]"), n = e.querySelector("[data-color-palette-popover]"), r = wn(t), i = n?.style;
1328
+ if (r === void 0 || n === null || i === void 0) return;
1329
+ let a = e.ownerDocument.defaultView, o = a?.innerWidth ?? e.ownerDocument.documentElement?.clientWidth ?? 0, s = a?.innerHeight ?? e.ownerDocument.documentElement?.clientHeight ?? 0;
1330
+ if (o <= 0 || s <= 0) return;
1331
+ let c = wn(e.closest("[data-inspector-pane]")), l = {
1332
+ top: Math.max(q, c?.top ?? q),
1333
+ right: Math.min(o - q, c?.right ?? o - q),
1334
+ bottom: Math.min(s - q, c?.bottom ?? s - q),
1335
+ left: Math.max(q, c?.left ?? q)
1336
+ }, u = Math.max(0, l.right - l.left), d = Math.min(nn, u);
1337
+ if (d <= 0) return;
1338
+ let f = En(r.right - d, l.left, l.right - d);
1339
+ i.width = `${Math.round(d)}px`, i.left = `${Math.round(f)}px`;
1340
+ let p = Math.min(rn, Math.max(n.scrollHeight, wn(n)?.height ?? 0)), m = Math.max(0, l.bottom - r.bottom - tn), h = Math.max(0, r.top - l.top - tn), g = m < p && h > m, _ = Math.min(rn, Math.max(an, g ? h : m)), v = Math.min(p, _), y = g ? Math.max(l.top, r.top - tn - v) : Math.min(l.bottom - v, r.bottom + tn);
1341
+ n.dataset.colorPalettePlacement = g ? "top" : "bottom", i.top = `${Math.round(y)}px`, i.maxHeight = `${Math.round(_)}px`;
1342
+ }
1343
+ function Cn(e) {
1344
+ if (cn.has(e)) return;
1345
+ cn.add(e);
1346
+ let t = () => {
1347
+ cn.delete(e), J.get(e.ownerDocument) === e && Sn(e);
1348
+ }, n = e.ownerDocument.defaultView;
1349
+ if (n?.requestAnimationFrame !== void 0) {
1350
+ n.requestAnimationFrame(t);
1351
+ return;
1352
+ }
1353
+ if (n?.queueMicrotask !== void 0) {
1354
+ n.queueMicrotask(t);
1355
+ return;
1356
+ }
1357
+ t();
1358
+ }
1359
+ function wn(e) {
1360
+ let t = e?.getBoundingClientRect;
1361
+ if (typeof t == "function") return t.call(e);
1362
+ }
1363
+ function Tn(e, t) {
1364
+ let n = e.ownerDocument.defaultView;
1365
+ if (n?.requestAnimationFrame !== void 0) {
1366
+ n.requestAnimationFrame(() => {
1367
+ e.dataset.colorPaletteOpen === "true" && t();
1368
+ });
1369
+ return;
1370
+ }
1371
+ e.ownerDocument.defaultView?.queueMicrotask?.(() => {
1372
+ e.dataset.colorPaletteOpen === "true" && t();
1373
+ });
1374
+ }
1375
+ function En(e, t, n) {
1376
+ return Math.min(Math.max(e, t), n);
1377
+ }
1378
+ function Dn(e, t) {
1379
+ let n = f(e, { className: "designer-color-palette-trigger" });
1380
+ n.dataset.colorPaletteAction = "toggle", n.setAttribute("aria-haspopup", "dialog"), n.setAttribute("aria-controls", t), n.setAttribute("aria-expanded", "false");
1381
+ let r = e.createElement("span");
1382
+ r.className = "designer-color-palette-trigger-swatch designer-fill-color-checkerboard", r.dataset.colorPaletteTriggerSwatch = "", r.setAttribute("aria-hidden", "true");
1383
+ let i = e.createElement("span");
1384
+ i.className = "designer-color-palette-trigger-value", i.dataset.colorPaletteTriggerValue = "";
1385
+ let a = e.createElement("span");
1386
+ return a.className = "designer-color-palette-trigger-caret", a.innerHTML = c("chevron-down"), n.appendChild(r), n.appendChild(i), n.appendChild(a), n;
1387
+ }
1388
+ function On(e) {
1389
+ let t = [...e.querySelectorAll("[data-color-palette-field]")].some((e) => e.disabled), n = e.querySelector("[data-color-palette-action=\"toggle\"]");
1390
+ n !== null && n.disabled !== t && (n.disabled = t);
1391
+ let r = e.querySelector("[data-designer-fill-color-picker]");
1392
+ r !== null && Nt(r, t), t && X(e, !1);
1393
+ }
1394
+ function kn(e, t, n, r = {}) {
1395
+ let i = r.allowGradient !== !1, a = ze(t), o = i ? a : An(a), s = n === void 0 ? void 0 : Ne(n), u = s !== void 0 && I(s) === t ? s : o, f = i ? u : An(u), p = rt(n === void 0 ? void 0 : Pe(n), f.stops.length), m = e.createElement("div");
1396
+ m.className = "designer-color-palette", m.dataset.designerColorPalette = "", m.dataset.colorPaletteMode = f.mode, m.dataset.colorPaletteSelectedStop = String(p), m.dataset.colorPaletteOpen = "false", n !== void 0 && (m.dataset.colorPaletteKey = n);
1397
+ let h = Math.random().toString(36).slice(2), g = `designer-color-popover-${h}`, _ = Dn(e, g);
1398
+ m.appendChild(_);
1399
+ let v = e.createElement("section");
1400
+ v.id = g, v.className = "designer-color-popover", v.dataset.colorPalettePopover = "", n !== void 0 && (v.dataset.designerScrollScope = `color-palette:${n}`), v.hidden = !0, v.setAttribute("role", "dialog"), v.setAttribute("aria-label", l.propertiesPanel.colorPickerTitle);
1401
+ let y = e.createElement("div");
1402
+ y.className = "designer-color-popover-toolbar";
1403
+ let b = d(e, {
1404
+ className: "designer-color-popover-close",
1405
+ icon: "close",
1406
+ label: l.propertiesPanel.colorPickerClose
1407
+ });
1408
+ b.dataset.colorPaletteAction = "close";
1409
+ let x = e.createElement("div");
1410
+ x.className = "designer-color-palette-modes", x.setAttribute("role", "radiogroup");
1411
+ let S = `designer-color-mode-${h}`, C = [];
1412
+ if (i) {
1413
+ for (let [t, n, r] of [
1414
+ [
1415
+ "solid",
1416
+ l.propertiesPanel.backgroundSolid,
1417
+ "color-solid"
1418
+ ],
1419
+ [
1420
+ "linear-gradient",
1421
+ l.propertiesPanel.backgroundLinear,
1422
+ "color-linear"
1423
+ ],
1424
+ [
1425
+ "radial-gradient",
1426
+ l.propertiesPanel.backgroundRadial,
1427
+ "color-radial"
1428
+ ]
1429
+ ]) {
1430
+ let i = e.createElement("label");
1431
+ i.className = "designer-color-palette-mode", i.setAttribute("data-tip", n);
1432
+ let a = e.createElement("input");
1433
+ a.type = "radio", a.name = S, a.value = t, a.checked = f.mode === t, a.dataset.colorPaletteField = "mode", a.setAttribute("aria-label", n);
1434
+ let o = e.createElement("span");
1435
+ o.className = "designer-color-palette-mode-icon", o.setAttribute("aria-hidden", "true"), o.innerHTML = c(r), i.appendChild(a), i.appendChild(o), x.appendChild(i), C.push(a);
1436
+ }
1437
+ y.appendChild(x);
1438
+ }
1439
+ y.appendChild(b), v.appendChild(y);
1440
+ let w = e.createElement("div");
1441
+ w.className = "designer-color-palette-fields";
1442
+ let { solid: T, solidValue: E, solidAlpha: D, stops: O, gradientInputs: k } = Zt(m, w, f, p);
1443
+ v.appendChild(w), m.appendChild(v), m.addEventListener("click", (e) => {
1444
+ let t = e.target, n = t?.closest?.("[data-color-palette-stop-handle]");
1445
+ if (n != null) {
1446
+ zt(m, Number(n.dataset.colorPaletteStopHandle));
1447
+ return;
1448
+ }
1449
+ let r = t?.closest?.("[data-color-palette-action]");
1450
+ if (r == null) return;
1451
+ let i = r.dataset.colorPaletteAction;
1452
+ if (i === "toggle") {
1453
+ if (!r.disabled) {
1454
+ let t = m.dataset.colorPaletteOpen !== "true";
1455
+ X(m, t), t && e.detail === 0 && dn(m);
1456
+ }
1457
+ return;
1458
+ }
1459
+ if (i === "close") {
1460
+ X(m, !1), _.focus?.();
1461
+ return;
1462
+ }
1463
+ (i === "add-stop" || i === "remove-stop") && Mn(m, i, Number(r.dataset.colorPaletteStopIndex));
1464
+ }), m.addEventListener("change", (e) => {
1465
+ let t = e.target, n = t?.dataset?.colorPaletteField;
1466
+ if (lt(n)) {
1467
+ Vt(m, t, n), K(m);
1468
+ return;
1469
+ }
1470
+ if (n !== "mode" || !Ge(t?.value)) return;
1471
+ let r = H(m);
1472
+ if (r === void 0) return;
1473
+ let i = Pn(m), a = B(m, r.stops.length), o = Ge(m.dataset.colorPaletteMode) ? m.dataset.colorPaletteMode : r.mode, s = He(r, t.value, o, a);
1474
+ m.dataset.colorPaletteMode = s.mode, Zt(m, w, s, a), Fn(m, i), K(m, !1), On(m);
1475
+ }), m.addEventListener("input", (e) => {
1476
+ let t = e.target;
1477
+ if (t?.dataset === void 0 || t.value === void 0 || It(m)) return;
1478
+ let n = t.dataset.colorPaletteField;
1479
+ if (lt(n)) {
1480
+ ut(t);
1481
+ return;
1482
+ }
1483
+ if (n === "solid-alpha" || n === "stop-alpha") {
1484
+ Bt(m, t, n), K(m);
1485
+ return;
1486
+ }
1487
+ (n === "solid" || n === "stop-position" || n === "stop-color" || n === "angle" || n === "x" || n === "y") && ((n === "stop-position" || n === "stop-color") && Ut(m, t, n), Yt(m), K(m));
1488
+ }), m.addEventListener("keydown", (e) => {
1489
+ let t = e;
1490
+ t.key === "Escape" && m.dataset.colorPaletteOpen === "true" && (t.preventDefault(), X(m, !1), _.focus?.());
1491
+ }), fn(e), K(m, !1), un(m);
1492
+ let ee = e.defaultView?.MutationObserver;
1493
+ return ee !== void 0 && new ee(() => On(m)).observe(m, {
1494
+ attributes: !0,
1495
+ subtree: !0,
1496
+ attributeFilter: ["disabled"]
1497
+ }), {
1498
+ element: m,
1499
+ controls: [
1500
+ T,
1501
+ E,
1502
+ D,
1503
+ ...O,
1504
+ ...k,
1505
+ ...C
1506
+ ]
1507
+ };
1508
+ }
1509
+ function An(e) {
1510
+ return e.mode === "solid" ? e : He(e, "solid", e.mode, 0);
1511
+ }
1512
+ function jn(e) {
1513
+ let t = e?.closest?.("[data-designer-color-palette]");
1514
+ if (t == null) return;
1515
+ let n = H(t);
1516
+ if (n === void 0) return;
1517
+ let r = t.dataset.colorPaletteKey;
1518
+ return r !== void 0 && (ke(r, n), Ae(r, B(t, n.stops.length))), I(n);
1519
+ }
1520
+ function Mn(e, t, n) {
1521
+ let r = H(e);
1522
+ if (r === void 0) return !1;
1523
+ let i = t === "add-stop" ? Be(r) : Ve(r, n);
1524
+ if (i === void 0) return !1;
1525
+ let a = e.querySelector(".designer-color-palette-fields");
1526
+ if (a === null) return !1;
1527
+ let o = Pn(e), s = B(e, r.stops.length), c = t === "add-stop" ? it(r.stops, i.stops) : s === n ? Math.min(n, i.stops.length - 1) : s > n ? s - 1 : s;
1528
+ e.dataset.colorPaletteMode = i.mode, e.dataset.colorPaletteSelectedStop = String(c), Zt(e, a, i, c), Fn(e, o), K(e, !1), On(e);
1529
+ let l = e.querySelector("[data-color-palette-field=\"solid\"], [data-color-palette-field=\"stop-position\"]");
1530
+ return l !== null && typeof l.dispatchEvent == "function" && l.dispatchEvent(new Event("change", { bubbles: !0 })), !0;
1531
+ }
1532
+ var Nn = [
1533
+ "prop",
1534
+ "style",
1535
+ "descriptorFieldId",
1536
+ "descriptorTarget",
1537
+ "descriptorPath",
1538
+ "descriptorControl",
1539
+ "descriptorProjection"
1540
+ ];
1541
+ function Pn(e) {
1542
+ let t = e.querySelector("[data-color-palette-field=\"solid\"]");
1543
+ return t === null ? {} : Object.fromEntries(Nn.flatMap((e) => {
1544
+ let n = t.dataset[e];
1545
+ return n === void 0 ? [] : [[e, n]];
1546
+ }));
1547
+ }
1548
+ function Fn(e, t) {
1549
+ for (let n of e.querySelectorAll("[data-color-palette-field]")) for (let e of Nn) {
1550
+ let r = t[e];
1551
+ r !== void 0 && (n.dataset[e] = r);
1552
+ }
1553
+ }
1554
+ function In(e, t) {
1555
+ return Ln(e, t).field;
1556
+ }
1557
+ function Ln(e, t) {
1558
+ let n = e.createElement(t.tagName ?? "label");
1559
+ n.className = o(t.stacked === !0 ? "designer-field designer-field-label designer-field-stacked" : "designer-field designer-field-label", t.className);
1560
+ let r = e.createElement("span");
1561
+ return r.className = "designer-field-label-text", r.textContent = t.label, n.appendChild(r), {
1562
+ field: n,
1563
+ labelText: r
1564
+ };
1565
+ }
1566
+ function Rn(e, t) {
1567
+ let { field: n, labelText: r } = Ln(e, t), i = e.createElement("span");
1568
+ return i.className = o("designer-field-control", t.controlClassName), n.appendChild(i), {
1569
+ field: n,
1570
+ control: i,
1571
+ labelText: r
1572
+ };
1573
+ }
1574
+ function zn(e, t) {
1575
+ let n = e.createElement("label");
1576
+ n.className = o("designer-field designer-field-label designer-field-toggle", t.className);
1577
+ let r = e.createElement("span");
1578
+ r.className = "designer-field-toggle-copy";
1579
+ let i = e.createElement("span");
1580
+ if (i.className = o("designer-field-label-text", t.labelClassName), i.textContent = t.label, r.appendChild(i), t.hint !== void 0) {
1581
+ let n = e.createElement("span");
1582
+ n.className = "designer-field-hint", n.textContent = t.hint, r.appendChild(n);
1583
+ }
1584
+ n.appendChild(r);
1585
+ let a = t.control === "switch" ? u(e, {
1586
+ ...t.ariaLabel === void 0 ? {} : { ariaLabel: t.ariaLabel },
1587
+ ...t.checked === void 0 ? {} : { checked: t.checked },
1588
+ ...t.disabled === void 0 ? {} : { disabled: t.disabled }
1589
+ }) : g(e, {
1590
+ ...t.ariaLabel === void 0 ? {} : { ariaLabel: t.ariaLabel },
1591
+ ...t.checked === void 0 ? {} : { checked: t.checked },
1592
+ ...t.disabled === void 0 ? {} : { disabled: t.disabled }
1593
+ });
1594
+ return n.appendChild(a), {
1595
+ field: n,
1596
+ input: a
1597
+ };
1598
+ }
1599
+ function Bn(e, t) {
1600
+ let n = e.ownerDocument, r = t.rangeValue ?? (t.value === "" ? String(t.min) : t.value), i = h(n, {
1601
+ appearance: "range",
1602
+ ariaLabel: t.ariaLabel,
1603
+ max: t.max,
1604
+ min: t.min,
1605
+ step: t.step,
1606
+ value: r
1607
+ });
1608
+ t.empty === !0 && (i.dataset.empty = "true");
1609
+ let a = h(n, {
1610
+ appearance: "number",
1611
+ ariaLabel: t.ariaLabel,
1612
+ ...t.numberClassName === void 0 ? {} : { className: t.numberClassName },
1613
+ max: t.max,
1614
+ min: t.min,
1615
+ step: t.step,
1616
+ value: t.value
1617
+ });
1618
+ if (t.placeholder !== void 0 && (a.placeholder = t.placeholder), i.addEventListener("input", () => {
1619
+ a.value = i.value, delete i.dataset.empty;
1620
+ }), i.addEventListener("change", () => {
1621
+ a.value = i.value, t.forwardRangeChange === !0 && a.dispatchEvent(new Event("change", {
1622
+ bubbles: !0,
1623
+ composed: !0
1624
+ }));
1625
+ }), a.addEventListener("input", () => {
1626
+ i.value = a.value;
1627
+ }), e.appendChild(i), t.numberSymbol === void 0) e.appendChild(a);
1628
+ else {
1629
+ let r = n.createElement("label");
1630
+ r.className = "designer-geo-field", r.dataset.symbol = t.numberSymbol, r.appendChild(a), e.appendChild(r);
1631
+ }
1632
+ return {
1633
+ range: i,
1634
+ number: a
1635
+ };
1636
+ }
1637
+ function Vn(e, t) {
1638
+ let n = e.createElement("div");
1639
+ n.className = o("designer-stepper", t.className), n.setAttribute("role", "group"), n.setAttribute("aria-label", t.ariaLabel);
1640
+ let r = Number.isFinite(t.step) && (t.step ?? 0) > 0 ? t.step : 1, i = Hn(e, -1, t.ariaLabel), a = Hn(e, 1, t.ariaLabel), s = h(e, {
1641
+ appearance: "number",
1642
+ ariaLabel: t.ariaLabel,
1643
+ className: "designer-stepper-value",
1644
+ value: String(Un(t.value, t.min, t.max))
1645
+ });
1646
+ s.min = String(t.min), s.max = String(t.max), s.step = String(r), s.dataset.flush = "true";
1647
+ let c = (e, n) => {
1648
+ let r = Un(e, t.min, t.max);
1649
+ s.value = String(r), u(), n && Wn(s);
1650
+ }, l = () => n.getRootNode?.()?.activeElement ?? e.activeElement ?? null, u = () => {
1651
+ let e = Number(s.value), n = Number.isFinite(e) ? e : t.min, r = i.disabled, o = a.disabled;
1652
+ i.disabled = n <= t.min, a.disabled = n >= t.max, i.disabled && !r && l() === i && a.focus({ preventScroll: !0 }), a.disabled && !o && l() === a && i.focus({ preventScroll: !0 });
1653
+ };
1654
+ return i.addEventListener("click", () => c(Number(s.value) - r, !0)), a.addEventListener("click", () => c(Number(s.value) + r, !0)), s.addEventListener("input", () => {
1655
+ let e = Number(s.value);
1656
+ Number.isFinite(e) && u();
1657
+ }), s.addEventListener("change", () => {
1658
+ let e = Number(s.value);
1659
+ c(Number.isFinite(e) ? e : t.min, !1);
1660
+ }), s.addEventListener("blur", () => c(Number(s.value), !1)), n.append(i, s, a), u(), {
1661
+ element: n,
1662
+ input: s
1663
+ };
1664
+ }
1665
+ function Hn(e, t, n) {
1666
+ let r = e.createElement("button");
1667
+ return r.type = "button", r.className = "designer-stepper-button", r.dataset.step = String(t), r.setAttribute("aria-label", t === -1 ? l.stepper.decrement(n) : l.stepper.increment(n)), r.innerHTML = c(t === -1 ? "minus" : "plus"), r;
1668
+ }
1669
+ function Un(e, t, n) {
1670
+ return Math.min(Math.max(Number.isFinite(e) ? e : t, t), n);
1671
+ }
1672
+ function Wn(e) {
1673
+ e.dispatchEvent(new Event("change", {
1674
+ bubbles: !0,
1675
+ composed: !0
1676
+ }));
1677
+ }
1678
+ function Gn(e, t, n, r, i) {
1679
+ let a = t.control;
1680
+ if (a === "stepper") {
1681
+ let i = typeof r == "number" && Number.isFinite(r) ? r : Number(r), a = t.min ?? (n?.kind === "number" ? n.minimum : void 0) ?? 0, o = t.max ?? (n?.kind === "number" ? n.maximum : void 0) ?? 100, s = Vn(e, {
1682
+ value: Number.isFinite(i) ? i : a,
1683
+ min: a,
1684
+ max: o,
1685
+ ...t.step === void 0 ? {} : { step: t.step },
1686
+ ariaLabel: t.label
1687
+ });
1688
+ return {
1689
+ element: s.element,
1690
+ valueTarget: s.input
1691
+ };
1692
+ }
1693
+ if (a === "boolean") {
1694
+ let n = u(e, {
1695
+ ariaLabel: t.label,
1696
+ checked: r === !0
1697
+ });
1698
+ return {
1699
+ element: n,
1700
+ valueTarget: n
1701
+ };
1702
+ }
1703
+ if (a === "select" && n?.kind === "enum") {
1704
+ let t = _(e, { options: n.values.map((e) => ({
1705
+ label: String(e),
1706
+ selected: r === e,
1707
+ value: String(e)
1708
+ })) });
1709
+ return {
1710
+ element: s(t).element,
1711
+ valueTarget: t
1712
+ };
1713
+ }
1714
+ if (a === "color") {
1715
+ let t = h(e, {
1716
+ appearance: "color",
1717
+ value: typeof r == "string" ? r : ""
1718
+ });
1719
+ return {
1720
+ element: t,
1721
+ valueTarget: t
1722
+ };
1723
+ }
1724
+ if (a === "json") {
1725
+ let t = p(e);
1726
+ return t.value = JSON.stringify(r), {
1727
+ element: t,
1728
+ valueTarget: t
1729
+ };
1730
+ }
1731
+ if (a === "field-selector") {
1732
+ if (i.length > 0) {
1733
+ let n = _(e, {
1734
+ ariaLabel: t.label,
1735
+ options: [{
1736
+ label: l.descriptor.noField,
1737
+ selected: r === void 0 || r === "",
1738
+ value: ""
1739
+ }, ...i.map((e) => ({
1740
+ label: e.label,
1741
+ selected: r === e.id,
1742
+ value: e.id
1743
+ }))]
1744
+ });
1745
+ return {
1746
+ element: s(n).element,
1747
+ valueTarget: n
1748
+ };
1749
+ }
1750
+ let n = h(e, { value: typeof r == "string" ? r : "" });
1751
+ return {
1752
+ element: n,
1753
+ valueTarget: n
1754
+ };
1755
+ }
1756
+ let o = a === "number" || a === "unit-number", c = h(e, {
1757
+ appearance: o ? "number" : "text",
1758
+ ...o && t.max !== void 0 ? { max: t.max } : {},
1759
+ ...o && t.min !== void 0 ? { min: t.min } : {},
1760
+ ...o && t.step !== void 0 ? { step: t.step } : {},
1761
+ value: String(r ?? "")
1762
+ });
1763
+ return {
1764
+ element: c,
1765
+ valueTarget: c
1766
+ };
1767
+ }
1768
+ function Kn(e, t) {
1769
+ let n = e.target === "interaction" ? e.projection ?? "props" : e.target, r = n === "props" ? t.manifest.propsSchema : n === "style" ? t.manifest.styleSchema : void 0;
1770
+ return r === void 0 ? void 0 : v(e.path, r);
1771
+ }
1772
+ function qn(e, t) {
1773
+ e.dataset.descriptorFieldId = t.id, e.dataset.descriptorTarget = t.target, e.dataset.descriptorPath = JSON.stringify(t.path), e.dataset.descriptorControl = t.control, t.projection !== void 0 && (e.dataset.descriptorProjection = t.projection);
1774
+ }
1775
+ function Jn(e) {
1776
+ let t = e.document?.components.find((t) => t.id === e.interaction.focusedComponentId), n = t === void 0 ? void 0 : e.catalog?.get(t.type)?.manifest;
1777
+ return t === void 0 || n === void 0 ? void 0 : {
1778
+ component: t,
1779
+ manifest: n,
1780
+ datasetFields: e.getDatasetFields?.() ?? [],
1781
+ inspectorControls: e.inspectorControls
1782
+ };
1783
+ }
1784
+ function Yn(e, t) {
1785
+ return e.when === void 0 || e.when.length === 0 || e.when.every((n) => Xn(n, e, t));
1786
+ }
1787
+ function Xn(e, t, n) {
1788
+ let r = Z(t, e.path, n), i = r !== void 0;
1789
+ switch (e.operator) {
1790
+ case "exists": return i;
1791
+ case "not-exists": return !i;
1792
+ case "eq": return i && Object.is(e.value, r);
1793
+ case "neq": return !i || !Object.is(e.value, r);
1794
+ case "in": return Array.isArray(e.value) && i && e.value.some((e) => Object.is(e, r));
1795
+ case "not-in": return !i || !Array.isArray(e.value) || !e.value.some((e) => Object.is(e, r));
1796
+ }
1797
+ }
1798
+ function Z(e, t, n) {
1799
+ let r = e.target === "interaction" ? e.projection ?? "props" : e.target;
1800
+ return r === "props" ? Qn(n.component.props, t) : r === "style" ? Qn(n.component.style, t) : Zn(n.component.dataSource, t);
1801
+ }
1802
+ function Zn(e, t) {
1803
+ let n = t[0];
1804
+ if (n === "params") {
1805
+ let n = e?.type === "host-resource" || e?.type === "dataset" ? e.params[String(t[1])] : void 0;
1806
+ return n?.kind === "literal" ? n.value : void 0;
1807
+ }
1808
+ if (n === "binding") {
1809
+ let n = e?.type === "host-resource" || e?.type === "dataset" ? e.binding?.fields : void 0;
1810
+ if (t[1] !== "fields") return;
1811
+ let r = String(t[2]), i = n?.[r];
1812
+ if (i === void 0) return;
1813
+ let a = t[3];
1814
+ return typeof a == "number" ? i[a] : i;
1815
+ }
1816
+ }
1817
+ function Qn(e, t) {
1818
+ if (e === void 0) return;
1819
+ let n = e;
1820
+ for (let e of t) {
1821
+ if (typeof n != "object" || !n) return;
1822
+ if (Array.isArray(n)) {
1823
+ if (typeof e != "number" || e >= n.length) return;
1824
+ n = n[e];
1825
+ } else {
1826
+ if (typeof e != "string" || !Object.hasOwn(n, e)) return;
1827
+ n = n[e];
1828
+ }
1829
+ }
1830
+ return n;
1831
+ }
1832
+ function $n(e, t) {
1833
+ return Kn(e, t);
1834
+ }
1835
+ function er(e, t, n) {
1836
+ let r = e.ownerDocument, i = r.createElement("div");
1837
+ i.className = "designer-descriptor-array";
1838
+ let a = In(r, {
1839
+ label: t.label,
1840
+ tagName: "span"
1841
+ });
1842
+ i.appendChild(a);
1843
+ let o = r.createElement("ol");
1844
+ o.className = "designer-descriptor-array-list";
1845
+ let s = Z(t, t.path, n), c = Array.isArray(s) ? s : [], u = $n(t, n), d = u?.kind === "array" ? u.maxItems : void 0;
1846
+ for (let e = 0; e < c.length; e++) {
1847
+ let i = r.createElement("li");
1848
+ i.className = "designer-descriptor-array-item";
1849
+ let a = nr(c[e]);
1850
+ if (t.itemFields !== void 0 && a) for (let r of t.itemFields) rr(i, t, r, e, n);
1851
+ else rr(i, t, {
1852
+ id: t.id,
1853
+ target: t.target,
1854
+ ...t.projection === void 0 ? {} : { projection: t.projection },
1855
+ path: [e],
1856
+ label: t.itemLabel ?? l.descriptor.item(e + 1),
1857
+ control: tr(u)
1858
+ }, e, n);
1859
+ let s = r.createElement("span");
1860
+ s.className = "designer-descriptor-array-actions", t.control === "reorderable-array" && (s.appendChild(or(r, l.descriptor.moveUp, "move-up", t, e, e === 0)), s.appendChild(or(r, l.descriptor.moveDown, "move-down", t, e, e === c.length - 1))), s.appendChild(or(r, l.descriptor.removeItem, "remove", t, e, t.control === "array")), i.appendChild(s), o.appendChild(i);
1861
+ }
1862
+ i.appendChild(o);
1863
+ let f = d === void 0 || c.length < d;
1864
+ i.appendChild(or(r, l.descriptor.addItem, "add", t, c.length, !f)), e.appendChild(i);
1865
+ }
1866
+ function tr(e) {
1867
+ if (e?.kind === "array") return tr(e.items);
1868
+ switch (e?.kind) {
1869
+ case "number": return "number";
1870
+ case "boolean": return "boolean";
1871
+ case "enum": return "select";
1872
+ case "string": return "text";
1873
+ default: return "text";
1874
+ }
1875
+ }
1876
+ function nr(e) {
1877
+ return typeof e == "object" && !!e && !Array.isArray(e);
1878
+ }
1879
+ function rr(e, t, n, r, i) {
1880
+ let a = e.ownerDocument, o = In(a, {
1881
+ label: n.label,
1882
+ ...n.control === "color" ? { tagName: "span" } : {}
1883
+ }), s = ir(i, t, r, n.path), c = Gn(a, n, ar(t, n, i), s, i.datasetFields), l = c.valueTarget;
1884
+ l.dataset.descriptorFieldId = n.id, l.dataset.descriptorTarget = n.target, l.dataset.descriptorPath = JSON.stringify([
1885
+ ...t.path,
1886
+ r,
1887
+ ...n.path
1888
+ ]), l.dataset.descriptorControl = n.control, o.appendChild(c.element), m(o, l, `descriptor-${t.id}-${r}-${n.id}`), e.appendChild(o);
1889
+ }
1890
+ function ir(e, t, n, r) {
1891
+ let i = Z(t, t.path, e);
1892
+ if (!Array.isArray(i)) return;
1893
+ let a = i[n];
1894
+ if (!(typeof a != "object" || !a || Array.isArray(a))) return Qn(a, r);
1895
+ }
1896
+ function ar(e, t, n) {
1897
+ let r = $n(e, n);
1898
+ if (r?.kind !== "array") return;
1899
+ let i = r.items;
1900
+ return i.kind === "object" ? v(t.path, i) : i;
1901
+ }
1902
+ function or(e, t, n, r, i, a) {
1903
+ let o = f(e, {
1904
+ disabled: a,
1905
+ text: t
1906
+ });
1907
+ return o.dataset.descriptorArrayPath = JSON.stringify(r.path), o.dataset.descriptorArrayAction = n, o.dataset.descriptorArrayIndex = String(i), o.dataset.descriptorFieldId = r.id, o;
1908
+ }
1909
+ function sr(e, t, n) {
1910
+ let r = e.ownerDocument, i = In(r, {
1911
+ label: t.label,
1912
+ tagName: "span"
1913
+ });
1914
+ i.dataset.inspectorSearchKind = "field", i.dataset.inspectorSearchKey = `descriptor-field-${t.id}`, i.dataset.inspectorSearchText = `${t.label} ${t.help ?? ""} ${t.keywords?.join(" ") ?? ""}`, t.advanced === !0 && (i.dataset.inspectorAdvanced = "true");
1915
+ let a = t.tagName === void 0 ? void 0 : n.inspectorControls?.getByTagName(t.tagName);
1916
+ if (a === void 0) {
1917
+ let n = r.createElement("span");
1918
+ n.className = "designer-descriptor-unsupported", n.dataset.descriptorUnsupported = t.id, n.textContent = l.descriptor.unsupportedControl;
1919
+ let a = r.createElement("span");
1920
+ a.className = "designer-field-control", a.appendChild(n), i.appendChild(a), e.appendChild(i);
1921
+ return;
1922
+ }
1923
+ let o = new a.constructor();
1924
+ o.dataset.descriptorCustomOwner = a.pluginId, qn(o, t), o.model = {
1925
+ value: Z(t, t.path, n),
1926
+ componentId: n.component.id,
1927
+ componentType: n.component.type,
1928
+ target: t.target === "style" ? "style" : "props",
1929
+ path: t.path
1930
+ };
1931
+ let s = r.createElement("span");
1932
+ if (s.className = "designer-field-control", s.appendChild(o), i.appendChild(s), t.help !== void 0) {
1933
+ let e = r.createElement("span");
1934
+ e.className = "designer-descriptor-help", e.textContent = t.help, i.appendChild(e);
1935
+ }
1936
+ e.appendChild(i);
1937
+ }
1938
+ function cr(e, t, n) {
1939
+ let r = e.ownerDocument, i = r.createElement("section");
1940
+ i.className = "designer-inspector-section", i.dataset.inspectorSearchKind = "section", i.dataset.inspectorSearchKey = `descriptor-section-${t.id}`, i.dataset.inspectorSearchText = `${t.label} ${t.help ?? ""}`, i.dataset.inspectorPreferenceContext = n.component.type, t.advanced === !0 && (i.dataset.inspectorAdvanced = "true");
1941
+ let a = r.createElement("details");
1942
+ a.className = "designer-descriptor-group", a.open = t.advanced !== !0 && t.collapsed !== !0;
1943
+ let o = r.createElement("summary");
1944
+ o.className = "designer-descriptor-group-summary", o.textContent = t.label;
1945
+ let s = r.createElement("span");
1946
+ if (s.className = "designer-panel-section-disclosure designer-inspector-section-disclosure", s.innerHTML = c("chevron-down"), o.appendChild(s), a.appendChild(o), t.help !== void 0) {
1947
+ let e = r.createElement("p");
1948
+ e.className = "designer-descriptor-help", e.textContent = t.help, a.appendChild(e);
1949
+ }
1950
+ let l = r.createElement("div");
1951
+ l.className = "designer-descriptor-fields";
1952
+ for (let e of t.fields) Yn(e, n) && lr(l, e, n);
1953
+ a.appendChild(l), i.appendChild(a), e.appendChild(i);
1954
+ }
1955
+ function lr(e, t, n) {
1956
+ if (t.control === "group") {
1957
+ ur(e, t, n);
1958
+ return;
1959
+ }
1960
+ if (t.control === "custom") {
1961
+ sr(e, t, n);
1962
+ return;
1963
+ }
1964
+ if (t.control === "array" || t.control === "repeatable-array" || t.control === "reorderable-array") {
1965
+ er(e, t, n);
1966
+ return;
1967
+ }
1968
+ let r = Kn(t, n), i = Z(t, t.path, n), a = e.ownerDocument, o = t.control === "color" ? kn(a, typeof i == "string" ? i : void 0, `${n.component.id}:descriptor:${t.id}`, { allowGradient: t.allowGradient === !0 }) : void 0, s = o !== void 0 || t.control === "json", { field: c, control: l } = Rn(a, {
1969
+ label: t.label,
1970
+ tagName: o === void 0 ? "label" : "span",
1971
+ stacked: s
1972
+ });
1973
+ c.dataset.inspectorSearchKind = "field", c.dataset.inspectorSearchKey = `descriptor-field-${t.id}`, c.dataset.inspectorSearchText = `${t.label} ${t.help ?? ""} ${t.keywords?.join(" ") ?? ""}`, t.advanced === !0 && (c.dataset.inspectorAdvanced = "true");
1974
+ let u = o === void 0 ? Gn(a, t, r, i, n.datasetFields) : void 0, d = u === void 0 ? o.controls[0] : u.valueTarget;
1975
+ if (u === void 0) {
1976
+ for (let e of o.controls) qn(e, t);
1977
+ l.appendChild(o.element);
1978
+ } else qn(u.valueTarget, t), l.appendChild(u.element);
1979
+ if (t.help !== void 0) {
1980
+ let e = a.createElement("span");
1981
+ e.className = "designer-descriptor-help", e.textContent = t.help, c.appendChild(e);
1982
+ }
1983
+ m(c, d, `descriptor-${t.id}`), e.appendChild(c);
1984
+ }
1985
+ function ur(e, t, n) {
1986
+ let r = e.ownerDocument, i = r.createElement("fieldset");
1987
+ i.className = "designer-descriptor-group";
1988
+ let a = r.createElement("legend");
1989
+ a.textContent = t.label, i.appendChild(a);
1990
+ for (let e of dr(n, t)) Yn(e, n) && lr(i, e, n);
1991
+ e.appendChild(i);
1992
+ }
1993
+ function dr(e, t) {
1994
+ let n = [
1995
+ "appearance",
1996
+ "data",
1997
+ "interaction"
1998
+ ], r = [];
1999
+ for (let i of n) for (let n of e.manifest.editorDescriptor?.[i] ?? []) for (let e of n.fields) e.id !== t.id && fr(e.path, t.path) && r.push(e);
2000
+ return r;
2001
+ }
2002
+ function fr(e, t) {
2003
+ return e.length > t.length && t.every((t, n) => t === e[n]);
2004
+ }
2005
+ function pr(e, t, n) {
2006
+ if (e === void 0 || t === void 0 || t.length === 0) return;
2007
+ let r = Jn(n);
2008
+ if (r !== void 0) for (let n of t) cr(e, n, r);
2009
+ }
2010
+ var mr = "base-screen-host-resource-selection-request", hr = /* @__PURE__ */ new Set([
2011
+ "requestId",
2012
+ "selection",
2013
+ "backgroundImageFit"
2014
+ ]), gr = 8192;
2015
+ function _r(e) {
2016
+ return e !== void 0 && e.hostResourceSelection === !0 && e.dataCapabilities.includes("host-resource");
2017
+ }
2018
+ function vr(e) {
2019
+ return {
2020
+ requestId: e.requestId,
2021
+ instanceId: e.instanceId,
2022
+ documentRevision: e.documentRevision,
2023
+ target: e.target,
2024
+ current: e.current
2025
+ };
2026
+ }
2027
+ function yr(e) {
2028
+ return e.disposed ? $("AUTHORING_EXPIRED", ["requestId"], "Designer is unloaded or disposed; the host resource selection session has expired.") : e.pendingKind === "host-resource-selection" ? {
2029
+ ok: !0,
2030
+ value: null,
2031
+ diagnostics: []
2032
+ } : $("AUTHORING_REQUEST_INVALID", ["requestId"], "Host resource selection session is missing or no longer current.");
2033
+ }
2034
+ function br(e) {
2035
+ let t = Cr(e);
2036
+ if (!t.ok) return t;
2037
+ let n = t.value;
2038
+ if (!wr(n) || !Object.keys(n).every((e) => hr.has(e))) return Q("Host resource selection commit must be a strict object.");
2039
+ let r = n.requestId;
2040
+ if (typeof r != "string" || r.length === 0 || r.length > 128) return Q("Host resource selection requestId is invalid.", ["requestId"]);
2041
+ let i = Sr(n.selection);
2042
+ if (!i.ok) return i;
2043
+ let a;
2044
+ if (n.backgroundImageFit !== void 0) {
2045
+ if (n.backgroundImageFit !== "cover" && n.backgroundImageFit !== "contain") return Q("Host resource selection backgroundImageFit is invalid.", ["backgroundImageFit"]);
2046
+ a = n.backgroundImageFit;
2047
+ }
2048
+ return {
2049
+ ok: !0,
2050
+ value: {
2051
+ requestId: r,
2052
+ selection: i.value,
2053
+ ...a === void 0 ? {} : { backgroundImageFit: a }
2054
+ },
2055
+ diagnostics: []
2056
+ };
2057
+ }
2058
+ function xr(e, t) {
2059
+ if (t.kind === "canvas-background") {
2060
+ let t = e.canvas.backgroundImage;
2061
+ return typeof t == "string" && t.length > 0 ? {
2062
+ kind: "url",
2063
+ url: t
2064
+ } : { kind: "none" };
2065
+ }
2066
+ let r = e.components.find((e) => e.id === t.componentId);
2067
+ if (r === void 0) return { kind: "none" };
2068
+ let o = a(r);
2069
+ if (o === null) return { kind: "none" };
2070
+ if (o.kind === "inline") return typeof o.value != "string" || o.value.length === 0 ? { kind: "none" } : n(o.value) ? {
2071
+ kind: "url",
2072
+ url: o.value
2073
+ } : { kind: "other" };
2074
+ if (o.kind === "variable") return { kind: "other" };
2075
+ let s = i(e).find((e) => e.id === o.dataSourceId)?.source;
2076
+ return s?.kind === "host-resource" ? {
2077
+ kind: "host-resource",
2078
+ resourceType: s.resourceType,
2079
+ resourceId: s.resourceId
2080
+ } : { kind: "other" };
2081
+ }
2082
+ function Sr(e) {
2083
+ return !wr(e) || typeof e.kind != "string" ? Q("Host resource selection is invalid.", ["selection"]) : e.kind === "url" ? !Tr(e, ["kind", "url"]) || typeof e.url != "string" ? Q("Host resource URL selection is invalid.", ["selection"]) : n(e.url) ? {
2084
+ ok: !0,
2085
+ value: {
2086
+ kind: "url",
2087
+ url: e.url
2088
+ },
2089
+ diagnostics: []
2090
+ } : $("AUTHORING_SOURCE_INVALID", ["selection", "url"], "Host resource selection URL is invalid.") : e.kind === "host-resource" ? !Object.keys(e).every((e) => [
2091
+ "kind",
2092
+ "resourceType",
2093
+ "resourceId",
2094
+ "params"
2095
+ ].includes(e)) || typeof e.resourceType != "string" || e.resourceType.length === 0 || typeof e.resourceId != "string" || e.resourceId.length === 0 ? Q("Host resource identity selection is invalid.", ["selection"]) : e.params !== void 0 && (!wr(e.params) || Array.isArray(e.params)) ? Q("Host resource selection params must be an object.", ["selection", "params"]) : Ce(e) ? $("AUTHORING_SOURCE_INVALID", ["selection"], "Host resource selection must not contain URLs, tokens, or headers.") : {
2096
+ ok: !0,
2097
+ value: {
2098
+ kind: "host-resource",
2099
+ resourceType: e.resourceType,
2100
+ resourceId: e.resourceId,
2101
+ ...e.params === void 0 ? {} : { params: e.params }
2102
+ },
2103
+ diagnostics: []
2104
+ } : Q("Host resource selection kind is invalid.", ["selection", "kind"]);
2105
+ }
2106
+ function Cr(t) {
2107
+ try {
2108
+ let n = e(t, {
2109
+ maxBytes: gr,
2110
+ maxStringBytes: gr
2111
+ });
2112
+ return n.ok ? n : n.diagnostics.some((e) => e.code === "JSON_LIMIT_EXCEEDED") ? $("AUTHORING_LIMIT_EXCEEDED", [], "Host resource selection commit exceeds its JSON limits.") : Q("Host resource selection commit is not JSON-safe.");
2113
+ } catch {
2114
+ return Q("Host resource selection commit is not JSON-safe.");
2115
+ }
2116
+ }
2117
+ function wr(e) {
2118
+ return typeof e == "object" && !!e && !Array.isArray(e);
2119
+ }
2120
+ function Tr(e, t) {
2121
+ let n = Object.keys(e);
2122
+ return n.length === t.length && n.every((e) => t.includes(e));
2123
+ }
2124
+ function Q(e, t = []) {
2125
+ return $("AUTHORING_PAYLOAD_INVALID", t, e);
2126
+ }
2127
+ function $(e, t, n) {
2128
+ return {
2129
+ ok: !1,
2130
+ diagnostics: [{
2131
+ severity: "error",
2132
+ code: e,
2133
+ path: t,
2134
+ message: n
2135
+ }]
2136
+ };
2137
+ }
2138
+ //#endregion
2139
+ export { _r as A, kn as C, ne as D, ae as E, ve as F, vr as I, zn as L, b as M, be as N, ee as O, br as P, jn as S, te as T, yr as _, E as a, mr as b, In as c, xe as d, xr as f, ye as g, y as h, Se as i, C as j, _e as k, Rn as l, ie as m, Bn as n, T as o, w as p, S as r, I as s, ze as t, x as u, se as v, pr as w, re as x, de as y };
2140
+
2141
+ //# sourceMappingURL=host-resource-selection-5Cf_gclK-Sv4Z8UXS.js.map