@lostgradient/cinder 0.17.0 → 0.19.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 (68) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components.json +3 -2
  3. package/dist/cli/index.js +2 -2
  4. package/dist/cli/types.d.ts +1 -0
  5. package/dist/components/approval-card/index.js +105 -37
  6. package/dist/components/code-block/index.js +103 -36
  7. package/dist/components/combobox/combobox.schema.js +14 -1
  8. package/dist/components/combobox/combobox.svelte.d.ts +12 -12
  9. package/dist/components/combobox/combobox.types.d.ts +11 -5
  10. package/dist/components/combobox/index.js +94 -16
  11. package/dist/components/event-stream-viewer/index.js +3 -2
  12. package/dist/components/invocation-rule-builder/index.js +3602 -380
  13. package/dist/components/invocation-rule-builder/invocation-rule-builder.css +14 -0
  14. package/dist/components/json-editor/index.js +86 -18
  15. package/dist/components/json-editor/json-editor-enhancement.d.ts +7 -0
  16. package/dist/components/json-editor/json-editor-enhancement.js +201 -0
  17. package/dist/components/json-editor/json-editor.css +68 -0
  18. package/dist/components/json-editor/json-editor.schema.js +5 -1
  19. package/dist/components/json-editor/json-editor.types.d.ts +2 -0
  20. package/dist/components/run-step-timeline/index.js +3 -2
  21. package/dist/components/status-dot/index.js +3 -2
  22. package/dist/highlighters/shiki/default.d.ts +5 -0
  23. package/dist/highlighters/shiki/default.js +278 -0
  24. package/dist/highlighters/shiki/index.d.ts +9 -2
  25. package/dist/highlighters/shiki/index.js +72 -35
  26. package/dist/index.js +608 -356
  27. package/dist/server/components/approval-card/index.js +2 -2
  28. package/dist/server/components/combobox/index.js +5 -3
  29. package/dist/server/components/event-stream-viewer/index.js +2 -2
  30. package/dist/server/components/invocation-rule-builder/index.js +15 -2
  31. package/dist/server/components/json-editor/index.js +1 -1
  32. package/dist/server/components/json-editor/json-editor-enhancement.js +150 -0
  33. package/dist/server/components/run-step-timeline/index.js +2 -2
  34. package/dist/server/components/status-dot/index.js +2 -2
  35. package/dist/server/highlighters/shiki/default.js +39 -0
  36. package/dist/server/highlighters/shiki/index.js +7 -131
  37. package/dist/server/index.js +10 -9
  38. package/dist/server/{index.server-npxtkwjp.js → index.server-0gg1njz4.js} +3 -2
  39. package/dist/server/{index.server-j87v28yy.js → index.server-0hjcds3y.js} +35 -18
  40. package/dist/server/{index.server-9vqfmhez.js → index.server-20km2ga0.js} +1 -1
  41. package/dist/server/{index.server-qxneqxf8.js → index.server-62593nnh.js} +1 -1
  42. package/dist/server/{index.server-m8ya4p7w.js → index.server-8grn4zd3.js} +74 -14
  43. package/dist/server/index.server-c9gtmre4.js +178 -0
  44. package/dist/server/{index.server-tez36va4.js → index.server-kvn6cj65.js} +1 -1
  45. package/dist/server/{index.server-93vt8ktj.js → index.server-v73af5rk.js} +18 -2
  46. package/dist/server/{index.server-qke3ekjt.js → index.server-ww54rv4y.js} +1 -1
  47. package/dist/server/index.server-x4a15jpm.js +9 -0
  48. package/dist/utilities/json-highlight.d.ts +2 -0
  49. package/package.json +19 -1
  50. package/src/components/code-block/code-block-default-highlighter.ts +2 -2
  51. package/src/components/combobox/combobox.schema.json +13 -0
  52. package/src/components/combobox/combobox.schema.ts +13 -0
  53. package/src/components/combobox/combobox.svelte +100 -14
  54. package/src/components/combobox/combobox.types.ts +11 -5
  55. package/src/components/invocation-rule-builder/invocation-rule-builder.css +14 -0
  56. package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +1 -1
  57. package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +30 -16
  58. package/src/components/json-editor/json-editor-enhancement.ts +48 -0
  59. package/src/components/json-editor/json-editor.css +68 -0
  60. package/src/components/json-editor/json-editor.examples.json +2 -2
  61. package/src/components/json-editor/json-editor.schema.json +4 -0
  62. package/src/components/json-editor/json-editor.schema.ts +5 -0
  63. package/src/components/json-editor/json-editor.svelte +80 -20
  64. package/src/components/json-editor/json-editor.types.ts +2 -0
  65. package/src/components/status-dot/status-dot.svelte +6 -1
  66. package/src/highlighters/shiki/default.ts +46 -0
  67. package/src/highlighters/shiki/index.ts +101 -32
  68. package/src/utilities/json-highlight.ts +5 -0
@@ -51,21 +51,3205 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
51
51
  throw Error('Dynamic require of "' + x + '" is not supported');
52
52
  });
53
53
 
54
+ // ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
55
+ function clamp(start, value, end) {
56
+ return max(start, min(value, end));
57
+ }
58
+ function evaluate(value, param) {
59
+ return typeof value === "function" ? value(param) : value;
60
+ }
61
+ function getSide(placement) {
62
+ return placement.split("-")[0];
63
+ }
64
+ function getAlignment(placement) {
65
+ return placement.split("-")[1];
66
+ }
67
+ function getOppositeAxis(axis) {
68
+ return axis === "x" ? "y" : "x";
69
+ }
70
+ function getAxisLength(axis) {
71
+ return axis === "y" ? "height" : "width";
72
+ }
73
+ function getSideAxis(placement) {
74
+ const firstChar = placement[0];
75
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
76
+ }
77
+ function getAlignmentAxis(placement) {
78
+ return getOppositeAxis(getSideAxis(placement));
79
+ }
80
+ function getAlignmentSides(placement, rects, rtl) {
81
+ if (rtl === undefined) {
82
+ rtl = false;
83
+ }
84
+ const alignment = getAlignment(placement);
85
+ const alignmentAxis = getAlignmentAxis(placement);
86
+ const length = getAxisLength(alignmentAxis);
87
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
88
+ if (rects.reference[length] > rects.floating[length]) {
89
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
90
+ }
91
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
92
+ }
93
+ function getExpandedPlacements(placement) {
94
+ const oppositePlacement = getOppositePlacement(placement);
95
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
96
+ }
97
+ function getOppositeAlignmentPlacement(placement) {
98
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
99
+ }
100
+ function getSideList(side, isStart, rtl) {
101
+ switch (side) {
102
+ case "top":
103
+ case "bottom":
104
+ if (rtl)
105
+ return isStart ? rlPlacement : lrPlacement;
106
+ return isStart ? lrPlacement : rlPlacement;
107
+ case "left":
108
+ case "right":
109
+ return isStart ? tbPlacement : btPlacement;
110
+ default:
111
+ return [];
112
+ }
113
+ }
114
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
115
+ const alignment = getAlignment(placement);
116
+ let list = getSideList(getSide(placement), direction === "start", rtl);
117
+ if (alignment) {
118
+ list = list.map((side) => side + "-" + alignment);
119
+ if (flipAlignment) {
120
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
121
+ }
122
+ }
123
+ return list;
124
+ }
125
+ function getOppositePlacement(placement) {
126
+ const side = getSide(placement);
127
+ return oppositeSideMap[side] + placement.slice(side.length);
128
+ }
129
+ function expandPaddingObject(padding) {
130
+ return {
131
+ top: 0,
132
+ right: 0,
133
+ bottom: 0,
134
+ left: 0,
135
+ ...padding
136
+ };
137
+ }
138
+ function getPaddingObject(padding) {
139
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
140
+ top: padding,
141
+ right: padding,
142
+ bottom: padding,
143
+ left: padding
144
+ };
145
+ }
146
+ function rectToClientRect(rect) {
147
+ const {
148
+ x,
149
+ y,
150
+ width,
151
+ height
152
+ } = rect;
153
+ return {
154
+ width,
155
+ height,
156
+ top: y,
157
+ left: x,
158
+ right: x + width,
159
+ bottom: y + height,
160
+ x,
161
+ y
162
+ };
163
+ }
164
+ var sides, alignments, placements, min, max, round, floor, createCoords = (v) => ({
165
+ x: v,
166
+ y: v
167
+ }), oppositeSideMap, lrPlacement, rlPlacement, tbPlacement, btPlacement;
168
+ var init_floating_ui_utils = __esm(() => {
169
+ sides = ["top", "right", "bottom", "left"];
170
+ alignments = ["start", "end"];
171
+ placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
172
+ min = Math.min;
173
+ max = Math.max;
174
+ round = Math.round;
175
+ floor = Math.floor;
176
+ oppositeSideMap = {
177
+ left: "right",
178
+ right: "left",
179
+ bottom: "top",
180
+ top: "bottom"
181
+ };
182
+ lrPlacement = ["left", "right"];
183
+ rlPlacement = ["right", "left"];
184
+ tbPlacement = ["top", "bottom"];
185
+ btPlacement = ["bottom", "top"];
186
+ });
187
+
188
+ // ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
189
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
190
+ let {
191
+ reference,
192
+ floating
193
+ } = _ref;
194
+ const sideAxis = getSideAxis(placement);
195
+ const alignmentAxis = getAlignmentAxis(placement);
196
+ const alignLength = getAxisLength(alignmentAxis);
197
+ const side = getSide(placement);
198
+ const isVertical = sideAxis === "y";
199
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
200
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
201
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
202
+ let coords;
203
+ switch (side) {
204
+ case "top":
205
+ coords = {
206
+ x: commonX,
207
+ y: reference.y - floating.height
208
+ };
209
+ break;
210
+ case "bottom":
211
+ coords = {
212
+ x: commonX,
213
+ y: reference.y + reference.height
214
+ };
215
+ break;
216
+ case "right":
217
+ coords = {
218
+ x: reference.x + reference.width,
219
+ y: commonY
220
+ };
221
+ break;
222
+ case "left":
223
+ coords = {
224
+ x: reference.x - floating.width,
225
+ y: commonY
226
+ };
227
+ break;
228
+ default:
229
+ coords = {
230
+ x: reference.x,
231
+ y: reference.y
232
+ };
233
+ }
234
+ switch (getAlignment(placement)) {
235
+ case "start":
236
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
237
+ break;
238
+ case "end":
239
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
240
+ break;
241
+ }
242
+ return coords;
243
+ }
244
+ async function detectOverflow(state2, options) {
245
+ var _await$platform$isEle;
246
+ if (options === undefined) {
247
+ options = {};
248
+ }
249
+ const {
250
+ x,
251
+ y,
252
+ platform,
253
+ rects,
254
+ elements,
255
+ strategy
256
+ } = state2;
257
+ const {
258
+ boundary = "clippingAncestors",
259
+ rootBoundary = "viewport",
260
+ elementContext = "floating",
261
+ altBoundary = false,
262
+ padding = 0
263
+ } = evaluate(options, state2);
264
+ const paddingObject = getPaddingObject(padding);
265
+ const altContext = elementContext === "floating" ? "reference" : "floating";
266
+ const element = elements[altBoundary ? altContext : elementContext];
267
+ const clippingClientRect = rectToClientRect(await platform.getClippingRect({
268
+ element: ((_await$platform$isEle = await (platform.isElement == null ? undefined : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? undefined : platform.getDocumentElement(elements.floating)),
269
+ boundary,
270
+ rootBoundary,
271
+ strategy
272
+ }));
273
+ const rect = elementContext === "floating" ? {
274
+ x,
275
+ y,
276
+ width: rects.floating.width,
277
+ height: rects.floating.height
278
+ } : rects.reference;
279
+ const offsetParent = await (platform.getOffsetParent == null ? undefined : platform.getOffsetParent(elements.floating));
280
+ const offsetScale = await (platform.isElement == null ? undefined : platform.isElement(offsetParent)) ? await (platform.getScale == null ? undefined : platform.getScale(offsetParent)) || {
281
+ x: 1,
282
+ y: 1
283
+ } : {
284
+ x: 1,
285
+ y: 1
286
+ };
287
+ const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
288
+ elements,
289
+ rect,
290
+ offsetParent,
291
+ strategy
292
+ }) : rect);
293
+ return {
294
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
295
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
296
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
297
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
298
+ };
299
+ }
300
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
301
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
302
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
303
+ if (alignment) {
304
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
305
+ }
306
+ return true;
307
+ });
308
+ }
309
+ function getSideOffsets(overflow, rect) {
310
+ return {
311
+ top: overflow.top - rect.height,
312
+ right: overflow.right - rect.width,
313
+ bottom: overflow.bottom - rect.height,
314
+ left: overflow.left - rect.width
315
+ };
316
+ }
317
+ function isAnySideFullyClipped(overflow) {
318
+ return sides.some((side) => overflow[side] >= 0);
319
+ }
320
+ function getBoundingRect(rects) {
321
+ const minX = min(...rects.map((rect) => rect.left));
322
+ const minY = min(...rects.map((rect) => rect.top));
323
+ const maxX = max(...rects.map((rect) => rect.right));
324
+ const maxY = max(...rects.map((rect) => rect.bottom));
325
+ return {
326
+ x: minX,
327
+ y: minY,
328
+ width: maxX - minX,
329
+ height: maxY - minY
330
+ };
331
+ }
332
+ function getRectsByLine(rects) {
333
+ const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
334
+ const groups = [];
335
+ let prevRect = null;
336
+ for (let i = 0;i < sortedRects.length; i++) {
337
+ const rect = sortedRects[i];
338
+ if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
339
+ groups.push([rect]);
340
+ } else {
341
+ groups[groups.length - 1].push(rect);
342
+ }
343
+ prevRect = rect;
344
+ }
345
+ return groups.map((rect) => rectToClientRect(getBoundingRect(rect)));
346
+ }
347
+ async function convertValueToCoords(state2, options) {
348
+ const {
349
+ placement,
350
+ platform,
351
+ elements
352
+ } = state2;
353
+ const rtl = await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating));
354
+ const side = getSide(placement);
355
+ const alignment = getAlignment(placement);
356
+ const isVertical = getSideAxis(placement) === "y";
357
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
358
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
359
+ const rawValue = evaluate(options, state2);
360
+ let {
361
+ mainAxis,
362
+ crossAxis,
363
+ alignmentAxis
364
+ } = typeof rawValue === "number" ? {
365
+ mainAxis: rawValue,
366
+ crossAxis: 0,
367
+ alignmentAxis: null
368
+ } : {
369
+ mainAxis: rawValue.mainAxis || 0,
370
+ crossAxis: rawValue.crossAxis || 0,
371
+ alignmentAxis: rawValue.alignmentAxis
372
+ };
373
+ if (alignment && typeof alignmentAxis === "number") {
374
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
375
+ }
376
+ return isVertical ? {
377
+ x: crossAxis * crossAxisMulti,
378
+ y: mainAxis * mainAxisMulti
379
+ } : {
380
+ x: mainAxis * mainAxisMulti,
381
+ y: crossAxis * crossAxisMulti
382
+ };
383
+ }
384
+ var MAX_RESET_COUNT = 50, computePosition = async (reference, floating, config) => {
385
+ const {
386
+ placement = "bottom",
387
+ strategy = "absolute",
388
+ middleware = [],
389
+ platform
390
+ } = config;
391
+ const platformWithDetectOverflow = platform.detectOverflow ? platform : {
392
+ ...platform,
393
+ detectOverflow
394
+ };
395
+ const rtl = await (platform.isRTL == null ? undefined : platform.isRTL(floating));
396
+ let rects = await platform.getElementRects({
397
+ reference,
398
+ floating,
399
+ strategy
400
+ });
401
+ let {
402
+ x,
403
+ y
404
+ } = computeCoordsFromPlacement(rects, placement, rtl);
405
+ let statefulPlacement = placement;
406
+ let resetCount = 0;
407
+ const middlewareData = {};
408
+ for (let i = 0;i < middleware.length; i++) {
409
+ const currentMiddleware = middleware[i];
410
+ if (!currentMiddleware) {
411
+ continue;
412
+ }
413
+ const {
414
+ name,
415
+ fn
416
+ } = currentMiddleware;
417
+ const {
418
+ x: nextX,
419
+ y: nextY,
420
+ data,
421
+ reset: reset2
422
+ } = await fn({
423
+ x,
424
+ y,
425
+ initialPlacement: placement,
426
+ placement: statefulPlacement,
427
+ strategy,
428
+ middlewareData,
429
+ rects,
430
+ platform: platformWithDetectOverflow,
431
+ elements: {
432
+ reference,
433
+ floating
434
+ }
435
+ });
436
+ x = nextX != null ? nextX : x;
437
+ y = nextY != null ? nextY : y;
438
+ middlewareData[name] = {
439
+ ...middlewareData[name],
440
+ ...data
441
+ };
442
+ if (reset2 && resetCount < MAX_RESET_COUNT) {
443
+ resetCount++;
444
+ if (typeof reset2 === "object") {
445
+ if (reset2.placement) {
446
+ statefulPlacement = reset2.placement;
447
+ }
448
+ if (reset2.rects) {
449
+ rects = reset2.rects === true ? await platform.getElementRects({
450
+ reference,
451
+ floating,
452
+ strategy
453
+ }) : reset2.rects;
454
+ }
455
+ ({
456
+ x,
457
+ y
458
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
459
+ }
460
+ i = -1;
461
+ }
462
+ }
463
+ return {
464
+ x,
465
+ y,
466
+ placement: statefulPlacement,
467
+ strategy,
468
+ middlewareData
469
+ };
470
+ }, arrow = (options) => ({
471
+ name: "arrow",
472
+ options,
473
+ async fn(state2) {
474
+ const {
475
+ x,
476
+ y,
477
+ placement,
478
+ rects,
479
+ platform,
480
+ elements,
481
+ middlewareData
482
+ } = state2;
483
+ const {
484
+ element,
485
+ padding = 0
486
+ } = evaluate(options, state2) || {};
487
+ if (element == null) {
488
+ return {};
489
+ }
490
+ const paddingObject = getPaddingObject(padding);
491
+ const coords = {
492
+ x,
493
+ y
494
+ };
495
+ const axis = getAlignmentAxis(placement);
496
+ const length = getAxisLength(axis);
497
+ const arrowDimensions = await platform.getDimensions(element);
498
+ const isYAxis = axis === "y";
499
+ const minProp = isYAxis ? "top" : "left";
500
+ const maxProp = isYAxis ? "bottom" : "right";
501
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
502
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
503
+ const startDiff = coords[axis] - rects.reference[axis];
504
+ const arrowOffsetParent = await (platform.getOffsetParent == null ? undefined : platform.getOffsetParent(element));
505
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
506
+ if (!clientSize || !await (platform.isElement == null ? undefined : platform.isElement(arrowOffsetParent))) {
507
+ clientSize = elements.floating[clientProp] || rects.floating[length];
508
+ }
509
+ const centerToReference = endDiff / 2 - startDiff / 2;
510
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
511
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
512
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
513
+ const min$1 = minPadding;
514
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
515
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
516
+ const offset = clamp(min$1, center, max2);
517
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
518
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
519
+ return {
520
+ [axis]: coords[axis] + alignmentOffset,
521
+ data: {
522
+ [axis]: offset,
523
+ centerOffset: center - offset - alignmentOffset,
524
+ ...shouldAddOffset && {
525
+ alignmentOffset
526
+ }
527
+ },
528
+ reset: shouldAddOffset
529
+ };
530
+ }
531
+ }), autoPlacement = function(options) {
532
+ if (options === undefined) {
533
+ options = {};
534
+ }
535
+ return {
536
+ name: "autoPlacement",
537
+ options,
538
+ async fn(state2) {
539
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
540
+ const {
541
+ rects,
542
+ middlewareData,
543
+ placement,
544
+ platform,
545
+ elements
546
+ } = state2;
547
+ const {
548
+ crossAxis = false,
549
+ alignment,
550
+ allowedPlacements = placements,
551
+ autoAlignment = true,
552
+ ...detectOverflowOptions
553
+ } = evaluate(options, state2);
554
+ const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
555
+ const overflow = await platform.detectOverflow(state2, detectOverflowOptions);
556
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? undefined : _middlewareData$autoP.index) || 0;
557
+ const currentPlacement = placements$1[currentIndex];
558
+ if (currentPlacement == null) {
559
+ return {};
560
+ }
561
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating)));
562
+ if (placement !== currentPlacement) {
563
+ return {
564
+ reset: {
565
+ placement: placements$1[0]
566
+ }
567
+ };
568
+ }
569
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
570
+ const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? undefined : _middlewareData$autoP2.overflows) || [], {
571
+ placement: currentPlacement,
572
+ overflows: currentOverflows
573
+ }];
574
+ const nextPlacement = placements$1[currentIndex + 1];
575
+ if (nextPlacement) {
576
+ return {
577
+ data: {
578
+ index: currentIndex + 1,
579
+ overflows: allOverflows
580
+ },
581
+ reset: {
582
+ placement: nextPlacement
583
+ }
584
+ };
585
+ }
586
+ const placementsSortedByMostSpace = allOverflows.map((d) => {
587
+ const alignment2 = getAlignment(d.placement);
588
+ return [d.placement, alignment2 && crossAxis ? d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) : d.overflows[0], d.overflows];
589
+ }).sort((a, b) => a[1] - b[1]);
590
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d) => d[2].slice(0, getAlignment(d[0]) ? 2 : 3).every((v) => v <= 0));
591
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? undefined : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
592
+ if (resetPlacement !== placement) {
593
+ return {
594
+ data: {
595
+ index: currentIndex + 1,
596
+ overflows: allOverflows
597
+ },
598
+ reset: {
599
+ placement: resetPlacement
600
+ }
601
+ };
602
+ }
603
+ return {};
604
+ }
605
+ };
606
+ }, flip = function(options) {
607
+ if (options === undefined) {
608
+ options = {};
609
+ }
610
+ return {
611
+ name: "flip",
612
+ options,
613
+ async fn(state2) {
614
+ var _middlewareData$arrow, _middlewareData$flip;
615
+ const {
616
+ placement,
617
+ middlewareData,
618
+ rects,
619
+ initialPlacement,
620
+ platform,
621
+ elements
622
+ } = state2;
623
+ const {
624
+ mainAxis: checkMainAxis = true,
625
+ crossAxis: checkCrossAxis = true,
626
+ fallbackPlacements: specifiedFallbackPlacements,
627
+ fallbackStrategy = "bestFit",
628
+ fallbackAxisSideDirection = "none",
629
+ flipAlignment = true,
630
+ ...detectOverflowOptions
631
+ } = evaluate(options, state2);
632
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
633
+ return {};
634
+ }
635
+ const side = getSide(placement);
636
+ const initialSideAxis = getSideAxis(initialPlacement);
637
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
638
+ const rtl = await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating));
639
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
640
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
641
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
642
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
643
+ }
644
+ const placements2 = [initialPlacement, ...fallbackPlacements];
645
+ const overflow = await platform.detectOverflow(state2, detectOverflowOptions);
646
+ const overflows = [];
647
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? undefined : _middlewareData$flip.overflows) || [];
648
+ if (checkMainAxis) {
649
+ overflows.push(overflow[side]);
650
+ }
651
+ if (checkCrossAxis) {
652
+ const sides2 = getAlignmentSides(placement, rects, rtl);
653
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
654
+ }
655
+ overflowsData = [...overflowsData, {
656
+ placement,
657
+ overflows
658
+ }];
659
+ if (!overflows.every((side2) => side2 <= 0)) {
660
+ var _middlewareData$flip2, _overflowsData$filter;
661
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? undefined : _middlewareData$flip2.index) || 0) + 1;
662
+ const nextPlacement = placements2[nextIndex];
663
+ if (nextPlacement) {
664
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
665
+ if (!ignoreCrossAxisOverflow || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
666
+ return {
667
+ data: {
668
+ index: nextIndex,
669
+ overflows: overflowsData
670
+ },
671
+ reset: {
672
+ placement: nextPlacement
673
+ }
674
+ };
675
+ }
676
+ }
677
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? undefined : _overflowsData$filter.placement;
678
+ if (!resetPlacement) {
679
+ switch (fallbackStrategy) {
680
+ case "bestFit": {
681
+ var _overflowsData$filter2;
682
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
683
+ if (hasFallbackAxisSideDirection) {
684
+ const currentSideAxis = getSideAxis(d.placement);
685
+ return currentSideAxis === initialSideAxis || currentSideAxis === "y";
686
+ }
687
+ return true;
688
+ }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? undefined : _overflowsData$filter2[0];
689
+ if (placement2) {
690
+ resetPlacement = placement2;
691
+ }
692
+ break;
693
+ }
694
+ case "initialPlacement":
695
+ resetPlacement = initialPlacement;
696
+ break;
697
+ }
698
+ }
699
+ if (placement !== resetPlacement) {
700
+ return {
701
+ reset: {
702
+ placement: resetPlacement
703
+ }
704
+ };
705
+ }
706
+ }
707
+ return {};
708
+ }
709
+ };
710
+ }, hide = function(options) {
711
+ if (options === undefined) {
712
+ options = {};
713
+ }
714
+ return {
715
+ name: "hide",
716
+ options,
717
+ async fn(state2) {
718
+ const {
719
+ rects,
720
+ platform
721
+ } = state2;
722
+ const {
723
+ strategy = "referenceHidden",
724
+ ...detectOverflowOptions
725
+ } = evaluate(options, state2);
726
+ switch (strategy) {
727
+ case "referenceHidden": {
728
+ const overflow = await platform.detectOverflow(state2, {
729
+ ...detectOverflowOptions,
730
+ elementContext: "reference"
731
+ });
732
+ const offsets = getSideOffsets(overflow, rects.reference);
733
+ return {
734
+ data: {
735
+ referenceHiddenOffsets: offsets,
736
+ referenceHidden: isAnySideFullyClipped(offsets)
737
+ }
738
+ };
739
+ }
740
+ case "escaped": {
741
+ const overflow = await platform.detectOverflow(state2, {
742
+ ...detectOverflowOptions,
743
+ altBoundary: true
744
+ });
745
+ const offsets = getSideOffsets(overflow, rects.floating);
746
+ return {
747
+ data: {
748
+ escapedOffsets: offsets,
749
+ escaped: isAnySideFullyClipped(offsets)
750
+ }
751
+ };
752
+ }
753
+ default: {
754
+ return {};
755
+ }
756
+ }
757
+ }
758
+ };
759
+ }, inline = function(options) {
760
+ if (options === undefined) {
761
+ options = {};
762
+ }
763
+ return {
764
+ name: "inline",
765
+ options,
766
+ async fn(state2) {
767
+ const {
768
+ placement,
769
+ elements,
770
+ rects,
771
+ platform,
772
+ strategy
773
+ } = state2;
774
+ const {
775
+ padding = 2,
776
+ x,
777
+ y
778
+ } = evaluate(options, state2);
779
+ const nativeClientRects = Array.from(await (platform.getClientRects == null ? undefined : platform.getClientRects(elements.reference)) || []);
780
+ const clientRects = getRectsByLine(nativeClientRects);
781
+ const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
782
+ const paddingObject = getPaddingObject(padding);
783
+ function getBoundingClientRect() {
784
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
785
+ return clientRects.find((rect) => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
786
+ }
787
+ if (clientRects.length >= 2) {
788
+ if (getSideAxis(placement) === "y") {
789
+ const firstRect = clientRects[0];
790
+ const lastRect = clientRects[clientRects.length - 1];
791
+ const isTop = getSide(placement) === "top";
792
+ const top2 = firstRect.top;
793
+ const bottom2 = lastRect.bottom;
794
+ const left2 = isTop ? firstRect.left : lastRect.left;
795
+ const right2 = isTop ? firstRect.right : lastRect.right;
796
+ const width2 = right2 - left2;
797
+ const height2 = bottom2 - top2;
798
+ return {
799
+ top: top2,
800
+ bottom: bottom2,
801
+ left: left2,
802
+ right: right2,
803
+ width: width2,
804
+ height: height2,
805
+ x: left2,
806
+ y: top2
807
+ };
808
+ }
809
+ const isLeftSide = getSide(placement) === "left";
810
+ const maxRight = max(...clientRects.map((rect) => rect.right));
811
+ const minLeft = min(...clientRects.map((rect) => rect.left));
812
+ const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
813
+ const top = measureRects[0].top;
814
+ const bottom = measureRects[measureRects.length - 1].bottom;
815
+ const left = minLeft;
816
+ const right = maxRight;
817
+ const width = right - left;
818
+ const height = bottom - top;
819
+ return {
820
+ top,
821
+ bottom,
822
+ left,
823
+ right,
824
+ width,
825
+ height,
826
+ x: left,
827
+ y: top
828
+ };
829
+ }
830
+ return fallback;
831
+ }
832
+ const resetRects = await platform.getElementRects({
833
+ reference: {
834
+ getBoundingClientRect
835
+ },
836
+ floating: elements.floating,
837
+ strategy
838
+ });
839
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
840
+ return {
841
+ reset: {
842
+ rects: resetRects
843
+ }
844
+ };
845
+ }
846
+ return {};
847
+ }
848
+ };
849
+ }, originSides, offset = function(options) {
850
+ if (options === undefined) {
851
+ options = 0;
852
+ }
853
+ return {
854
+ name: "offset",
855
+ options,
856
+ async fn(state2) {
857
+ var _middlewareData$offse, _middlewareData$arrow;
858
+ const {
859
+ x,
860
+ y,
861
+ placement,
862
+ middlewareData
863
+ } = state2;
864
+ const diffCoords = await convertValueToCoords(state2, options);
865
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? undefined : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
866
+ return {};
867
+ }
868
+ return {
869
+ x: x + diffCoords.x,
870
+ y: y + diffCoords.y,
871
+ data: {
872
+ ...diffCoords,
873
+ placement
874
+ }
875
+ };
876
+ }
877
+ };
878
+ }, shift = function(options) {
879
+ if (options === undefined) {
880
+ options = {};
881
+ }
882
+ return {
883
+ name: "shift",
884
+ options,
885
+ async fn(state2) {
886
+ const {
887
+ x,
888
+ y,
889
+ placement,
890
+ platform
891
+ } = state2;
892
+ const {
893
+ mainAxis: checkMainAxis = true,
894
+ crossAxis: checkCrossAxis = false,
895
+ limiter = {
896
+ fn: (_ref) => {
897
+ let {
898
+ x: x2,
899
+ y: y2
900
+ } = _ref;
901
+ return {
902
+ x: x2,
903
+ y: y2
904
+ };
905
+ }
906
+ },
907
+ ...detectOverflowOptions
908
+ } = evaluate(options, state2);
909
+ const coords = {
910
+ x,
911
+ y
912
+ };
913
+ const overflow = await platform.detectOverflow(state2, detectOverflowOptions);
914
+ const crossAxis = getSideAxis(getSide(placement));
915
+ const mainAxis = getOppositeAxis(crossAxis);
916
+ let mainAxisCoord = coords[mainAxis];
917
+ let crossAxisCoord = coords[crossAxis];
918
+ if (checkMainAxis) {
919
+ const minSide = mainAxis === "y" ? "top" : "left";
920
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
921
+ const min2 = mainAxisCoord + overflow[minSide];
922
+ const max2 = mainAxisCoord - overflow[maxSide];
923
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
924
+ }
925
+ if (checkCrossAxis) {
926
+ const minSide = crossAxis === "y" ? "top" : "left";
927
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
928
+ const min2 = crossAxisCoord + overflow[minSide];
929
+ const max2 = crossAxisCoord - overflow[maxSide];
930
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
931
+ }
932
+ const limitedCoords = limiter.fn({
933
+ ...state2,
934
+ [mainAxis]: mainAxisCoord,
935
+ [crossAxis]: crossAxisCoord
936
+ });
937
+ return {
938
+ ...limitedCoords,
939
+ data: {
940
+ x: limitedCoords.x - x,
941
+ y: limitedCoords.y - y,
942
+ enabled: {
943
+ [mainAxis]: checkMainAxis,
944
+ [crossAxis]: checkCrossAxis
945
+ }
946
+ }
947
+ };
948
+ }
949
+ };
950
+ }, limitShift = function(options) {
951
+ if (options === undefined) {
952
+ options = {};
953
+ }
954
+ return {
955
+ options,
956
+ fn(state2) {
957
+ const {
958
+ x,
959
+ y,
960
+ placement,
961
+ rects,
962
+ middlewareData
963
+ } = state2;
964
+ const {
965
+ offset: offset2 = 0,
966
+ mainAxis: checkMainAxis = true,
967
+ crossAxis: checkCrossAxis = true
968
+ } = evaluate(options, state2);
969
+ const coords = {
970
+ x,
971
+ y
972
+ };
973
+ const crossAxis = getSideAxis(placement);
974
+ const mainAxis = getOppositeAxis(crossAxis);
975
+ let mainAxisCoord = coords[mainAxis];
976
+ let crossAxisCoord = coords[crossAxis];
977
+ const rawOffset = evaluate(offset2, state2);
978
+ const computedOffset = typeof rawOffset === "number" ? {
979
+ mainAxis: rawOffset,
980
+ crossAxis: 0
981
+ } : {
982
+ mainAxis: 0,
983
+ crossAxis: 0,
984
+ ...rawOffset
985
+ };
986
+ if (checkMainAxis) {
987
+ const len = mainAxis === "y" ? "height" : "width";
988
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
989
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
990
+ if (mainAxisCoord < limitMin) {
991
+ mainAxisCoord = limitMin;
992
+ } else if (mainAxisCoord > limitMax) {
993
+ mainAxisCoord = limitMax;
994
+ }
995
+ }
996
+ if (checkCrossAxis) {
997
+ var _middlewareData$offse, _middlewareData$offse2;
998
+ const len = mainAxis === "y" ? "width" : "height";
999
+ const isOriginSide = originSides.has(getSide(placement));
1000
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? undefined : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1001
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? undefined : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1002
+ if (crossAxisCoord < limitMin) {
1003
+ crossAxisCoord = limitMin;
1004
+ } else if (crossAxisCoord > limitMax) {
1005
+ crossAxisCoord = limitMax;
1006
+ }
1007
+ }
1008
+ return {
1009
+ [mainAxis]: mainAxisCoord,
1010
+ [crossAxis]: crossAxisCoord
1011
+ };
1012
+ }
1013
+ };
1014
+ }, size = function(options) {
1015
+ if (options === undefined) {
1016
+ options = {};
1017
+ }
1018
+ return {
1019
+ name: "size",
1020
+ options,
1021
+ async fn(state2) {
1022
+ var _state$middlewareData, _state$middlewareData2;
1023
+ const {
1024
+ placement,
1025
+ rects,
1026
+ platform,
1027
+ elements
1028
+ } = state2;
1029
+ const {
1030
+ apply = () => {},
1031
+ ...detectOverflowOptions
1032
+ } = evaluate(options, state2);
1033
+ const overflow = await platform.detectOverflow(state2, detectOverflowOptions);
1034
+ const side = getSide(placement);
1035
+ const alignment = getAlignment(placement);
1036
+ const isYAxis = getSideAxis(placement) === "y";
1037
+ const {
1038
+ width,
1039
+ height
1040
+ } = rects.floating;
1041
+ let heightSide;
1042
+ let widthSide;
1043
+ if (side === "top" || side === "bottom") {
1044
+ heightSide = side;
1045
+ widthSide = alignment === (await (platform.isRTL == null ? undefined : platform.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
1046
+ } else {
1047
+ widthSide = side;
1048
+ heightSide = alignment === "end" ? "top" : "bottom";
1049
+ }
1050
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1051
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1052
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1053
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1054
+ const noShift = !state2.middlewareData.shift;
1055
+ let availableHeight = overflowAvailableHeight;
1056
+ let availableWidth = overflowAvailableWidth;
1057
+ if ((_state$middlewareData = state2.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
1058
+ availableWidth = maximumClippingWidth;
1059
+ }
1060
+ if ((_state$middlewareData2 = state2.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
1061
+ availableHeight = maximumClippingHeight;
1062
+ }
1063
+ if (noShift && !alignment) {
1064
+ const xMin = max(overflow.left, 0);
1065
+ const xMax = max(overflow.right, 0);
1066
+ const yMin = max(overflow.top, 0);
1067
+ const yMax = max(overflow.bottom, 0);
1068
+ if (isYAxis) {
1069
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1070
+ } else {
1071
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1072
+ }
1073
+ }
1074
+ await apply({
1075
+ ...state2,
1076
+ availableWidth,
1077
+ availableHeight
1078
+ });
1079
+ const nextDimensions = await platform.getDimensions(elements.floating);
1080
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1081
+ return {
1082
+ reset: {
1083
+ rects: true
1084
+ }
1085
+ };
1086
+ }
1087
+ return {};
1088
+ }
1089
+ };
1090
+ };
1091
+ var init_floating_ui_core = __esm(() => {
1092
+ init_floating_ui_utils();
1093
+ init_floating_ui_utils();
1094
+ originSides = /* @__PURE__ */ new Set(["left", "top"]);
1095
+ });
1096
+
1097
+ // ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
1098
+ function hasWindow() {
1099
+ return typeof window !== "undefined";
1100
+ }
1101
+ function getNodeName(node) {
1102
+ if (isNode(node)) {
1103
+ return (node.nodeName || "").toLowerCase();
1104
+ }
1105
+ return "#document";
1106
+ }
1107
+ function getWindow(node) {
1108
+ var _node$ownerDocument;
1109
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? undefined : _node$ownerDocument.defaultView) || window;
1110
+ }
1111
+ function getDocumentElement(node) {
1112
+ var _ref;
1113
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? undefined : _ref.documentElement;
1114
+ }
1115
+ function isNode(value) {
1116
+ if (!hasWindow()) {
1117
+ return false;
1118
+ }
1119
+ return value instanceof Node || value instanceof getWindow(value).Node;
1120
+ }
1121
+ function isElement(value) {
1122
+ if (!hasWindow()) {
1123
+ return false;
1124
+ }
1125
+ return value instanceof Element || value instanceof getWindow(value).Element;
1126
+ }
1127
+ function isHTMLElement(value) {
1128
+ if (!hasWindow()) {
1129
+ return false;
1130
+ }
1131
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1132
+ }
1133
+ function isShadowRoot(value) {
1134
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
1135
+ return false;
1136
+ }
1137
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1138
+ }
1139
+ function isOverflowElement(element) {
1140
+ const {
1141
+ overflow,
1142
+ overflowX,
1143
+ overflowY,
1144
+ display
1145
+ } = getComputedStyle2(element);
1146
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1147
+ }
1148
+ function isTableElement(element) {
1149
+ return /^(table|td|th)$/.test(getNodeName(element));
1150
+ }
1151
+ function isTopLayer(element) {
1152
+ try {
1153
+ if (element.matches(":popover-open")) {
1154
+ return true;
1155
+ }
1156
+ } catch (_e) {}
1157
+ try {
1158
+ return element.matches(":modal");
1159
+ } catch (_e) {
1160
+ return false;
1161
+ }
1162
+ }
1163
+ function isContainingBlock(elementOrCss) {
1164
+ const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
1165
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
1166
+ }
1167
+ function getContainingBlock(element) {
1168
+ let currentNode = getParentNode(element);
1169
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1170
+ if (isContainingBlock(currentNode)) {
1171
+ return currentNode;
1172
+ } else if (isTopLayer(currentNode)) {
1173
+ return null;
1174
+ }
1175
+ currentNode = getParentNode(currentNode);
1176
+ }
1177
+ return null;
1178
+ }
1179
+ function isWebKit() {
1180
+ if (isWebKitValue == null) {
1181
+ isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1182
+ }
1183
+ return isWebKitValue;
1184
+ }
1185
+ function isLastTraversableNode(node) {
1186
+ return /^(html|body|#document)$/.test(getNodeName(node));
1187
+ }
1188
+ function getComputedStyle2(element) {
1189
+ return getWindow(element).getComputedStyle(element);
1190
+ }
1191
+ function getNodeScroll(element) {
1192
+ if (isElement(element)) {
1193
+ return {
1194
+ scrollLeft: element.scrollLeft,
1195
+ scrollTop: element.scrollTop
1196
+ };
1197
+ }
1198
+ return {
1199
+ scrollLeft: element.scrollX,
1200
+ scrollTop: element.scrollY
1201
+ };
1202
+ }
1203
+ function getParentNode(node) {
1204
+ if (getNodeName(node) === "html") {
1205
+ return node;
1206
+ }
1207
+ const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
1208
+ return isShadowRoot(result) ? result.host : result;
1209
+ }
1210
+ function getNearestOverflowAncestor(node) {
1211
+ const parentNode = getParentNode(node);
1212
+ if (isLastTraversableNode(parentNode)) {
1213
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1214
+ }
1215
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1216
+ return parentNode;
1217
+ }
1218
+ return getNearestOverflowAncestor(parentNode);
1219
+ }
1220
+ function getOverflowAncestors(node, list, traverseIframes) {
1221
+ var _node$ownerDocument2;
1222
+ if (list === undefined) {
1223
+ list = [];
1224
+ }
1225
+ if (traverseIframes === undefined) {
1226
+ traverseIframes = true;
1227
+ }
1228
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1229
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? undefined : _node$ownerDocument2.body);
1230
+ const win = getWindow(scrollableAncestor);
1231
+ if (isBody) {
1232
+ const frameElement = getFrameElement(win);
1233
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1234
+ } else {
1235
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1236
+ }
1237
+ }
1238
+ function getFrameElement(win) {
1239
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1240
+ }
1241
+ var willChangeRe, containRe, isNotNone = (value) => !!value && value !== "none", isWebKitValue;
1242
+ var init_floating_ui_utils_dom = __esm(() => {
1243
+ willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1244
+ containRe = /paint|layout|strict|content/;
1245
+ });
1246
+
1247
+ // ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
1248
+ var exports_floating_ui_dom = {};
1249
+ __export(exports_floating_ui_dom, {
1250
+ size: () => size2,
1251
+ shift: () => shift2,
1252
+ platform: () => platform,
1253
+ offset: () => offset2,
1254
+ limitShift: () => limitShift2,
1255
+ inline: () => inline2,
1256
+ hide: () => hide2,
1257
+ getOverflowAncestors: () => getOverflowAncestors,
1258
+ flip: () => flip2,
1259
+ detectOverflow: () => detectOverflow2,
1260
+ computePosition: () => computePosition2,
1261
+ autoUpdate: () => autoUpdate,
1262
+ autoPlacement: () => autoPlacement2,
1263
+ arrow: () => arrow2
1264
+ });
1265
+ function getCssDimensions(element) {
1266
+ const css = getComputedStyle2(element);
1267
+ let width = parseFloat(css.width) || 0;
1268
+ let height = parseFloat(css.height) || 0;
1269
+ const hasOffset = isHTMLElement(element);
1270
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1271
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1272
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1273
+ if (shouldFallback) {
1274
+ width = offsetWidth;
1275
+ height = offsetHeight;
1276
+ }
1277
+ return {
1278
+ width,
1279
+ height,
1280
+ $: shouldFallback
1281
+ };
1282
+ }
1283
+ function unwrapElement(element) {
1284
+ return !isElement(element) ? element.contextElement : element;
1285
+ }
1286
+ function getScale(element) {
1287
+ const domElement = unwrapElement(element);
1288
+ if (!isHTMLElement(domElement)) {
1289
+ return createCoords(1);
1290
+ }
1291
+ const rect = domElement.getBoundingClientRect();
1292
+ const {
1293
+ width,
1294
+ height,
1295
+ $: $3
1296
+ } = getCssDimensions(domElement);
1297
+ let x = ($3 ? round(rect.width) : rect.width) / width;
1298
+ let y = ($3 ? round(rect.height) : rect.height) / height;
1299
+ if (!x || !Number.isFinite(x)) {
1300
+ x = 1;
1301
+ }
1302
+ if (!y || !Number.isFinite(y)) {
1303
+ y = 1;
1304
+ }
1305
+ return {
1306
+ x,
1307
+ y
1308
+ };
1309
+ }
1310
+ function getVisualOffsets(element) {
1311
+ const win = getWindow(element);
1312
+ if (!isWebKit() || !win.visualViewport) {
1313
+ return noOffsets;
1314
+ }
1315
+ return {
1316
+ x: win.visualViewport.offsetLeft,
1317
+ y: win.visualViewport.offsetTop
1318
+ };
1319
+ }
1320
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1321
+ if (isFixed === undefined) {
1322
+ isFixed = false;
1323
+ }
1324
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1325
+ return false;
1326
+ }
1327
+ return isFixed;
1328
+ }
1329
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1330
+ if (includeScale === undefined) {
1331
+ includeScale = false;
1332
+ }
1333
+ if (isFixedStrategy === undefined) {
1334
+ isFixedStrategy = false;
1335
+ }
1336
+ const clientRect = element.getBoundingClientRect();
1337
+ const domElement = unwrapElement(element);
1338
+ let scale = createCoords(1);
1339
+ if (includeScale) {
1340
+ if (offsetParent) {
1341
+ if (isElement(offsetParent)) {
1342
+ scale = getScale(offsetParent);
1343
+ }
1344
+ } else {
1345
+ scale = getScale(element);
1346
+ }
1347
+ }
1348
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1349
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1350
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1351
+ let width = clientRect.width / scale.x;
1352
+ let height = clientRect.height / scale.y;
1353
+ if (domElement) {
1354
+ const win = getWindow(domElement);
1355
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1356
+ let currentWin = win;
1357
+ let currentIFrame = getFrameElement(currentWin);
1358
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1359
+ const iframeScale = getScale(currentIFrame);
1360
+ const iframeRect = currentIFrame.getBoundingClientRect();
1361
+ const css = getComputedStyle2(currentIFrame);
1362
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1363
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1364
+ x *= iframeScale.x;
1365
+ y *= iframeScale.y;
1366
+ width *= iframeScale.x;
1367
+ height *= iframeScale.y;
1368
+ x += left;
1369
+ y += top;
1370
+ currentWin = getWindow(currentIFrame);
1371
+ currentIFrame = getFrameElement(currentWin);
1372
+ }
1373
+ }
1374
+ return rectToClientRect({
1375
+ width,
1376
+ height,
1377
+ x,
1378
+ y
1379
+ });
1380
+ }
1381
+ function getWindowScrollBarX(element, rect) {
1382
+ const leftScroll = getNodeScroll(element).scrollLeft;
1383
+ if (!rect) {
1384
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1385
+ }
1386
+ return rect.left + leftScroll;
1387
+ }
1388
+ function getHTMLOffset(documentElement, scroll) {
1389
+ const htmlRect = documentElement.getBoundingClientRect();
1390
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1391
+ const y = htmlRect.top + scroll.scrollTop;
1392
+ return {
1393
+ x,
1394
+ y
1395
+ };
1396
+ }
1397
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1398
+ let {
1399
+ elements,
1400
+ rect,
1401
+ offsetParent,
1402
+ strategy
1403
+ } = _ref;
1404
+ const isFixed = strategy === "fixed";
1405
+ const documentElement = getDocumentElement(offsetParent);
1406
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1407
+ if (offsetParent === documentElement || topLayer && isFixed) {
1408
+ return rect;
1409
+ }
1410
+ let scroll = {
1411
+ scrollLeft: 0,
1412
+ scrollTop: 0
1413
+ };
1414
+ let scale = createCoords(1);
1415
+ const offsets = createCoords(0);
1416
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1417
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1418
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1419
+ scroll = getNodeScroll(offsetParent);
1420
+ }
1421
+ if (isOffsetParentAnElement) {
1422
+ const offsetRect = getBoundingClientRect(offsetParent);
1423
+ scale = getScale(offsetParent);
1424
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1425
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1426
+ }
1427
+ }
1428
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1429
+ return {
1430
+ width: rect.width * scale.x,
1431
+ height: rect.height * scale.y,
1432
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1433
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1434
+ };
1435
+ }
1436
+ function getClientRects(element) {
1437
+ return Array.from(element.getClientRects());
1438
+ }
1439
+ function getDocumentRect(element) {
1440
+ const html = getDocumentElement(element);
1441
+ const scroll = getNodeScroll(element);
1442
+ const body = element.ownerDocument.body;
1443
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1444
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1445
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1446
+ const y = -scroll.scrollTop;
1447
+ if (getComputedStyle2(body).direction === "rtl") {
1448
+ x += max(html.clientWidth, body.clientWidth) - width;
1449
+ }
1450
+ return {
1451
+ width,
1452
+ height,
1453
+ x,
1454
+ y
1455
+ };
1456
+ }
1457
+ function getViewportRect(element, strategy) {
1458
+ const win = getWindow(element);
1459
+ const html = getDocumentElement(element);
1460
+ const visualViewport = win.visualViewport;
1461
+ let width = html.clientWidth;
1462
+ let height = html.clientHeight;
1463
+ let x = 0;
1464
+ let y = 0;
1465
+ if (visualViewport) {
1466
+ width = visualViewport.width;
1467
+ height = visualViewport.height;
1468
+ const visualViewportBased = isWebKit();
1469
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1470
+ x = visualViewport.offsetLeft;
1471
+ y = visualViewport.offsetTop;
1472
+ }
1473
+ }
1474
+ const windowScrollbarX = getWindowScrollBarX(html);
1475
+ if (windowScrollbarX <= 0) {
1476
+ const doc = html.ownerDocument;
1477
+ const body = doc.body;
1478
+ const bodyStyles = getComputedStyle(body);
1479
+ const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1480
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1481
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1482
+ width -= clippingStableScrollbarWidth;
1483
+ }
1484
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1485
+ width += windowScrollbarX;
1486
+ }
1487
+ return {
1488
+ width,
1489
+ height,
1490
+ x,
1491
+ y
1492
+ };
1493
+ }
1494
+ function getInnerBoundingClientRect(element, strategy) {
1495
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1496
+ const top = clientRect.top + element.clientTop;
1497
+ const left = clientRect.left + element.clientLeft;
1498
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1499
+ const width = element.clientWidth * scale.x;
1500
+ const height = element.clientHeight * scale.y;
1501
+ const x = left * scale.x;
1502
+ const y = top * scale.y;
1503
+ return {
1504
+ width,
1505
+ height,
1506
+ x,
1507
+ y
1508
+ };
1509
+ }
1510
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1511
+ let rect;
1512
+ if (clippingAncestor === "viewport") {
1513
+ rect = getViewportRect(element, strategy);
1514
+ } else if (clippingAncestor === "document") {
1515
+ rect = getDocumentRect(getDocumentElement(element));
1516
+ } else if (isElement(clippingAncestor)) {
1517
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1518
+ } else {
1519
+ const visualOffsets = getVisualOffsets(element);
1520
+ rect = {
1521
+ x: clippingAncestor.x - visualOffsets.x,
1522
+ y: clippingAncestor.y - visualOffsets.y,
1523
+ width: clippingAncestor.width,
1524
+ height: clippingAncestor.height
1525
+ };
1526
+ }
1527
+ return rectToClientRect(rect);
1528
+ }
1529
+ function hasFixedPositionAncestor(element, stopNode) {
1530
+ const parentNode = getParentNode(element);
1531
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1532
+ return false;
1533
+ }
1534
+ return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1535
+ }
1536
+ function getClippingElementAncestors(element, cache) {
1537
+ const cachedResult = cache.get(element);
1538
+ if (cachedResult) {
1539
+ return cachedResult;
1540
+ }
1541
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1542
+ let currentContainingBlockComputedStyle = null;
1543
+ const elementIsFixed = getComputedStyle2(element).position === "fixed";
1544
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1545
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1546
+ const computedStyle = getComputedStyle2(currentNode);
1547
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1548
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1549
+ currentContainingBlockComputedStyle = null;
1550
+ }
1551
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1552
+ if (shouldDropCurrentNode) {
1553
+ result = result.filter((ancestor) => ancestor !== currentNode);
1554
+ } else {
1555
+ currentContainingBlockComputedStyle = computedStyle;
1556
+ }
1557
+ currentNode = getParentNode(currentNode);
1558
+ }
1559
+ cache.set(element, result);
1560
+ return result;
1561
+ }
1562
+ function getClippingRect(_ref) {
1563
+ let {
1564
+ element,
1565
+ boundary,
1566
+ rootBoundary,
1567
+ strategy
1568
+ } = _ref;
1569
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1570
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1571
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
1572
+ let top = firstRect.top;
1573
+ let right = firstRect.right;
1574
+ let bottom = firstRect.bottom;
1575
+ let left = firstRect.left;
1576
+ for (let i = 1;i < clippingAncestors.length; i++) {
1577
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
1578
+ top = max(rect.top, top);
1579
+ right = min(rect.right, right);
1580
+ bottom = min(rect.bottom, bottom);
1581
+ left = max(rect.left, left);
1582
+ }
1583
+ return {
1584
+ width: right - left,
1585
+ height: bottom - top,
1586
+ x: left,
1587
+ y: top
1588
+ };
1589
+ }
1590
+ function getDimensions(element) {
1591
+ const {
1592
+ width,
1593
+ height
1594
+ } = getCssDimensions(element);
1595
+ return {
1596
+ width,
1597
+ height
1598
+ };
1599
+ }
1600
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1601
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1602
+ const documentElement = getDocumentElement(offsetParent);
1603
+ const isFixed = strategy === "fixed";
1604
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1605
+ let scroll = {
1606
+ scrollLeft: 0,
1607
+ scrollTop: 0
1608
+ };
1609
+ const offsets = createCoords(0);
1610
+ function setLeftRTLScrollbarOffset() {
1611
+ offsets.x = getWindowScrollBarX(documentElement);
1612
+ }
1613
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1614
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1615
+ scroll = getNodeScroll(offsetParent);
1616
+ }
1617
+ if (isOffsetParentAnElement) {
1618
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1619
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1620
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1621
+ } else if (documentElement) {
1622
+ setLeftRTLScrollbarOffset();
1623
+ }
1624
+ }
1625
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1626
+ setLeftRTLScrollbarOffset();
1627
+ }
1628
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1629
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1630
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1631
+ return {
1632
+ x,
1633
+ y,
1634
+ width: rect.width,
1635
+ height: rect.height
1636
+ };
1637
+ }
1638
+ function isStaticPositioned(element) {
1639
+ return getComputedStyle2(element).position === "static";
1640
+ }
1641
+ function getTrueOffsetParent(element, polyfill) {
1642
+ if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
1643
+ return null;
1644
+ }
1645
+ if (polyfill) {
1646
+ return polyfill(element);
1647
+ }
1648
+ let rawOffsetParent = element.offsetParent;
1649
+ if (getDocumentElement(element) === rawOffsetParent) {
1650
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1651
+ }
1652
+ return rawOffsetParent;
1653
+ }
1654
+ function getOffsetParent(element, polyfill) {
1655
+ const win = getWindow(element);
1656
+ if (isTopLayer(element)) {
1657
+ return win;
1658
+ }
1659
+ if (!isHTMLElement(element)) {
1660
+ let svgOffsetParent = getParentNode(element);
1661
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1662
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1663
+ return svgOffsetParent;
1664
+ }
1665
+ svgOffsetParent = getParentNode(svgOffsetParent);
1666
+ }
1667
+ return win;
1668
+ }
1669
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1670
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1671
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1672
+ }
1673
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1674
+ return win;
1675
+ }
1676
+ return offsetParent || getContainingBlock(element) || win;
1677
+ }
1678
+ function isRTL(element) {
1679
+ return getComputedStyle2(element).direction === "rtl";
1680
+ }
1681
+ function rectsAreEqual(a, b) {
1682
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1683
+ }
1684
+ function observeMove(element, onMove) {
1685
+ let io = null;
1686
+ let timeoutId;
1687
+ const root2 = getDocumentElement(element);
1688
+ function cleanup() {
1689
+ var _io;
1690
+ clearTimeout(timeoutId);
1691
+ (_io = io) == null || _io.disconnect();
1692
+ io = null;
1693
+ }
1694
+ function refresh(skip, threshold) {
1695
+ if (skip === undefined) {
1696
+ skip = false;
1697
+ }
1698
+ if (threshold === undefined) {
1699
+ threshold = 1;
1700
+ }
1701
+ cleanup();
1702
+ const elementRectForRootMargin = element.getBoundingClientRect();
1703
+ const {
1704
+ left,
1705
+ top,
1706
+ width,
1707
+ height
1708
+ } = elementRectForRootMargin;
1709
+ if (!skip) {
1710
+ onMove();
1711
+ }
1712
+ if (!width || !height) {
1713
+ return;
1714
+ }
1715
+ const insetTop = floor(top);
1716
+ const insetRight = floor(root2.clientWidth - (left + width));
1717
+ const insetBottom = floor(root2.clientHeight - (top + height));
1718
+ const insetLeft = floor(left);
1719
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1720
+ const options = {
1721
+ rootMargin,
1722
+ threshold: max(0, min(1, threshold)) || 1
1723
+ };
1724
+ let isFirstUpdate = true;
1725
+ function handleObserve(entries) {
1726
+ const ratio = entries[0].intersectionRatio;
1727
+ if (ratio !== threshold) {
1728
+ if (!isFirstUpdate) {
1729
+ return refresh();
1730
+ }
1731
+ if (!ratio) {
1732
+ timeoutId = setTimeout(() => {
1733
+ refresh(false, 0.0000001);
1734
+ }, 1000);
1735
+ } else {
1736
+ refresh(false, ratio);
1737
+ }
1738
+ }
1739
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1740
+ refresh();
1741
+ }
1742
+ isFirstUpdate = false;
1743
+ }
1744
+ try {
1745
+ io = new IntersectionObserver(handleObserve, {
1746
+ ...options,
1747
+ root: root2.ownerDocument
1748
+ });
1749
+ } catch (_e) {
1750
+ io = new IntersectionObserver(handleObserve, options);
1751
+ }
1752
+ io.observe(element);
1753
+ }
1754
+ refresh(true);
1755
+ return cleanup;
1756
+ }
1757
+ function autoUpdate(reference, floating, update, options) {
1758
+ if (options === undefined) {
1759
+ options = {};
1760
+ }
1761
+ const {
1762
+ ancestorScroll = true,
1763
+ ancestorResize = true,
1764
+ elementResize = typeof ResizeObserver === "function",
1765
+ layoutShift = typeof IntersectionObserver === "function",
1766
+ animationFrame = false
1767
+ } = options;
1768
+ const referenceEl = unwrapElement(reference);
1769
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
1770
+ ancestors.forEach((ancestor) => {
1771
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
1772
+ passive: true
1773
+ });
1774
+ ancestorResize && ancestor.addEventListener("resize", update);
1775
+ });
1776
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
1777
+ let reobserveFrame = -1;
1778
+ let resizeObserver = null;
1779
+ if (elementResize) {
1780
+ resizeObserver = new ResizeObserver((_ref) => {
1781
+ let [firstEntry] = _ref;
1782
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
1783
+ resizeObserver.unobserve(floating);
1784
+ cancelAnimationFrame(reobserveFrame);
1785
+ reobserveFrame = requestAnimationFrame(() => {
1786
+ var _resizeObserver;
1787
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1788
+ });
1789
+ }
1790
+ update();
1791
+ });
1792
+ if (referenceEl && !animationFrame) {
1793
+ resizeObserver.observe(referenceEl);
1794
+ }
1795
+ if (floating) {
1796
+ resizeObserver.observe(floating);
1797
+ }
1798
+ }
1799
+ let frameId;
1800
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1801
+ if (animationFrame) {
1802
+ frameLoop();
1803
+ }
1804
+ function frameLoop() {
1805
+ const nextRefRect = getBoundingClientRect(reference);
1806
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1807
+ update();
1808
+ }
1809
+ prevRefRect = nextRefRect;
1810
+ frameId = requestAnimationFrame(frameLoop);
1811
+ }
1812
+ update();
1813
+ return () => {
1814
+ var _resizeObserver2;
1815
+ ancestors.forEach((ancestor) => {
1816
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
1817
+ ancestorResize && ancestor.removeEventListener("resize", update);
1818
+ });
1819
+ cleanupIo == null || cleanupIo();
1820
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
1821
+ resizeObserver = null;
1822
+ if (animationFrame) {
1823
+ cancelAnimationFrame(frameId);
1824
+ }
1825
+ };
1826
+ }
1827
+ var noOffsets, SCROLLBAR_MAX = 25, getElementRects = async function(data) {
1828
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1829
+ const getDimensionsFn = this.getDimensions;
1830
+ const floatingDimensions = await getDimensionsFn(data.floating);
1831
+ return {
1832
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1833
+ floating: {
1834
+ x: 0,
1835
+ y: 0,
1836
+ width: floatingDimensions.width,
1837
+ height: floatingDimensions.height
1838
+ }
1839
+ };
1840
+ }, platform, detectOverflow2, offset2, autoPlacement2, shift2, flip2, size2, hide2, arrow2, inline2, limitShift2, computePosition2 = (reference, floating, options) => {
1841
+ const cache = new Map;
1842
+ const mergedOptions = {
1843
+ platform,
1844
+ ...options
1845
+ };
1846
+ const platformWithCache = {
1847
+ ...mergedOptions.platform,
1848
+ _c: cache
1849
+ };
1850
+ return computePosition(reference, floating, {
1851
+ ...mergedOptions,
1852
+ platform: platformWithCache
1853
+ });
1854
+ };
1855
+ var init_floating_ui_dom = __esm(() => {
1856
+ init_floating_ui_core();
1857
+ init_floating_ui_utils();
1858
+ init_floating_ui_utils_dom();
1859
+ init_floating_ui_utils_dom();
1860
+ noOffsets = /* @__PURE__ */ createCoords(0);
1861
+ platform = {
1862
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1863
+ getDocumentElement,
1864
+ getClippingRect,
1865
+ getOffsetParent,
1866
+ getElementRects,
1867
+ getClientRects,
1868
+ getDimensions,
1869
+ getScale,
1870
+ isElement,
1871
+ isRTL
1872
+ };
1873
+ detectOverflow2 = detectOverflow;
1874
+ offset2 = offset;
1875
+ autoPlacement2 = autoPlacement;
1876
+ shift2 = shift;
1877
+ flip2 = flip;
1878
+ size2 = size;
1879
+ hide2 = hide;
1880
+ arrow2 = arrow;
1881
+ inline2 = inline;
1882
+ limitShift2 = limitShift;
1883
+ });
1884
+
1885
+ // src/components/portal/portal.svelte
1886
+ import"svelte/internal/disclose-version";
1887
+ import * as $2 from "svelte/internal/client";
1888
+
1889
+ // src/utilities/class-names.ts
1890
+ function classNames(...parts) {
1891
+ return parts.filter((part) => typeof part === "string" && part.length > 0).join(" ");
1892
+ }
1893
+
1894
+ // src/components/portal/portal.utilities.svelte.ts
1895
+ import * as $ from "svelte/internal/client";
1896
+
1897
+ // ../../node_modules/esm-env/true.js
1898
+ var true_default = true;
1899
+ // src/utilities/dev-warn.ts
1900
+ function devWarn(message, ...args) {
1901
+ if (!true_default)
1902
+ return;
1903
+ console.warn(message, ...args);
1904
+ }
1905
+
1906
+ // src/utilities/read-option.ts
1907
+ function isOptionGetter(value) {
1908
+ return typeof value === "function";
1909
+ }
1910
+ function readOption(value) {
1911
+ return isOptionGetter(value) ? value() : value;
1912
+ }
1913
+
1914
+ // src/components/portal/portal.utilities.svelte.ts
1915
+ function resolvePortalTarget(target) {
1916
+ if (typeof document === "undefined")
1917
+ return null;
1918
+ if (target == null) {
1919
+ return { kind: "resolved", target: document.body };
1920
+ }
1921
+ if (target instanceof HTMLElement) {
1922
+ return { kind: "resolved", target };
1923
+ }
1924
+ try {
1925
+ const resolved = document.querySelector(target);
1926
+ return resolved instanceof HTMLElement ? { kind: "resolved", target: resolved } : { kind: "unresolved", key: target };
1927
+ } catch {
1928
+ return { kind: "unresolved", key: target };
1929
+ }
1930
+ }
1931
+ function copyInheritedPortalAttributes(element, source, inheritAttributes, fallbackAttributes = {
1932
+ dir: element.getAttribute("dir"),
1933
+ dataTheme: element.getAttribute("data-theme"),
1934
+ theme: element.getAttribute("data-cinder-theme")
1935
+ }) {
1936
+ const preservesExplicitDirection = fallbackAttributes.preserveDirection || element.dataset["cinderExplicitDirection"] === "true";
1937
+ const inheritedDir = inheritAttributes && source && !preservesExplicitDirection ? source.closest("[dir]")?.getAttribute("dir") : null;
1938
+ const nextDir = inheritedDir ?? fallbackAttributes.dir;
1939
+ if (nextDir) {
1940
+ element.setAttribute("dir", nextDir);
1941
+ } else {
1942
+ element.removeAttribute("dir");
1943
+ }
1944
+ const preservesExplicitDataTheme = fallbackAttributes.preserveDataTheme === true;
1945
+ const inheritedDataTheme = inheritAttributes && source && !preservesExplicitDataTheme && fallbackAttributes.dataTheme === null ? source.closest("[data-theme]")?.getAttribute("data-theme") : null;
1946
+ const nextDataTheme = inheritedDataTheme ?? fallbackAttributes.dataTheme;
1947
+ if (nextDataTheme) {
1948
+ element.setAttribute("data-theme", nextDataTheme);
1949
+ } else {
1950
+ element.removeAttribute("data-theme");
1951
+ }
1952
+ const preservesExplicitTheme = fallbackAttributes.preserveTheme === true;
1953
+ const inheritedTheme = inheritAttributes && source && !preservesExplicitTheme && fallbackAttributes.theme === null ? source.closest("[data-cinder-theme]")?.getAttribute("data-cinder-theme") : null;
1954
+ const nextTheme = inheritedTheme ?? fallbackAttributes.theme;
1955
+ if (nextTheme) {
1956
+ element.setAttribute("data-cinder-theme", nextTheme);
1957
+ } else {
1958
+ element.removeAttribute("data-cinder-theme");
1959
+ }
1960
+ return {
1961
+ dir: inheritedDir ?? null,
1962
+ dataTheme: inheritedDataTheme ?? null,
1963
+ theme: inheritedTheme ?? null
1964
+ };
1965
+ }
1966
+ function observeInheritedPortalAttributes(source, inheritAttributes, syncAttributes) {
1967
+ if (!inheritAttributes || !source || typeof MutationObserver === "undefined")
1968
+ return null;
1969
+ const observer = new MutationObserver(() => {
1970
+ syncAttributes();
1971
+ });
1972
+ function observe(elementToObserve) {
1973
+ if (!elementToObserve || observedElements.includes(elementToObserve))
1974
+ return;
1975
+ observedElements.push(elementToObserve);
1976
+ observer.observe(elementToObserve, {
1977
+ attributes: true,
1978
+ attributeFilter: ["dir", "data-theme", "data-cinder-theme"]
1979
+ });
1980
+ }
1981
+ const observedElements = [];
1982
+ let ancestor = source;
1983
+ while (ancestor) {
1984
+ observe(ancestor);
1985
+ ancestor = ancestor.parentElement;
1986
+ }
1987
+ observe(document.documentElement);
1988
+ return () => observer.disconnect();
1989
+ }
1990
+ function createPortalAttachment(options = {}) {
1991
+ let lastWarnedUnresolvedKey = null;
1992
+ return (element) => {
1993
+ const initialParent = element.parentElement;
1994
+ const initialAttributes = {
1995
+ dir: element.getAttribute("dir"),
1996
+ dataTheme: element.getAttribute("data-theme"),
1997
+ theme: element.getAttribute("data-cinder-theme")
1998
+ };
1999
+ const managedAttributes = { dir: null, dataTheme: null, theme: null };
2000
+ function currentFallbackAttributes() {
2001
+ const explicitAttributes = readOption(options.explicitAttributes ?? {});
2002
+ const explicitDirection = explicitAttributes.dir;
2003
+ const explicitDataTheme = explicitAttributes.dataTheme;
2004
+ const explicitTheme = explicitAttributes.theme;
2005
+ const direction = element.getAttribute("dir");
2006
+ const dataTheme = element.getAttribute("data-theme");
2007
+ const theme = element.getAttribute("data-cinder-theme");
2008
+ return {
2009
+ dir: explicitDirection !== undefined ? explicitDirection : direction !== managedAttributes.dir ? direction : initialAttributes.dir,
2010
+ preserveDirection: explicitDirection !== undefined,
2011
+ dataTheme: explicitDataTheme !== undefined ? explicitDataTheme : dataTheme !== managedAttributes.dataTheme ? dataTheme : null,
2012
+ preserveDataTheme: explicitDataTheme !== undefined,
2013
+ theme: explicitTheme !== undefined ? explicitTheme : theme !== managedAttributes.theme ? theme : null,
2014
+ preserveTheme: explicitTheme !== undefined
2015
+ };
2016
+ }
2017
+ function syncInheritedAttributes(source, inheritAttributes) {
2018
+ const nextManagedAttributes = copyInheritedPortalAttributes(element, source, inheritAttributes, currentFallbackAttributes());
2019
+ managedAttributes.dir = nextManagedAttributes.dir;
2020
+ managedAttributes.dataTheme = nextManagedAttributes.dataTheme;
2021
+ managedAttributes.theme = nextManagedAttributes.theme;
2022
+ }
2023
+ const anchor = typeof document !== "undefined" ? document.createComment("@lostgradient/cinder/portal") : null;
2024
+ if (anchor && initialParent && element.parentNode === initialParent) {
2025
+ initialParent.insertBefore(anchor, element);
2026
+ }
2027
+ function restoreInline() {
2028
+ if (!anchor || !anchor.parentNode)
2029
+ return;
2030
+ if (element.parentNode === anchor.parentNode && element.previousSibling === anchor)
2031
+ return;
2032
+ anchor.parentNode.insertBefore(element, anchor.nextSibling);
2033
+ }
2034
+ $.user_effect(() => {
2035
+ let stopObservingInheritedAttributes = null;
2036
+ const disabled = readOption(options.disabled ?? false);
2037
+ const inheritAttributes = readOption(options.inheritAttributes ?? true);
2038
+ const targetValue = readOption(options.target ?? null);
2039
+ const attributeSource = readOption(options.source ?? initialParent) ?? initialParent;
2040
+ const resolved = disabled ? null : resolvePortalTarget(targetValue);
2041
+ if (!disabled && resolved?.kind === "resolved") {
2042
+ syncInheritedAttributes(attributeSource, inheritAttributes);
2043
+ stopObservingInheritedAttributes = observeInheritedPortalAttributes(attributeSource, inheritAttributes, () => syncInheritedAttributes(attributeSource, inheritAttributes));
2044
+ resolved.target.appendChild(element);
2045
+ lastWarnedUnresolvedKey = null;
2046
+ } else if (!disabled && resolved?.kind === "unresolved") {
2047
+ restoreInline();
2048
+ syncInheritedAttributes(null, false);
2049
+ if (lastWarnedUnresolvedKey !== resolved.key) {
2050
+ devWarn(`[cinder/portal] could not resolve portal target ${JSON.stringify(resolved.key)}.`);
2051
+ lastWarnedUnresolvedKey = resolved.key;
2052
+ }
2053
+ } else if (disabled) {
2054
+ restoreInline();
2055
+ syncInheritedAttributes(null, false);
2056
+ lastWarnedUnresolvedKey = null;
2057
+ }
2058
+ return () => {
2059
+ stopObservingInheritedAttributes?.();
2060
+ if (element.isConnected) {
2061
+ element.remove();
2062
+ }
2063
+ };
2064
+ });
2065
+ return () => {
2066
+ if (anchor && anchor.parentNode) {
2067
+ anchor.parentNode.removeChild(anchor);
2068
+ }
2069
+ };
2070
+ };
2071
+ }
2072
+
2073
+ // src/components/portal/portal.svelte
2074
+ var rest_excludes = new Set([
2075
+ "$$slots",
2076
+ "$$events",
2077
+ "$$legacy",
2078
+ "target",
2079
+ "disabled",
2080
+ "class",
2081
+ "inheritAttributes",
2082
+ "children"
2083
+ ]);
2084
+ var root = $2.from_html(`<div><!></div>`);
2085
+ function Portal($$anchor, $$props) {
2086
+ $2.push($$props, true);
2087
+ let target = $2.prop($$props, "target", 3, null), disabled = $2.prop($$props, "disabled", 3, false), inheritAttributes = $2.prop($$props, "inheritAttributes", 3, true), rest = $2.rest_props($$props, rest_excludes);
2088
+ let hasHydrated = $2.state(false);
2089
+ $2.user_effect(() => {
2090
+ $2.set(hasHydrated, true);
2091
+ });
2092
+ const resolvedTarget = $2.derived(() => !disabled() ? resolvePortalTarget(target()) : null);
2093
+ const shouldRenderChildren = $2.derived(() => disabled() || $2.get(hasHydrated) && $2.get(resolvedTarget) !== null);
2094
+ var div = root();
2095
+ $2.attribute_effect(div, ($0) => ({ class: $0, ...rest }), [() => classNames($$props.class)]);
2096
+ var node = $2.child(div);
2097
+ {
2098
+ var consequent = ($$anchor2) => {
2099
+ var fragment = $2.comment();
2100
+ var node_1 = $2.first_child(fragment);
2101
+ $2.snippet(node_1, () => $$props.children);
2102
+ $2.append($$anchor2, fragment);
2103
+ };
2104
+ $2.if(node, ($$render) => {
2105
+ if ($2.get(shouldRenderChildren))
2106
+ $$render(consequent);
2107
+ });
2108
+ }
2109
+ $2.reset(div);
2110
+ $2.attach(div, () => createPortalAttachment({
2111
+ target: () => target(),
2112
+ disabled: () => disabled(),
2113
+ inheritAttributes: () => inheritAttributes(),
2114
+ explicitAttributes: () => ({
2115
+ dir: $$props.dir,
2116
+ dataTheme: rest["data-theme"],
2117
+ theme: rest["data-cinder-theme"]
2118
+ })
2119
+ }));
2120
+ $2.append($$anchor, div);
2121
+ $2.pop();
2122
+ }
2123
+
2124
+ // src/components/portal/index.ts
2125
+ var portal_default = Portal;
54
2126
  // src/components/invocation-rule-builder/index.ts
55
2127
  import"@lostgradient/cinder/invocation-rule-builder/styles";
56
2128
 
57
2129
  // src/components/invocation-rule-builder/invocation-rule-builder.svelte
58
2130
  import"svelte/internal/disclose-version";
59
- import * as $ from "svelte/internal/client";
2131
+ import * as $6 from "svelte/internal/client";
60
2132
  import { tick } from "svelte";
61
2133
 
62
- // src/utilities/class-names.ts
63
- function classNames(...parts) {
64
- return parts.filter((part) => typeof part === "string" && part.length > 0).join(" ");
2134
+ // src/components/combobox/combobox.svelte
2135
+ import"svelte/internal/disclose-version";
2136
+ import * as $5 from "svelte/internal/client";
2137
+ import { untrack as untrack2 } from "svelte";
2138
+
2139
+ // src/_internal/field-control.ts
2140
+ function describeId(fieldId, hasDescription) {
2141
+ return hasDescription ? `${fieldId}-description` : undefined;
2142
+ }
2143
+ function errorId(fieldId, hasError) {
2144
+ return hasError ? `${fieldId}-error` : undefined;
2145
+ }
2146
+ function composeDescribedBy(...ids) {
2147
+ const filtered = ids.flatMap((id) => typeof id === "string" ? id.trim().split(/\s+/).filter(Boolean) : []);
2148
+ const unique = Array.from(new Set(filtered));
2149
+ return unique.length > 0 ? unique.join(" ") : undefined;
2150
+ }
2151
+ function ariaInvalid(hasError) {
2152
+ return hasError ? "true" : undefined;
2153
+ }
2154
+ function resolveFieldControl(input) {
2155
+ const resolvedId = input.id ?? input.context?.controlId ?? input.generatedId;
2156
+ const defaultDescriptionId = describeId(resolvedId, input.hasDescription ?? false);
2157
+ const defaultErrorId = errorId(resolvedId, input.hasError ?? false);
2158
+ const ownDescriptionId = defaultDescriptionId && defaultDescriptionId === input.context?.descriptionId && input.localIdNamespace ? `${resolvedId}-${input.localIdNamespace}-description` : defaultDescriptionId;
2159
+ const ownErrorId = defaultErrorId && defaultErrorId === input.context?.errorId && input.localIdNamespace ? `${resolvedId}-${input.localIdNamespace}-error` : defaultErrorId;
2160
+ const descriptionId = ownDescriptionId ?? input.context?.descriptionId;
2161
+ const resolvedErrorId = ownErrorId ?? input.context?.errorId;
2162
+ const explicitInvalid = ariaInvalid(input.hasError ?? false);
2163
+ const consumerInvalid = input.consumerInvalid === true ? "true" : input.consumerInvalid === false ? undefined : input.consumerInvalid ?? undefined;
2164
+ return {
2165
+ id: resolvedId,
2166
+ ownDescriptionId,
2167
+ ownErrorId,
2168
+ descriptionId,
2169
+ errorId: resolvedErrorId,
2170
+ describedBy: composeDescribedBy(descriptionId, ...input.additionalDescribedBy ?? [], resolvedErrorId, input.context?.describedBy, input.consumerDescribedBy),
2171
+ ariaInvalid: explicitInvalid ?? input.context?.invalid ?? consumerInvalid,
2172
+ required: input.required ?? input.context?.required ?? false,
2173
+ disabled: input.disabled ?? input.context?.disabled ?? false
2174
+ };
2175
+ }
2176
+
2177
+ // src/_internal/form-field-context.ts
2178
+ import { createContext } from "svelte";
2179
+
2180
+ // src/_internal/optional-context.ts
2181
+ function optionalContext(getStrict) {
2182
+ return () => {
2183
+ try {
2184
+ return getStrict();
2185
+ } catch {
2186
+ return;
2187
+ }
2188
+ };
2189
+ }
2190
+
2191
+ // src/_internal/form-field-context.ts
2192
+ var [getFormFieldContextStrict, setFormFieldContextRaw] = createContext();
2193
+ function setFormFieldContext(context) {
2194
+ setFormFieldContextRaw(context);
2195
+ }
2196
+ var getFormFieldContext = optionalContext(getFormFieldContextStrict);
2197
+
2198
+ // src/_internal/overlay.ts
2199
+ var escapeStack = [];
2200
+ function pushEscapeHandler(handler) {
2201
+ escapeStack.push(handler);
2202
+ if (escapeStack.length === 1 && typeof window !== "undefined") {
2203
+ window.addEventListener("keydown", onEscapeKeydown, { capture: true });
2204
+ }
2205
+ let released = false;
2206
+ return () => {
2207
+ if (released)
2208
+ return;
2209
+ released = true;
2210
+ const index = escapeStack.lastIndexOf(handler);
2211
+ if (index !== -1)
2212
+ escapeStack.splice(index, 1);
2213
+ if (escapeStack.length === 0 && typeof window !== "undefined") {
2214
+ window.removeEventListener("keydown", onEscapeKeydown, { capture: true });
2215
+ }
2216
+ };
2217
+ }
2218
+ function onEscapeKeydown(event) {
2219
+ if (event.key !== "Escape")
2220
+ return;
2221
+ const handler = escapeStack.at(-1);
2222
+ if (!handler)
2223
+ return;
2224
+ handler(event);
2225
+ }
2226
+ var scrollLockCount = 0;
2227
+ var originalBodyOverflow = null;
2228
+ function lockBodyScroll() {
2229
+ if (typeof document === "undefined")
2230
+ return () => {};
2231
+ if (scrollLockCount === 0) {
2232
+ originalBodyOverflow = document.body.style.overflow;
2233
+ document.body.style.overflow = "hidden";
2234
+ }
2235
+ scrollLockCount += 1;
2236
+ let released = false;
2237
+ return () => {
2238
+ if (released)
2239
+ return;
2240
+ released = true;
2241
+ scrollLockCount = Math.max(0, scrollLockCount - 1);
2242
+ if (scrollLockCount === 0) {
2243
+ document.body.style.overflow = originalBodyOverflow ?? "";
2244
+ originalBodyOverflow = null;
2245
+ }
2246
+ };
2247
+ }
2248
+ function captureFocus() {
2249
+ if (typeof document === "undefined")
2250
+ return null;
2251
+ const active = document.activeElement;
2252
+ if (active && active !== document.body && active instanceof HTMLElement) {
2253
+ return active;
2254
+ }
2255
+ return null;
2256
+ }
2257
+
2258
+ // src/components/popover/popover.svelte
2259
+ import"svelte/internal/disclose-version";
2260
+ import * as $4 from "svelte/internal/client";
2261
+ import { onDestroy, untrack } from "svelte";
2262
+
2263
+ // src/_internal/anchored-overlay.svelte.ts
2264
+ import * as $3 from "svelte/internal/client";
2265
+ var DEFAULT_PLACEMENT = "bottom-start";
2266
+ var DEFAULT_OFFSET = 8;
2267
+ var DEFAULT_SHIFT_PADDING = 8;
2268
+ var DEFAULT_ARROW_PADDING = 6;
2269
+ function getPlacementSide(placement) {
2270
+ if (placement.startsWith("top"))
2271
+ return "top";
2272
+ if (placement.startsWith("right"))
2273
+ return "right";
2274
+ if (placement.startsWith("left"))
2275
+ return "left";
2276
+ return "bottom";
2277
+ }
2278
+ function getAnchoredOverlayWidthStyle(widthMode, anchorRect) {
2279
+ if (widthMode === "none")
2280
+ return "";
2281
+ if (widthMode === "match-anchor") {
2282
+ const width = Math.max(0, anchorRect?.width ?? 0);
2283
+ return width > 0 ? `min-inline-size: ${width}px; inline-size: ${width}px;` : "";
2284
+ }
2285
+ if (widthMode === "menu") {
2286
+ return [
2287
+ "inline-size: max-content;",
2288
+ "min-inline-size: min(12rem, calc(100vw - var(--cinder-space-4)));",
2289
+ "max-inline-size: min(24rem, calc(100vw - var(--cinder-space-4)));"
2290
+ ].join(" ");
2291
+ }
2292
+ return "max-inline-size: min(28rem, calc(100vw - var(--cinder-space-4)));";
2293
+ }
2294
+ function getArrowStyle(placement, data) {
2295
+ if (!data)
2296
+ return "";
2297
+ const side = getPlacementSide(placement);
2298
+ const staticSide = { top: "bottom", right: "left", bottom: "top", left: "right" }[side];
2299
+ return [
2300
+ data.x != null ? `left: ${data.x}px;` : "",
2301
+ data.y != null ? `top: ${data.y}px;` : "",
2302
+ staticSide ? `${staticSide}: -4px;` : ""
2303
+ ].filter(Boolean).join(" ");
2304
+ }
2305
+ function reportAnchoredOverlaySetupError(error) {
2306
+ if (typeof globalThis.reportError === "function") {
2307
+ globalThis.reportError(error);
2308
+ return;
2309
+ }
2310
+ setTimeout(() => {
2311
+ throw error;
2312
+ }, 0);
2313
+ }
2314
+ function createAnchoredOverlay(options) {
2315
+ let positionReady = $3.state(false);
2316
+ let positionStyle = $3.state("");
2317
+ let resolvedPlacement = $3.state($3.proxy(options.placement?.() ?? DEFAULT_PLACEMENT));
2318
+ let arrowStyle = $3.state("");
2319
+ $3.user_effect(() => {
2320
+ if (!options.open()) {
2321
+ $3.set(positionReady, false);
2322
+ $3.set(positionStyle, "");
2323
+ $3.set(arrowStyle, "");
2324
+ $3.set(resolvedPlacement, options.placement?.() ?? DEFAULT_PLACEMENT, true);
2325
+ return;
2326
+ }
2327
+ const anchor = options.anchor();
2328
+ const panel = options.panel();
2329
+ if (!anchor || !panel) {
2330
+ $3.set(positionReady, false);
2331
+ $3.set(positionStyle, "");
2332
+ $3.set(arrowStyle, "");
2333
+ return;
2334
+ }
2335
+ const placement = options.placement?.() ?? DEFAULT_PLACEMENT;
2336
+ const offset3 = options.offset?.() ?? DEFAULT_OFFSET;
2337
+ const shiftPadding = options.shiftPadding?.() ?? DEFAULT_SHIFT_PADDING;
2338
+ const shiftCrossAxis = options.shiftCrossAxis?.() ?? false;
2339
+ const arrowPadding = options.arrowPadding?.() ?? DEFAULT_ARROW_PADDING;
2340
+ const arrow3 = options.arrow?.();
2341
+ const showArrow = options.showArrow?.() ?? Boolean(arrow3);
2342
+ const widthMode = options.widthMode?.() ?? "content";
2343
+ let cancelled = false;
2344
+ let generation = 0;
2345
+ let stopAutoUpdate;
2346
+ (async () => {
2347
+ const {
2348
+ arrow: arrowMiddleware,
2349
+ autoUpdate: autoUpdate2,
2350
+ computePosition: computePosition3,
2351
+ flip: flip3,
2352
+ offset: offsetMiddleware,
2353
+ shift: shift3
2354
+ } = await Promise.resolve().then(() => (init_floating_ui_dom(), exports_floating_ui_dom));
2355
+ if (cancelled)
2356
+ return;
2357
+ const middleware = [
2358
+ offsetMiddleware(offset3),
2359
+ flip3(),
2360
+ shift3({ padding: shiftPadding, crossAxis: shiftCrossAxis })
2361
+ ];
2362
+ if (showArrow && arrow3) {
2363
+ middleware.push(arrowMiddleware({ element: arrow3, padding: arrowPadding }));
2364
+ }
2365
+ stopAutoUpdate = autoUpdate2(anchor, panel, async () => {
2366
+ if (cancelled)
2367
+ return;
2368
+ const currentGeneration = ++generation;
2369
+ let result;
2370
+ try {
2371
+ result = await computePosition3(anchor, panel, { placement, middleware, strategy: "fixed" });
2372
+ } catch {
2373
+ if (cancelled || currentGeneration !== generation)
2374
+ return;
2375
+ $3.set(positionReady, false);
2376
+ $3.set(positionStyle, "");
2377
+ $3.set(arrowStyle, "");
2378
+ $3.set(resolvedPlacement, placement, true);
2379
+ return;
2380
+ }
2381
+ if (cancelled || currentGeneration !== generation)
2382
+ return;
2383
+ const widthStyle = getAnchoredOverlayWidthStyle(widthMode, anchor.getBoundingClientRect());
2384
+ $3.set(positionStyle, [
2385
+ "position: fixed;",
2386
+ `left: ${result.x}px;`,
2387
+ `top: ${result.y}px;`,
2388
+ widthStyle
2389
+ ].filter(Boolean).join(" "), true);
2390
+ $3.set(resolvedPlacement, result.placement, true);
2391
+ $3.set(arrowStyle, showArrow ? getArrowStyle(result.placement, result.middlewareData.arrow) : "", true);
2392
+ $3.set(positionReady, true);
2393
+ });
2394
+ })().catch((error) => {
2395
+ if (cancelled)
2396
+ return;
2397
+ $3.set(positionReady, false);
2398
+ $3.set(positionStyle, "");
2399
+ $3.set(arrowStyle, "");
2400
+ $3.set(resolvedPlacement, placement, true);
2401
+ reportAnchoredOverlaySetupError(error);
2402
+ });
2403
+ return () => {
2404
+ cancelled = true;
2405
+ stopAutoUpdate?.();
2406
+ $3.set(positionReady, false);
2407
+ $3.set(positionStyle, "");
2408
+ $3.set(arrowStyle, "");
2409
+ $3.set(resolvedPlacement, placement, true);
2410
+ };
2411
+ });
2412
+ return {
2413
+ get positionReady() {
2414
+ return $3.get(positionReady);
2415
+ },
2416
+ get positionStyle() {
2417
+ return $3.get(positionStyle);
2418
+ },
2419
+ get resolvedPlacement() {
2420
+ return $3.get(resolvedPlacement);
2421
+ },
2422
+ get arrowStyle() {
2423
+ return $3.get(arrowStyle);
2424
+ }
2425
+ };
2426
+ }
2427
+
2428
+ // src/utilities/focus.ts
2429
+ function restoreFocusTo(target) {
2430
+ if (!target)
2431
+ return false;
2432
+ if (typeof document === "undefined")
2433
+ return false;
2434
+ if (!target.isConnected)
2435
+ return false;
2436
+ if (target.ownerDocument !== document)
2437
+ return false;
2438
+ try {
2439
+ target.focus();
2440
+ } catch {
2441
+ return false;
2442
+ }
2443
+ return true;
2444
+ }
2445
+
2446
+ // src/utilities/attachments.ts
2447
+ function createBodyScrollLock() {
2448
+ return () => {
2449
+ const release = lockBodyScroll();
2450
+ return release;
2451
+ };
2452
+ }
2453
+ function isInsideEventPath(event, element) {
2454
+ const path = event.composedPath();
2455
+ return path.some((entry) => entry instanceof Node && element.contains(entry));
2456
+ }
2457
+ function createClickOutside(options) {
2458
+ const { handler, enabled = true, eventType = "click", capture = true, ignoreRefs } = options;
2459
+ return (node) => {
2460
+ function handleEvent(event) {
2461
+ const isEnabled = typeof enabled === "function" ? enabled() : enabled;
2462
+ if (!isEnabled)
2463
+ return;
2464
+ if (event.type === "touchstart" && !event.cancelable)
2465
+ return;
2466
+ const target = event.target;
2467
+ if (!(target instanceof Node)) {
2468
+ handler();
2469
+ return;
2470
+ }
2471
+ if (isInsideEventPath(event, node))
2472
+ return;
2473
+ if (ignoreRefs) {
2474
+ for (const ref of ignoreRefs) {
2475
+ const element = ref();
2476
+ if (element && isInsideEventPath(event, element))
2477
+ return;
2478
+ }
2479
+ }
2480
+ handler();
2481
+ }
2482
+ document.addEventListener(eventType, handleEvent, capture);
2483
+ return () => {
2484
+ document.removeEventListener(eventType, handleEvent, capture);
2485
+ };
2486
+ };
2487
+ }
2488
+ function overflowFade() {
2489
+ return (node) => {
2490
+ if (typeof ResizeObserver === "undefined") {
2491
+ node.removeAttribute("data-cinder-overflows");
2492
+ return;
2493
+ }
2494
+ const update = () => {
2495
+ const overflows = node.scrollHeight - node.clientHeight > 1;
2496
+ const atBottom = node.scrollTop + node.clientHeight >= node.scrollHeight - 1;
2497
+ node.toggleAttribute("data-cinder-overflows", overflows && !atBottom);
2498
+ };
2499
+ const requestFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : (callback) => window.setTimeout(() => callback(performance.now()));
2500
+ const cancelFrame = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : (handle) => window.clearTimeout(handle);
2501
+ let frame = 0;
2502
+ const scheduleUpdate = () => {
2503
+ if (frame)
2504
+ return;
2505
+ frame = requestFrame(() => {
2506
+ frame = 0;
2507
+ update();
2508
+ });
2509
+ };
2510
+ const resizeObserver = new ResizeObserver(scheduleUpdate);
2511
+ const observedElements = new Set;
2512
+ const observeElement = (element) => {
2513
+ if (observedElements.has(element))
2514
+ return;
2515
+ resizeObserver.observe(element);
2516
+ observedElements.add(element);
2517
+ };
2518
+ const syncObservedElements = () => {
2519
+ const currentElements = new Set([node, ...node.querySelectorAll("*")]);
2520
+ for (const element of observedElements) {
2521
+ if (!currentElements.has(element)) {
2522
+ resizeObserver.unobserve(element);
2523
+ observedElements.delete(element);
2524
+ }
2525
+ }
2526
+ for (const element of currentElements) {
2527
+ observeElement(element);
2528
+ }
2529
+ };
2530
+ syncObservedElements();
2531
+ const mutationObserver = typeof MutationObserver === "undefined" ? null : new MutationObserver(() => {
2532
+ syncObservedElements();
2533
+ scheduleUpdate();
2534
+ });
2535
+ mutationObserver?.observe(node, {
2536
+ childList: true,
2537
+ subtree: true,
2538
+ characterData: true,
2539
+ attributes: true,
2540
+ attributeFilter: ["hidden", "class", "style", "aria-hidden"]
2541
+ });
2542
+ node.addEventListener("scroll", scheduleUpdate, { passive: true });
2543
+ update();
2544
+ return () => {
2545
+ if (frame)
2546
+ cancelFrame(frame);
2547
+ resizeObserver.disconnect();
2548
+ observedElements.clear();
2549
+ mutationObserver?.disconnect();
2550
+ node.removeEventListener("scroll", scheduleUpdate);
2551
+ };
2552
+ };
2553
+ }
2554
+
2555
+ // src/components/popover/popover.svelte
2556
+ var root2 = $4.from_html(`<div class="cinder-popover__trigger"><!></div>`);
2557
+ var root_1 = $4.from_html(`<span class="cinder-popover__arrow" aria-hidden="true"></span>`);
2558
+ var root_2 = $4.from_html(`<div tabindex="-1"><!> <!></div>`);
2559
+ var root_3 = $4.from_html(`<!> <!>`, 1);
2560
+ function Popover($$anchor, $$props) {
2561
+ const generatedPanelId = $4.props_id();
2562
+ $4.push($$props, true);
2563
+ let open = $4.prop($$props, "open", 15, false), placement = $4.prop($$props, "placement", 3, "bottom-start"), offset3 = $4.prop($$props, "offset", 3, 8), showArrow = $4.prop($$props, "showArrow", 3, false), triggerRef = $4.prop($$props, "triggerRef", 3, null), role = $4.prop($$props, "role", 3, "dialog"), focusManagement = $4.prop($$props, "focusManagement", 3, "panel"), wireTriggerAria = $4.prop($$props, "wireTriggerAria", 3, true), closeOnEscape = $4.prop($$props, "closeOnEscape", 3, true), widthMode = $4.prop($$props, "widthMode", 3, "content");
2564
+ const FOCUSABLE_SELECTOR = 'button:not([disabled]), a[href], [tabindex]:not([tabindex="-1"]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])';
2565
+ function findFirstFocusable(container) {
2566
+ if (!container)
2567
+ return null;
2568
+ const candidates = container.querySelectorAll(FOCUSABLE_SELECTOR);
2569
+ for (const el of candidates) {
2570
+ if (el.closest('[hidden], [inert], [aria-hidden="true"]'))
2571
+ continue;
2572
+ return el;
2573
+ }
2574
+ return null;
2575
+ }
2576
+ let triggerWrapper = $4.state(undefined);
2577
+ let panelElement = $4.state(undefined);
2578
+ let arrowElement = $4.state(undefined);
2579
+ const panelId = $4.derived(() => $$props.id ?? generatedPanelId);
2580
+ const anchorElement = $4.derived(() => triggerRef() && triggerRef().isConnected ? triggerRef() : findFirstFocusable($4.get(triggerWrapper)) ?? null);
2581
+ const resolvedAriaLabel = $4.derived(() => $$props.ariaLabelledby ? undefined : role() === "dialog" ? $$props.label ?? "Popover" : $$props.label);
2582
+ let mounted = $4.state(false);
2583
+ let capturedFocus = null;
2584
+ let resolvedAnchorAtOpen = null;
2585
+ let pendingInitialFocus = $4.state(false);
2586
+ let openSessionFocusManagement = $4.state("panel");
2587
+ let isDestroyed = false;
2588
+ onDestroy(() => {
2589
+ isDestroyed = true;
2590
+ });
2591
+ const portalAttachment = createPortalAttachment({
2592
+ target: () => document.body,
2593
+ inheritAttributes: true,
2594
+ source: () => $4.get(anchorElement) ?? null
2595
+ });
2596
+ const anchoredOverlay = createAnchoredOverlay({
2597
+ open: () => open(),
2598
+ anchor: () => $4.get(anchorElement),
2599
+ panel: () => $4.get(panelElement),
2600
+ arrow: () => $4.get(arrowElement),
2601
+ placement: () => placement(),
2602
+ offset: () => offset3(),
2603
+ showArrow: () => showArrow(),
2604
+ widthMode: () => widthMode()
2605
+ });
2606
+ $4.user_effect(() => {
2607
+ $4.set(mounted, true);
2608
+ });
2609
+ const dismissOnOutsideMousedown = $4.derived(() => createClickOutside({
2610
+ handler: () => {
2611
+ open(false);
2612
+ },
2613
+ enabled: () => open(),
2614
+ eventType: "mousedown",
2615
+ capture: true,
2616
+ ignoreRefs: [() => resolvedAnchorAtOpen ?? null]
2617
+ }));
2618
+ function moveFocusIntoPanel() {
2619
+ if (isDestroyed || !$4.get(panelElement))
2620
+ return;
2621
+ const focusable = findFirstFocusable($4.get(panelElement));
2622
+ (focusable ?? $4.get(panelElement)).focus();
2623
+ }
2624
+ $4.user_effect(() => {
2625
+ if (!open())
2626
+ return;
2627
+ if (!$4.get(anchorElement))
2628
+ return;
2629
+ $4.set(openSessionFocusManagement, untrack(() => focusManagement()), true);
2630
+ if ($4.get(openSessionFocusManagement) === "panel") {
2631
+ capturedFocus = captureFocus();
2632
+ $4.set(pendingInitialFocus, true);
2633
+ } else {
2634
+ capturedFocus = null;
2635
+ $4.set(pendingInitialFocus, false);
2636
+ }
2637
+ resolvedAnchorAtOpen = untrack(() => $4.get(anchorElement));
2638
+ const releaseEscape = closeOnEscape() ? pushEscapeHandler(() => {
2639
+ open(false);
2640
+ }) : () => {};
2641
+ return () => {
2642
+ releaseEscape();
2643
+ $4.set(pendingInitialFocus, false);
2644
+ if (isDestroyed) {
2645
+ capturedFocus = null;
2646
+ resolvedAnchorAtOpen = null;
2647
+ return;
2648
+ }
2649
+ if ($4.get(openSessionFocusManagement) === "panel") {
2650
+ const candidates = [triggerRef(), resolvedAnchorAtOpen, capturedFocus];
2651
+ for (const candidate of candidates) {
2652
+ if (restoreFocusTo(candidate))
2653
+ break;
2654
+ }
2655
+ }
2656
+ capturedFocus = null;
2657
+ resolvedAnchorAtOpen = null;
2658
+ };
2659
+ });
2660
+ $4.user_effect(() => {
2661
+ if (isDestroyed)
2662
+ return;
2663
+ if ($4.get(openSessionFocusManagement) !== "panel")
2664
+ return;
2665
+ if (!open() || !$4.get(panelElement) || !$4.get(anchorElement) || !anchoredOverlay.positionReady || !$4.get(pendingInitialFocus)) {
2666
+ return;
2667
+ }
2668
+ moveFocusIntoPanel();
2669
+ $4.set(pendingInitialFocus, false);
2670
+ });
2671
+ $4.user_effect(() => {
2672
+ if (!open())
2673
+ return;
2674
+ if (!$4.get(anchorElement)) {
2675
+ devWarn("[cinder/popover] open without a trigger anchor. " + "Provide either a `trigger` snippet with a focusable child or a `triggerRef`.");
2676
+ }
2677
+ if (role() === "dialog" && !$$props.label && !$$props.ariaLabelledby) {
2678
+ devWarn('[cinder/popover] role="dialog" without `label` or `ariaLabelledby` falls back to ' + 'aria-label="Popover". Pass a descriptive name for production usage.');
2679
+ }
2680
+ if (role() === "listbox" && wireTriggerAria()) {
2681
+ devWarn('[cinder/popover] role="listbox" only sets the surface role. ' + 'You must render role="option" children and own selection/keyboard semantics. ' + "See popover.a11y.md §Role.");
2682
+ }
2683
+ });
2684
+ $4.user_effect(() => {
2685
+ if (!wireTriggerAria())
2686
+ return;
2687
+ const target = $4.get(anchorElement);
2688
+ if (!target)
2689
+ return;
2690
+ const prior = {
2691
+ expanded: target.getAttribute("aria-expanded"),
2692
+ controls: target.getAttribute("aria-controls"),
2693
+ haspopup: target.getAttribute("aria-haspopup")
2694
+ };
2695
+ target.setAttribute("aria-expanded", String(open()));
2696
+ const mappedHaspopup = role() === "group" ? null : role() === "listbox" ? "listbox" : "dialog";
2697
+ if (mappedHaspopup)
2698
+ target.setAttribute("aria-haspopup", mappedHaspopup);
2699
+ else
2700
+ target.removeAttribute("aria-haspopup");
2701
+ if (open())
2702
+ target.setAttribute("aria-controls", $4.get(panelId));
2703
+ else
2704
+ target.removeAttribute("aria-controls");
2705
+ return () => {
2706
+ for (const [name, value] of Object.entries({
2707
+ "aria-expanded": prior.expanded,
2708
+ "aria-controls": prior.controls,
2709
+ "aria-haspopup": prior.haspopup
2710
+ })) {
2711
+ if (value === null)
2712
+ target.removeAttribute(name);
2713
+ else
2714
+ target.setAttribute(name, value);
2715
+ }
2716
+ };
2717
+ });
2718
+ var fragment = root_3();
2719
+ var node = $4.first_child(fragment);
2720
+ {
2721
+ var consequent = ($$anchor2) => {
2722
+ var div = root2();
2723
+ var node_1 = $4.child(div);
2724
+ $4.snippet(node_1, () => $$props.trigger);
2725
+ $4.reset(div);
2726
+ $4.bind_this(div, ($$value) => $4.set(triggerWrapper, $$value), () => $4.get(triggerWrapper));
2727
+ $4.append($$anchor2, div);
2728
+ };
2729
+ $4.if(node, ($$render) => {
2730
+ if ($$props.trigger)
2731
+ $$render(consequent);
2732
+ });
2733
+ }
2734
+ var node_2 = $4.sibling(node, 2);
2735
+ {
2736
+ var consequent_2 = ($$anchor2) => {
2737
+ var div_1 = root_2();
2738
+ var node_3 = $4.child(div_1);
2739
+ $4.snippet(node_3, () => $$props.children);
2740
+ var node_4 = $4.sibling(node_3, 2);
2741
+ {
2742
+ var consequent_1 = ($$anchor3) => {
2743
+ var span = root_1();
2744
+ $4.bind_this(span, ($$value) => $4.set(arrowElement, $$value), () => $4.get(arrowElement));
2745
+ $4.template_effect(() => $4.set_style(span, anchoredOverlay.arrowStyle));
2746
+ $4.append($$anchor3, span);
2747
+ };
2748
+ $4.if(node_4, ($$render) => {
2749
+ if (showArrow())
2750
+ $$render(consequent_1);
2751
+ });
2752
+ }
2753
+ $4.reset(div_1);
2754
+ $4.bind_this(div_1, ($$value) => $4.set(panelElement, $$value), () => $4.get(panelElement));
2755
+ $4.attach(div_1, () => portalAttachment);
2756
+ $4.attach(div_1, () => $4.get(dismissOnOutsideMousedown));
2757
+ $4.template_effect(($0) => {
2758
+ $4.set_attribute(div_1, "id", $4.get(panelId));
2759
+ $4.set_attribute(div_1, "role", role());
2760
+ $4.set_attribute(div_1, "aria-label", $4.get(resolvedAriaLabel));
2761
+ $4.set_attribute(div_1, "aria-labelledby", $$props.ariaLabelledby);
2762
+ $4.set_attribute(div_1, "aria-hidden", anchoredOverlay.positionReady ? undefined : "true");
2763
+ $4.set_class(div_1, 1, $0);
2764
+ $4.set_attribute(div_1, "data-cinder-placement", anchoredOverlay.resolvedPlacement);
2765
+ $4.set_attribute(div_1, "data-cinder-position-ready", anchoredOverlay.positionReady);
2766
+ $4.set_style(div_1, anchoredOverlay.positionStyle);
2767
+ }, [
2768
+ () => $4.clsx(classNames("cinder-_floating-surface", "cinder-popover", $$props.class))
2769
+ ]);
2770
+ $4.append($$anchor2, div_1);
2771
+ };
2772
+ $4.if(node_2, ($$render) => {
2773
+ if ($4.get(mounted) && open() && $4.get(anchorElement))
2774
+ $$render(consequent_2);
2775
+ });
2776
+ }
2777
+ $4.append($$anchor, fragment);
2778
+ $4.pop();
2779
+ }
2780
+
2781
+ // src/components/combobox/combobox.svelte
2782
+ var root3 = $5.from_html(`<span class="cinder-_required-marker" aria-hidden="true">*</span>`);
2783
+ var root_12 = $5.from_html(`<label class="cinder-combobox__label"> <!></label>`);
2784
+ var root_22 = $5.from_html(`<input type="hidden"/>`);
2785
+ var root_32 = $5.from_html(`<img class="cinder-combobox__option-avatar" alt="" loading="lazy"/>`);
2786
+ var root_4 = $5.from_html(`<span class="cinder-combobox__option-description"> </span>`);
2787
+ var root_5 = $5.from_html(`<li role="option" class="cinder-_option-row cinder-combobox__option"><!> <span class="cinder-combobox__option-text"><span class="cinder-combobox__option-label"> </span> <!></span></li>`);
2788
+ var root_6 = $5.from_html(`<ul role="presentation" class="cinder-combobox__listbox"></ul>`);
2789
+ var root_7 = $5.from_html(`<p class="cinder-combobox__description"> </p>`);
2790
+ var root_8 = $5.from_html(`<div><!> <div class="cinder-combobox__control"><input type="text" role="combobox" class="cinder-combobox__input" autocomplete="off" autocorrect="off" spellcheck="false" aria-autocomplete="list"/></div> <!> <!> <div class="cinder-combobox__empty" role="status"> </div> <!> <p class="cinder-combobox__error" aria-live="polite"> </p></div>`);
2791
+ function Combobox($$anchor, $$props) {
2792
+ $5.push($$props, true);
2793
+ let value = $5.prop($$props, "value", 15, ""), inputValue = $5.prop($$props, "inputValue", 15, ""), maxVisibleOptions = $5.prop($$props, "maxVisibleOptions", 3, 200), allowCustomValue = $5.prop($$props, "allowCustomValue", 3, false);
2794
+ const context = getFormFieldContext();
2795
+ const field = $5.derived(() => resolveFieldControl({
2796
+ id: $$props.id,
2797
+ generatedId: $$props.id,
2798
+ context,
2799
+ hasDescription: !!$$props.description,
2800
+ hasError: !!$$props.error,
2801
+ localIdNamespace: "combobox",
2802
+ consumerDescribedBy: $$props["aria-describedby"],
2803
+ required: $$props.required,
2804
+ disabled: $$props.disabled
2805
+ }));
2806
+ const resolvedDisabled = $5.derived(() => $5.get(field).disabled);
2807
+ const resolvedRequired = $5.derived(() => $5.get(field).required);
2808
+ const describedBy = $5.derived(() => $5.get(field).describedBy);
2809
+ const listboxId = $5.derived(() => `${$$props.id}-listbox`);
2810
+ const descriptionId = $5.derived(() => $5.get(field).ownDescriptionId);
2811
+ const stableLocalErrorId = $5.derived(() => context?.errorId === `${$5.get(field).id}-error` ? `${$5.get(field).id}-combobox-error` : `${$5.get(field).id}-error`);
2812
+ const defaultFilter = (option, query) => {
2813
+ if (!query)
2814
+ return true;
2815
+ const q = query.toLowerCase();
2816
+ return option.label.toLowerCase().includes(q) || (option.description?.toLowerCase().includes(q) ?? false);
2817
+ };
2818
+ const filteredOptions = $5.derived(() => {
2819
+ const fn = $$props.filter ?? defaultFilter;
2820
+ const matches = [];
2821
+ for (const option of $$props.options) {
2822
+ if (fn(option, inputValue())) {
2823
+ matches.push(option);
2824
+ if (matches.length >= maxVisibleOptions())
2825
+ break;
2826
+ }
2827
+ }
2828
+ return matches;
2829
+ });
2830
+ let open = $5.state(false);
2831
+ let activeIndex = $5.state(-1);
2832
+ let inputElement = $5.state(null);
2833
+ let hiddenInputElement = $5.state(null);
2834
+ let listboxElement = $5.state(null);
2835
+ let committedLabel = $5.state("");
2836
+ let initialCustomValue = $5.state("");
2837
+ let hasUserCommittedValue = $5.state(false);
2838
+ let hasExplicitNavigation = $5.state(false);
2839
+ let hasStoredInitialValue = $5.state(false);
2840
+ let resetSyncTimeout;
2841
+ let initialValue = $5.state($5.proxy(untrack2(() => value())));
2842
+ const initialInputValue = untrack2(() => inputValue());
2843
+ $5.user_pre_effect(() => {
2844
+ if (!$5.get(hasUserCommittedValue) && !$5.get(hasStoredInitialValue) && value()) {
2845
+ $5.set(initialValue, value(), true);
2846
+ $5.set(hasStoredInitialValue, true);
2847
+ }
2848
+ if (allowCustomValue() && !$5.get(hasUserCommittedValue) && value() && !$5.get(initialCustomValue)) {
2849
+ $5.set(initialCustomValue, value(), true);
2850
+ }
2851
+ });
2852
+ $5.user_effect(() => {
2853
+ $5.get(filteredOptions);
2854
+ if ($5.get(activeIndex) >= $5.get(filteredOptions).length) {
2855
+ $5.set(activeIndex, $5.get(filteredOptions).length > 0 ? 0 : -1, true);
2856
+ }
2857
+ });
2858
+ $5.user_effect(() => {
2859
+ if (!value()) {
2860
+ if (untrack2(() => inputValue()))
2861
+ inputValue("");
2862
+ $5.set(committedLabel, "");
2863
+ return;
2864
+ }
2865
+ const matched = $$props.options.find((option) => option.value === value());
2866
+ if (matched) {
2867
+ $5.set(committedLabel, matched.label, true);
2868
+ if (untrack2(() => inputValue()) !== matched.label) {
2869
+ inputValue(matched.label);
2870
+ }
2871
+ } else if (allowCustomValue()) {
2872
+ if (!$5.get(initialCustomValue))
2873
+ $5.set(initialCustomValue, value(), true);
2874
+ $5.set(committedLabel, value(), true);
2875
+ if (untrack2(() => inputValue()) !== value())
2876
+ inputValue(value());
2877
+ }
2878
+ });
2879
+ function handleEscape(event2 = undefined) {
2880
+ const wasOpen = $5.get(open);
2881
+ $5.set(open, false);
2882
+ if (inputValue() !== $5.get(committedLabel)) {
2883
+ inputValue($5.get(committedLabel));
2884
+ if ($5.get(inputElement))
2885
+ $5.get(inputElement).value = $5.get(committedLabel);
2886
+ }
2887
+ if (wasOpen)
2888
+ event2?.preventDefault();
2889
+ }
2890
+ $5.user_effect(() => {
2891
+ if (!$5.get(open))
2892
+ return;
2893
+ const releaseEscape = pushEscapeHandler(handleEscape);
2894
+ return releaseEscape;
2895
+ });
2896
+ const listboxVisible = $5.derived(() => $5.get(open) && $5.get(filteredOptions).length > 0);
2897
+ const activeOptionId = $5.derived(() => $5.get(listboxVisible) && $5.get(activeIndex) >= 0 && $5.get(activeIndex) < $5.get(filteredOptions).length ? `${$$props.id}-option-${$5.get(activeIndex)}` : undefined);
2898
+ function findCommittedOption(rawValue) {
2899
+ const query = rawValue.trim();
2900
+ if (!query)
2901
+ return;
2902
+ let labelMatch;
2903
+ for (const option of $$props.options) {
2904
+ if (option.disabled)
2905
+ continue;
2906
+ if (option.value === query)
2907
+ return option;
2908
+ if (labelMatch === undefined && option.label === query) {
2909
+ labelMatch = option;
2910
+ }
2911
+ }
2912
+ return labelMatch;
2913
+ }
2914
+ function handleInput(event2) {
2915
+ const target = event2.target;
2916
+ inputValue(target.value);
2917
+ $5.set(open, true);
2918
+ $5.set(activeIndex, $5.get(filteredOptions).length > 0 ? 0 : -1, true);
2919
+ $5.set(hasExplicitNavigation, false);
2920
+ }
2921
+ function handleFocus() {
2922
+ if (!$5.get(resolvedDisabled))
2923
+ $5.set(open, true);
2924
+ }
2925
+ function handleBlur(event2) {
2926
+ const next = event2.relatedTarget;
2927
+ if (next && $5.get(listboxElement)?.contains(next))
2928
+ return;
2929
+ if (allowCustomValue() && inputValue().trim() && inputValue() !== $5.get(committedLabel)) {
2930
+ commitCustomValue();
2931
+ return;
2932
+ }
2933
+ $5.set(open, false);
2934
+ if (inputValue() !== $5.get(committedLabel)) {
2935
+ inputValue($5.get(committedLabel));
2936
+ if ($5.get(inputElement))
2937
+ $5.get(inputElement).value = $5.get(committedLabel);
2938
+ }
2939
+ }
2940
+ function selectOption(option) {
2941
+ if (option.disabled)
2942
+ return;
2943
+ $5.set(hasUserCommittedValue, true);
2944
+ value(option.value);
2945
+ inputValue(option.label);
2946
+ $5.set(committedLabel, option.label, true);
2947
+ $5.set(open, false);
2948
+ $$props.onchange?.(option.value);
2949
+ }
2950
+ function commitCustomValue() {
2951
+ const nextValue = inputValue().trim();
2952
+ if (!allowCustomValue() || !nextValue)
2953
+ return;
2954
+ if ($$props.options.some((option) => option.disabled && (option.value === nextValue || option.label === nextValue))) {
2955
+ inputValue($5.get(committedLabel));
2956
+ if ($5.get(inputElement))
2957
+ $5.get(inputElement).value = $5.get(committedLabel);
2958
+ $5.set(open, false);
2959
+ return;
2960
+ }
2961
+ $5.set(hasUserCommittedValue, true);
2962
+ const matched = findCommittedOption(nextValue);
2963
+ const committedValue = matched?.value ?? nextValue;
2964
+ const committedText = matched?.label ?? nextValue;
2965
+ const previousValue = value();
2966
+ value(committedValue);
2967
+ inputValue(committedText);
2968
+ $5.set(committedLabel, committedText, true);
2969
+ $5.set(open, false);
2970
+ if (committedValue !== previousValue)
2971
+ $$props.onchange?.(committedValue);
2972
+ }
2973
+ function resetToInitialValue(event2) {
2974
+ if (resetSyncTimeout !== undefined)
2975
+ clearTimeout(resetSyncTimeout);
2976
+ resetSyncTimeout = setTimeout(() => {
2977
+ resetSyncTimeout = undefined;
2978
+ if (event2.defaultPrevented)
2979
+ return;
2980
+ const resetValue = $5.get(hasStoredInitialValue) ? $5.get(initialValue) : allowCustomValue() ? $5.get(initialCustomValue) || $5.get(committedLabel) : "";
2981
+ value(resetValue);
2982
+ const matched = $$props.options.find((option) => option.value === resetValue);
2983
+ const nextInputValue = matched?.label ?? (allowCustomValue() ? resetValue : initialInputValue);
2984
+ inputValue(nextInputValue);
2985
+ $5.set(committedLabel, matched?.label ?? (allowCustomValue() ? resetValue : ""), true);
2986
+ $5.set(open, false);
2987
+ $5.set(activeIndex, -1);
2988
+ if ($5.get(inputElement))
2989
+ $5.get(inputElement).value = nextInputValue;
2990
+ if ($5.get(hiddenInputElement))
2991
+ $5.get(hiddenInputElement).value = resetValue;
2992
+ }, 0);
2993
+ }
2994
+ $5.user_effect(() => {
2995
+ const input = $5.get(hiddenInputElement);
2996
+ if (input === null)
2997
+ return;
2998
+ const form = input.form;
2999
+ form?.addEventListener("reset", resetToInitialValue);
3000
+ return () => {
3001
+ form?.removeEventListener("reset", resetToInitialValue);
3002
+ if (resetSyncTimeout !== undefined) {
3003
+ clearTimeout(resetSyncTimeout);
3004
+ resetSyncTimeout = undefined;
3005
+ }
3006
+ };
3007
+ });
3008
+ $5.user_effect(() => {
3009
+ $5.get(inputElement)?.setCustomValidity($5.get(resolvedRequired) && !value() || !allowCustomValue() && inputValue() !== $5.get(committedLabel) ? "Please select an option." : "");
3010
+ });
3011
+ function handleKeydown(event2) {
3012
+ if (event2.key === "ArrowDown") {
3013
+ event2.preventDefault();
3014
+ $5.set(open, true);
3015
+ if ($5.get(filteredOptions).length === 0)
3016
+ return;
3017
+ $5.set(activeIndex, ($5.get(activeIndex) + 1) % $5.get(filteredOptions).length);
3018
+ $5.set(hasExplicitNavigation, true);
3019
+ } else if (event2.key === "ArrowUp") {
3020
+ event2.preventDefault();
3021
+ $5.set(open, true);
3022
+ if ($5.get(filteredOptions).length === 0)
3023
+ return;
3024
+ $5.set(activeIndex, $5.get(activeIndex) <= 0 ? $5.get(filteredOptions).length - 1 : $5.get(activeIndex) - 1, true);
3025
+ $5.set(hasExplicitNavigation, true);
3026
+ } else if (event2.key === "Home") {
3027
+ if (!$5.get(open))
3028
+ return;
3029
+ event2.preventDefault();
3030
+ $5.set(activeIndex, $5.get(filteredOptions).length > 0 ? 0 : -1, true);
3031
+ $5.set(hasExplicitNavigation, true);
3032
+ } else if (event2.key === "End") {
3033
+ if (!$5.get(open))
3034
+ return;
3035
+ event2.preventDefault();
3036
+ $5.set(activeIndex, $5.get(filteredOptions).length - 1);
3037
+ $5.set(hasExplicitNavigation, true);
3038
+ } else if (event2.key === "Enter" && $5.get(open)) {
3039
+ const option = $5.get(filteredOptions)[$5.get(activeIndex)];
3040
+ if (allowCustomValue() && !($5.get(hasExplicitNavigation) && option)) {
3041
+ event2.preventDefault();
3042
+ commitCustomValue();
3043
+ } else if (option) {
3044
+ event2.preventDefault();
3045
+ selectOption(option);
3046
+ }
3047
+ } else if (event2.key === "Escape") {
3048
+ if (event2.defaultPrevented)
3049
+ return;
3050
+ handleEscape(event2);
3051
+ }
3052
+ }
3053
+ var div = root_8();
3054
+ var node = $5.child(div);
3055
+ {
3056
+ var consequent_1 = ($$anchor2) => {
3057
+ var label_1 = root_12();
3058
+ var text = $5.child(label_1);
3059
+ var node_1 = $5.sibling(text);
3060
+ {
3061
+ var consequent = ($$anchor3) => {
3062
+ var span = root3();
3063
+ $5.append($$anchor3, span);
3064
+ };
3065
+ $5.if(node_1, ($$render) => {
3066
+ if ($5.get(resolvedRequired))
3067
+ $$render(consequent);
3068
+ });
3069
+ }
3070
+ $5.reset(label_1);
3071
+ $5.template_effect(() => {
3072
+ $5.set_attribute(label_1, "for", $$props.id);
3073
+ $5.set_attribute(label_1, "data-disabled", $5.get(resolvedDisabled) || undefined);
3074
+ $5.set_text(text, `${$$props.label ?? ""} `);
3075
+ });
3076
+ $5.append($$anchor2, label_1);
3077
+ };
3078
+ $5.if(node, ($$render) => {
3079
+ if ($$props.label)
3080
+ $$render(consequent_1);
3081
+ });
3082
+ }
3083
+ var div_1 = $5.sibling(node, 2);
3084
+ var input_1 = $5.child(div_1);
3085
+ $5.remove_input_defaults(input_1);
3086
+ $5.bind_this(input_1, ($$value) => $5.set(inputElement, $$value), () => $5.get(inputElement));
3087
+ $5.reset(div_1);
3088
+ var node_2 = $5.sibling(div_1, 2);
3089
+ {
3090
+ var consequent_2 = ($$anchor2) => {
3091
+ var input_2 = root_22();
3092
+ $5.remove_input_defaults(input_2);
3093
+ $5.bind_this(input_2, ($$value) => $5.set(hiddenInputElement, $$value), () => $5.get(hiddenInputElement));
3094
+ $5.template_effect(() => {
3095
+ $5.set_attribute(input_2, "name", $$props.name);
3096
+ $5.set_value(input_2, value());
3097
+ input_2.disabled = $5.get(resolvedDisabled);
3098
+ });
3099
+ $5.append($$anchor2, input_2);
3100
+ };
3101
+ $5.if(node_2, ($$render) => {
3102
+ if ($$props.name)
3103
+ $$render(consequent_2);
3104
+ });
3105
+ }
3106
+ var node_3 = $5.sibling(node_2, 2);
3107
+ {
3108
+ var consequent_5 = ($$anchor2) => {
3109
+ Popover($$anchor2, {
3110
+ get id() {
3111
+ return $5.get(listboxId);
3112
+ },
3113
+ get triggerRef() {
3114
+ return $5.get(inputElement);
3115
+ },
3116
+ role: "listbox",
3117
+ focusManagement: "preserve",
3118
+ wireTriggerAria: false,
3119
+ closeOnEscape: false,
3120
+ widthMode: "match-anchor",
3121
+ class: "cinder-combobox__panel",
3122
+ get open() {
3123
+ return $5.get(open);
3124
+ },
3125
+ set open($$value) {
3126
+ $5.set(open, $$value, true);
3127
+ },
3128
+ children: ($$anchor3, $$slotProps) => {
3129
+ var ul = root_6();
3130
+ $5.each(ul, 23, () => $5.get(filteredOptions), (option) => option.value, ($$anchor4, option, index) => {
3131
+ var li = root_5();
3132
+ var node_4 = $5.child(li);
3133
+ {
3134
+ var consequent_3 = ($$anchor5) => {
3135
+ var img = root_32();
3136
+ $5.template_effect(() => $5.set_attribute(img, "src", $5.get(option).avatar));
3137
+ $5.append($$anchor5, img);
3138
+ };
3139
+ var d = $5.derived(() => $5.get(option).avatar?.trim());
3140
+ $5.if(node_4, ($$render) => {
3141
+ if ($5.get(d))
3142
+ $$render(consequent_3);
3143
+ });
3144
+ }
3145
+ var span_1 = $5.sibling(node_4, 2);
3146
+ var span_2 = $5.child(span_1);
3147
+ var text_1 = $5.child(span_2, true);
3148
+ $5.reset(span_2);
3149
+ var node_5 = $5.sibling(span_2, 2);
3150
+ {
3151
+ var consequent_4 = ($$anchor5) => {
3152
+ var span_3 = root_4();
3153
+ var text_2 = $5.child(span_3, true);
3154
+ $5.reset(span_3);
3155
+ $5.template_effect(() => $5.set_text(text_2, $5.get(option).description));
3156
+ $5.append($$anchor5, span_3);
3157
+ };
3158
+ $5.if(node_5, ($$render) => {
3159
+ if ($5.get(option).description)
3160
+ $$render(consequent_4);
3161
+ });
3162
+ }
3163
+ $5.reset(span_1);
3164
+ $5.reset(li);
3165
+ $5.template_effect(() => {
3166
+ $5.set_attribute(li, "id", `${$$props.id ?? ""}-option-${$5.get(index) ?? ""}`);
3167
+ $5.set_attribute(li, "aria-selected", value() === $5.get(option).value);
3168
+ $5.set_attribute(li, "aria-disabled", $5.get(option).disabled || undefined);
3169
+ $5.set_attribute(li, "aria-label", $5.get(option).description ? `${$5.get(option).label}, ${$5.get(option).description}` : undefined);
3170
+ $5.set_attribute(li, "data-cinder-active", $5.get(index) === $5.get(activeIndex) || undefined);
3171
+ $5.set_text(text_1, $5.get(option).label);
3172
+ });
3173
+ $5.delegated("mousedown", li, (event2) => {
3174
+ event2.preventDefault();
3175
+ selectOption($5.get(option));
3176
+ });
3177
+ $5.event("mouseenter", li, () => {
3178
+ $5.set(activeIndex, $5.get(index), true);
3179
+ });
3180
+ $5.append($$anchor4, li);
3181
+ });
3182
+ $5.reset(ul);
3183
+ $5.bind_this(ul, ($$value) => $5.set(listboxElement, $$value), () => $5.get(listboxElement));
3184
+ $5.append($$anchor3, ul);
3185
+ },
3186
+ $$slots: { default: true }
3187
+ });
3188
+ };
3189
+ $5.if(node_3, ($$render) => {
3190
+ if ($5.get(listboxVisible))
3191
+ $$render(consequent_5);
3192
+ });
3193
+ }
3194
+ var div_2 = $5.sibling(node_3, 2);
3195
+ var text_3 = $5.child(div_2, true);
3196
+ $5.reset(div_2);
3197
+ var node_6 = $5.sibling(div_2, 2);
3198
+ {
3199
+ var consequent_6 = ($$anchor2) => {
3200
+ var p = root_7();
3201
+ var text_4 = $5.child(p, true);
3202
+ $5.reset(p);
3203
+ $5.template_effect(() => {
3204
+ $5.set_attribute(p, "id", $5.get(descriptionId));
3205
+ $5.set_text(text_4, $$props.description);
3206
+ });
3207
+ $5.append($$anchor2, p);
3208
+ };
3209
+ $5.if(node_6, ($$render) => {
3210
+ if ($$props.description)
3211
+ $$render(consequent_6);
3212
+ });
3213
+ }
3214
+ var p_1 = $5.sibling(node_6, 2);
3215
+ var text_5 = $5.child(p_1, true);
3216
+ $5.reset(p_1);
3217
+ $5.reset(div);
3218
+ $5.template_effect(($0, $1) => {
3219
+ $5.set_class(div, 1, $0);
3220
+ $5.set_attribute(div_1, "data-cinder-open", $5.get(open) || undefined);
3221
+ $5.set_attribute(input_1, "id", $$props.id);
3222
+ input_1.disabled = $5.get(resolvedDisabled);
3223
+ input_1.required = $5.get(resolvedRequired);
3224
+ $5.set_attribute(input_1, "placeholder", $$props.placeholder);
3225
+ $5.set_value(input_1, inputValue());
3226
+ $5.set_attribute(input_1, "aria-label", $1);
3227
+ $5.set_attribute(input_1, "aria-expanded", $5.get(listboxVisible));
3228
+ $5.set_attribute(input_1, "aria-controls", $5.get(listboxVisible) ? $5.get(listboxId) : undefined);
3229
+ $5.set_attribute(input_1, "aria-activedescendant", $5.get(activeOptionId));
3230
+ $5.set_attribute(input_1, "aria-invalid", $5.get(field).ariaInvalid);
3231
+ $5.set_attribute(input_1, "aria-required", $5.get(resolvedRequired) || undefined);
3232
+ $5.set_attribute(input_1, "aria-describedby", $5.get(describedBy));
3233
+ $5.set_attribute(div_2, "data-cinder-active", $5.get(open) && $5.get(filteredOptions).length === 0 || undefined);
3234
+ $5.set_text(text_3, $5.get(open) && $5.get(filteredOptions).length === 0 ? "No results" : "");
3235
+ $5.set_attribute(p_1, "id", $5.get(field).ownErrorId ?? $5.get(stableLocalErrorId));
3236
+ $5.set_attribute(p_1, "data-cinder-error", !!$$props.error || undefined);
3237
+ $5.set_text(text_5, $$props.error ?? "");
3238
+ }, [
3239
+ () => $5.clsx(classNames("cinder-combobox", $$props.class)),
3240
+ () => $$props["aria-label"]?.trim() || undefined
3241
+ ]);
3242
+ $5.delegated("input", input_1, handleInput);
3243
+ $5.event("focus", input_1, handleFocus);
3244
+ $5.event("blur", input_1, handleBlur);
3245
+ $5.delegated("keydown", input_1, handleKeydown);
3246
+ $5.append($$anchor, div);
3247
+ $5.pop();
65
3248
  }
3249
+ $5.delegate(["input", "keydown", "mousedown"]);
66
3250
 
67
3251
  // src/components/invocation-rule-builder/invocation-rule-builder.svelte
68
- var rest_excludes = new Set([
3252
+ var rest_excludes2 = new Set([
69
3253
  "$$slots",
70
3254
  "$$events",
71
3255
  "$$legacy",
@@ -85,34 +3269,35 @@ var rest_excludes = new Set([
85
3269
  "aria-label",
86
3270
  "aria-labelledby"
87
3271
  ]);
88
- var root = $.from_html(`<h3 class="cinder-invocation-rule-builder__rule-label"> </h3>`);
89
- var root_1 = $.from_html(`<label class="cinder-invocation-rule-builder__rule-label-field"><span class="cinder-sr-only">Rule name</span> <input class="cinder-invocation-rule-builder__rule-label-input"/></label>`);
90
- var root_2 = $.from_html(`<div class="cinder-invocation-rule-builder__rule-controls"><button type="button" class="cinder-invocation-rule-builder__icon-btn"><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 3l5 6H3z"></path></svg></button> <button type="button" class="cinder-invocation-rule-builder__icon-btn"><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 13l-5-6h10z"></path></svg></button> <button type="button" class="cinder-invocation-rule-builder__icon-btn" data-irb-rule-remove=""><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2" fill="none"></path></svg></button></div>`);
91
- var root_3 = $.from_html(`<div class="cinder-invocation-rule-builder__rule-header"><!> <!></div>`);
92
- var root_4 = $.from_html(`<h3 class="cinder-sr-only">Conditions</h3>`);
93
- var root_5 = $.from_html(`<p class="cinder-invocation-rule-builder__validation" role="status"> </p>`);
94
- var root_6 = $.from_html(`<p class="cinder-invocation-rule-builder__empty"> </p>`);
95
- var root_7 = $.from_html(`<div class="cinder-invocation-rule-builder__summary-row"> </div>`);
96
- var root_8 = $.from_html(`<div class="cinder-invocation-rule-builder__summary"><!></div>`);
97
- var root_9 = $.from_html(`<option> </option>`);
98
- var root_10 = $.from_html(`<input type="number" class="cinder-invocation-rule-builder__condition-value" placeholder="Value to compare"/>`);
99
- var root_11 = $.from_html(`<input type="checkbox" class="cinder-invocation-rule-builder__condition-value-checkbox"/>`);
100
- var root_12 = $.from_html(`<select class="cinder-invocation-rule-builder__condition-select cinder-invocation-rule-builder__condition-value-select"></select>`);
101
- var root_13 = $.from_html(`<input type="text" class="cinder-invocation-rule-builder__condition-value" placeholder="Value to compare"/>`);
102
- var root_14 = $.from_html(`<div class="cinder-invocation-rule-builder__condition" role="listitem"><select class="cinder-invocation-rule-builder__condition-select"></select> <select class="cinder-invocation-rule-builder__condition-select"></select> <!> <button type="button" class="cinder-invocation-rule-builder__icon-btn" data-irb-condition-remove=""><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2" fill="none"></path></svg></button></div>`);
103
- var root_15 = $.from_html(`<div class="cinder-invocation-rule-builder__conditions" role="list"></div> <button type="button" class="cinder-invocation-rule-builder__add-btn" data-irb-add-condition=""> </button>`, 1);
104
- var root_16 = $.from_html(`<p class="cinder-invocation-rule-builder__validation" role="status">Add at least one action for this rule.</p>`);
105
- var root_17 = $.from_html(`<p class="cinder-invocation-rule-builder__empty">No actions configured.</p>`);
106
- var root_18 = $.from_html(`<div class="cinder-invocation-rule-builder__action" role="listitem"><select class="cinder-invocation-rule-builder__action-select"></select> <button type="button" class="cinder-invocation-rule-builder__icon-btn" data-irb-action-remove=""><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2" fill="none"></path></svg></button></div>`);
107
- var root_19 = $.from_html(`<div class="cinder-invocation-rule-builder__actions" role="list"></div> <button type="button" class="cinder-invocation-rule-builder__add-btn" data-irb-add-action=""> </button>`, 1);
108
- var root_20 = $.from_html(`<div><span class="cinder-invocation-rule-builder__section-heading">Actions</span> <!> <!></div>`);
109
- var root_21 = $.from_html(`<div class="cinder-invocation-rule-builder__rule"><!> <div><span class="cinder-invocation-rule-builder__section-heading">Conditions</span> <!> <!></div> <!></div>`);
110
- var root_22 = $.from_html(`<button type="button" class="cinder-invocation-rule-builder__add-btn cinder-invocation-rule-builder__add-rule-btn" data-irb-add-rule=""> </button>`);
111
- var root_23 = $.from_html(`<p class="cinder-invocation-rule-builder__empty">No rules configured.</p>`);
112
- var root_24 = $.from_html(`<section><!> <!> <!></section> <div role="status" aria-live="polite" aria-atomic="true" class="cinder-invocation-rule-builder__announcer"> </div>`, 1);
3272
+ var root4 = $6.from_html(`<h3 class="cinder-invocation-rule-builder__rule-label"> </h3>`);
3273
+ var root_13 = $6.from_html(`<label class="cinder-invocation-rule-builder__rule-label-field"><span class="cinder-sr-only">Rule name</span> <input class="cinder-invocation-rule-builder__rule-label-input"/></label>`);
3274
+ var root_23 = $6.from_html(`<div class="cinder-invocation-rule-builder__rule-controls"><button type="button" class="cinder-invocation-rule-builder__icon-btn"><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 3l5 6H3z"></path></svg></button> <button type="button" class="cinder-invocation-rule-builder__icon-btn"><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M8 13l-5-6h10z"></path></svg></button> <button type="button" class="cinder-invocation-rule-builder__icon-btn" data-irb-rule-remove=""><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2" fill="none"></path></svg></button></div>`);
3275
+ var root_33 = $6.from_html(`<div class="cinder-invocation-rule-builder__rule-header"><!> <!></div>`);
3276
+ var root_42 = $6.from_html(`<h3 class="cinder-sr-only">Conditions</h3>`);
3277
+ var root_52 = $6.from_html(`<p class="cinder-invocation-rule-builder__validation" role="status"> </p>`);
3278
+ var root_62 = $6.from_html(`<p class="cinder-invocation-rule-builder__empty"> </p>`);
3279
+ var root_72 = $6.from_html(`<div class="cinder-invocation-rule-builder__summary-row"> </div>`);
3280
+ var root_82 = $6.from_html(`<div class="cinder-invocation-rule-builder__summary"><!></div>`);
3281
+ var root_9 = $6.from_html(`<option> </option>`);
3282
+ var root_10 = $6.from_html(`<select class="cinder-invocation-rule-builder__condition-select"></select>`);
3283
+ var root_11 = $6.from_html(`<input type="number" class="cinder-invocation-rule-builder__condition-value" placeholder="Value to compare"/>`);
3284
+ var root_122 = $6.from_html(`<input type="checkbox" class="cinder-invocation-rule-builder__condition-value-checkbox"/>`);
3285
+ var root_132 = $6.from_html(`<select class="cinder-invocation-rule-builder__condition-select cinder-invocation-rule-builder__condition-value-select"></select>`);
3286
+ var root_14 = $6.from_html(`<input type="text" class="cinder-invocation-rule-builder__condition-value" placeholder="Value to compare"/>`);
3287
+ var root_15 = $6.from_html(`<div class="cinder-invocation-rule-builder__condition" role="listitem"><!> <select class="cinder-invocation-rule-builder__condition-select"></select> <!> <button type="button" class="cinder-invocation-rule-builder__icon-btn" data-irb-condition-remove=""><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2" fill="none"></path></svg></button></div>`);
3288
+ var root_16 = $6.from_html(`<div class="cinder-invocation-rule-builder__conditions" role="list"></div> <button type="button" class="cinder-invocation-rule-builder__add-btn" data-irb-add-condition=""> </button>`, 1);
3289
+ var root_17 = $6.from_html(`<p class="cinder-invocation-rule-builder__validation" role="status">Add at least one action for this rule.</p>`);
3290
+ var root_18 = $6.from_html(`<p class="cinder-invocation-rule-builder__empty">No actions configured.</p>`);
3291
+ var root_19 = $6.from_html(`<div class="cinder-invocation-rule-builder__action" role="listitem"><select class="cinder-invocation-rule-builder__action-select"></select> <button type="button" class="cinder-invocation-rule-builder__icon-btn" data-irb-action-remove=""><svg viewBox="0 0 16 16" width="12" height="12" aria-hidden="true"><path d="M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="2" fill="none"></path></svg></button></div>`);
3292
+ var root_20 = $6.from_html(`<div class="cinder-invocation-rule-builder__actions" role="list"></div> <button type="button" class="cinder-invocation-rule-builder__add-btn" data-irb-add-action=""> </button>`, 1);
3293
+ var root_21 = $6.from_html(`<div><span class="cinder-invocation-rule-builder__section-heading">Actions</span> <!> <!></div>`);
3294
+ var root_222 = $6.from_html(`<div class="cinder-invocation-rule-builder__rule"><!> <div><span class="cinder-invocation-rule-builder__section-heading">Conditions</span> <!> <!></div> <!></div>`);
3295
+ var root_232 = $6.from_html(`<button type="button" class="cinder-invocation-rule-builder__add-btn cinder-invocation-rule-builder__add-rule-btn" data-irb-add-rule=""> </button>`);
3296
+ var root_24 = $6.from_html(`<p class="cinder-invocation-rule-builder__empty">No rules configured.</p>`);
3297
+ var root_25 = $6.from_html(`<section><!> <!> <!></section> <div role="status" aria-live="polite" aria-atomic="true" class="cinder-invocation-rule-builder__announcer"> </div>`, 1);
113
3298
  function Invocation_rule_builder($$anchor, $$props) {
114
- const baseId = $.props_id();
115
- $.push($$props, true);
3299
+ const baseId = $6.props_id();
3300
+ $6.push($$props, true);
116
3301
  const CONDITIONS_ONLY_OPERATOR_OPTIONS = [
117
3302
  { value: "eq", label: "equals" },
118
3303
  { value: "gt", label: "greater than" },
@@ -120,12 +3305,12 @@ function Invocation_rule_builder($$anchor, $$props) {
120
3305
  { value: "gte", label: "greater than or equal" },
121
3306
  { value: "lte", label: "less than or equal" }
122
3307
  ];
123
- let rules = $.prop($$props, "rules", 19, () => []), conditions = $.prop($$props, "conditions", 19, () => []), mode = $.prop($$props, "mode", 3, "full"), readonly = $.prop($$props, "readonly", 3, false), addRuleLabel = $.prop($$props, "addRuleLabel", 3, "Add rule"), addConditionLabel = $.prop($$props, "addConditionLabel", 3, "Add condition"), addActionLabel = $.prop($$props, "addActionLabel", 3, "Add action"), rest = $.rest_props($$props, rest_excludes);
124
- const sectionAriaLabel = $.derived(() => $$props["aria-labelledby"] ? undefined : $$props["aria-label"] ?? $$props.label ?? "Invocation rules");
125
- const effectiveReadonly = $.derived(() => readonly() || $$props.onchange === undefined);
126
- const conditionsOnly = $.derived(() => mode() === "conditions" || mode() === "flat-conditions");
127
- const flatConditions = $.derived(() => mode() === "flat-conditions");
128
- const renderedRules = $.derived(() => $.get(flatConditions) ? [
3308
+ let rules = $6.prop($$props, "rules", 19, () => []), conditions = $6.prop($$props, "conditions", 19, () => []), mode = $6.prop($$props, "mode", 3, "full"), readonly = $6.prop($$props, "readonly", 3, false), addRuleLabel = $6.prop($$props, "addRuleLabel", 3, "Add rule"), addConditionLabel = $6.prop($$props, "addConditionLabel", 3, "Add condition"), addActionLabel = $6.prop($$props, "addActionLabel", 3, "Add action"), rest = $6.rest_props($$props, rest_excludes2);
3309
+ const sectionAriaLabel = $6.derived(() => $$props["aria-labelledby"] ? undefined : $$props["aria-label"] ?? $$props.label ?? "Invocation rules");
3310
+ const effectiveReadonly = $6.derived(() => readonly() || $$props.onchange === undefined);
3311
+ const conditionsOnly = $6.derived(() => mode() === "conditions" || mode() === "flat-conditions");
3312
+ const flatConditions = $6.derived(() => mode() === "flat-conditions");
3313
+ const renderedRules = $6.derived(() => $6.get(flatConditions) ? [
129
3314
  {
130
3315
  id: `${baseId}-flat`,
131
3316
  label: "Conditions",
@@ -133,8 +3318,8 @@ function Invocation_rule_builder($$anchor, $$props) {
133
3318
  actions: []
134
3319
  }
135
3320
  ] : rules());
136
- const resolvedOperatorOptions = $.derived(() => $.get(conditionsOnly) ? CONDITIONS_ONLY_OPERATOR_OPTIONS : $$props.operatorOptions ?? []);
137
- const resolvedActionOptions = $.derived(() => $$props.actionOptions ?? []);
3321
+ const resolvedOperatorOptions = $6.derived(() => $6.get(conditionsOnly) ? CONDITIONS_ONLY_OPERATOR_OPTIONS : $$props.operatorOptions ?? []);
3322
+ const resolvedActionOptions = $6.derived(() => $$props.actionOptions ?? []);
138
3323
  function fieldValueType(fieldValue) {
139
3324
  return $$props.fieldOptions.find((option) => option.value === fieldValue)?.type ?? "string";
140
3325
  }
@@ -170,10 +3355,10 @@ function Invocation_rule_builder($$anchor, $$props) {
170
3355
  return CONDITIONS_ONLY_OPERATOR_OPTIONS.some((option) => option.value === operator);
171
3356
  }
172
3357
  function displayOperator(operator) {
173
- return $.get(conditionsOnly) && !isConditionsOnlyOperator(operator) ? "eq" : operator;
3358
+ return $6.get(conditionsOnly) && !isConditionsOnlyOperator(operator) ? "eq" : operator;
174
3359
  }
175
3360
  function emitChange(nextRules, change) {
176
- const rulesToEmit = $.get(conditionsOnly) ? nextRules.map((rule) => ({
3361
+ const rulesToEmit = $6.get(conditionsOnly) ? nextRules.map((rule) => ({
177
3362
  ...rule,
178
3363
  actions: [],
179
3364
  conditions: rule.conditions.map((condition) => {
@@ -183,7 +3368,7 @@ function Invocation_rule_builder($$anchor, $$props) {
183
3368
  return operator === condition.operator && value === condition.value ? condition : { ...condition, operator, value };
184
3369
  })
185
3370
  })) : nextRules;
186
- if ($.get(flatConditions)) {
3371
+ if ($6.get(flatConditions)) {
187
3372
  if (change.type !== "add-condition" && change.type !== "remove-condition" && change.type !== "update-condition") {
188
3373
  return;
189
3374
  }
@@ -195,27 +3380,27 @@ function Invocation_rule_builder($$anchor, $$props) {
195
3380
  const ruleChangeHandler = $$props.onchange;
196
3381
  ruleChangeHandler?.(rulesToEmit, change);
197
3382
  }
198
- let announcement = $.state("");
199
- let ruleLabelDrafts = $.state($.proxy({}));
3383
+ let announcement = $6.state("");
3384
+ let ruleLabelDrafts = $6.state($6.proxy({}));
200
3385
  function announce(message) {
201
- $.set(announcement, "");
3386
+ $6.set(announcement, "");
202
3387
  tick().then(() => {
203
- $.set(announcement, message, true);
3388
+ $6.set(announcement, message, true);
204
3389
  });
205
3390
  }
206
3391
  function generateId() {
207
3392
  return `${Math.random().toString(36).slice(2)}-${Date.now()}`;
208
3393
  }
209
3394
  function updateRules(ruleId, updater) {
210
- return $.get(renderedRules).map((rule) => rule.id === ruleId ? updater(rule) : rule);
3395
+ return $6.get(renderedRules).map((rule) => rule.id === ruleId ? updater(rule) : rule);
211
3396
  }
212
3397
  function handleAddRule() {
213
3398
  const ruleId = generateId();
214
3399
  const nextRules = [
215
- ...$.get(renderedRules),
3400
+ ...$6.get(renderedRules),
216
3401
  {
217
3402
  id: ruleId,
218
- label: `Rule ${$.get(renderedRules).length + 1}`,
3403
+ label: `Rule ${$6.get(renderedRules).length + 1}`,
219
3404
  conditions: [],
220
3405
  actions: []
221
3406
  }
@@ -225,7 +3410,7 @@ function Invocation_rule_builder($$anchor, $$props) {
225
3410
  announce("Rule added.");
226
3411
  }
227
3412
  function handleRemoveRule(ruleId, ruleLabel, ruleIndex) {
228
- const nextRules = $.get(renderedRules).filter((rule) => rule.id !== ruleId);
3413
+ const nextRules = $6.get(renderedRules).filter((rule) => rule.id !== ruleId);
229
3414
  const change = { type: "remove-rule", ruleId };
230
3415
  emitChange(nextRules, change);
231
3416
  announce(`${ruleLabel} removed.`);
@@ -238,9 +3423,9 @@ function Invocation_rule_builder($$anchor, $$props) {
238
3423
  }
239
3424
  function handleMoveRule(ruleId, fromIndex, direction) {
240
3425
  const toIndex = fromIndex + direction;
241
- if (toIndex < 0 || toIndex >= $.get(renderedRules).length)
3426
+ if (toIndex < 0 || toIndex >= $6.get(renderedRules).length)
242
3427
  return;
243
- const nextRules = [...$.get(renderedRules)];
3428
+ const nextRules = [...$6.get(renderedRules)];
244
3429
  const [moved] = nextRules.splice(fromIndex, 1);
245
3430
  nextRules.splice(toIndex, 0, moved);
246
3431
  const change = { type: "move-rule", ruleId, fromIndex, toIndex };
@@ -249,9 +3434,9 @@ function Invocation_rule_builder($$anchor, $$props) {
249
3434
  }
250
3435
  function handleRenameRule(ruleId, label) {
251
3436
  const nextLabel = label.trim() || "Untitled rule";
252
- const { [ruleId]: _removedDraft, ...remainingDrafts } = $.get(ruleLabelDrafts);
253
- $.set(ruleLabelDrafts, remainingDrafts, true);
254
- const currentLabel = $.get(renderedRules).find((rule) => rule.id === ruleId)?.label;
3437
+ const { [ruleId]: _removedDraft, ...remainingDrafts } = $6.get(ruleLabelDrafts);
3438
+ $6.set(ruleLabelDrafts, remainingDrafts, true);
3439
+ const currentLabel = $6.get(renderedRules).find((rule) => rule.id === ruleId)?.label;
255
3440
  if (currentLabel === nextLabel)
256
3441
  return;
257
3442
  const nextRules = updateRules(ruleId, (rule) => ({ ...rule, label: nextLabel }));
@@ -259,14 +3444,14 @@ function Invocation_rule_builder($$anchor, $$props) {
259
3444
  emitChange(nextRules, change);
260
3445
  }
261
3446
  function ruleLabelDraft(rule) {
262
- const draft = $.get(ruleLabelDrafts)[rule.id];
3447
+ const draft = $6.get(ruleLabelDrafts)[rule.id];
263
3448
  return draft?.baseLabel === rule.label ? draft.value : rule.label;
264
3449
  }
265
3450
  function handleAddCondition(ruleId) {
266
3451
  const conditionId = generateId();
267
3452
  const firstField = $$props.fieldOptions[0]?.value ?? "";
268
- const firstOperator = $.get(resolvedOperatorOptions)[0]?.value ?? "";
269
- const initialValue = $.get(conditionsOnly) ? defaultConditionValue(firstField) : "";
3453
+ const firstOperator = $6.get(resolvedOperatorOptions)[0]?.value ?? "";
3454
+ const initialValue = $6.get(conditionsOnly) ? defaultConditionValue(firstField) : "";
270
3455
  const nextRules = updateRules(ruleId, (rule) => ({
271
3456
  ...rule,
272
3457
  conditions: [
@@ -305,7 +3490,7 @@ function Invocation_rule_builder($$anchor, $$props) {
305
3490
  conditions: rule.conditions.map((condition) => {
306
3491
  if (condition.id !== conditionId)
307
3492
  return condition;
308
- if (field === "field" && $.get(conditionsOnly)) {
3493
+ if (field === "field" && $6.get(conditionsOnly)) {
309
3494
  const nextType = fieldValueType(value);
310
3495
  const nextValue = isValueValidForFieldType(condition.value, nextType, value) ? condition.value : defaultConditionValue(value);
311
3496
  return { ...condition, field: value, value: nextValue };
@@ -318,7 +3503,7 @@ function Invocation_rule_builder($$anchor, $$props) {
318
3503
  }
319
3504
  function handleAddAction(ruleId) {
320
3505
  const actionId = generateId();
321
- const firstTarget = $.get(resolvedActionOptions)[0]?.value ?? "";
3506
+ const firstTarget = $6.get(resolvedActionOptions)[0]?.value ?? "";
322
3507
  const nextRules = updateRules(ruleId, (rule) => ({
323
3508
  ...rule,
324
3509
  actions: [...rule.actions, { id: actionId, target: firstTarget }]
@@ -356,10 +3541,10 @@ function Invocation_rule_builder($$anchor, $$props) {
356
3541
  }
357
3542
  function operatorLabel(value) {
358
3543
  const displayValue = displayOperator(value);
359
- return $.get(resolvedOperatorOptions).find((option) => option.value === displayValue)?.label ?? displayValue;
3544
+ return $6.get(resolvedOperatorOptions).find((option) => option.value === displayValue)?.label ?? displayValue;
360
3545
  }
361
3546
  function actionTargetLabel(value) {
362
- return $.get(resolvedActionOptions).find((option) => option.value === value)?.label ?? value;
3547
+ return $6.get(resolvedActionOptions).find((option) => option.value === value)?.label ?? value;
363
3548
  }
364
3549
  function conditionSummary(condition) {
365
3550
  return `${fieldLabel(condition.field)} ${operatorLabel(condition.operator)} "${condition.value}"`;
@@ -367,458 +3552,495 @@ function Invocation_rule_builder($$anchor, $$props) {
367
3552
  function actionSummary(action) {
368
3553
  return `Invoke ${actionTargetLabel(action.target)}`;
369
3554
  }
370
- var fragment = root_24();
371
- var section = $.first_child(fragment);
372
- $.attribute_effect(section, ($0) => ({
3555
+ var fragment = root_25();
3556
+ var section = $6.first_child(fragment);
3557
+ $6.attribute_effect(section, ($0) => ({
373
3558
  ...rest,
374
3559
  class: $0,
375
- "aria-label": $.get(sectionAriaLabel),
3560
+ "aria-label": $6.get(sectionAriaLabel),
376
3561
  "aria-labelledby": $$props["aria-labelledby"],
377
3562
  "data-irb-region": baseId,
378
- "data-irb-flat": $.get(flatConditions) || undefined
3563
+ "data-irb-flat": $6.get(flatConditions) || undefined
379
3564
  }), [
380
3565
  () => classNames("cinder-invocation-rule-builder", $$props.class)
381
3566
  ]);
382
- var node = $.child(section);
383
- $.each(node, 19, () => $.get(renderedRules), (rule) => rule.id, ($$anchor2, rule, ruleIndex) => {
384
- var div = root_21();
385
- var node_1 = $.child(div);
3567
+ var node = $6.child(section);
3568
+ $6.each(node, 19, () => $6.get(renderedRules), (rule) => rule.id, ($$anchor2, rule, ruleIndex) => {
3569
+ var div = root_222();
3570
+ var node_1 = $6.child(div);
386
3571
  {
387
3572
  var consequent_2 = ($$anchor3) => {
388
- var div_1 = root_3();
389
- var node_2 = $.child(div_1);
3573
+ var div_1 = root_33();
3574
+ var node_2 = $6.child(div_1);
390
3575
  {
391
3576
  var consequent = ($$anchor4) => {
392
- var h3 = root();
393
- var text = $.child(h3, true);
394
- $.reset(h3);
395
- $.template_effect(() => $.set_text(text, $.get(rule).label));
396
- $.append($$anchor4, h3);
3577
+ var h3 = root4();
3578
+ var text = $6.child(h3, true);
3579
+ $6.reset(h3);
3580
+ $6.template_effect(() => $6.set_text(text, $6.get(rule).label));
3581
+ $6.append($$anchor4, h3);
397
3582
  };
398
3583
  var alternate = ($$anchor4) => {
399
- var label_1 = root_1();
400
- var input = $.sibling($.child(label_1), 2);
401
- $.remove_input_defaults(input);
402
- $.reset(label_1);
403
- $.template_effect(($0) => {
404
- $.set_value(input, $0);
405
- $.set_attribute(input, "aria-label", `Rule name for ${$.get(rule).label}`);
406
- }, [() => ruleLabelDraft($.get(rule))]);
407
- $.delegated("input", input, (event2) => $.set(ruleLabelDrafts, {
408
- ...$.get(ruleLabelDrafts),
409
- [$.get(rule).id]: { baseLabel: $.get(rule).label, value: event2.target.value }
3584
+ var label_1 = root_13();
3585
+ var input = $6.sibling($6.child(label_1), 2);
3586
+ $6.remove_input_defaults(input);
3587
+ $6.reset(label_1);
3588
+ $6.template_effect(($0) => {
3589
+ $6.set_value(input, $0);
3590
+ $6.set_attribute(input, "aria-label", `Rule name for ${$6.get(rule).label}`);
3591
+ }, [() => ruleLabelDraft($6.get(rule))]);
3592
+ $6.delegated("input", input, (event3) => $6.set(ruleLabelDrafts, {
3593
+ ...$6.get(ruleLabelDrafts),
3594
+ [$6.get(rule).id]: { baseLabel: $6.get(rule).label, value: event3.target.value }
410
3595
  }, true));
411
- $.event("blur", input, (event2) => handleRenameRule($.get(rule).id, event2.target.value));
412
- $.delegated("keydown", input, (event2) => {
413
- if (event2.key === "Enter") {
414
- event2.preventDefault();
415
- event2.currentTarget.blur();
3596
+ $6.event("blur", input, (event3) => handleRenameRule($6.get(rule).id, event3.target.value));
3597
+ $6.delegated("keydown", input, (event3) => {
3598
+ if (event3.key === "Enter") {
3599
+ event3.preventDefault();
3600
+ event3.currentTarget.blur();
416
3601
  }
417
3602
  });
418
- $.append($$anchor4, label_1);
3603
+ $6.append($$anchor4, label_1);
419
3604
  };
420
- $.if(node_2, ($$render) => {
421
- if ($.get(effectiveReadonly))
3605
+ $6.if(node_2, ($$render) => {
3606
+ if ($6.get(effectiveReadonly))
422
3607
  $$render(consequent);
423
3608
  else
424
3609
  $$render(alternate, -1);
425
3610
  });
426
3611
  }
427
- var node_3 = $.sibling(node_2, 2);
3612
+ var node_3 = $6.sibling(node_2, 2);
428
3613
  {
429
3614
  var consequent_1 = ($$anchor4) => {
430
- var div_2 = root_2();
431
- var button = $.child(div_2);
432
- var button_1 = $.sibling(button, 2);
433
- var button_2 = $.sibling(button_1, 2);
434
- $.reset(div_2);
435
- $.template_effect(() => {
436
- $.set_attribute(button, "aria-label", `Move ${$.get(rule).label} up`);
437
- button.disabled = $.get(ruleIndex) === 0;
438
- $.set_attribute(button_1, "aria-label", `Move ${$.get(rule).label} down`);
439
- button_1.disabled = $.get(ruleIndex) === $.get(renderedRules).length - 1;
440
- $.set_attribute(button_2, "aria-label", `Remove ${$.get(rule).label}`);
3615
+ var div_2 = root_23();
3616
+ var button = $6.child(div_2);
3617
+ var button_1 = $6.sibling(button, 2);
3618
+ var button_2 = $6.sibling(button_1, 2);
3619
+ $6.reset(div_2);
3620
+ $6.template_effect(() => {
3621
+ $6.set_attribute(button, "aria-label", `Move ${$6.get(rule).label} up`);
3622
+ button.disabled = $6.get(ruleIndex) === 0;
3623
+ $6.set_attribute(button_1, "aria-label", `Move ${$6.get(rule).label} down`);
3624
+ button_1.disabled = $6.get(ruleIndex) === $6.get(renderedRules).length - 1;
3625
+ $6.set_attribute(button_2, "aria-label", `Remove ${$6.get(rule).label}`);
441
3626
  });
442
- $.delegated("click", button, () => handleMoveRule($.get(rule).id, $.get(ruleIndex), -1));
443
- $.delegated("click", button_1, () => handleMoveRule($.get(rule).id, $.get(ruleIndex), 1));
444
- $.delegated("click", button_2, () => handleRemoveRule($.get(rule).id, $.get(rule).label, $.get(ruleIndex)));
445
- $.append($$anchor4, div_2);
3627
+ $6.delegated("click", button, () => handleMoveRule($6.get(rule).id, $6.get(ruleIndex), -1));
3628
+ $6.delegated("click", button_1, () => handleMoveRule($6.get(rule).id, $6.get(ruleIndex), 1));
3629
+ $6.delegated("click", button_2, () => handleRemoveRule($6.get(rule).id, $6.get(rule).label, $6.get(ruleIndex)));
3630
+ $6.append($$anchor4, div_2);
446
3631
  };
447
- $.if(node_3, ($$render) => {
448
- if (!$.get(effectiveReadonly))
3632
+ $6.if(node_3, ($$render) => {
3633
+ if (!$6.get(effectiveReadonly))
449
3634
  $$render(consequent_1);
450
3635
  });
451
3636
  }
452
- $.reset(div_1);
453
- $.append($$anchor3, div_1);
3637
+ $6.reset(div_1);
3638
+ $6.append($$anchor3, div_1);
454
3639
  };
455
3640
  var alternate_1 = ($$anchor3) => {
456
- var h3_1 = root_4();
457
- $.append($$anchor3, h3_1);
3641
+ var h3_1 = root_42();
3642
+ $6.append($$anchor3, h3_1);
458
3643
  };
459
- $.if(node_1, ($$render) => {
460
- if (!$.get(flatConditions))
3644
+ $6.if(node_1, ($$render) => {
3645
+ if (!$6.get(flatConditions))
461
3646
  $$render(consequent_2);
462
3647
  else
463
3648
  $$render(alternate_1, -1);
464
3649
  });
465
3650
  }
466
- var div_3 = $.sibling(node_1, 2);
467
- var span = $.child(div_3);
468
- var node_4 = $.sibling(span, 2);
3651
+ var div_3 = $6.sibling(node_1, 2);
3652
+ var span = $6.child(div_3);
3653
+ var node_4 = $6.sibling(span, 2);
469
3654
  {
470
3655
  var consequent_3 = ($$anchor3) => {
471
- var p = root_5();
472
- var text_1 = $.child(p, true);
473
- $.reset(p);
474
- $.template_effect(() => $.set_text(text_1, $.get(flatConditions) ? "Add at least one condition." : "Add at least one condition or this rule will always fire."));
475
- $.append($$anchor3, p);
3656
+ var p = root_52();
3657
+ var text_1 = $6.child(p, true);
3658
+ $6.reset(p);
3659
+ $6.template_effect(() => $6.set_text(text_1, $6.get(flatConditions) ? "Add at least one condition." : "Add at least one condition or this rule will always fire."));
3660
+ $6.append($$anchor3, p);
476
3661
  };
477
- $.if(node_4, ($$render) => {
478
- if (!$.get(effectiveReadonly) && $.get(rule).conditions.length === 0)
3662
+ $6.if(node_4, ($$render) => {
3663
+ if (!$6.get(effectiveReadonly) && $6.get(rule).conditions.length === 0)
479
3664
  $$render(consequent_3);
480
3665
  });
481
3666
  }
482
- var node_5 = $.sibling(node_4, 2);
3667
+ var node_5 = $6.sibling(node_4, 2);
483
3668
  {
484
3669
  var consequent_5 = ($$anchor3) => {
485
- var div_4 = root_8();
486
- var node_6 = $.child(div_4);
3670
+ var div_4 = root_82();
3671
+ var node_6 = $6.child(div_4);
487
3672
  {
488
3673
  var consequent_4 = ($$anchor4) => {
489
- var p_1 = root_6();
490
- var text_2 = $.child(p_1, true);
491
- $.reset(p_1);
492
- $.template_effect(() => $.set_text(text_2, $.get(flatConditions) ? "No conditions." : "No conditions — rule always fires."));
493
- $.append($$anchor4, p_1);
3674
+ var p_1 = root_62();
3675
+ var text_2 = $6.child(p_1, true);
3676
+ $6.reset(p_1);
3677
+ $6.template_effect(() => $6.set_text(text_2, $6.get(flatConditions) ? "No conditions." : "No conditions — rule always fires."));
3678
+ $6.append($$anchor4, p_1);
494
3679
  };
495
3680
  var alternate_2 = ($$anchor4) => {
496
- var fragment_1 = $.comment();
497
- var node_7 = $.first_child(fragment_1);
498
- $.each(node_7, 17, () => $.get(rule).conditions, (condition) => condition.id, ($$anchor5, condition) => {
499
- var div_5 = root_7();
500
- var text_3 = $.child(div_5, true);
501
- $.reset(div_5);
502
- $.template_effect(($0) => $.set_text(text_3, $0), [() => conditionSummary($.get(condition))]);
503
- $.append($$anchor5, div_5);
3681
+ var fragment_1 = $6.comment();
3682
+ var node_7 = $6.first_child(fragment_1);
3683
+ $6.each(node_7, 17, () => $6.get(rule).conditions, (condition) => condition.id, ($$anchor5, condition) => {
3684
+ var div_5 = root_72();
3685
+ var text_3 = $6.child(div_5, true);
3686
+ $6.reset(div_5);
3687
+ $6.template_effect(($0) => $6.set_text(text_3, $0), [() => conditionSummary($6.get(condition))]);
3688
+ $6.append($$anchor5, div_5);
504
3689
  });
505
- $.append($$anchor4, fragment_1);
3690
+ $6.append($$anchor4, fragment_1);
506
3691
  };
507
- $.if(node_6, ($$render) => {
508
- if ($.get(rule).conditions.length === 0)
3692
+ $6.if(node_6, ($$render) => {
3693
+ if ($6.get(rule).conditions.length === 0)
509
3694
  $$render(consequent_4);
510
3695
  else
511
3696
  $$render(alternate_2, -1);
512
3697
  });
513
3698
  }
514
- $.reset(div_4);
515
- $.template_effect(() => $.set_attribute(div_4, "aria-label", $.get(flatConditions) ? "Conditions" : `Conditions for ${$.get(rule).label}`));
516
- $.append($$anchor3, div_4);
3699
+ $6.reset(div_4);
3700
+ $6.template_effect(() => $6.set_attribute(div_4, "aria-label", $6.get(flatConditions) ? "Conditions" : `Conditions for ${$6.get(rule).label}`));
3701
+ $6.append($$anchor3, div_4);
517
3702
  };
518
- var alternate_4 = ($$anchor3) => {
519
- var fragment_2 = root_15();
520
- var div_6 = $.first_child(fragment_2);
521
- $.each(div_6, 23, () => $.get(rule).conditions, (condition) => condition.id, ($$anchor4, condition, conditionIndex) => {
522
- var div_7 = root_14();
523
- var select = $.child(div_7);
524
- $.each(select, 21, () => $$props.fieldOptions, (option) => option.value, ($$anchor5, option) => {
525
- var option_1 = root_9();
526
- var text_4 = $.child(option_1, true);
527
- $.reset(option_1);
528
- var option_1_value = {};
529
- $.template_effect(() => {
530
- $.set_text(text_4, $.get(option).label);
531
- if (option_1_value !== (option_1_value = $.get(option).value)) {
532
- option_1.value = (option_1.__value = $.get(option).value) ?? "";
3703
+ var alternate_5 = ($$anchor3) => {
3704
+ var fragment_2 = root_16();
3705
+ var div_6 = $6.first_child(fragment_2);
3706
+ $6.each(div_6, 23, () => $6.get(rule).conditions, (condition) => condition.id, ($$anchor4, condition, conditionIndex) => {
3707
+ var div_7 = root_15();
3708
+ var node_8 = $6.child(div_7);
3709
+ {
3710
+ var consequent_6 = ($$anchor5) => {
3711
+ {
3712
+ let $0 = $6.derived(() => `${baseId}-rule-${$6.get(ruleIndex)}-condition-${$6.get(conditionIndex)}-field`);
3713
+ let $1 = $6.derived(() => `Field for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3714
+ Combobox($$anchor5, {
3715
+ get id() {
3716
+ return $6.get($0);
3717
+ },
3718
+ get value() {
3719
+ return $6.get(condition).field;
3720
+ },
3721
+ get options() {
3722
+ return $$props.fieldOptions;
3723
+ },
3724
+ allowCustomValue: true,
3725
+ get "aria-label"() {
3726
+ return $6.get($1);
3727
+ },
3728
+ onchange: (value) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "field", value),
3729
+ class: "cinder-invocation-rule-builder__condition-combobox"
3730
+ });
533
3731
  }
3732
+ };
3733
+ var alternate_3 = ($$anchor5) => {
3734
+ var select = root_10();
3735
+ $6.each(select, 21, () => $$props.fieldOptions, (option) => option.value, ($$anchor6, option) => {
3736
+ var option_1 = root_9();
3737
+ var text_4 = $6.child(option_1, true);
3738
+ $6.reset(option_1);
3739
+ var option_1_value = {};
3740
+ $6.template_effect(() => {
3741
+ $6.set_text(text_4, $6.get(option).label);
3742
+ if (option_1_value !== (option_1_value = $6.get(option).value)) {
3743
+ option_1.value = (option_1.__value = $6.get(option).value) ?? "";
3744
+ }
3745
+ });
3746
+ $6.append($$anchor6, option_1);
3747
+ });
3748
+ $6.reset(select);
3749
+ var select_value;
3750
+ $6.init_select(select);
3751
+ $6.template_effect(() => {
3752
+ $6.set_attribute(select, "aria-label", `Field for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3753
+ if (select_value !== (select_value = $6.get(condition).field)) {
3754
+ select.value = (select.__value = $6.get(condition).field) ?? "", $6.select_option(select, $6.get(condition).field);
3755
+ }
3756
+ });
3757
+ $6.delegated("change", select, (event3) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "field", event3.target.value));
3758
+ $6.append($$anchor5, select);
3759
+ };
3760
+ $6.if(node_8, ($$render) => {
3761
+ if ($6.get(conditionsOnly))
3762
+ $$render(consequent_6);
3763
+ else
3764
+ $$render(alternate_3, -1);
534
3765
  });
535
- $.append($$anchor5, option_1);
536
- });
537
- $.reset(select);
538
- var select_value;
539
- $.init_select(select);
540
- var select_1 = $.sibling(select, 2);
541
- $.each(select_1, 21, () => $.get(resolvedOperatorOptions), (option) => option.value, ($$anchor5, option) => {
3766
+ }
3767
+ var select_1 = $6.sibling(node_8, 2);
3768
+ $6.each(select_1, 21, () => $6.get(resolvedOperatorOptions), (option) => option.value, ($$anchor5, option) => {
542
3769
  var option_2 = root_9();
543
- var text_5 = $.child(option_2, true);
544
- $.reset(option_2);
3770
+ var text_5 = $6.child(option_2, true);
3771
+ $6.reset(option_2);
545
3772
  var option_2_value = {};
546
- $.template_effect(() => {
547
- $.set_text(text_5, $.get(option).label);
548
- if (option_2_value !== (option_2_value = $.get(option).value)) {
549
- option_2.value = (option_2.__value = $.get(option).value) ?? "";
3773
+ $6.template_effect(() => {
3774
+ $6.set_text(text_5, $6.get(option).label);
3775
+ if (option_2_value !== (option_2_value = $6.get(option).value)) {
3776
+ option_2.value = (option_2.__value = $6.get(option).value) ?? "";
550
3777
  }
551
3778
  });
552
- $.append($$anchor5, option_2);
3779
+ $6.append($$anchor5, option_2);
553
3780
  });
554
- $.reset(select_1);
3781
+ $6.reset(select_1);
555
3782
  var select_1_value;
556
- $.init_select(select_1);
557
- var node_8 = $.sibling(select_1, 2);
3783
+ $6.init_select(select_1);
3784
+ var node_9 = $6.sibling(select_1, 2);
558
3785
  {
559
- var consequent_6 = ($$anchor5) => {
560
- var input_1 = root_10();
561
- $.remove_input_defaults(input_1);
562
- $.template_effect(() => {
563
- $.set_attribute(input_1, "aria-label", `Value for condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
564
- $.set_value(input_1, $.get(condition).value);
565
- });
566
- $.delegated("input", input_1, (event2) => handleUpdateCondition($.get(rule).id, $.get(condition).id, "value", event2.target.value));
567
- $.append($$anchor5, input_1);
568
- };
569
- var d = $.derived(() => $.get(conditionsOnly) && fieldValueType($.get(condition).field) === "number");
570
3786
  var consequent_7 = ($$anchor5) => {
571
- var input_2 = root_11();
572
- $.remove_input_defaults(input_2);
573
- $.template_effect(() => {
574
- $.set_attribute(input_2, "aria-label", `Value for condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
575
- $.set_checked(input_2, $.get(condition).value === "true");
3787
+ var input_1 = root_11();
3788
+ $6.remove_input_defaults(input_1);
3789
+ $6.template_effect(() => {
3790
+ $6.set_attribute(input_1, "aria-label", `Value for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3791
+ $6.set_value(input_1, $6.get(condition).value);
576
3792
  });
577
- $.delegated("change", input_2, (event2) => handleUpdateCondition($.get(rule).id, $.get(condition).id, "value", String(event2.target.checked)));
578
- $.append($$anchor5, input_2);
3793
+ $6.delegated("input", input_1, (event3) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "value", event3.target.value));
3794
+ $6.append($$anchor5, input_1);
579
3795
  };
580
- var d_1 = $.derived(() => $.get(conditionsOnly) && fieldValueType($.get(condition).field) === "boolean");
3796
+ var d = $6.derived(() => $6.get(conditionsOnly) && fieldValueType($6.get(condition).field) === "number");
581
3797
  var consequent_8 = ($$anchor5) => {
582
- var select_2 = root_12();
583
- $.each(select_2, 21, () => fieldEnumOptions($.get(condition).field), (option) => option.value, ($$anchor6, option) => {
3798
+ var input_2 = root_122();
3799
+ $6.remove_input_defaults(input_2);
3800
+ $6.template_effect(() => {
3801
+ $6.set_attribute(input_2, "aria-label", `Value for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3802
+ $6.set_checked(input_2, $6.get(condition).value === "true");
3803
+ });
3804
+ $6.delegated("change", input_2, (event3) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "value", String(event3.target.checked)));
3805
+ $6.append($$anchor5, input_2);
3806
+ };
3807
+ var d_1 = $6.derived(() => $6.get(conditionsOnly) && fieldValueType($6.get(condition).field) === "boolean");
3808
+ var consequent_9 = ($$anchor5) => {
3809
+ var select_2 = root_132();
3810
+ $6.each(select_2, 21, () => fieldEnumOptions($6.get(condition).field), (option) => option.value, ($$anchor6, option) => {
584
3811
  var option_3 = root_9();
585
- var text_6 = $.child(option_3, true);
586
- $.reset(option_3);
3812
+ var text_6 = $6.child(option_3, true);
3813
+ $6.reset(option_3);
587
3814
  var option_3_value = {};
588
- $.template_effect(() => {
589
- $.set_text(text_6, $.get(option).label);
590
- if (option_3_value !== (option_3_value = $.get(option).value)) {
591
- option_3.value = (option_3.__value = $.get(option).value) ?? "";
3815
+ $6.template_effect(() => {
3816
+ $6.set_text(text_6, $6.get(option).label);
3817
+ if (option_3_value !== (option_3_value = $6.get(option).value)) {
3818
+ option_3.value = (option_3.__value = $6.get(option).value) ?? "";
592
3819
  }
593
3820
  });
594
- $.append($$anchor6, option_3);
3821
+ $6.append($$anchor6, option_3);
595
3822
  });
596
- $.reset(select_2);
3823
+ $6.reset(select_2);
597
3824
  var select_2_value;
598
- $.init_select(select_2);
599
- $.template_effect(() => {
600
- $.set_attribute(select_2, "aria-label", `Value for condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
601
- if (select_2_value !== (select_2_value = $.get(condition).value)) {
602
- select_2.value = (select_2.__value = $.get(condition).value) ?? "", $.select_option(select_2, $.get(condition).value);
3825
+ $6.init_select(select_2);
3826
+ $6.template_effect(() => {
3827
+ $6.set_attribute(select_2, "aria-label", `Value for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3828
+ if (select_2_value !== (select_2_value = $6.get(condition).value)) {
3829
+ select_2.value = (select_2.__value = $6.get(condition).value) ?? "", $6.select_option(select_2, $6.get(condition).value);
603
3830
  }
604
3831
  });
605
- $.delegated("change", select_2, (event2) => handleUpdateCondition($.get(rule).id, $.get(condition).id, "value", event2.target.value));
606
- $.append($$anchor5, select_2);
3832
+ $6.delegated("change", select_2, (event3) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "value", event3.target.value));
3833
+ $6.append($$anchor5, select_2);
607
3834
  };
608
- var d_2 = $.derived(() => $.get(conditionsOnly) && fieldValueType($.get(condition).field) === "enum");
609
- var alternate_3 = ($$anchor5) => {
610
- var input_3 = root_13();
611
- $.remove_input_defaults(input_3);
612
- $.template_effect(() => {
613
- $.set_attribute(input_3, "aria-label", `Value for condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
614
- $.set_value(input_3, $.get(condition).value);
3835
+ var d_2 = $6.derived(() => $6.get(conditionsOnly) && fieldValueType($6.get(condition).field) === "enum");
3836
+ var alternate_4 = ($$anchor5) => {
3837
+ var input_3 = root_14();
3838
+ $6.remove_input_defaults(input_3);
3839
+ $6.template_effect(() => {
3840
+ $6.set_attribute(input_3, "aria-label", `Value for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3841
+ $6.set_value(input_3, $6.get(condition).value);
615
3842
  });
616
- $.delegated("input", input_3, (event2) => handleUpdateCondition($.get(rule).id, $.get(condition).id, "value", event2.target.value));
617
- $.append($$anchor5, input_3);
3843
+ $6.delegated("input", input_3, (event3) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "value", event3.target.value));
3844
+ $6.append($$anchor5, input_3);
618
3845
  };
619
- $.if(node_8, ($$render) => {
620
- if ($.get(d))
621
- $$render(consequent_6);
622
- else if ($.get(d_1))
623
- $$render(consequent_7, 1);
624
- else if ($.get(d_2))
625
- $$render(consequent_8, 2);
3846
+ $6.if(node_9, ($$render) => {
3847
+ if ($6.get(d))
3848
+ $$render(consequent_7);
3849
+ else if ($6.get(d_1))
3850
+ $$render(consequent_8, 1);
3851
+ else if ($6.get(d_2))
3852
+ $$render(consequent_9, 2);
626
3853
  else
627
- $$render(alternate_3, -1);
3854
+ $$render(alternate_4, -1);
628
3855
  });
629
3856
  }
630
- var button_3 = $.sibling(node_8, 2);
631
- $.reset(div_7);
632
- $.template_effect(($0) => {
633
- $.set_attribute(select, "aria-label", `Field for condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
634
- if (select_value !== (select_value = $.get(condition).field)) {
635
- select.value = (select.__value = $.get(condition).field) ?? "", $.select_option(select, $.get(condition).field);
636
- }
637
- $.set_attribute(select_1, "aria-label", `Operator for condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
3857
+ var button_3 = $6.sibling(node_9, 2);
3858
+ $6.reset(div_7);
3859
+ $6.template_effect(($0) => {
3860
+ $6.set_attribute(select_1, "aria-label", `Operator for condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
638
3861
  if (select_1_value !== (select_1_value = $0)) {
639
- select_1.value = (select_1.__value = $0) ?? "", $.select_option(select_1, $0);
3862
+ select_1.value = (select_1.__value = $0) ?? "", $6.select_option(select_1, $0);
640
3863
  }
641
- $.set_attribute(button_3, "aria-label", `Remove condition ${$.get(conditionIndex) + 1} of ${$.get(rule).label}`);
642
- }, [() => displayOperator($.get(condition).operator)]);
643
- $.delegated("change", select, (event2) => handleUpdateCondition($.get(rule).id, $.get(condition).id, "field", event2.target.value));
644
- $.delegated("change", select_1, (event2) => handleUpdateCondition($.get(rule).id, $.get(condition).id, "operator", event2.target.value));
645
- $.delegated("click", button_3, () => handleRemoveCondition($.get(rule).id, $.get(condition).id, $.get(conditionIndex), $.get(ruleIndex)));
646
- $.append($$anchor4, div_7);
3864
+ $6.set_attribute(button_3, "aria-label", `Remove condition ${$6.get(conditionIndex) + 1} of ${$6.get(rule).label}`);
3865
+ }, [() => displayOperator($6.get(condition).operator)]);
3866
+ $6.delegated("change", select_1, (event3) => handleUpdateCondition($6.get(rule).id, $6.get(condition).id, "operator", event3.target.value));
3867
+ $6.delegated("click", button_3, () => handleRemoveCondition($6.get(rule).id, $6.get(condition).id, $6.get(conditionIndex), $6.get(ruleIndex)));
3868
+ $6.append($$anchor4, div_7);
647
3869
  });
648
- $.reset(div_6);
649
- var button_4 = $.sibling(div_6, 2);
650
- var text_7 = $.child(button_4);
651
- $.reset(button_4);
652
- $.template_effect(() => {
653
- $.set_attribute(div_6, "aria-labelledby", `${baseId}-rule-${$.get(ruleIndex)}-conditions-label`);
654
- $.set_attribute(button_4, "aria-label", `${addConditionLabel()} to ${$.get(rule).label}`);
655
- $.set_text(text_7, `+ ${addConditionLabel() ?? ""}`);
3870
+ $6.reset(div_6);
3871
+ var button_4 = $6.sibling(div_6, 2);
3872
+ var text_7 = $6.child(button_4);
3873
+ $6.reset(button_4);
3874
+ $6.template_effect(() => {
3875
+ $6.set_attribute(div_6, "aria-labelledby", `${baseId}-rule-${$6.get(ruleIndex)}-conditions-label`);
3876
+ $6.set_attribute(button_4, "aria-label", `${addConditionLabel()} to ${$6.get(rule).label}`);
3877
+ $6.set_text(text_7, `+ ${addConditionLabel() ?? ""}`);
656
3878
  });
657
- $.delegated("click", button_4, () => handleAddCondition($.get(rule).id));
658
- $.append($$anchor3, fragment_2);
3879
+ $6.delegated("click", button_4, () => handleAddCondition($6.get(rule).id));
3880
+ $6.append($$anchor3, fragment_2);
659
3881
  };
660
- $.if(node_5, ($$render) => {
661
- if ($.get(effectiveReadonly))
3882
+ $6.if(node_5, ($$render) => {
3883
+ if ($6.get(effectiveReadonly))
662
3884
  $$render(consequent_5);
663
3885
  else
664
- $$render(alternate_4, -1);
3886
+ $$render(alternate_5, -1);
665
3887
  });
666
3888
  }
667
- $.reset(div_3);
668
- var node_9 = $.sibling(div_3, 2);
3889
+ $6.reset(div_3);
3890
+ var node_10 = $6.sibling(div_3, 2);
669
3891
  {
670
- var consequent_12 = ($$anchor3) => {
671
- var div_8 = root_20();
672
- var span_1 = $.child(div_8);
673
- var node_10 = $.sibling(span_1, 2);
3892
+ var consequent_13 = ($$anchor3) => {
3893
+ var div_8 = root_21();
3894
+ var span_1 = $6.child(div_8);
3895
+ var node_11 = $6.sibling(span_1, 2);
674
3896
  {
675
- var consequent_9 = ($$anchor4) => {
676
- var p_2 = root_16();
677
- $.append($$anchor4, p_2);
3897
+ var consequent_10 = ($$anchor4) => {
3898
+ var p_2 = root_17();
3899
+ $6.append($$anchor4, p_2);
678
3900
  };
679
- $.if(node_10, ($$render) => {
680
- if (!$.get(effectiveReadonly) && $.get(rule).actions.length === 0)
681
- $$render(consequent_9);
3901
+ $6.if(node_11, ($$render) => {
3902
+ if (!$6.get(effectiveReadonly) && $6.get(rule).actions.length === 0)
3903
+ $$render(consequent_10);
682
3904
  });
683
3905
  }
684
- var node_11 = $.sibling(node_10, 2);
3906
+ var node_12 = $6.sibling(node_11, 2);
685
3907
  {
686
- var consequent_11 = ($$anchor4) => {
687
- var div_9 = root_8();
688
- var node_12 = $.child(div_9);
3908
+ var consequent_12 = ($$anchor4) => {
3909
+ var div_9 = root_82();
3910
+ var node_13 = $6.child(div_9);
689
3911
  {
690
- var consequent_10 = ($$anchor5) => {
691
- var p_3 = root_17();
692
- $.append($$anchor5, p_3);
3912
+ var consequent_11 = ($$anchor5) => {
3913
+ var p_3 = root_18();
3914
+ $6.append($$anchor5, p_3);
693
3915
  };
694
- var alternate_5 = ($$anchor5) => {
695
- var fragment_3 = $.comment();
696
- var node_13 = $.first_child(fragment_3);
697
- $.each(node_13, 17, () => $.get(rule).actions, (action) => action.id, ($$anchor6, action) => {
698
- var div_10 = root_7();
699
- var text_8 = $.child(div_10, true);
700
- $.reset(div_10);
701
- $.template_effect(($0) => $.set_text(text_8, $0), [() => actionSummary($.get(action))]);
702
- $.append($$anchor6, div_10);
3916
+ var alternate_6 = ($$anchor5) => {
3917
+ var fragment_4 = $6.comment();
3918
+ var node_14 = $6.first_child(fragment_4);
3919
+ $6.each(node_14, 17, () => $6.get(rule).actions, (action) => action.id, ($$anchor6, action) => {
3920
+ var div_10 = root_72();
3921
+ var text_8 = $6.child(div_10, true);
3922
+ $6.reset(div_10);
3923
+ $6.template_effect(($0) => $6.set_text(text_8, $0), [() => actionSummary($6.get(action))]);
3924
+ $6.append($$anchor6, div_10);
703
3925
  });
704
- $.append($$anchor5, fragment_3);
3926
+ $6.append($$anchor5, fragment_4);
705
3927
  };
706
- $.if(node_12, ($$render) => {
707
- if ($.get(rule).actions.length === 0)
708
- $$render(consequent_10);
3928
+ $6.if(node_13, ($$render) => {
3929
+ if ($6.get(rule).actions.length === 0)
3930
+ $$render(consequent_11);
709
3931
  else
710
- $$render(alternate_5, -1);
3932
+ $$render(alternate_6, -1);
711
3933
  });
712
3934
  }
713
- $.reset(div_9);
714
- $.template_effect(() => $.set_attribute(div_9, "aria-label", `Actions for ${$.get(rule).label}`));
715
- $.append($$anchor4, div_9);
3935
+ $6.reset(div_9);
3936
+ $6.template_effect(() => $6.set_attribute(div_9, "aria-label", `Actions for ${$6.get(rule).label}`));
3937
+ $6.append($$anchor4, div_9);
716
3938
  };
717
- var alternate_6 = ($$anchor4) => {
718
- var fragment_4 = root_19();
719
- var div_11 = $.first_child(fragment_4);
720
- $.each(div_11, 23, () => $.get(rule).actions, (action) => action.id, ($$anchor5, action, actionIndex) => {
721
- var div_12 = root_18();
722
- var select_3 = $.child(div_12);
723
- $.each(select_3, 21, () => $.get(resolvedActionOptions), (option) => option.value, ($$anchor6, option) => {
3939
+ var alternate_7 = ($$anchor4) => {
3940
+ var fragment_5 = root_20();
3941
+ var div_11 = $6.first_child(fragment_5);
3942
+ $6.each(div_11, 23, () => $6.get(rule).actions, (action) => action.id, ($$anchor5, action, actionIndex) => {
3943
+ var div_12 = root_19();
3944
+ var select_3 = $6.child(div_12);
3945
+ $6.each(select_3, 21, () => $6.get(resolvedActionOptions), (option) => option.value, ($$anchor6, option) => {
724
3946
  var option_4 = root_9();
725
- var text_9 = $.child(option_4, true);
726
- $.reset(option_4);
3947
+ var text_9 = $6.child(option_4, true);
3948
+ $6.reset(option_4);
727
3949
  var option_4_value = {};
728
- $.template_effect(() => {
729
- $.set_text(text_9, $.get(option).label);
730
- if (option_4_value !== (option_4_value = $.get(option).value)) {
731
- option_4.value = (option_4.__value = $.get(option).value) ?? "";
3950
+ $6.template_effect(() => {
3951
+ $6.set_text(text_9, $6.get(option).label);
3952
+ if (option_4_value !== (option_4_value = $6.get(option).value)) {
3953
+ option_4.value = (option_4.__value = $6.get(option).value) ?? "";
732
3954
  }
733
3955
  });
734
- $.append($$anchor6, option_4);
3956
+ $6.append($$anchor6, option_4);
735
3957
  });
736
- $.reset(select_3);
3958
+ $6.reset(select_3);
737
3959
  var select_3_value;
738
- $.init_select(select_3);
739
- var button_5 = $.sibling(select_3, 2);
740
- $.reset(div_12);
741
- $.template_effect(() => {
742
- $.set_attribute(select_3, "aria-label", `Action ${$.get(actionIndex) + 1} target for ${$.get(rule).label}`);
743
- if (select_3_value !== (select_3_value = $.get(action).target)) {
744
- select_3.value = (select_3.__value = $.get(action).target) ?? "", $.select_option(select_3, $.get(action).target);
3960
+ $6.init_select(select_3);
3961
+ var button_5 = $6.sibling(select_3, 2);
3962
+ $6.reset(div_12);
3963
+ $6.template_effect(() => {
3964
+ $6.set_attribute(select_3, "aria-label", `Action ${$6.get(actionIndex) + 1} target for ${$6.get(rule).label}`);
3965
+ if (select_3_value !== (select_3_value = $6.get(action).target)) {
3966
+ select_3.value = (select_3.__value = $6.get(action).target) ?? "", $6.select_option(select_3, $6.get(action).target);
745
3967
  }
746
- $.set_attribute(button_5, "aria-label", `Remove action ${$.get(actionIndex) + 1} of ${$.get(rule).label}`);
3968
+ $6.set_attribute(button_5, "aria-label", `Remove action ${$6.get(actionIndex) + 1} of ${$6.get(rule).label}`);
747
3969
  });
748
- $.delegated("change", select_3, (event2) => handleUpdateAction($.get(rule).id, $.get(action).id, event2.target.value));
749
- $.delegated("click", button_5, () => handleRemoveAction($.get(rule).id, $.get(action).id, $.get(actionIndex), $.get(ruleIndex)));
750
- $.append($$anchor5, div_12);
3970
+ $6.delegated("change", select_3, (event3) => handleUpdateAction($6.get(rule).id, $6.get(action).id, event3.target.value));
3971
+ $6.delegated("click", button_5, () => handleRemoveAction($6.get(rule).id, $6.get(action).id, $6.get(actionIndex), $6.get(ruleIndex)));
3972
+ $6.append($$anchor5, div_12);
751
3973
  });
752
- $.reset(div_11);
753
- var button_6 = $.sibling(div_11, 2);
754
- var text_10 = $.child(button_6);
755
- $.reset(button_6);
756
- $.template_effect(() => {
757
- $.set_attribute(div_11, "aria-labelledby", `${baseId}-rule-${$.get(ruleIndex)}-actions-label`);
758
- $.set_attribute(button_6, "aria-label", `${addActionLabel()} to ${$.get(rule).label}`);
759
- $.set_text(text_10, `+ ${addActionLabel() ?? ""}`);
3974
+ $6.reset(div_11);
3975
+ var button_6 = $6.sibling(div_11, 2);
3976
+ var text_10 = $6.child(button_6);
3977
+ $6.reset(button_6);
3978
+ $6.template_effect(() => {
3979
+ $6.set_attribute(div_11, "aria-labelledby", `${baseId}-rule-${$6.get(ruleIndex)}-actions-label`);
3980
+ $6.set_attribute(button_6, "aria-label", `${addActionLabel()} to ${$6.get(rule).label}`);
3981
+ $6.set_text(text_10, `+ ${addActionLabel() ?? ""}`);
760
3982
  });
761
- $.delegated("click", button_6, () => handleAddAction($.get(rule).id));
762
- $.append($$anchor4, fragment_4);
3983
+ $6.delegated("click", button_6, () => handleAddAction($6.get(rule).id));
3984
+ $6.append($$anchor4, fragment_5);
763
3985
  };
764
- $.if(node_11, ($$render) => {
765
- if ($.get(effectiveReadonly))
766
- $$render(consequent_11);
3986
+ $6.if(node_12, ($$render) => {
3987
+ if ($6.get(effectiveReadonly))
3988
+ $$render(consequent_12);
767
3989
  else
768
- $$render(alternate_6, -1);
3990
+ $$render(alternate_7, -1);
769
3991
  });
770
3992
  }
771
- $.reset(div_8);
772
- $.template_effect(() => $.set_attribute(span_1, "id", `${baseId}-rule-${$.get(ruleIndex)}-actions-label`));
773
- $.append($$anchor3, div_8);
3993
+ $6.reset(div_8);
3994
+ $6.template_effect(() => $6.set_attribute(span_1, "id", `${baseId}-rule-${$6.get(ruleIndex)}-actions-label`));
3995
+ $6.append($$anchor3, div_8);
774
3996
  };
775
- $.if(node_9, ($$render) => {
3997
+ $6.if(node_10, ($$render) => {
776
3998
  if (mode() === "full")
777
- $$render(consequent_12);
3999
+ $$render(consequent_13);
778
4000
  });
779
4001
  }
780
- $.reset(div);
781
- $.template_effect(() => {
782
- $.set_attribute(div, "data-irb-rule", $.get(ruleIndex));
783
- $.set_attribute(span, "id", `${baseId}-rule-${$.get(ruleIndex)}-conditions-label`);
4002
+ $6.reset(div);
4003
+ $6.template_effect(() => {
4004
+ $6.set_attribute(div, "data-irb-rule", $6.get(ruleIndex));
4005
+ $6.set_attribute(span, "id", `${baseId}-rule-${$6.get(ruleIndex)}-conditions-label`);
784
4006
  });
785
- $.append($$anchor2, div);
4007
+ $6.append($$anchor2, div);
786
4008
  });
787
- var node_14 = $.sibling(node, 2);
4009
+ var node_15 = $6.sibling(node, 2);
788
4010
  {
789
- var consequent_13 = ($$anchor2) => {
790
- var button_7 = root_22();
791
- var text_11 = $.child(button_7);
792
- $.reset(button_7);
793
- $.template_effect(() => $.set_text(text_11, `+ ${addRuleLabel() ?? ""}`));
794
- $.delegated("click", button_7, handleAddRule);
795
- $.append($$anchor2, button_7);
4011
+ var consequent_14 = ($$anchor2) => {
4012
+ var button_7 = root_232();
4013
+ var text_11 = $6.child(button_7);
4014
+ $6.reset(button_7);
4015
+ $6.template_effect(() => $6.set_text(text_11, `+ ${addRuleLabel() ?? ""}`));
4016
+ $6.delegated("click", button_7, handleAddRule);
4017
+ $6.append($$anchor2, button_7);
796
4018
  };
797
- $.if(node_14, ($$render) => {
798
- if (!$.get(effectiveReadonly) && !$.get(flatConditions))
799
- $$render(consequent_13);
4019
+ $6.if(node_15, ($$render) => {
4020
+ if (!$6.get(effectiveReadonly) && !$6.get(flatConditions))
4021
+ $$render(consequent_14);
800
4022
  });
801
4023
  }
802
- var node_15 = $.sibling(node_14, 2);
4024
+ var node_16 = $6.sibling(node_15, 2);
803
4025
  {
804
- var consequent_14 = ($$anchor2) => {
805
- var p_4 = root_23();
806
- $.append($$anchor2, p_4);
4026
+ var consequent_15 = ($$anchor2) => {
4027
+ var p_4 = root_24();
4028
+ $6.append($$anchor2, p_4);
807
4029
  };
808
- $.if(node_15, ($$render) => {
809
- if ($.get(renderedRules).length === 0 && $.get(effectiveReadonly))
810
- $$render(consequent_14);
4030
+ $6.if(node_16, ($$render) => {
4031
+ if ($6.get(renderedRules).length === 0 && $6.get(effectiveReadonly))
4032
+ $$render(consequent_15);
811
4033
  });
812
4034
  }
813
- $.reset(section);
814
- var div_13 = $.sibling(section, 2);
815
- var text_12 = $.child(div_13, true);
816
- $.reset(div_13);
817
- $.template_effect(() => $.set_text(text_12, $.get(announcement)));
818
- $.append($$anchor, fragment);
819
- $.pop();
4035
+ $6.reset(section);
4036
+ var div_13 = $6.sibling(section, 2);
4037
+ var text_12 = $6.child(div_13, true);
4038
+ $6.reset(div_13);
4039
+ $6.template_effect(() => $6.set_text(text_12, $6.get(announcement)));
4040
+ $6.append($$anchor, fragment);
4041
+ $6.pop();
820
4042
  }
821
- $.delegate(["input", "keydown", "click", "change"]);
4043
+ $6.delegate(["input", "keydown", "click", "change"]);
822
4044
 
823
4045
  // src/components/invocation-rule-builder/index.ts
824
4046
  var invocation_rule_builder_default = Invocation_rule_builder;
@@ -827,4 +4049,4 @@ export {
827
4049
  Invocation_rule_builder as InvocationRuleBuilder
828
4050
  };
829
4051
 
830
- //# debugId=0B534AAA5E880EC064756E2164756E21
4052
+ //# debugId=37AFC5D76EEF116F64756E2164756E21