@redocly/config-rules-builder 0.0.1 → 0.1.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.
@@ -0,0 +1,4091 @@
1
+ import { useEffect as N, useId as Dr, useMemo as Y, useRef as A, useState as I } from "react";
2
+ import n, { css as Ne } from "styled-components";
3
+ import { Oas3_1Types as Lr, YamlParseError as Or, createConfig as zr, getAstNodeByPointer as Br, lintFromString as Nr } from "@redocly/openapi-core";
4
+ import { safeLoad as jr } from "yaml-ast-parser";
5
+ import { dump as qr, load as Fr } from "js-yaml";
6
+ import { Fragment as X, jsx as r, jsxs as d } from "react/jsx-runtime";
7
+ import { defaultKeymap as _r, history as Kr, historyKeymap as Ur } from "@codemirror/commands";
8
+ import { yaml as Wr } from "@codemirror/lang-yaml";
9
+ import { defaultHighlightStyle as Hr, syntaxHighlighting as Gr } from "@codemirror/language";
10
+ import { EditorState as Yr, RangeSet as je, StateEffect as qe, StateField as Fe } from "@codemirror/state";
11
+ import { Decoration as z, EditorView as ie, GutterMarker as Vr, gutter as Jr, hoverTooltip as Qr, keymap as Xr, lineNumbers as Zr } from "@codemirror/view";
12
+ var yr = "var(--font-family-base, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif)", D = "var(--font-family-monospaced, 'SF Mono', 'JetBrains Mono', ui-monospace, Menlo, Monaco, 'Courier New', monospace)", H = {
13
+ subject: {
14
+ fg: "#2563eb",
15
+ line: "#c9dafb",
16
+ soft: "#eff4fe"
17
+ },
18
+ where: {
19
+ fg: "#7c3aed",
20
+ line: "#e2d6fa",
21
+ soft: "#f4f0fe"
22
+ },
23
+ assert: {
24
+ fg: "#b45309",
25
+ line: "#f5ddb8",
26
+ soft: "#fef3e2"
27
+ },
28
+ message: {
29
+ fg: "#15803d",
30
+ line: "#c9e8d3",
31
+ soft: "#eaf7ef"
32
+ },
33
+ suggest: {
34
+ fg: "#0e7490",
35
+ line: "#bfe3ec",
36
+ soft: "#e7f4f8"
37
+ }
38
+ }, be = {
39
+ bg: "var(--color-success-bg, #eaf7ef)",
40
+ fg: "var(--color-success-text, #15803d)"
41
+ }, F = {
42
+ error: {
43
+ bg: "var(--color-error-bg, #fef2f2)",
44
+ fg: "var(--color-error-base, #dc2626)"
45
+ },
46
+ warn: {
47
+ bg: "var(--color-warning-bg, #fef3e2)",
48
+ fg: "var(--color-warning-text, #b45309)"
49
+ },
50
+ off: {
51
+ bg: "var(--color-warm-grey-1, #fbfbfc)",
52
+ fg: "var(--text-color-secondary, #64748b)"
53
+ }
54
+ }, et = `openapi: 3.1.0
55
+ info:
56
+ title: Redocly Museum API
57
+ description: Imaginary, but delightful Museum API for interacting with museum services and information. Built with love by Redocly.
58
+ version: 1.2.1
59
+ termsOfService: 'https://redocly.com/subscription-agreement/'
60
+ contact:
61
+ email: team@redocly.com
62
+ url: "https://redocly.com/docs/cli/"
63
+ license:
64
+ name: MIT
65
+ url: "https://opensource.org/license/mit/"
66
+ servers:
67
+ - url: "https://redocly.com/_mock/docs/openapi/museum-api"
68
+ paths:
69
+ /museum-hours:
70
+ get:
71
+ summary: Get museum hours
72
+ description: Get upcoming museum operating hours.
73
+ operationId: getMuseumHours
74
+ tags:
75
+ - Operations
76
+ parameters:
77
+ - $ref: "#/components/parameters/StartDate"
78
+ - $ref: "#/components/parameters/PaginationPage"
79
+ - $ref: "#/components/parameters/PaginationLimit"
80
+ responses:
81
+ "200":
82
+ description: Success.
83
+ content:
84
+ application/json:
85
+ schema:
86
+ $ref: "#/components/schemas/MuseumHours"
87
+ examples:
88
+ default_example:
89
+ $ref: "#/components/examples/GetMuseumHoursResponseExample"
90
+ "400":
91
+ $ref: '#/components/responses/BadRequest'
92
+ "404":
93
+ $ref: '#/components/responses/NotFound'
94
+ /special-events:
95
+ post:
96
+ summary: Create special events
97
+ description: Creates a new special event for the museum.
98
+ operationId: createSpecialEvent
99
+ tags:
100
+ - Events
101
+ requestBody:
102
+ required: true
103
+ content:
104
+ application/json:
105
+ schema:
106
+ $ref: "#/components/schemas/SpecialEvent"
107
+ examples:
108
+ default_example:
109
+ $ref: "#/components/examples/CreateSpecialEventRequestExample"
110
+ responses:
111
+ "201":
112
+ description: Created.
113
+ content:
114
+ application/json:
115
+ schema:
116
+ $ref: "#/components/schemas/SpecialEvent"
117
+ examples:
118
+ default_example:
119
+ $ref: "#/components/examples/CreateSpecialEventResponseExample"
120
+ "400":
121
+ $ref: '#/components/responses/BadRequest'
122
+ "404":
123
+ $ref: '#/components/responses/NotFound'
124
+ get:
125
+ summary: List special events
126
+ description: Return a list of upcoming special events at the museum.
127
+ operationId: listSpecialEvents
128
+ tags:
129
+ - Events
130
+ parameters:
131
+ - $ref: "#/components/parameters/StartDate"
132
+ - $ref: "#/components/parameters/EndDate"
133
+ - $ref: "#/components/parameters/PaginationPage"
134
+ - $ref: "#/components/parameters/PaginationLimit"
135
+ responses:
136
+ "200":
137
+ description: Success.
138
+ content:
139
+ application/json:
140
+ schema:
141
+ $ref: "#/components/schemas/SpecialEventCollection"
142
+ examples:
143
+ default_example:
144
+ $ref: "#/components/examples/ListSpecialEventsResponseExample"
145
+ "400":
146
+ $ref: '#/components/responses/BadRequest'
147
+ "404":
148
+ $ref: '#/components/responses/NotFound'
149
+ /special-events/{eventId}:
150
+ get:
151
+ summary: Get special event
152
+ description: Get details about a special event.
153
+ operationId: getSpecialEvent
154
+ tags:
155
+ - Events
156
+ parameters:
157
+ - $ref: "#/components/parameters/EventId"
158
+ responses:
159
+ "200":
160
+ description: Success.
161
+ content:
162
+ application/json:
163
+ schema:
164
+ $ref: "#/components/schemas/SpecialEvent"
165
+ examples:
166
+ default_example:
167
+ $ref: "#/components/examples/GetSpecialEventResponseExample"
168
+ "400":
169
+ $ref: '#/components/responses/BadRequest'
170
+ "404":
171
+ $ref: '#/components/responses/NotFound'
172
+ patch:
173
+ summary: Update special event
174
+ description: Update the details of a special event.
175
+ operationId: updateSpecialEvent
176
+ tags:
177
+ - Events
178
+ parameters:
179
+ - $ref: "#/components/parameters/EventId"
180
+ requestBody:
181
+ required: true
182
+ content:
183
+ application/json:
184
+ schema:
185
+ $ref: "#/components/schemas/SpecialEventFields"
186
+ examples:
187
+ default_example:
188
+ $ref: "#/components/examples/UpdateSpecialEventRequestExample"
189
+ responses:
190
+ "200":
191
+ description: Success.
192
+ content:
193
+ application/json:
194
+ schema:
195
+ $ref: "#/components/schemas/SpecialEvent"
196
+ examples:
197
+ default_example:
198
+ $ref: "#/components/examples/UpdateSpecialEventResponseExample"
199
+ "400":
200
+ $ref: '#/components/responses/BadRequest'
201
+ "404":
202
+ $ref: '#/components/responses/NotFound'
203
+ delete:
204
+ summary: Delete special event
205
+ description: Delete a special event from the collection. Allows museum to cancel planned events.
206
+ operationId: deleteSpecialEvent
207
+ tags:
208
+ - Events
209
+ parameters:
210
+ - $ref: "#/components/parameters/EventId"
211
+ responses:
212
+ "204":
213
+ description: Success - no content.
214
+ "400":
215
+ $ref: '#/components/responses/BadRequest'
216
+ "401":
217
+ $ref: '#/components/responses/Unauthorized'
218
+ "404":
219
+ $ref: '#/components/responses/NotFound'
220
+ /tickets:
221
+ post:
222
+ summary: Buy museum tickets
223
+ description: Purchase museum tickets for general entry or special events.
224
+ operationId: buyMuseumTickets
225
+ tags:
226
+ - Tickets
227
+ requestBody:
228
+ required: true
229
+ content:
230
+ application/json:
231
+ schema:
232
+ $ref: "#/components/schemas/BuyMuseumTickets"
233
+ examples:
234
+ general_entry:
235
+ $ref: "#/components/examples/BuyGeneralTicketsRequestExample"
236
+ event_entry:
237
+ $ref: "#/components/examples/BuyEventTicketsRequestExample"
238
+ responses:
239
+ "201":
240
+ description: Created.
241
+ content:
242
+ application/json:
243
+ schema:
244
+ $ref: "#/components/schemas/MuseumTicketsConfirmation"
245
+ examples:
246
+ general_entry:
247
+ $ref: "#/components/examples/BuyGeneralTicketsResponseExample"
248
+ event_entry:
249
+ $ref: "#/components/examples/BuyEventTicketsResponseExample"
250
+ "400":
251
+ $ref: '#/components/responses/BadRequest'
252
+ "404":
253
+ $ref: '#/components/responses/NotFound'
254
+ /tickets/{ticketId}/qr:
255
+ get:
256
+ summary: Get ticket QR code
257
+ description: Return an image of your ticket with scannable QR code. Used for event entry.
258
+ operationId: getTicketCode
259
+ tags:
260
+ - Tickets
261
+ parameters:
262
+ - $ref: "#/components/parameters/TicketId"
263
+ responses:
264
+ "200":
265
+ description: Scannable event ticket in image format.
266
+ content:
267
+ image/png:
268
+ schema:
269
+ $ref: "#/components/schemas/TicketCodeImage"
270
+ "400":
271
+ $ref: '#/components/responses/BadRequest'
272
+ "404":
273
+ $ref: '#/components/responses/NotFound'
274
+ webhooks:
275
+ publishNewEvent:
276
+ post:
277
+ summary: New special event added
278
+ description: Publish details of a new or updated event.
279
+ operationId: publishNewEvent
280
+ tags:
281
+ - Events
282
+ requestBody:
283
+ content:
284
+ application/json:
285
+ schema:
286
+ $ref: "#/components/schemas/SpecialEvent"
287
+ examples:
288
+ default_example:
289
+ $ref: "#/components/examples/GetSpecialEventResponseExample"
290
+ responses:
291
+ "202":
292
+ description: Data accepted.
293
+
294
+ components:
295
+ schemas:
296
+ TicketType:
297
+ description: Type of ticket being purchased. Use \`general\` for regular museum entry and \`event\` for tickets to special events.
298
+ type: string
299
+ enum:
300
+ - event
301
+ - general
302
+ example: event
303
+ Date:
304
+ type: string
305
+ format: date
306
+ example: '2023-10-29'
307
+ Email:
308
+ description: Email address for ticket purchaser.
309
+ type: string
310
+ format: email
311
+ example: museum-lover@example.com
312
+ BuyMuseumTickets:
313
+ description: Data to purchase a ticket.
314
+ type: object
315
+ allOf:
316
+ - type: object
317
+ properties:
318
+ email:
319
+ $ref: "#/components/schemas/Email"
320
+ - $ref: "#/components/schemas/Ticket"
321
+ TicketMessage:
322
+ description: Confirmation message after a ticket purchase.
323
+ type: string
324
+ example: Museum general entry ticket purchased
325
+ TicketId:
326
+ description: Unique identifier for museum ticket. Generated when purchased.
327
+ type: string
328
+ format: uuid
329
+ example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c
330
+ TicketConfirmation:
331
+ description: Unique confirmation code used to verify ticket purchase.
332
+ type: string
333
+ example: 'ticket-event-a98c8f-7eb12'
334
+ Ticket:
335
+ description: Ticket for museum entry, can be general admission or special event.
336
+ type: object
337
+ properties:
338
+ ticketId:
339
+ $ref: "#/components/schemas/TicketId"
340
+ ticketDate:
341
+ description: Date when this ticket can be used for museum entry.
342
+ $ref: "#/components/schemas/Date"
343
+ ticketType:
344
+ $ref: "#/components/schemas/TicketType"
345
+ eventId:
346
+ description: Unique identifier for a special event. Required if purchasing tickets for the museum's special events.
347
+ $ref: "#/components/schemas/EventId"
348
+ required:
349
+ - ticketType
350
+ - ticketDate
351
+ MuseumTicketsConfirmation:
352
+ description: Details for a museum ticket after a successful purchase.
353
+ allOf:
354
+ - $ref: "#/components/schemas/Ticket"
355
+ - type: object
356
+ properties:
357
+ message:
358
+ $ref: "#/components/schemas/TicketMessage"
359
+ confirmationCode:
360
+ $ref: "#/components/schemas/TicketConfirmation"
361
+ required:
362
+ - message
363
+ - confirmationCode
364
+ TicketCodeImage:
365
+ description: Image of a ticket with a QR code used for museum or event entry.
366
+ type: string
367
+ format: binary
368
+ MuseumHours:
369
+ description: List of museum operating hours for a date range.
370
+ type: array
371
+ items:
372
+ $ref: "#/components/schemas/MuseumDailyHours"
373
+ MuseumDailyHours:
374
+ description: Daily operating hours for the museum.
375
+ type: object
376
+ properties:
377
+ date:
378
+ description: Date the operating hours apply to.
379
+ $ref: "#/components/schemas/Date"
380
+ example: '2024-12-31'
381
+ timeOpen:
382
+ type: string
383
+ pattern: '^([01]\\d|2[0-3]):?([0-5]\\d)$'
384
+ description: Time the museum opens on a specific date. Uses 24 hour time format (\`HH:mm\`).
385
+ example: 09:00
386
+ timeClose:
387
+ description: Time the museum closes on a specific date. Uses 24 hour time format (\`HH:mm\`).
388
+ type: string
389
+ pattern: '^([01]\\d|2[0-3]):?([0-5]\\d)$'
390
+ example: 18:00
391
+ required:
392
+ - date
393
+ - timeOpen
394
+ - timeClose
395
+ EventId:
396
+ description: Identifier for a special event.
397
+ type: string
398
+ format: uuid
399
+ example: 3be6453c-03eb-4357-ae5a-984a0e574a54
400
+ EventName:
401
+ type: string
402
+ description: Name of the special event.
403
+ example: Pirate Coding Workshop
404
+ EventLocation:
405
+ type: string
406
+ description: Location where the special event is held.
407
+ example: Computer Room
408
+ EventDescription:
409
+ type: string
410
+ description: Description of the special event.
411
+ example: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang).
412
+ EventDates:
413
+ type: array
414
+ items:
415
+ $ref: "#/components/schemas/Date"
416
+ description: List of planned dates for the special event.
417
+ EventPrice:
418
+ description: Price of a ticket for the special event.
419
+ type: number
420
+ format: float
421
+ example: 25
422
+ SpecialEventFields:
423
+ type: object
424
+ properties:
425
+ name:
426
+ $ref: "#/components/schemas/EventName"
427
+ location:
428
+ $ref: "#/components/schemas/EventLocation"
429
+ eventDescription:
430
+ $ref: "#/components/schemas/EventDescription"
431
+ dates:
432
+ $ref: "#/components/schemas/EventDates"
433
+ price:
434
+ $ref: "#/components/schemas/EventPrice"
435
+ SpecialEvent:
436
+ type: object
437
+ properties:
438
+ eventId:
439
+ $ref: "#/components/schemas/EventId"
440
+ name:
441
+ $ref: "#/components/schemas/EventName"
442
+ location:
443
+ $ref: "#/components/schemas/EventLocation"
444
+ eventDescription:
445
+ $ref: "#/components/schemas/EventDescription"
446
+ dates:
447
+ $ref: "#/components/schemas/EventDates"
448
+ price:
449
+ $ref: "#/components/schemas/EventPrice"
450
+ required:
451
+ - name
452
+ - location
453
+ - eventDescription
454
+ - dates
455
+ - price
456
+ SpecialEventCollection:
457
+ description: List of upcoming special events.
458
+ type: array
459
+ items:
460
+ $ref: "#/components/schemas/SpecialEvent"
461
+ Error:
462
+ type: object
463
+ properties:
464
+ type:
465
+ type: string
466
+ example: object
467
+ title:
468
+ type: string
469
+ example: Validation failed
470
+
471
+ securitySchemes:
472
+ MuseumPlaceholderAuth:
473
+ type: http
474
+ scheme: basic
475
+ examples:
476
+ BuyGeneralTicketsRequestExample:
477
+ summary: General entry ticket
478
+ value:
479
+ ticketType: general
480
+ ticketDate: '2023-09-07'
481
+ email: todd@example.com
482
+ BuyEventTicketsRequestExample:
483
+ summary: Special event ticket
484
+ value:
485
+ ticketType: event
486
+ eventId: dad4bce8-f5cb-4078-a211-995864315e39
487
+ ticketDate: '2023-09-05'
488
+ email: todd@example.com
489
+ BuyGeneralTicketsResponseExample:
490
+ summary: General entry ticket
491
+ value:
492
+ message: Museum general entry ticket purchased
493
+ ticketId: 382c0820-0530-4f4b-99af-13811ad0f17a
494
+ ticketType: general
495
+ ticketDate: '2023-09-07'
496
+ confirmationCode: ticket-general-e5e5c6-dce78
497
+ BuyEventTicketsResponseExample:
498
+ summary: Special event ticket
499
+ value:
500
+ message: Museum special event ticket purchased
501
+ ticketId: b811f723-17b2-44f7-8952-24b03e43d8a9
502
+ eventName: Mermaid Treasure Identification and Analysis
503
+ ticketType: event
504
+ ticketDate: '2023-09-05'
505
+ confirmationCode: ticket-event-9c55eg-8v82a
506
+ CreateSpecialEventRequestExample:
507
+ summary: Create special event
508
+ value:
509
+ name: Mermaid Treasure Identification and Analysis
510
+ location: Under the seaaa 🦀 🎶 🌊.
511
+ eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
512
+ dates:
513
+ - '2023-09-05'
514
+ - '2023-09-08'
515
+ price: 0
516
+ CreateSpecialEventResponseExample:
517
+ summary: Special event created
518
+ value:
519
+ eventId: dad4bce8-f5cb-4078-a211-995864315e39
520
+ name: Mermaid Treasure Identification and Analysis
521
+ location: Under the seaaa 🦀 🎶 🌊.
522
+ eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
523
+ dates:
524
+ - '2023-09-05'
525
+ - '2023-09-08'
526
+ price: 30
527
+ GetSpecialEventResponseExample:
528
+ summary: Get special event
529
+ value:
530
+ eventId: 6744a0da-4121-49cd-8479-f8cc20526495
531
+ name: Time Traveler Tea Party
532
+ location: Temporal Tearoom
533
+ eventDescription: Sip tea with important historical figures.
534
+ dates:
535
+ - '2023-11-18'
536
+ - '2023-11-25'
537
+ - '2023-12-02'
538
+ price: 60
539
+ ListSpecialEventsResponseExample:
540
+ summary: List of special events
541
+ value:
542
+ - eventId: f3e0e76e-e4a8-466e-ab9c-ae36c15b8e97
543
+ name: Sasquatch Ballet
544
+ location: Seattle... probably
545
+ eventDescription: They're big, they're hairy, but they're also graceful. Come learn how the biggest feet can have the lightest touch.
546
+ dates:
547
+ - '2023-12-15'
548
+ - '2023-12-22'
549
+ price: 40
550
+ - eventId: 2f14374a-9c65-4ee5-94b7-fba66d893483
551
+ name: Solar Telescope Demonstration
552
+ location: Far from the sun.
553
+ eventDescription: Look at the sun without going blind!
554
+ dates:
555
+ - '2023-09-07'
556
+ - '2023-09-14'
557
+ price: 50
558
+ - eventId: 6aaa61ba-b2aa-4868-b803-603dbbf7bfdb
559
+ name: Cook like a Caveman
560
+ location: Fire Pit on East side
561
+ eventDescription: Learn to cook on an open flame.
562
+ dates:
563
+ - '2023-11-10'
564
+ - '2023-11-17'
565
+ - '2023-11-24'
566
+ price: 5
567
+ - eventId: 602b75e1-5696-4ab8-8c7a-f9e13580f910
568
+ name: Underwater Basket Weaving
569
+ location: Rec Center Pool next door.
570
+ eventDescription: Learn to weave baskets underwater.
571
+ dates:
572
+ - '2023-09-12'
573
+ - '2023-09-15'
574
+ price: 15
575
+ - eventId: dad4bce8-f5cb-4078-a211-995864315e39
576
+ name: Mermaid Treasure Identification and Analysis
577
+ location: Room Sea-12
578
+ eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits — kindly donated by Ariel.
579
+ dates:
580
+ - '2023-09-05'
581
+ - '2023-09-08'
582
+ price: 30
583
+ - eventId: 6744a0da-4121-49cd-8479-f8cc20526495
584
+ name: Time Traveler Tea Party
585
+ location: Temporal Tearoom
586
+ eventDescription: Sip tea with important historical figures.
587
+ dates:
588
+ - '2023-11-18'
589
+ - '2023-11-25'
590
+ - '2023-12-02'
591
+ price: 60
592
+ - eventId: 3be6453c-03eb-4357-ae5a-984a0e574a54
593
+ name: Pirate Coding Workshop
594
+ location: Computer Room
595
+ eventDescription: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang).
596
+ dates:
597
+ - '2023-10-29'
598
+ - '2023-10-30'
599
+ - '2023-10-31'
600
+ price: 45
601
+ - eventId: 9d90d29a-2af5-4206-97d9-9ea9ceadcb78
602
+ name: Llama Street Art Through the Ages
603
+ location: Auditorium
604
+ eventDescription: Llama street art?! Alpaca my bags -- let's go!
605
+ dates:
606
+ - '2023-10-29'
607
+ - '2023-10-30'
608
+ - '2023-10-31'
609
+ price: 45
610
+ - eventId: a3c7b2c4-b5fb-4ef7-9322-00a919864957
611
+ name: The Great Parrot Debate
612
+ location: Outdoor Amphitheatre
613
+ eventDescription: See leading parrot minds discuss important geopolitical issues.
614
+ dates:
615
+ - '2023-11-03'
616
+ - '2023-11-10'
617
+ price: 35
618
+ - eventId: b92d46b7-4c5d-422b-87a5-287767e26f29
619
+ name: Eat a Bunch of Corn
620
+ location: Cafeteria
621
+ eventDescription: We accidentally bought too much corn. Please come eat it.
622
+ dates:
623
+ - '2023-11-10'
624
+ - '2023-11-17'
625
+ - '2023-11-24'
626
+ price: 5
627
+ UpdateSpecialEventRequestExample:
628
+ summary: Update special event request
629
+ value:
630
+ location: On the beach.
631
+ price: 15
632
+ UpdateSpecialEventResponseExample:
633
+ summary: Update special event
634
+ value:
635
+ eventId: dad4bce8-f5cb-4078-a211-995864315e39
636
+ name: Mermaid Treasure Identification and Analysis
637
+ location: On the beach.
638
+ eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
639
+ dates:
640
+ - '2023-09-05'
641
+ - '2023-09-08'
642
+ price: 15
643
+ GetMuseumHoursResponseExample:
644
+ summary: Get hours response
645
+ value:
646
+ - date: "2023-09-11"
647
+ timeOpen: "09:00"
648
+ timeClose: "18:00"
649
+ - date: "2023-09-12"
650
+ timeOpen: "09:00"
651
+ timeClose: "18:00"
652
+ - date: "2023-09-13"
653
+ timeOpen: "09:00"
654
+ timeClose: "18:00"
655
+ - date: "2023-09-14"
656
+ timeOpen: "09:00"
657
+ timeClose: "18:00"
658
+ - date: "2023-09-15"
659
+ timeOpen: "10:00"
660
+ timeClose: "16:00"
661
+ - date: "2023-09-18"
662
+ timeOpen: "09:00"
663
+ timeClose: "18:00"
664
+ - date: "2023-09-19"
665
+ timeOpen: "09:00"
666
+ timeClose: "18:00"
667
+ - date: "2023-09-20"
668
+ timeOpen: "09:00"
669
+ timeClose: "18:00"
670
+ - date: "2023-09-21"
671
+ timeOpen: "09:00"
672
+ timeClose: "18:00"
673
+ - date: "2023-09-22"
674
+ timeOpen: "10:00"
675
+ timeClose: "16:00"
676
+ parameters:
677
+ PaginationPage:
678
+ name: page
679
+ in: query
680
+ description: Page number to retrieve.
681
+ schema:
682
+ type: integer
683
+ default: 1
684
+ example: 2
685
+ PaginationLimit:
686
+ name: limit
687
+ in: query
688
+ description: Number of days per page.
689
+ schema:
690
+ type: integer
691
+ default: 10
692
+ maximum: 30
693
+ example: 15
694
+ EventId:
695
+ name: eventId
696
+ in: path
697
+ description: Identifier for a special event.
698
+ required: true
699
+ schema:
700
+ type: string
701
+ format: uuid
702
+ example: dad4bce8-f5cb-4078-a211-995864315e39
703
+ StartDate:
704
+ name: startDate
705
+ in: query
706
+ description: Starting date to retrieve future operating hours from. Defaults to today's date.
707
+ schema:
708
+ type: string
709
+ format: date
710
+ example: '2023-02-23'
711
+ EndDate:
712
+ name: endDate
713
+ in: query
714
+ description: End of a date range to retrieve special events for. Defaults to 7 days after \`startDate\`.
715
+ schema:
716
+ type: string
717
+ format: date
718
+ example: '2023-04-18'
719
+ TicketId:
720
+ name: ticketId
721
+ in: path
722
+ description: Identifier for a ticket to a museum event. Used to generate ticket image.
723
+ required: true
724
+ schema:
725
+ type: string
726
+ format: uuid
727
+ example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c
728
+ responses:
729
+ BadRequest:
730
+ description: Bad request.
731
+ content:
732
+ application/problem+json:
733
+ schema:
734
+ $ref: '#/components/schemas/Error'
735
+ NotFound:
736
+ description: Not found.
737
+ content:
738
+ application/problem+json:
739
+ schema:
740
+ $ref: '#/components/schemas/Error'
741
+ Unauthorized:
742
+ description: Unauthorized.
743
+ content:
744
+ application/problem+json:
745
+ schema:
746
+ $ref: '#/components/schemas/Error'
747
+ tags:
748
+ - name: Operations
749
+ description: Operational information about the museum.
750
+ - name: Events
751
+ description: Special events hosted by the museum.
752
+ - name: Tickets
753
+ description: Museum tickets for general entrance or special events.
754
+ security:
755
+ - MuseumPlaceholderAuth: []
756
+ `;
757
+ function xr(e) {
758
+ return {
759
+ subject: _e(e.subject),
760
+ assertions: e.assertions ?? {},
761
+ ...Te(e.where) ? { where: Te(e.where) } : {},
762
+ ...e.message ? { message: e.message } : {},
763
+ ...e.suggest?.length ? { suggest: e.suggest } : {},
764
+ ...e.reference ? { reference: e.reference } : {},
765
+ ...e.severity && e.severity !== "error" ? { severity: e.severity } : {}
766
+ };
767
+ }
768
+ function Te(e) {
769
+ if (!e?.length) return;
770
+ const t = e.filter((o) => o.subject?.type).map((o) => ({
771
+ subject: _e(o.subject),
772
+ assertions: o.assertions ?? {}
773
+ }));
774
+ return t.length ? t : void 0;
775
+ }
776
+ function _e(e) {
777
+ const t = Array.isArray(e.property) ? e.property.filter(Boolean) : e.property;
778
+ return {
779
+ type: e.type,
780
+ ...t && (!Array.isArray(t) || t.length) ? { property: Array.isArray(t) && t.length === 1 ? t[0] : t } : {},
781
+ ...e.filterInParentKeys?.length ? { filterInParentKeys: e.filterInParentKeys } : {},
782
+ ...e.filterOutParentKeys?.length ? { filterOutParentKeys: e.filterOutParentKeys } : {},
783
+ ...e.matchParentKeys ? { matchParentKeys: e.matchParentKeys } : {}
784
+ };
785
+ }
786
+ function kr(e, t) {
787
+ return `rule/${(e || `untitled-${t + 1}`).trim().replace(/\s+/g, "-")}`;
788
+ }
789
+ var Ve = "rules-builder", Je = "rule/rules-builder-match-", Qe = Promise.resolve();
790
+ function rt(e) {
791
+ const t = Qe.then(e, e);
792
+ return Qe = t.catch(() => {
793
+ }), t;
794
+ }
795
+ function tt(e, t, o = "openapi.yaml") {
796
+ return rt(async () => {
797
+ const i = t.map((l, p) => ({
798
+ named: l,
799
+ index: p
800
+ })), a = await Xe(e, i, o);
801
+ if (a.error === void 0) return {
802
+ matches: a.matches,
803
+ problems: a.problems,
804
+ ruleErrors: a.ruleErrors
805
+ };
806
+ const c = Ze(a.error);
807
+ if (a.error instanceof Or || ot(c)) return {
808
+ matches: [],
809
+ problems: [],
810
+ ruleErrors: [],
811
+ specError: c
812
+ };
813
+ const s = {
814
+ matches: [],
815
+ problems: [],
816
+ ruleErrors: []
817
+ };
818
+ for (const l of i) {
819
+ const p = await Xe(e, [l], o);
820
+ if (p.error !== void 0) {
821
+ s.ruleErrors.push(`rule/${l.named.name}: ${Ze(p.error)}`);
822
+ continue;
823
+ }
824
+ s.matches.push(...p.matches), s.problems.push(...p.problems), s.ruleErrors.push(...p.ruleErrors);
825
+ }
826
+ return s;
827
+ });
828
+ }
829
+ async function Xe(e, t, o) {
830
+ const i = /* @__PURE__ */ new Map(), a = {
831
+ matches: [],
832
+ problems: [],
833
+ ruleErrors: []
834
+ }, c = (p, f, m) => {
835
+ const h = m, { ruleIndex: y } = f, u = h.location?.pointer;
836
+ if (u === void 0) return [];
837
+ const g = `${y}:${u}`;
838
+ let x = i.get(g);
839
+ x || (x = {
840
+ ruleIndex: y,
841
+ pointer: u,
842
+ nodeType: h.type?.name ?? "",
843
+ key: String(h.key ?? ""),
844
+ propertyPointers: []
845
+ }, i.set(g, x));
846
+ const C = h.baseLocation?.pointer;
847
+ return C && C !== u && x.propertyPointers.push(C), [];
848
+ }, s = {}, l = /* @__PURE__ */ new Map();
849
+ for (const { named: p, index: f } of t) {
850
+ const m = p.rule;
851
+ if (m.subject?.type) {
852
+ if (m.severity !== "off") {
853
+ let h = kr(p.name, f);
854
+ for (; l.has(h); ) h += "-dup";
855
+ l.set(h, f), s[h] = xr(m);
856
+ }
857
+ s[`${Je}${f}`] = {
858
+ subject: _e(m.subject),
859
+ where: Te(m.where),
860
+ assertions: { [`${Ve}/collect`]: { ruleIndex: f } }
861
+ };
862
+ }
863
+ }
864
+ try {
865
+ const p = await zr({
866
+ extends: [],
867
+ plugins: [{
868
+ id: Ve,
869
+ assertions: { collect: c }
870
+ }],
871
+ rules: s
872
+ }), f = await Nr({
873
+ source: e,
874
+ absoluteRef: `/${o}`,
875
+ config: p
876
+ });
877
+ for (const m of f) {
878
+ const h = l.get(m.ruleId);
879
+ if (h === void 0) {
880
+ if (m.ruleId.startsWith(Je)) continue;
881
+ a.ruleErrors.push(m.message);
882
+ continue;
883
+ }
884
+ const y = m.location?.[0];
885
+ a.problems.push({
886
+ ruleIndex: h,
887
+ ruleId: m.ruleId,
888
+ severity: m.severity === "warn" ? "warn" : "error",
889
+ message: m.message,
890
+ suggest: m.suggest ?? [],
891
+ pointer: y && "pointer" in y && y.pointer || "#/",
892
+ reportOnKey: !!y?.reportOnKey
893
+ });
894
+ }
895
+ } catch (p) {
896
+ a.error = p ?? /* @__PURE__ */ new Error("Unknown lint error");
897
+ }
898
+ return a.matches = Array.from(i.values()), a;
899
+ }
900
+ function Ze(e) {
901
+ return e instanceof Error ? e.message : String(e);
902
+ }
903
+ function ot(e) {
904
+ return /parse|unsupported|version|document/i.test(e);
905
+ }
906
+ function er(e) {
907
+ let t;
908
+ try {
909
+ t = jr(e);
910
+ } catch {
911
+ t = void 0;
912
+ }
913
+ const o = [0];
914
+ for (let i = 0; i < e.length; i++) e[i] === `
915
+ ` && o.push(i + 1);
916
+ return {
917
+ resolve(i, a) {
918
+ if (!t) return;
919
+ let c;
920
+ try {
921
+ c = Br(t, i, a);
922
+ } catch {
923
+ return;
924
+ }
925
+ if (!c || typeof c.startPosition != "number" || typeof c.endPosition != "number") return;
926
+ const s = Math.max(0, Math.min(c.startPosition, e.length)), l = Math.max(s, Math.min(c.endPosition, e.length));
927
+ if (!(l <= s))
928
+ return {
929
+ from: s,
930
+ to: l
931
+ };
932
+ },
933
+ lineAt(i) {
934
+ let a = 0, c = o.length - 1;
935
+ for (; a < c; ) {
936
+ const s = a + c + 1 >> 1;
937
+ o[s] <= i ? a = s : c = s - 1;
938
+ }
939
+ return a + 1;
940
+ },
941
+ lineCount: o.length,
942
+ lineRange(i) {
943
+ const a = o[i - 1] ?? 0, c = i < o.length ? o[i] - 1 : e.length;
944
+ return {
945
+ from: a,
946
+ to: Math.max(a, c)
947
+ };
948
+ }
949
+ };
950
+ }
951
+ function we() {
952
+ return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2);
953
+ }
954
+ function nt(e) {
955
+ return e.map(({ name: t, rule: o }) => ({
956
+ name: t,
957
+ rule: o
958
+ }));
959
+ }
960
+ function at(e) {
961
+ return {
962
+ id: we(),
963
+ name: e.name,
964
+ rule: e.rule
965
+ };
966
+ }
967
+ function it(e) {
968
+ let t = e.length + 1;
969
+ for (; e.includes(`my-rule-${t}`); ) t++;
970
+ return {
971
+ id: we(),
972
+ name: `my-rule-${t}`,
973
+ rule: {
974
+ subject: { type: "Operation" },
975
+ assertions: { defined: !0 },
976
+ severity: "warn"
977
+ }
978
+ };
979
+ }
980
+ function st(e) {
981
+ const t = {};
982
+ return e.forEach((o, i) => {
983
+ if (!o.rule.subject?.type) return;
984
+ let a = kr(o.name, i);
985
+ for (; a in t; ) a += "-dup";
986
+ t[a] = xr(o.rule);
987
+ }), qr({ rules: t }, {
988
+ noRefs: !0,
989
+ lineWidth: 100,
990
+ quotingType: "'"
991
+ });
992
+ }
993
+ function lt({ problems: e, ruleErrors: t, specError: o, isRunning: i, onSelect: a }) {
994
+ const c = e.filter((l) => l.severity === "error").length, s = e.length - c;
995
+ return /* @__PURE__ */ d(ct, { children: [/* @__PURE__ */ d(pt, { children: [
996
+ "Problems",
997
+ c > 0 && /* @__PURE__ */ d(rr, {
998
+ style: {
999
+ background: F.error.bg,
1000
+ color: F.error.fg
1001
+ },
1002
+ children: [
1003
+ c,
1004
+ " error",
1005
+ c === 1 ? "" : "s"
1006
+ ]
1007
+ }),
1008
+ s > 0 && /* @__PURE__ */ d(rr, {
1009
+ style: {
1010
+ background: F.warn.bg,
1011
+ color: F.warn.fg
1012
+ },
1013
+ children: [
1014
+ s,
1015
+ " warning",
1016
+ s === 1 ? "" : "s"
1017
+ ]
1018
+ }),
1019
+ i && /* @__PURE__ */ r(dt, { children: "checking…" })
1020
+ ] }), /* @__PURE__ */ d(ut, { children: [
1021
+ o && /* @__PURE__ */ d(tr, {
1022
+ role: "alert",
1023
+ children: ["Could not lint the document: ", o]
1024
+ }),
1025
+ t.map((l, p) => /* @__PURE__ */ d(tr, {
1026
+ role: "alert",
1027
+ children: ["Rule configuration error: ", l]
1028
+ }, p)),
1029
+ !o && e.length === 0 && /* @__PURE__ */ r($t, { children: "No problems found in the current document." }),
1030
+ e.map((l, p) => {
1031
+ const f = F[l.severity];
1032
+ return /* @__PURE__ */ d(ft, {
1033
+ type: "button",
1034
+ style: {
1035
+ background: f.bg,
1036
+ "--sev": f.fg
1037
+ },
1038
+ onClick: () => a(l),
1039
+ children: [/* @__PURE__ */ r(mt, { style: { background: f.fg } }), /* @__PURE__ */ d(ht, { children: [
1040
+ /* @__PURE__ */ d(gt, { children: [
1041
+ /* @__PURE__ */ r(vt, {
1042
+ style: { color: f.fg },
1043
+ children: l.severity
1044
+ }),
1045
+ /* @__PURE__ */ r(bt, {
1046
+ style: { color: f.fg },
1047
+ children: l.ruleId
1048
+ }),
1049
+ /* @__PURE__ */ r(yt, {}),
1050
+ l.line !== void 0 && /* @__PURE__ */ d(xt, {
1051
+ style: { color: f.fg },
1052
+ children: [
1053
+ ":",
1054
+ l.line,
1055
+ l.col !== void 0 ? `:${l.col}` : ""
1056
+ ]
1057
+ })
1058
+ ] }),
1059
+ /* @__PURE__ */ r(kt, { children: l.message }),
1060
+ l.suggest.length > 0 && /* @__PURE__ */ r(wt, { children: l.suggest.map((m, h) => /* @__PURE__ */ r(Et, { children: m }, h)) })
1061
+ ] })]
1062
+ }, `${l.pointer}-${p}`);
1063
+ })
1064
+ ] })] });
1065
+ }
1066
+ var ct = n.div`
1067
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
1068
+ border-radius: 16px;
1069
+ padding: 10px 14px 12px;
1070
+ display: flex;
1071
+ flex-direction: column;
1072
+ gap: 6px;
1073
+ max-height: 240px;
1074
+ background: var(--bg-color, #ffffff);
1075
+ `, pt = n.div`
1076
+ font-weight: 700;
1077
+ font-size: 14px;
1078
+ display: flex;
1079
+ align-items: center;
1080
+ gap: 8px;
1081
+ color: var(--text-color-primary, #1b2430);
1082
+ flex-shrink: 0;
1083
+ `, rr = n.span`
1084
+ border-radius: 999px;
1085
+ font-size: 11.5px;
1086
+ font-weight: 700;
1087
+ padding: 2px 9px;
1088
+ `, dt = n.span`
1089
+ color: var(--text-color-secondary, #64748b);
1090
+ font-size: 12px;
1091
+ font-weight: 400;
1092
+ `, ut = n.div`
1093
+ display: flex;
1094
+ flex-direction: column;
1095
+ gap: 8px;
1096
+ overflow-y: auto;
1097
+ `, ft = n.button`
1098
+ display: flex;
1099
+ gap: 12px;
1100
+ border: 1px solid transparent;
1101
+ font: inherit;
1102
+ text-align: left;
1103
+ padding: 10px 14px;
1104
+ border-radius: 12px;
1105
+ cursor: pointer;
1106
+ flex-shrink: 0;
1107
+ transition: border-color 0.12s;
1108
+
1109
+ &:hover {
1110
+ border-color: var(--sev);
1111
+ }
1112
+
1113
+ &:focus-visible {
1114
+ outline: 2px solid var(--sev);
1115
+ outline-offset: -2px;
1116
+ }
1117
+ `, mt = n.span`
1118
+ width: 7px;
1119
+ height: 7px;
1120
+ border-radius: 50%;
1121
+ flex-shrink: 0;
1122
+ margin-top: 6px;
1123
+ `, ht = n.div`
1124
+ flex: 1;
1125
+ display: flex;
1126
+ flex-direction: column;
1127
+ gap: 3px;
1128
+ min-width: 0;
1129
+ `, gt = n.div`
1130
+ display: flex;
1131
+ align-items: center;
1132
+ gap: 8px;
1133
+ flex-wrap: wrap;
1134
+ `, vt = n.span`
1135
+ font-size: 10.5px;
1136
+ font-weight: 700;
1137
+ background: rgba(255, 255, 255, 0.75);
1138
+ border-radius: 6px;
1139
+ padding: 1px 7px;
1140
+ text-transform: uppercase;
1141
+ letter-spacing: 0.04em;
1142
+ `, bt = n.span`
1143
+ font-family: ${D};
1144
+ font-size: 12px;
1145
+ font-weight: 600;
1146
+ `, yt = n.span`
1147
+ flex: 1;
1148
+ `, xt = n.span`
1149
+ font-family: ${D};
1150
+ font-size: 11.5px;
1151
+ opacity: 0.75;
1152
+ `, kt = n.span`
1153
+ font-size: 12.5px;
1154
+ color: var(--text-color-primary, #1b2430);
1155
+ line-height: 1.45;
1156
+ `, wt = n.ul`
1157
+ margin: 5px 0 0;
1158
+ padding: 0;
1159
+ list-style: none;
1160
+ display: flex;
1161
+ flex-direction: column;
1162
+ gap: 3px;
1163
+ `, Et = n.li`
1164
+ display: flex;
1165
+ align-items: baseline;
1166
+ gap: 6px;
1167
+ font-size: 12px;
1168
+ line-height: 1.4;
1169
+ color: ${H.suggest.fg};
1170
+ background: rgba(255, 255, 255, 0.65);
1171
+ border-radius: 8px;
1172
+ padding: 3px 8px;
1173
+ align-self: flex-start;
1174
+
1175
+ &::before {
1176
+ content: '→';
1177
+ opacity: 0.75;
1178
+ }
1179
+ `, $t = n.div`
1180
+ font-size: 13px;
1181
+ color: var(--text-color-secondary, #64748b);
1182
+ padding: 3px 4px;
1183
+ `, tr = n.div`
1184
+ font-size: 12px;
1185
+ color: var(--color-error-base, #dc2626);
1186
+ background: var(--color-error-bg, #fef2f2);
1187
+ border-radius: 10px;
1188
+ padding: 5px 8px;
1189
+ white-space: pre-wrap;
1190
+ `;
1191
+ function wr({ title: e, subtitle: t, onClose: o, children: i, footer: a, width: c = 560 }) {
1192
+ return N(() => {
1193
+ const s = (l) => l.key === "Escape" && o();
1194
+ return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
1195
+ }, [o]), /* @__PURE__ */ r(Ct, {
1196
+ onClick: o,
1197
+ children: /* @__PURE__ */ d(St, {
1198
+ role: "dialog",
1199
+ "aria-modal": !0,
1200
+ "aria-label": e,
1201
+ style: { maxWidth: c },
1202
+ onClick: (s) => s.stopPropagation(),
1203
+ children: [
1204
+ /* @__PURE__ */ d(Rt, { children: [/* @__PURE__ */ d("div", {
1205
+ style: { flex: 1 },
1206
+ children: [/* @__PURE__ */ r(It, { children: e }), t && /* @__PURE__ */ r(Mt, { children: t })]
1207
+ }), /* @__PURE__ */ r(Pt, {
1208
+ type: "button",
1209
+ "aria-label": "Close",
1210
+ onClick: o,
1211
+ children: "×"
1212
+ })] }),
1213
+ /* @__PURE__ */ r(Tt, { children: i }),
1214
+ a && /* @__PURE__ */ r(At, { children: a })
1215
+ ]
1216
+ })
1217
+ });
1218
+ }
1219
+ var Ct = n.div`
1220
+ position: fixed;
1221
+ inset: 0;
1222
+ background: rgba(15, 23, 42, 0.45);
1223
+ z-index: 50;
1224
+ display: flex;
1225
+ align-items: center;
1226
+ justify-content: center;
1227
+ padding: 20px;
1228
+ `, St = n.div`
1229
+ background: var(--bg-color, #ffffff);
1230
+ border-radius: 16px;
1231
+ width: 100%;
1232
+ max-height: 86vh;
1233
+ display: flex;
1234
+ flex-direction: column;
1235
+ overflow: hidden;
1236
+ box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
1237
+ `, Rt = n.div`
1238
+ display: flex;
1239
+ align-items: flex-start;
1240
+ gap: 12px;
1241
+ padding: 18px 20px 14px;
1242
+ border-bottom: 1px solid var(--border-color-secondary, #e5e9f0);
1243
+ `, It = n.div`
1244
+ font-size: 15.5px;
1245
+ font-weight: 700;
1246
+ color: var(--text-color-primary, #1b2430);
1247
+ `, Mt = n.div`
1248
+ font-size: 12.5px;
1249
+ color: var(--text-color-secondary, #64748b);
1250
+ margin-top: 3px;
1251
+ `, Pt = n.button`
1252
+ background: none;
1253
+ border: none;
1254
+ color: var(--color-warm-grey-6, #94a3b8);
1255
+ font-size: 18px;
1256
+ cursor: pointer;
1257
+ line-height: 1;
1258
+ padding: 4px;
1259
+
1260
+ &:hover {
1261
+ color: var(--text-color-primary, #1b2430);
1262
+ }
1263
+ `, Tt = n.div`
1264
+ padding: 20px;
1265
+ overflow: auto;
1266
+ flex: 1;
1267
+ `, At = n.div`
1268
+ display: flex;
1269
+ justify-content: flex-end;
1270
+ gap: 10px;
1271
+ padding: 14px 20px;
1272
+ border-top: 1px solid var(--border-color-secondary, #e5e9f0);
1273
+ background: var(--color-warm-grey-1, #fbfbfc);
1274
+ flex-wrap: wrap;
1275
+ `, he = n.select`
1276
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
1277
+ border-radius: 10px;
1278
+ background: var(--bg-color, #ffffff);
1279
+ color: var(--text-color-primary, #1b2430);
1280
+ font: inherit;
1281
+ font-size: 13px;
1282
+ font-weight: 600;
1283
+ padding: 2px 6px;
1284
+ cursor: pointer;
1285
+ max-width: 260px;
1286
+
1287
+ &:focus-visible {
1288
+ outline: none;
1289
+ border-color: var(--color-primary-base, #2563eb);
1290
+ }
1291
+ `, le = n.input`
1292
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
1293
+ border-radius: 10px;
1294
+ background: var(--bg-color, #ffffff);
1295
+ color: var(--text-color-primary, #1b2430);
1296
+ font: inherit;
1297
+ font-size: 13px;
1298
+ padding: 2px 8px;
1299
+ min-width: 60px;
1300
+ box-sizing: border-box;
1301
+
1302
+ &:focus {
1303
+ outline: none;
1304
+ border-color: var(--color-primary-base, #2563eb);
1305
+ }
1306
+
1307
+ &::placeholder {
1308
+ color: var(--text-color-secondary, #64748b);
1309
+ opacity: 0.8;
1310
+ }
1311
+ `, Ae = n(le)`
1312
+ font-family: ${D};
1313
+ font-size: 12px;
1314
+ `, or = n.button`
1315
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
1316
+ border-radius: 10px;
1317
+ background: transparent;
1318
+ font: inherit;
1319
+ font-size: 13px;
1320
+ padding: 3px 10px;
1321
+ cursor: pointer;
1322
+ color: var(--text-color-primary, #1b2430);
1323
+
1324
+ &:hover {
1325
+ border-color: var(--color-primary-base, #2563eb);
1326
+ color: var(--color-primary-base, #2563eb);
1327
+ }
1328
+
1329
+ &:focus-visible {
1330
+ outline: 2px solid var(--color-primary-base, #2563eb);
1331
+ }
1332
+ `, Er = n.button`
1333
+ display: inline-flex;
1334
+ align-items: center;
1335
+ gap: 7px;
1336
+ background: var(--bg-color, #ffffff);
1337
+ color: var(--text-color-primary, #1b2430);
1338
+ border: 1px solid var(--border-color-primary, #d6dde8);
1339
+ border-radius: 8px;
1340
+ padding: 6px 12px;
1341
+ font: inherit;
1342
+ font-size: 12.5px;
1343
+ cursor: pointer;
1344
+ white-space: nowrap;
1345
+
1346
+ &:hover {
1347
+ border-color: var(--color-primary-base, #2563eb);
1348
+ color: var(--color-primary-base, #2563eb);
1349
+ }
1350
+
1351
+ &:focus-visible {
1352
+ outline: 2px solid var(--color-primary-base, #2563eb);
1353
+ }
1354
+ `, De = n.button`
1355
+ background: var(--bg-color, #ffffff);
1356
+ color: var(--text-color-primary, #1b2430);
1357
+ border: 1px solid var(--border-color-primary, #d6dde8);
1358
+ border-radius: 8px;
1359
+ padding: 7px 14px;
1360
+ font: inherit;
1361
+ font-size: 12.5px;
1362
+ cursor: pointer;
1363
+
1364
+ &:hover {
1365
+ border-color: var(--color-primary-base, #2563eb);
1366
+ color: var(--color-primary-base, #2563eb);
1367
+ }
1368
+ `, Ke = n.button`
1369
+ display: inline-flex;
1370
+ align-items: center;
1371
+ gap: 7px;
1372
+ background: var(--color-primary-base, #2563eb);
1373
+ color: #fff;
1374
+ border: none;
1375
+ border-radius: 8px;
1376
+ padding: 7px 14px;
1377
+ font: inherit;
1378
+ font-size: 12.5px;
1379
+ font-weight: 600;
1380
+ cursor: pointer;
1381
+ white-space: nowrap;
1382
+
1383
+ &:hover {
1384
+ filter: brightness(1.05);
1385
+ }
1386
+
1387
+ &:disabled {
1388
+ opacity: 0.5;
1389
+ cursor: not-allowed;
1390
+ filter: none;
1391
+ }
1392
+
1393
+ &:focus-visible {
1394
+ outline: 2px solid var(--text-color-primary, #1b2430);
1395
+ outline-offset: 1px;
1396
+ }
1397
+ `, se = n.span`
1398
+ color: var(--text-color-secondary, #64748b);
1399
+ font-style: italic;
1400
+ `, Dt = n.span`
1401
+ font-size: 13px;
1402
+ font-weight: 700;
1403
+ color: var(--sec);
1404
+ flex-shrink: 0;
1405
+ `, Lt = n.span`
1406
+ display: block;
1407
+ font-size: 12px;
1408
+ color: var(--text-color-secondary, #64748b);
1409
+ margin-top: 4px;
1410
+ `, Ot = n.div`
1411
+ padding: 16px 2px 6px;
1412
+
1413
+ & + & {
1414
+ border-top: 1px solid var(--border-color-secondary, #e5e9f0);
1415
+ }
1416
+ `, zt = n.div`
1417
+ margin-bottom: 12px;
1418
+ `, Bt = n.div`
1419
+ display: flex;
1420
+ align-items: center;
1421
+ gap: 12px;
1422
+ `, Nt = n.span`
1423
+ flex: 1;
1424
+ height: 1px;
1425
+ background: var(--sec-line);
1426
+ `;
1427
+ function ne({ tone: e, label: t, hint: o, children: i }) {
1428
+ const a = H[e];
1429
+ return /* @__PURE__ */ d(Ot, {
1430
+ style: {
1431
+ "--sec": a.fg,
1432
+ "--sec-line": a.line
1433
+ },
1434
+ children: [/* @__PURE__ */ d(zt, { children: [/* @__PURE__ */ d(Bt, { children: [/* @__PURE__ */ r(Dt, { children: t }), /* @__PURE__ */ r(Nt, {})] }), /* @__PURE__ */ r(Lt, { children: o })] }), i]
1435
+ });
1436
+ }
1437
+ var ce = n.div`
1438
+ display: flex;
1439
+ flex-wrap: wrap;
1440
+ align-items: center;
1441
+ gap: 8px;
1442
+ font-size: 14px;
1443
+ color: var(--text-color-primary, #1b2430);
1444
+ `;
1445
+ function $r({ open: e }) {
1446
+ return /* @__PURE__ */ r("svg", {
1447
+ width: "12",
1448
+ height: "12",
1449
+ viewBox: "0 0 12 12",
1450
+ "aria-hidden": !0,
1451
+ style: {
1452
+ transition: "transform .15s",
1453
+ transform: e ? "rotate(90deg)" : "none",
1454
+ flexShrink: 0
1455
+ },
1456
+ children: /* @__PURE__ */ r("path", {
1457
+ d: "M4 2l4 4-4 4",
1458
+ fill: "none",
1459
+ stroke: "currentColor",
1460
+ strokeWidth: "1.6",
1461
+ strokeLinecap: "round",
1462
+ strokeLinejoin: "round"
1463
+ })
1464
+ });
1465
+ }
1466
+ var jt = (e) => `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' width='6' height='3' viewBox='0 0 6 3'><path d='M0 2.5 Q1.5 0.5 3 2.5 Q4.5 4.5 6 2.5' fill='none' stroke='${e}' stroke-width='1'/></svg>`)}")`, qt = Ne`
1467
+ background-image: ${jt("#dc2626")};
1468
+ background-repeat: repeat-x;
1469
+ background-position: bottom left;
1470
+ background-size: 6px 3px;
1471
+ padding-bottom: 3px;
1472
+ `, Ft = n.span`
1473
+ display: inline-flex;
1474
+ align-items: center;
1475
+ gap: 6px;
1476
+
1477
+ ${(e) => e.$error && qt}
1478
+ `;
1479
+ function ye({ error: e, children: t, style: o }) {
1480
+ return /* @__PURE__ */ r(Ft, {
1481
+ $error: e,
1482
+ title: e,
1483
+ "aria-invalid": !!e || void 0,
1484
+ style: o,
1485
+ children: t
1486
+ });
1487
+ }
1488
+ function _t({ yaml: e, host: t, fileName: o = "redocly.yaml" }) {
1489
+ const [i, a] = I(!1), [c, s] = I(!1), l = async () => {
1490
+ await (t?.copyToClipboard ?? ((f) => navigator.clipboard.writeText(f)))(e).then(() => !0, () => !1) && (s(!0), setTimeout(() => s(!1), 1500));
1491
+ }, p = async () => {
1492
+ if (t?.downloadFile) {
1493
+ await t.downloadFile(o, e);
1494
+ return;
1495
+ }
1496
+ const f = URL.createObjectURL(new Blob([e], { type: "text/yaml" })), m = document.createElement("a");
1497
+ m.href = f, m.download = o, document.body.appendChild(m), m.click(), m.remove(), setTimeout(() => URL.revokeObjectURL(f), 1e3);
1498
+ };
1499
+ return /* @__PURE__ */ d(X, { children: [/* @__PURE__ */ d(Er, {
1500
+ type: "button",
1501
+ onClick: () => a(!0),
1502
+ children: [
1503
+ /* @__PURE__ */ r(Kt, {}),
1504
+ " Generated ",
1505
+ o
1506
+ ]
1507
+ }), i && /* @__PURE__ */ r(wr, {
1508
+ title: `Generated ${o}`,
1509
+ subtitle: "Ready to drop into your project root",
1510
+ width: 620,
1511
+ onClose: () => a(!1),
1512
+ footer: /* @__PURE__ */ d(X, { children: [
1513
+ /* @__PURE__ */ r(De, {
1514
+ type: "button",
1515
+ onClick: () => a(!1),
1516
+ children: "Close"
1517
+ }),
1518
+ /* @__PURE__ */ r(De, {
1519
+ type: "button",
1520
+ onClick: l,
1521
+ children: c ? "Copied!" : "Copy"
1522
+ }),
1523
+ /* @__PURE__ */ d(Ke, {
1524
+ type: "button",
1525
+ onClick: p,
1526
+ children: [
1527
+ /* @__PURE__ */ r(Ut, {}),
1528
+ " Download ",
1529
+ o
1530
+ ]
1531
+ })
1532
+ ] }),
1533
+ children: /* @__PURE__ */ r(Wt, {
1534
+ "aria-label": `Generated ${o}`,
1535
+ children: e
1536
+ })
1537
+ })] });
1538
+ }
1539
+ function Kt() {
1540
+ return /* @__PURE__ */ d("svg", {
1541
+ width: "13",
1542
+ height: "13",
1543
+ viewBox: "0 0 14 14",
1544
+ "aria-hidden": !0,
1545
+ children: [/* @__PURE__ */ r("path", {
1546
+ d: "M3 1.5h5.5L11.5 4.5v8a1 1 0 01-1 1H3a1 1 0 01-1-1v-10a1 1 0 011-1z",
1547
+ fill: "none",
1548
+ stroke: "currentColor",
1549
+ strokeWidth: "1.3",
1550
+ strokeLinejoin: "round"
1551
+ }), /* @__PURE__ */ r("path", {
1552
+ d: "M8.5 1.5v3h3",
1553
+ fill: "none",
1554
+ stroke: "currentColor",
1555
+ strokeWidth: "1.3",
1556
+ strokeLinejoin: "round"
1557
+ })]
1558
+ });
1559
+ }
1560
+ function Ut() {
1561
+ return /* @__PURE__ */ r("svg", {
1562
+ width: "13",
1563
+ height: "13",
1564
+ viewBox: "0 0 14 14",
1565
+ "aria-hidden": !0,
1566
+ children: /* @__PURE__ */ r("path", {
1567
+ d: "M7 1.5v7M4 6l3 2.5L10 6M2 10.5v1.5a1 1 0 001 1h8a1 1 0 001-1v-1.5",
1568
+ fill: "none",
1569
+ stroke: "currentColor",
1570
+ strokeWidth: "1.4",
1571
+ strokeLinecap: "round",
1572
+ strokeLinejoin: "round"
1573
+ })
1574
+ });
1575
+ }
1576
+ var Wt = n.pre`
1577
+ margin: 0;
1578
+ background: #0f172a;
1579
+ color: #cbd5e1;
1580
+ border-radius: 12px;
1581
+ padding: 16px;
1582
+ font-family: ${D};
1583
+ font-size: 12px;
1584
+ line-height: 1.75;
1585
+ overflow: auto;
1586
+ max-height: 420px;
1587
+ `;
1588
+ function V(e) {
1589
+ return typeof e == "object" && e !== null && !Array.isArray(e);
1590
+ }
1591
+ function nr(e) {
1592
+ return V(e) && V(e.subject) && typeof e.subject.type == "string";
1593
+ }
1594
+ function Cr(e) {
1595
+ return V(e) ? e : {};
1596
+ }
1597
+ function Ht(e) {
1598
+ return e.map((t) => {
1599
+ const o = V(t) ? t : {}, i = V(o.subject) ? o.subject : {};
1600
+ return {
1601
+ subject: {
1602
+ ...i,
1603
+ type: typeof i.type == "string" ? i.type : ""
1604
+ },
1605
+ assertions: Cr(o.assertions)
1606
+ };
1607
+ });
1608
+ }
1609
+ function ar(e) {
1610
+ return {
1611
+ subject: e.subject,
1612
+ assertions: Cr(e.assertions),
1613
+ ...Array.isArray(e.where) ? { where: Ht(e.where) } : {},
1614
+ ...typeof e.message == "string" ? { message: e.message } : {},
1615
+ ...Array.isArray(e.suggest) ? { suggest: e.suggest } : {},
1616
+ ...typeof e.reference == "string" ? { reference: e.reference } : {},
1617
+ ...e.severity === "warn" || e.severity === "off" || e.severity === "error" ? { severity: e.severity } : {}
1618
+ };
1619
+ }
1620
+ function Gt(e) {
1621
+ let t;
1622
+ try {
1623
+ t = Fr(e);
1624
+ } catch (s) {
1625
+ return {
1626
+ rules: [],
1627
+ skipped: [],
1628
+ error: `Could not parse the document: ${s instanceof Error ? s.message : String(s)}`
1629
+ };
1630
+ }
1631
+ if (!V(t)) return {
1632
+ rules: [],
1633
+ skipped: [],
1634
+ error: "Expected a YAML/JSON object"
1635
+ };
1636
+ const o = t;
1637
+ if (nr(o)) return {
1638
+ rules: [{
1639
+ name: "imported-rule",
1640
+ rule: ar(o)
1641
+ }],
1642
+ skipped: []
1643
+ };
1644
+ const i = V(o.rules) ? o.rules : Object.keys(o).some((s) => s.startsWith("rule/")) ? o : void 0;
1645
+ if (!i) return {
1646
+ rules: [],
1647
+ skipped: [],
1648
+ error: "No configurable rules found — expected a `rules:` map with `rule/<name>` entries, or a single rule object"
1649
+ };
1650
+ const a = [], c = [];
1651
+ for (const [s, l] of Object.entries(i)) s.startsWith("rule/") && nr(l) ? a.push({
1652
+ name: s.slice(5),
1653
+ rule: ar(l)
1654
+ }) : c.push(s);
1655
+ return a.length === 0 ? {
1656
+ rules: a,
1657
+ skipped: c,
1658
+ error: "No `rule/<name>` entries with a valid subject found"
1659
+ } : {
1660
+ rules: a,
1661
+ skipped: c
1662
+ };
1663
+ }
1664
+ function Ue({ value: e, options: t, onChange: o, ariaLabel: i }) {
1665
+ return /* @__PURE__ */ r(Yt, {
1666
+ role: "radiogroup",
1667
+ "aria-label": i,
1668
+ children: t.map((a) => /* @__PURE__ */ r(Vt, {
1669
+ type: "button",
1670
+ role: "radio",
1671
+ "aria-checked": e === a.value,
1672
+ $active: e === a.value,
1673
+ $activeColor: a.activeColor,
1674
+ onClick: (c) => {
1675
+ c.stopPropagation(), o(a.value);
1676
+ },
1677
+ children: a.label
1678
+ }, a.value))
1679
+ });
1680
+ }
1681
+ var Yt = n.span`
1682
+ display: inline-flex;
1683
+ background: var(--bg-color, #ffffff);
1684
+ border: 1px solid var(--border-color-primary, #d6dde8);
1685
+ border-radius: 999px;
1686
+ padding: 2px;
1687
+ gap: 2px;
1688
+ flex-shrink: 0;
1689
+ `, Vt = n.button`
1690
+ border: none;
1691
+ border-radius: 999px;
1692
+ background: transparent;
1693
+ cursor: pointer;
1694
+ font: inherit;
1695
+ font-size: 12px;
1696
+ font-weight: 600;
1697
+ padding: 4px 12px;
1698
+ color: var(--text-color-secondary, #64748b);
1699
+ white-space: nowrap;
1700
+ transition:
1701
+ background 0.12s,
1702
+ color 0.12s;
1703
+
1704
+ ${(e) => e.$active && Ne`
1705
+ color: #fff;
1706
+ background: ${e.$activeColor ?? "var(--color-primary-base, #2563eb)"};
1707
+ `}
1708
+
1709
+ &:focus-visible {
1710
+ outline: 2px solid var(--color-primary-base, #2563eb);
1711
+ outline-offset: -2px;
1712
+ }
1713
+ `;
1714
+ function Jt({ onImport: e }) {
1715
+ const [t, o] = I(!1), [i, a] = I("paste"), [c, s] = I(""), [l, p] = I(), [f, m] = I(), [h, y] = I(!1), u = A(null), g = () => {
1716
+ o(!1), p(void 0), m(void 0);
1717
+ }, x = ($) => {
1718
+ const v = Gt($);
1719
+ if (v.error) {
1720
+ p(v.error), m(void 0);
1721
+ return;
1722
+ }
1723
+ e(v.rules), s(""), v.skipped.length ? (p(void 0), m(`Imported ${v.rules.length} rule(s); skipped non-configurable entries: ${v.skipped.join(", ")}`)) : g();
1724
+ }, C = ($) => {
1725
+ const v = new FileReader();
1726
+ v.onload = () => x(String(v.result ?? "")), v.onerror = () => p("Could not read the file"), v.readAsText($);
1727
+ };
1728
+ return /* @__PURE__ */ d(X, { children: [/* @__PURE__ */ d(Er, {
1729
+ type: "button",
1730
+ onClick: () => o(!0),
1731
+ children: [/* @__PURE__ */ r(ir, {}), " Import rules"]
1732
+ }), t && /* @__PURE__ */ d(wr, {
1733
+ title: "Import rules",
1734
+ subtitle: "Add existing rules from a redocly.yaml file",
1735
+ onClose: g,
1736
+ footer: /* @__PURE__ */ d(X, { children: [/* @__PURE__ */ r(De, {
1737
+ type: "button",
1738
+ onClick: g,
1739
+ children: "Cancel"
1740
+ }), i === "paste" && /* @__PURE__ */ r(Ke, {
1741
+ type: "button",
1742
+ disabled: !c.trim(),
1743
+ onClick: () => x(c),
1744
+ children: "Import rules"
1745
+ })] }),
1746
+ children: [
1747
+ /* @__PURE__ */ r(Qt, { children: /* @__PURE__ */ r(Ue, {
1748
+ ariaLabel: "Import mode",
1749
+ value: i,
1750
+ onChange: a,
1751
+ options: [{
1752
+ value: "paste",
1753
+ label: "paste"
1754
+ }, {
1755
+ value: "upload",
1756
+ label: "upload file"
1757
+ }]
1758
+ }) }),
1759
+ i === "paste" ? /* @__PURE__ */ r(Xt, {
1760
+ "aria-label": "Rules YAML",
1761
+ value: c,
1762
+ placeholder: `rules:
1763
+ rule/operation-summary:
1764
+ subject:
1765
+ type: Operation
1766
+ property: summary
1767
+ assertions:
1768
+ defined: true
1769
+ maxLength: 20`,
1770
+ onChange: ($) => s($.target.value)
1771
+ }) : /* @__PURE__ */ d(Zt, {
1772
+ $active: h,
1773
+ onClick: () => u.current?.click(),
1774
+ onDragOver: ($) => {
1775
+ $.preventDefault(), $.dataTransfer.dropEffect = "copy", h || y(!0);
1776
+ },
1777
+ onDragLeave: ($) => {
1778
+ $.currentTarget.contains($.relatedTarget) || y(!1);
1779
+ },
1780
+ onDrop: ($) => {
1781
+ $.preventDefault(), y(!1);
1782
+ const v = $.dataTransfer.files?.[0];
1783
+ v && C(v);
1784
+ },
1785
+ children: [
1786
+ /* @__PURE__ */ r(eo, { children: /* @__PURE__ */ r(ir, { size: 18 }) }),
1787
+ /* @__PURE__ */ r(ro, { children: "Drop your redocly.yaml here" }),
1788
+ /* @__PURE__ */ d(to, { children: [
1789
+ "or ",
1790
+ /* @__PURE__ */ r("b", { children: "browse files" }),
1791
+ " · .yaml, .yml, .json"
1792
+ ] })
1793
+ ]
1794
+ }),
1795
+ l && /* @__PURE__ */ r(oo, {
1796
+ role: "alert",
1797
+ children: l
1798
+ }),
1799
+ f && /* @__PURE__ */ r(no, { children: f }),
1800
+ /* @__PURE__ */ r("input", {
1801
+ ref: u,
1802
+ type: "file",
1803
+ accept: ".yaml,.yml,.json,.txt",
1804
+ hidden: !0,
1805
+ "aria-label": "Upload rules file",
1806
+ onChange: ($) => {
1807
+ const v = $.target.files?.[0];
1808
+ $.target.value = "", v && C(v);
1809
+ }
1810
+ })
1811
+ ]
1812
+ })] });
1813
+ }
1814
+ function ir({ size: e = 13 }) {
1815
+ return /* @__PURE__ */ r("svg", {
1816
+ width: e,
1817
+ height: e,
1818
+ viewBox: "0 0 14 14",
1819
+ "aria-hidden": !0,
1820
+ children: /* @__PURE__ */ r("path", {
1821
+ d: "M7 1.5v7M4 6l3 2.5L10 6M2 10.5v1.5a1 1 0 001 1h8a1 1 0 001-1v-1.5",
1822
+ fill: "none",
1823
+ stroke: "currentColor",
1824
+ strokeWidth: "1.4",
1825
+ strokeLinecap: "round",
1826
+ strokeLinejoin: "round"
1827
+ })
1828
+ });
1829
+ }
1830
+ var Qt = n.div`
1831
+ margin-bottom: 14px;
1832
+ `, Xt = n.textarea`
1833
+ width: 100%;
1834
+ box-sizing: border-box;
1835
+ display: block;
1836
+ height: 220px;
1837
+ background: var(--color-warm-grey-1, #fbfbfc);
1838
+ border: 1px solid var(--border-color-primary, #d6dde8);
1839
+ border-radius: 12px;
1840
+ padding: 14px;
1841
+ font-family: ${D};
1842
+ font-size: 12px;
1843
+ line-height: 1.7;
1844
+ color: var(--text-color-primary, #1b2430);
1845
+ resize: vertical;
1846
+ outline: none;
1847
+
1848
+ &:focus {
1849
+ border-color: var(--color-primary-base, #2563eb);
1850
+ }
1851
+ `, Zt = n.div`
1852
+ border: 1.5px dashed ${(e) => e.$active ? "var(--color-primary-base, #2563eb)" : "var(--border-color-primary, #d6dde8)"};
1853
+ border-radius: 12px;
1854
+ background: var(--color-warm-grey-1, #fbfbfc);
1855
+ padding: 38px 20px;
1856
+ display: flex;
1857
+ flex-direction: column;
1858
+ align-items: center;
1859
+ gap: 10px;
1860
+ cursor: pointer;
1861
+ text-align: center;
1862
+
1863
+ &:hover {
1864
+ border-color: var(--color-primary-base, #2563eb);
1865
+ }
1866
+ `, eo = n.div`
1867
+ width: 40px;
1868
+ height: 40px;
1869
+ border-radius: 12px;
1870
+ background: var(--color-primary-bg, #eff4fe);
1871
+ color: var(--color-primary-base, #2563eb);
1872
+ display: flex;
1873
+ align-items: center;
1874
+ justify-content: center;
1875
+ `, ro = n.div`
1876
+ font-size: 13.5px;
1877
+ font-weight: 600;
1878
+ color: var(--text-color-primary, #1b2430);
1879
+ `, to = n.div`
1880
+ font-size: 12.5px;
1881
+ color: var(--text-color-secondary, #64748b);
1882
+
1883
+ b {
1884
+ color: var(--color-primary-base, #2563eb);
1885
+ }
1886
+ `, oo = n.p`
1887
+ color: var(--color-error-base, #dc2626);
1888
+ font-size: 12.5px;
1889
+ margin: 12px 0 0;
1890
+ `, no = n.p`
1891
+ color: var(--text-color-secondary, #64748b);
1892
+ font-size: 12.5px;
1893
+ margin: 12px 0 0;
1894
+ `, ao = [
1895
+ "camelCase",
1896
+ "kebab-case",
1897
+ "snake_case",
1898
+ "PascalCase",
1899
+ "MACRO_CASE",
1900
+ "COBOL-CASE",
1901
+ "flatcase"
1902
+ ], io = [
1903
+ "Root",
1904
+ "Info",
1905
+ "Contact",
1906
+ "License",
1907
+ "Server",
1908
+ "ServerList",
1909
+ "ServerVariables",
1910
+ "Paths",
1911
+ "PathItem",
1912
+ "Operation",
1913
+ "Parameter",
1914
+ "ParameterList",
1915
+ "RequestBody",
1916
+ "MediaTypesMap",
1917
+ "MediaType",
1918
+ "Responses",
1919
+ "Response",
1920
+ "Schema",
1921
+ "SchemaProperties",
1922
+ "Discriminator",
1923
+ "DiscriminatorMapping",
1924
+ "Example",
1925
+ "ExamplesMap",
1926
+ "Encoding",
1927
+ "Header",
1928
+ "HeadersMap",
1929
+ "Link",
1930
+ "LinksMap",
1931
+ "Callback",
1932
+ "CallbacksMap",
1933
+ "XCodeSample",
1934
+ "WebhooksMap",
1935
+ "Components",
1936
+ "NamedSchemas",
1937
+ "NamedResponses",
1938
+ "NamedParameters",
1939
+ "NamedExamples",
1940
+ "NamedRequestBodies",
1941
+ "NamedHeaders",
1942
+ "NamedPathItems",
1943
+ "NamedSecuritySchemes",
1944
+ "NamedLinks",
1945
+ "NamedCallbacks",
1946
+ "SecurityScheme",
1947
+ "SecurityRequirement",
1948
+ "OAuth2Flows",
1949
+ "ImplicitFlow",
1950
+ "PasswordFlow",
1951
+ "AuthorizationCode",
1952
+ "ClientCredentials",
1953
+ "Tag",
1954
+ "TagList",
1955
+ "ExternalDocs"
1956
+ ], so = ["any", ...Array.from(/* @__PURE__ */ new Set([...io, ...Object.keys(Lr)])).sort()], Le = [
1957
+ {
1958
+ key: "casing",
1959
+ kind: "casing",
1960
+ propertyMode: "either",
1961
+ hint: "value matches a casing style"
1962
+ },
1963
+ {
1964
+ key: "const",
1965
+ kind: "text",
1966
+ propertyMode: "either",
1967
+ hint: "value equals exactly"
1968
+ },
1969
+ {
1970
+ key: "contains",
1971
+ kind: "stringList",
1972
+ propertyMode: "required",
1973
+ hint: "array value includes all of"
1974
+ },
1975
+ {
1976
+ key: "defined",
1977
+ kind: "boolean",
1978
+ propertyMode: "either",
1979
+ hint: "property is defined"
1980
+ },
1981
+ {
1982
+ key: "disallowed",
1983
+ kind: "stringList",
1984
+ propertyMode: "forbidden",
1985
+ hint: "none of these keys are defined"
1986
+ },
1987
+ {
1988
+ key: "enum",
1989
+ kind: "stringList",
1990
+ propertyMode: "either",
1991
+ hint: "value is one of"
1992
+ },
1993
+ {
1994
+ key: "maxLength",
1995
+ kind: "number",
1996
+ propertyMode: "either",
1997
+ hint: "string/array length at most (exclusive)"
1998
+ },
1999
+ {
2000
+ key: "minLength",
2001
+ kind: "number",
2002
+ propertyMode: "either",
2003
+ hint: "string/array length at least (inclusive)"
2004
+ },
2005
+ {
2006
+ key: "mutuallyExclusive",
2007
+ kind: "stringList",
2008
+ propertyMode: "forbidden",
2009
+ hint: "at most one of these keys is defined"
2010
+ },
2011
+ {
2012
+ key: "mutuallyRequired",
2013
+ kind: "stringList",
2014
+ propertyMode: "forbidden",
2015
+ hint: "these keys are defined together or not at all"
2016
+ },
2017
+ {
2018
+ key: "nonEmpty",
2019
+ kind: "boolean",
2020
+ propertyMode: "required",
2021
+ hint: "value is not empty"
2022
+ },
2023
+ {
2024
+ key: "notPattern",
2025
+ kind: "regex",
2026
+ propertyMode: "either",
2027
+ hint: "value does not match regex"
2028
+ },
2029
+ {
2030
+ key: "pattern",
2031
+ kind: "regex",
2032
+ propertyMode: "either",
2033
+ hint: "value matches regex"
2034
+ },
2035
+ {
2036
+ key: "ref",
2037
+ kind: "refValue",
2038
+ propertyMode: "either",
2039
+ hint: "$ref is (not) used, or matches pattern"
2040
+ },
2041
+ {
2042
+ key: "required",
2043
+ kind: "stringList",
2044
+ propertyMode: "forbidden",
2045
+ hint: "all of these keys are defined"
2046
+ },
2047
+ {
2048
+ key: "requireAny",
2049
+ kind: "stringList",
2050
+ propertyMode: "forbidden",
2051
+ hint: "at least one of these keys is defined"
2052
+ }
2053
+ ], xe = Object.fromEntries(Le.map((e) => [e.key, e])), lo = [
2054
+ "{{assertionName}}",
2055
+ "{{nodeType}}",
2056
+ "{{key}}",
2057
+ "{{property}}",
2058
+ "{{problems}}",
2059
+ "{{pointer}}",
2060
+ "{{file}}"
2061
+ ], co = /^[a-zA-Z][a-zA-Z0-9-]*$/;
2062
+ function Sr(e) {
2063
+ return Array.isArray(e.property) ? e.property.length > 0 : !!e.property;
2064
+ }
2065
+ function Oe(e) {
2066
+ const t = e.lastIndexOf("/"), o = e.startsWith("/") && t > 0;
2067
+ try {
2068
+ return o ? new RegExp(e.slice(1, t), e.slice(t + 1)) : new RegExp(e), !0;
2069
+ } catch {
2070
+ return !1;
2071
+ }
2072
+ }
2073
+ function sr(e, t, o) {
2074
+ e.type || (o[`${t}type`] = "Choose a node type"), e.matchParentKeys && !Oe(e.matchParentKeys) && (o[`${t}matchParentKeys`] = "Invalid regular expression");
2075
+ }
2076
+ function lr(e, t, o, i) {
2077
+ const a = Sr(t);
2078
+ for (const [c, s] of Object.entries(e)) {
2079
+ const l = xe[c];
2080
+ if (!l) continue;
2081
+ const p = `${o}assertion:${c}`;
2082
+ if (l.propertyMode === "required" && !a) {
2083
+ i[p] = `\`${c}\` needs a single property target`;
2084
+ continue;
2085
+ }
2086
+ if (l.propertyMode === "forbidden" && a) {
2087
+ i[p] = `\`${c}\` asserts on key names — target the whole node`;
2088
+ continue;
2089
+ }
2090
+ switch (l.kind) {
2091
+ case "regex":
2092
+ typeof s != "string" || !s ? i[p] = "Enter a regular expression" : Oe(s) || (i[p] = "Invalid regular expression");
2093
+ break;
2094
+ case "stringList":
2095
+ (!Array.isArray(s) || s.length === 0) && (i[p] = "Add at least one value");
2096
+ break;
2097
+ case "number":
2098
+ (!Number.isInteger(s) || s < 0) && (i[p] = "Enter a non-negative integer");
2099
+ break;
2100
+ case "text":
2101
+ (typeof s != "string" || s.trim() === "") && (i[p] = "Enter a value");
2102
+ break;
2103
+ case "refValue":
2104
+ typeof s == "string" && (!s || !Oe(s)) && (i[p] = "Enter a valid pattern");
2105
+ }
2106
+ }
2107
+ }
2108
+ function po(e, t) {
2109
+ const o = {};
2110
+ return co.test(e) || (o.name = "Use letters, digits and dashes, starting with a letter"), sr(t.subject, "subject.", o), lr(t.assertions ?? {}, t.subject, "", o), (t.where ?? []).forEach((i, a) => {
2111
+ sr(i.subject, `where:${a}.`, o), lr(i.assertions ?? {}, i.subject, `where:${a}.`, o);
2112
+ }), o;
2113
+ }
2114
+ var uo = n.span`
2115
+ display: inline-flex;
2116
+ flex-wrap: wrap;
2117
+ gap: 4px;
2118
+ align-items: center;
2119
+ border: 1px dashed var(--border-color-secondary, #e5e9f0);
2120
+ border-radius: 10px;
2121
+ padding: 2px 6px;
2122
+ background: var(--bg-color, #ffffff);
2123
+
2124
+ &:focus-within {
2125
+ border-color: var(--color-primary-base, #2563eb);
2126
+ border-style: solid;
2127
+ }
2128
+ `, fo = n.span`
2129
+ display: inline-flex;
2130
+ align-items: center;
2131
+ gap: 3px;
2132
+ font-size: 12px;
2133
+ font-family: ${D};
2134
+ background: var(--color-primary-bg, #eff4fe);
2135
+ color: var(--text-color-primary, #1b2430);
2136
+ border-radius: 10px;
2137
+ padding: 1px 3px 1px 7px;
2138
+ `, mo = n.button`
2139
+ font: inherit;
2140
+ font-size: 12px;
2141
+ line-height: 1;
2142
+ border: none;
2143
+ background: transparent;
2144
+ color: var(--text-color-secondary, #64748b);
2145
+ cursor: pointer;
2146
+ padding: 2px 4px;
2147
+ border-radius: 3px;
2148
+
2149
+ &:hover {
2150
+ color: var(--color-error-base, #dc2626);
2151
+ }
2152
+
2153
+ &:focus-visible {
2154
+ outline: 2px solid var(--color-primary-base, #2563eb);
2155
+ }
2156
+ `, ho = n.input`
2157
+ font: inherit;
2158
+ font-size: 12px;
2159
+ font-family: ${D};
2160
+ border: none;
2161
+ outline: none;
2162
+ background: transparent;
2163
+ color: var(--text-color-primary, #1b2430);
2164
+ min-width: 64px;
2165
+ flex: 1;
2166
+ padding: 1px 2px;
2167
+
2168
+ &::placeholder {
2169
+ color: var(--text-color-secondary, #64748b);
2170
+ opacity: 0.8;
2171
+ }
2172
+ `;
2173
+ function ke({ values: e, onChange: t, ariaLabel: o, placeholder: i }) {
2174
+ const [a, c] = I(""), s = (l) => {
2175
+ const p = l.trim();
2176
+ p && !e.includes(p) && t([...e, p]), c("");
2177
+ };
2178
+ return /* @__PURE__ */ d(uo, {
2179
+ role: "group",
2180
+ "aria-label": o,
2181
+ children: [e.map((l) => /* @__PURE__ */ d(fo, { children: [l, /* @__PURE__ */ r(mo, {
2182
+ type: "button",
2183
+ "aria-label": `Remove ${l}`,
2184
+ onClick: () => t(e.filter((p) => p !== l)),
2185
+ children: "×"
2186
+ })] }, l)), /* @__PURE__ */ r(ho, {
2187
+ value: a,
2188
+ "aria-label": `Add value to ${o}`,
2189
+ placeholder: e.length === 0 ? i ?? "add value…" : "add…",
2190
+ onChange: (l) => c(l.target.value),
2191
+ onKeyDown: (l) => {
2192
+ l.key === "Enter" || l.key === "," ? (l.preventDefault(), s(a)) : l.key === "Backspace" && a === "" && e.length && t(e.slice(0, -1));
2193
+ },
2194
+ onBlur: () => a.trim() && s(a)
2195
+ })]
2196
+ });
2197
+ }
2198
+ var cr = {
2199
+ casing: "camelCase",
2200
+ const: "",
2201
+ contains: [],
2202
+ defined: !0,
2203
+ disallowed: [],
2204
+ enum: [],
2205
+ maxLength: 10,
2206
+ minLength: 1,
2207
+ mutuallyExclusive: [],
2208
+ mutuallyRequired: [],
2209
+ nonEmpty: !0,
2210
+ notPattern: "",
2211
+ pattern: "",
2212
+ ref: !0,
2213
+ required: [],
2214
+ requireAny: []
2215
+ };
2216
+ function pr({ assertions: e, onChange: t, keyword: o, tone: i, errors: a, errorPrefix: c }) {
2217
+ const s = Le.filter((u) => e[u.key] !== void 0).map((u) => u.key), l = Le.filter((u) => e[u.key] === void 0), p = Object.keys(e).filter((u) => !xe[u] && e[u] !== void 0), f = H[i].fg, m = (u, g) => {
2218
+ t({
2219
+ ...e,
2220
+ [u]: g
2221
+ });
2222
+ }, h = (u, g) => {
2223
+ const x = { ...e };
2224
+ delete x[u], t({
2225
+ ...x,
2226
+ [g]: cr[g]
2227
+ });
2228
+ }, y = (u) => {
2229
+ const g = { ...e };
2230
+ delete g[u], t(g);
2231
+ };
2232
+ return /* @__PURE__ */ d(vo, { children: [
2233
+ s.map((u) => {
2234
+ const g = xe[u], x = a[`${c}assertion:${u}`];
2235
+ return /* @__PURE__ */ d(dr, { children: [
2236
+ /* @__PURE__ */ r(ur, {
2237
+ style: { color: f },
2238
+ children: o
2239
+ }),
2240
+ /* @__PURE__ */ d(he, {
2241
+ "aria-label": "Assertion kind",
2242
+ value: u,
2243
+ onChange: (C) => h(u, C.target.value),
2244
+ children: [/* @__PURE__ */ r("option", {
2245
+ value: u,
2246
+ children: u
2247
+ }), l.map((C) => /* @__PURE__ */ r("option", {
2248
+ value: C.key,
2249
+ children: C.key
2250
+ }, C.key))]
2251
+ }),
2252
+ /* @__PURE__ */ r(ye, {
2253
+ error: x,
2254
+ children: /* @__PURE__ */ r(go, {
2255
+ assertionKey: u,
2256
+ value: e[u],
2257
+ onChange: (C) => m(u, C)
2258
+ })
2259
+ }),
2260
+ /* @__PURE__ */ r(fr, { children: g.hint }),
2261
+ /* @__PURE__ */ r(mr, {
2262
+ type: "button",
2263
+ "aria-label": `Remove ${u} assertion`,
2264
+ onClick: () => y(u),
2265
+ children: "×"
2266
+ })
2267
+ ] }, u);
2268
+ }),
2269
+ p.map((u) => /* @__PURE__ */ d(dr, { children: [
2270
+ /* @__PURE__ */ r(ur, {
2271
+ style: { color: f },
2272
+ children: o
2273
+ }),
2274
+ /* @__PURE__ */ r(bo, { children: u }),
2275
+ /* @__PURE__ */ r(yo, { children: JSON.stringify(e[u]) }),
2276
+ /* @__PURE__ */ r(fr, { children: "edit in the generated YAML" }),
2277
+ /* @__PURE__ */ r(mr, {
2278
+ type: "button",
2279
+ "aria-label": `Remove ${u} assertion`,
2280
+ onClick: () => y(u),
2281
+ children: "×"
2282
+ })
2283
+ ] }, u)),
2284
+ l.length > 0 && /* @__PURE__ */ r(xo, {
2285
+ type: "button",
2286
+ style: { color: f },
2287
+ onClick: () => m(l[0].key, cr[l[0].key]),
2288
+ children: "+ Add assertion"
2289
+ })
2290
+ ] });
2291
+ }
2292
+ function go({ assertionKey: e, value: t, onChange: o }) {
2293
+ const i = xe[e], a = `${e} value`;
2294
+ switch (i.kind) {
2295
+ case "casing":
2296
+ return /* @__PURE__ */ r(he, {
2297
+ "aria-label": a,
2298
+ value: t,
2299
+ onChange: (c) => o(c.target.value),
2300
+ children: ao.map((c) => /* @__PURE__ */ r("option", {
2301
+ value: c,
2302
+ children: c
2303
+ }, c))
2304
+ });
2305
+ case "boolean":
2306
+ return /* @__PURE__ */ d(he, {
2307
+ "aria-label": a,
2308
+ value: String(!!t),
2309
+ onChange: (c) => o(c.target.value === "true"),
2310
+ children: [/* @__PURE__ */ r("option", {
2311
+ value: "true",
2312
+ children: "yes"
2313
+ }), /* @__PURE__ */ r("option", {
2314
+ value: "false",
2315
+ children: "no"
2316
+ })]
2317
+ });
2318
+ case "number":
2319
+ return /* @__PURE__ */ r(le, {
2320
+ type: "number",
2321
+ "aria-label": a,
2322
+ value: t,
2323
+ min: 0,
2324
+ style: { width: 70 },
2325
+ onChange: (c) => o(Number(c.target.value))
2326
+ });
2327
+ case "regex":
2328
+ return /* @__PURE__ */ r(Ae, {
2329
+ "aria-label": a,
2330
+ value: t,
2331
+ placeholder: "/\\\\.$/",
2332
+ style: { width: 150 },
2333
+ onChange: (c) => o(c.target.value)
2334
+ });
2335
+ case "stringList":
2336
+ return /* @__PURE__ */ r(ke, {
2337
+ ariaLabel: a,
2338
+ values: t ?? [],
2339
+ onChange: o
2340
+ });
2341
+ case "refValue": {
2342
+ const c = typeof t == "string" ? "pattern" : String(!!t);
2343
+ return /* @__PURE__ */ d(X, { children: [/* @__PURE__ */ d(he, {
2344
+ "aria-label": `${e} mode`,
2345
+ value: c,
2346
+ onChange: (s) => {
2347
+ const l = s.target.value;
2348
+ o(l === "pattern" ? "" : l === "true");
2349
+ },
2350
+ children: [
2351
+ /* @__PURE__ */ r("option", {
2352
+ value: "true",
2353
+ children: "must use $ref"
2354
+ }),
2355
+ /* @__PURE__ */ r("option", {
2356
+ value: "false",
2357
+ children: "must not use $ref"
2358
+ }),
2359
+ /* @__PURE__ */ r("option", {
2360
+ value: "pattern",
2361
+ children: "$ref matches pattern…"
2362
+ })
2363
+ ]
2364
+ }), c === "pattern" && /* @__PURE__ */ r(Ae, {
2365
+ "aria-label": `${e} pattern`,
2366
+ value: t,
2367
+ placeholder: "/components\\\\/schemas/",
2368
+ style: { width: 170 },
2369
+ onChange: (s) => o(s.target.value)
2370
+ })] });
2371
+ }
2372
+ default:
2373
+ return /* @__PURE__ */ r(le, {
2374
+ "aria-label": a,
2375
+ value: t ?? "",
2376
+ placeholder: "value",
2377
+ style: { width: 150 },
2378
+ onChange: (c) => o(c.target.value)
2379
+ });
2380
+ }
2381
+ }
2382
+ var vo = n.div`
2383
+ display: flex;
2384
+ flex-direction: column;
2385
+ gap: 8px;
2386
+ `, dr = n.div`
2387
+ display: flex;
2388
+ align-items: center;
2389
+ gap: 10px;
2390
+ flex-wrap: wrap;
2391
+ min-width: 0;
2392
+ background: var(--color-warm-grey-1, #fbfbfc);
2393
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
2394
+ border-radius: 12px;
2395
+ padding: 8px 12px;
2396
+ `, ur = n.span`
2397
+ font-size: 13px;
2398
+ font-style: italic;
2399
+ flex-shrink: 0;
2400
+ `, bo = n.span`
2401
+ font-family: ${D};
2402
+ font-size: 13px;
2403
+ font-weight: 600;
2404
+ `, yo = n.code`
2405
+ font-family: ${D};
2406
+ font-size: 12px;
2407
+ color: var(--text-color-secondary, #64748b);
2408
+ overflow: hidden;
2409
+ text-overflow: ellipsis;
2410
+ white-space: nowrap;
2411
+ max-width: 260px;
2412
+ `, fr = n.span`
2413
+ font-size: 12px;
2414
+ color: var(--color-warm-grey-6, #94a3b8);
2415
+ flex: 1 1 140px;
2416
+ min-width: 120px;
2417
+ `, mr = n.button`
2418
+ background: none;
2419
+ border: none;
2420
+ cursor: pointer;
2421
+ color: var(--color-warm-grey-6, #94a3b8);
2422
+ font-size: 15px;
2423
+ line-height: 1;
2424
+ margin-left: auto;
2425
+
2426
+ &:hover {
2427
+ color: var(--color-error-base, #dc2626);
2428
+ }
2429
+
2430
+ &:focus-visible {
2431
+ outline: 2px solid var(--color-primary-base, #2563eb);
2432
+ }
2433
+ `, xo = n.button`
2434
+ align-self: flex-start;
2435
+ background: none;
2436
+ border: none;
2437
+ font: inherit;
2438
+ font-size: 13px;
2439
+ font-weight: 600;
2440
+ cursor: pointer;
2441
+ padding: 2px 2px;
2442
+
2443
+ &:focus-visible {
2444
+ outline: 2px solid currentColor;
2445
+ }
2446
+ `;
2447
+ function ko({ value: e, onChange: t }) {
2448
+ return /* @__PURE__ */ r(Ue, {
2449
+ ariaLabel: "Severity",
2450
+ value: e,
2451
+ onChange: t,
2452
+ options: [
2453
+ {
2454
+ value: "error",
2455
+ label: "error",
2456
+ activeColor: F.error.fg
2457
+ },
2458
+ {
2459
+ value: "warn",
2460
+ label: "warn",
2461
+ activeColor: F.warn.fg
2462
+ },
2463
+ {
2464
+ value: "off",
2465
+ label: "off",
2466
+ activeColor: F.off.fg
2467
+ }
2468
+ ]
2469
+ });
2470
+ }
2471
+ var wo = n.div`
2472
+ position: relative;
2473
+ display: inline-block;
2474
+ `, Eo = n.input`
2475
+ font: inherit;
2476
+ font-size: 13px;
2477
+ font-weight: 600;
2478
+ color: var(--text-color-primary, #1b2430);
2479
+ background: var(--bg-color, #ffffff);
2480
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
2481
+ border-radius: 10px;
2482
+ padding: 2px 20px 2px 6px;
2483
+ width: 160px;
2484
+ box-sizing: border-box;
2485
+ cursor: pointer;
2486
+
2487
+ &:hover {
2488
+ border-color: var(--color-primary-base, #2563eb);
2489
+ }
2490
+
2491
+ &:focus-visible {
2492
+ outline: none;
2493
+ border-color: var(--color-primary-base, #2563eb);
2494
+ }
2495
+ `, $o = n.span`
2496
+ position: absolute;
2497
+ right: 7px;
2498
+ top: 50%;
2499
+ transform: translateY(-50%);
2500
+ pointer-events: none;
2501
+ font-size: 9px;
2502
+ color: var(--text-color-secondary, #64748b);
2503
+ `, Co = n.ul`
2504
+ position: absolute;
2505
+ z-index: 30;
2506
+ top: calc(100% + 4px);
2507
+ left: 0;
2508
+ margin: 0;
2509
+ padding: 4px;
2510
+ list-style: none;
2511
+ min-width: 210px;
2512
+ max-height: 260px;
2513
+ overflow-y: auto;
2514
+ background: var(--bg-color, #ffffff);
2515
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
2516
+ border-radius: 16px;
2517
+ box-shadow: 0 8px 24px rgba(15, 20, 40, 0.14);
2518
+ `, So = n.li`
2519
+ padding: 5px 10px;
2520
+ border-radius: 5px;
2521
+ font-size: 13px;
2522
+ cursor: pointer;
2523
+ color: var(--text-color-primary, #1b2430);
2524
+ background: ${(e) => e.$active ? "var(--color-primary-bg, #eff4fe)" : "transparent"};
2525
+ `, Ro = n.li`
2526
+ padding: 5px 10px;
2527
+ font-size: 12px;
2528
+ color: var(--text-color-secondary, #64748b);
2529
+ `;
2530
+ function Io({ value: e, options: t, onChange: o, ariaLabel: i, placeholder: a, width: c }) {
2531
+ const [s, l] = I(!1), [p, f] = I(null), [m, h] = I(0), y = A(null), u = A(null), g = Dr(), x = Y(() => {
2532
+ if (p === null || p === "") return t;
2533
+ const v = p.toLowerCase();
2534
+ return t.filter((P) => P.toLowerCase().includes(v));
2535
+ }, [t, p]);
2536
+ N(() => {
2537
+ if (!s) return;
2538
+ const v = (P) => {
2539
+ y.current?.contains(P.target) || (l(!1), f(null));
2540
+ };
2541
+ return document.addEventListener("pointerdown", v), () => document.removeEventListener("pointerdown", v);
2542
+ }, [s]), N(() => {
2543
+ s && u.current?.children[m]?.scrollIntoView({ block: "nearest" });
2544
+ }, [m, s]);
2545
+ const C = (v) => {
2546
+ o(v), l(!1), f(null);
2547
+ }, $ = (v) => {
2548
+ if (!s && (v.key === "ArrowDown" || v.key === "Enter")) {
2549
+ l(!0), h(Math.max(0, x.indexOf(e))), v.preventDefault();
2550
+ return;
2551
+ }
2552
+ if (s)
2553
+ switch (v.key) {
2554
+ case "ArrowDown":
2555
+ h((P) => Math.min(P + 1, x.length - 1)), v.preventDefault();
2556
+ break;
2557
+ case "ArrowUp":
2558
+ h((P) => Math.max(P - 1, 0)), v.preventDefault();
2559
+ break;
2560
+ case "Enter":
2561
+ x[m] && C(x[m]), v.preventDefault();
2562
+ break;
2563
+ case "Escape":
2564
+ l(!1), f(null), v.preventDefault();
2565
+ }
2566
+ };
2567
+ return /* @__PURE__ */ d(wo, {
2568
+ ref: y,
2569
+ children: [
2570
+ /* @__PURE__ */ r(Eo, {
2571
+ role: "combobox",
2572
+ "aria-expanded": s,
2573
+ "aria-controls": g,
2574
+ "aria-autocomplete": "list",
2575
+ "aria-label": i,
2576
+ "aria-activedescendant": s ? `${g}-${m}` : void 0,
2577
+ value: p ?? e,
2578
+ placeholder: a ?? "Select...",
2579
+ style: c ? { width: c } : void 0,
2580
+ onChange: (v) => {
2581
+ f(v.target.value), h(0), l(!0);
2582
+ },
2583
+ onClick: () => {
2584
+ l((v) => !v), h(Math.max(0, x.indexOf(e)));
2585
+ },
2586
+ onKeyDown: $,
2587
+ onBlur: () => {
2588
+ setTimeout(() => f(null), 150);
2589
+ }
2590
+ }),
2591
+ /* @__PURE__ */ r($o, {
2592
+ "aria-hidden": !0,
2593
+ children: "▾"
2594
+ }),
2595
+ s && /* @__PURE__ */ d(Co, {
2596
+ role: "listbox",
2597
+ id: g,
2598
+ ref: u,
2599
+ children: [x.length === 0 && /* @__PURE__ */ r(Ro, { children: "No matches" }), x.map((v, P) => /* @__PURE__ */ r(So, {
2600
+ id: `${g}-${P}`,
2601
+ role: "option",
2602
+ "aria-selected": v === e,
2603
+ $active: P === m,
2604
+ onMouseEnter: () => h(P),
2605
+ onMouseDown: (b) => {
2606
+ b.preventDefault(), C(v);
2607
+ },
2608
+ children: v
2609
+ }, v))]
2610
+ })
2611
+ ]
2612
+ });
2613
+ }
2614
+ function Me(e) {
2615
+ return e ? Array.isArray(e) ? e.join(", ") : e : "";
2616
+ }
2617
+ function hr(e) {
2618
+ const t = e.split(",").map((o) => o.trim()).filter(Boolean);
2619
+ if (t.length !== 0)
2620
+ return t.length === 1 ? t[0] : t;
2621
+ }
2622
+ function gr({ subject: e, onChange: t, lead: o, ariaPrefix: i, errors: a, errorPrefix: c }) {
2623
+ const s = Sr(e), l = !!(e.filterInParentKeys?.length || e.filterOutParentKeys?.length || e.matchParentKeys), [p, f] = I(l), [m, h] = I(Me(e.property)), y = A(Me(e.property)), u = (g) => {
2624
+ if (g === "node")
2625
+ s && (y.current = Me(e.property)), h(""), t({
2626
+ ...e,
2627
+ property: void 0
2628
+ });
2629
+ else {
2630
+ const x = y.current;
2631
+ h(x), t({
2632
+ ...e,
2633
+ property: hr(x) ?? ""
2634
+ });
2635
+ }
2636
+ };
2637
+ return /* @__PURE__ */ d(X, { children: [/* @__PURE__ */ d(ce, { children: [
2638
+ /* @__PURE__ */ r("span", { children: o }),
2639
+ /* @__PURE__ */ r(ye, {
2640
+ error: a[`${c}type`],
2641
+ children: /* @__PURE__ */ r(Io, {
2642
+ ariaLabel: `${i} node type`,
2643
+ value: e.type,
2644
+ options: so,
2645
+ onChange: (g) => t({
2646
+ ...e,
2647
+ type: g
2648
+ })
2649
+ })
2650
+ }),
2651
+ /* @__PURE__ */ r("span", { children: "node, check" }),
2652
+ /* @__PURE__ */ r(Ue, {
2653
+ ariaLabel: `${i} target`,
2654
+ value: s || e.property === "" ? "property" : "node",
2655
+ onChange: u,
2656
+ options: [{
2657
+ value: "node",
2658
+ label: "whole node"
2659
+ }, {
2660
+ value: "property",
2661
+ label: "single property"
2662
+ }]
2663
+ }),
2664
+ (s || e.property === "") && /* @__PURE__ */ r(le, {
2665
+ "aria-label": `${i} property name`,
2666
+ value: m,
2667
+ placeholder: "e.g. summary",
2668
+ style: { width: 140 },
2669
+ onChange: (g) => {
2670
+ h(g.target.value), t({
2671
+ ...e,
2672
+ property: hr(g.target.value) ?? ""
2673
+ });
2674
+ }
2675
+ })
2676
+ ] }), /* @__PURE__ */ d(Mo, { children: [/* @__PURE__ */ d(Po, {
2677
+ type: "button",
2678
+ "aria-expanded": p,
2679
+ onClick: () => f((g) => !g),
2680
+ children: [
2681
+ /* @__PURE__ */ r($r, { open: p }),
2682
+ " Advanced",
2683
+ !p && l && /* @__PURE__ */ r(To, { title: "Parent-key filters are set" })
2684
+ ]
2685
+ }), p && /* @__PURE__ */ d(Ao, { children: [
2686
+ /* @__PURE__ */ d(Pe, { children: [/* @__PURE__ */ r(se, { children: "under parent keys" }), /* @__PURE__ */ r(ke, {
2687
+ ariaLabel: `${i} filterInParentKeys`,
2688
+ values: e.filterInParentKeys ?? [],
2689
+ placeholder: "post, put…",
2690
+ onChange: (g) => t({
2691
+ ...e,
2692
+ filterInParentKeys: g.length ? g : void 0
2693
+ })
2694
+ })] }),
2695
+ /* @__PURE__ */ d(Pe, { children: [/* @__PURE__ */ r(se, { children: "not under parent keys" }), /* @__PURE__ */ r(ke, {
2696
+ ariaLabel: `${i} filterOutParentKeys`,
2697
+ values: e.filterOutParentKeys ?? [],
2698
+ placeholder: "none",
2699
+ onChange: (g) => t({
2700
+ ...e,
2701
+ filterOutParentKeys: g.length ? g : void 0
2702
+ })
2703
+ })] }),
2704
+ /* @__PURE__ */ d(Pe, { children: [/* @__PURE__ */ r(se, { children: "under parent keys matching" }), /* @__PURE__ */ r(ye, {
2705
+ error: a[`${c}matchParentKeys`],
2706
+ children: /* @__PURE__ */ r(Ae, {
2707
+ "aria-label": `${i} matchParentKeys regex`,
2708
+ value: e.matchParentKeys ?? "",
2709
+ placeholder: "^x-",
2710
+ style: { width: 140 },
2711
+ onChange: (g) => t({
2712
+ ...e,
2713
+ matchParentKeys: g.target.value || void 0
2714
+ })
2715
+ })
2716
+ })] })
2717
+ ] })] })] });
2718
+ }
2719
+ var Mo = n.div`
2720
+ margin-top: 10px;
2721
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
2722
+ border-radius: 12px;
2723
+ overflow: hidden;
2724
+ `, Po = n.button`
2725
+ width: 100%;
2726
+ display: flex;
2727
+ align-items: center;
2728
+ gap: 6px;
2729
+ background: none;
2730
+ border: none;
2731
+ cursor: pointer;
2732
+ padding: 8px 12px;
2733
+ font: inherit;
2734
+ font-size: 12.5px;
2735
+ font-weight: 600;
2736
+ color: var(--text-color-secondary, #64748b);
2737
+ text-align: left;
2738
+
2739
+ &:hover {
2740
+ color: var(--color-primary-base, #2563eb);
2741
+ }
2742
+
2743
+ &:focus-visible {
2744
+ outline: 2px solid var(--color-primary-base, #2563eb);
2745
+ outline-offset: -2px;
2746
+ }
2747
+ `, To = n.span`
2748
+ width: 6px;
2749
+ height: 6px;
2750
+ border-radius: 50%;
2751
+ background: var(--color-primary-base, #2563eb);
2752
+ `, Ao = n.div`
2753
+ border-top: 1px solid var(--border-color-secondary, #e5e9f0);
2754
+ padding: 6px 8px;
2755
+ display: flex;
2756
+ flex-direction: column;
2757
+ gap: 2px;
2758
+ `, Pe = n(ce)`
2759
+ padding: 3px 4px;
2760
+ border-radius: 8px;
2761
+
2762
+ &:hover {
2763
+ background: var(--color-warm-grey-1, #fbfbfc);
2764
+ }
2765
+ `, Do = {
2766
+ subject: { type: "PathItem" },
2767
+ assertions: { defined: !0 }
2768
+ };
2769
+ function Lo({ entry: e, selected: t, matchCount: o, isDuplicateName: i, isEvaluating: a, onToggle: c, onChange: s, onRemove: l }) {
2770
+ const { name: p, rule: f } = e, m = A(null), h = Y(() => po(p, f), [p, f]), y = (b) => {
2771
+ s({
2772
+ ...e,
2773
+ rule: {
2774
+ ...f,
2775
+ ...b
2776
+ }
2777
+ });
2778
+ }, u = f.where ?? [], g = A([]);
2779
+ for (; g.current.length < u.length; ) g.current.push(we());
2780
+ g.current.length > u.length && (g.current.length = u.length);
2781
+ const x = (b, R) => {
2782
+ const T = [...u];
2783
+ T[b] = R, y({ where: T });
2784
+ }, C = (b) => {
2785
+ g.current.splice(b, 1), y({ where: u.filter((R, T) => T !== b) });
2786
+ }, $ = (b) => {
2787
+ const R = m.current, T = f.message ?? "", _ = R?.selectionStart ?? T.length;
2788
+ y({ message: T.slice(0, _) + b + T.slice(_) }), requestAnimationFrame(() => {
2789
+ R?.focus(), R?.setSelectionRange(_ + b.length, _ + b.length);
2790
+ });
2791
+ }, v = h.name ?? (i ? "Rule names must be unique" : void 0), P = f.severity ?? "error";
2792
+ return /* @__PURE__ */ d(Oo, {
2793
+ $selected: t,
2794
+ children: [/* @__PURE__ */ d(zo, {
2795
+ onClick: c,
2796
+ children: [
2797
+ /* @__PURE__ */ r(Bo, {
2798
+ type: "button",
2799
+ "aria-expanded": t,
2800
+ "aria-label": `${t ? "Collapse" : "Expand"} rule ${p}`,
2801
+ onClick: (b) => {
2802
+ b.stopPropagation(), c();
2803
+ },
2804
+ children: /* @__PURE__ */ r($r, { open: t })
2805
+ }),
2806
+ /* @__PURE__ */ d(No, {
2807
+ onClick: (b) => t && b.stopPropagation(),
2808
+ children: [/* @__PURE__ */ r(jo, { children: "rule/" }), t ? /* @__PURE__ */ r(ye, {
2809
+ error: v,
2810
+ style: { flex: 1 },
2811
+ children: /* @__PURE__ */ r(qo, {
2812
+ "aria-label": "Rule name",
2813
+ value: p,
2814
+ onChange: (b) => s({
2815
+ ...e,
2816
+ name: b.target.value.replace(/\s+/g, "-")
2817
+ })
2818
+ })
2819
+ }) : /* @__PURE__ */ r(Fo, { children: p })]
2820
+ }),
2821
+ /* @__PURE__ */ d(_o, { children: [
2822
+ t ? /* @__PURE__ */ r(ko, {
2823
+ value: P,
2824
+ onChange: (b) => y({ severity: b })
2825
+ }) : /* @__PURE__ */ r(ge, {
2826
+ style: {
2827
+ background: F[P].bg,
2828
+ color: F[P].fg
2829
+ },
2830
+ children: P
2831
+ }),
2832
+ o > 0 ? /* @__PURE__ */ d(ge, {
2833
+ $dim: a,
2834
+ title: "Nodes matched in the current document",
2835
+ style: {
2836
+ background: be.bg,
2837
+ color: be.fg
2838
+ },
2839
+ children: [o, " matched"]
2840
+ }, o) : /* @__PURE__ */ r(ge, {
2841
+ $dim: a,
2842
+ title: "The subject and where conditions match no nodes in this document",
2843
+ style: {
2844
+ background: F.warn.bg,
2845
+ color: F.warn.fg
2846
+ },
2847
+ children: "no matches"
2848
+ }, "none"),
2849
+ /* @__PURE__ */ r(Ko, {
2850
+ type: "button",
2851
+ "aria-label": `Remove rule ${p}`,
2852
+ title: "Remove rule",
2853
+ onClick: (b) => {
2854
+ b.stopPropagation(), l();
2855
+ },
2856
+ children: /* @__PURE__ */ r("svg", {
2857
+ width: "12",
2858
+ height: "12",
2859
+ viewBox: "0 0 12 12",
2860
+ "aria-hidden": !0,
2861
+ children: /* @__PURE__ */ r("path", {
2862
+ d: "M2.5 6h7",
2863
+ stroke: "currentColor",
2864
+ strokeWidth: "1.7",
2865
+ strokeLinecap: "round"
2866
+ })
2867
+ })
2868
+ })
2869
+ ] })
2870
+ ]
2871
+ }), t && /* @__PURE__ */ d(Uo, { children: [
2872
+ /* @__PURE__ */ r(ne, {
2873
+ tone: "subject",
2874
+ label: "Subject",
2875
+ hint: "what the rule checks",
2876
+ children: /* @__PURE__ */ r(gr, {
2877
+ lead: "On each",
2878
+ subject: f.subject,
2879
+ ariaPrefix: "Subject",
2880
+ errors: h,
2881
+ errorPrefix: "subject.",
2882
+ onChange: (b) => y({ subject: b })
2883
+ })
2884
+ }),
2885
+ /* @__PURE__ */ d(ne, {
2886
+ tone: "where",
2887
+ label: "Where",
2888
+ hint: "narrows top-to-bottom — each condition is a descendant of the previous one",
2889
+ children: [u.map((b, R) => /* @__PURE__ */ d(Wo, {
2890
+ style: { marginTop: R ? 8 : 0 },
2891
+ children: [
2892
+ /* @__PURE__ */ d(Ho, { children: [
2893
+ /* @__PURE__ */ r(Go, { children: "where" }),
2894
+ R > 0 && /* @__PURE__ */ d(Yo, { children: ["descendant of condition ", R] }),
2895
+ /* @__PURE__ */ r(Vo, {
2896
+ type: "button",
2897
+ "aria-label": `Remove where condition ${R + 1}`,
2898
+ onClick: () => C(R),
2899
+ children: "×"
2900
+ })
2901
+ ] }),
2902
+ /* @__PURE__ */ r(gr, {
2903
+ lead: "inside a",
2904
+ subject: b.subject,
2905
+ ariaPrefix: `Where ${R + 1}`,
2906
+ errors: h,
2907
+ errorPrefix: `where:${R}.`,
2908
+ onChange: (T) => x(R, {
2909
+ ...b,
2910
+ subject: T
2911
+ })
2912
+ }),
2913
+ /* @__PURE__ */ r(pr, {
2914
+ tone: "where",
2915
+ keyword: "that satisfies",
2916
+ assertions: b.assertions,
2917
+ errors: h,
2918
+ errorPrefix: `where:${R}.`,
2919
+ onChange: (T) => x(R, {
2920
+ ...b,
2921
+ assertions: T
2922
+ })
2923
+ })
2924
+ ]
2925
+ }, g.current[R])), /* @__PURE__ */ r(Jo, {
2926
+ type: "button",
2927
+ $tone: H.where.fg,
2928
+ onClick: () => y({ where: [...u, structuredClone(Do)] }),
2929
+ children: "+ Add condition"
2930
+ })]
2931
+ }),
2932
+ /* @__PURE__ */ r(ne, {
2933
+ tone: "assert",
2934
+ label: "Assert",
2935
+ hint: "flags a problem when an assertion evaluates to false",
2936
+ children: /* @__PURE__ */ r(pr, {
2937
+ tone: "assert",
2938
+ keyword: "assert",
2939
+ assertions: f.assertions,
2940
+ errors: h,
2941
+ errorPrefix: "",
2942
+ onChange: (b) => y({ assertions: b })
2943
+ })
2944
+ }),
2945
+ /* @__PURE__ */ d(ne, {
2946
+ tone: "message",
2947
+ label: "Message",
2948
+ hint: "optional — click a placeholder to insert it",
2949
+ children: [
2950
+ /* @__PURE__ */ d(ce, { children: [/* @__PURE__ */ r(se, { children: "message" }), /* @__PURE__ */ r(Qo, {
2951
+ ref: m,
2952
+ "aria-label": "Problem message",
2953
+ rows: 1,
2954
+ value: f.message ?? "",
2955
+ placeholder: "Problem message (optional)",
2956
+ onChange: (b) => y({ message: b.target.value || void 0 })
2957
+ })] }),
2958
+ /* @__PURE__ */ r(Xo, { children: lo.map((b) => /* @__PURE__ */ r(Zo, {
2959
+ type: "button",
2960
+ onClick: () => $(b),
2961
+ children: b
2962
+ }, b)) }),
2963
+ /* @__PURE__ */ d(ce, {
2964
+ style: { marginTop: 8 },
2965
+ children: [/* @__PURE__ */ r(se, { children: "reference" }), /* @__PURE__ */ r(le, {
2966
+ "aria-label": "Reference link",
2967
+ value: f.reference ?? "",
2968
+ placeholder: "Link to the style guide entry (optional)",
2969
+ style: { flex: 1 },
2970
+ onChange: (b) => y({ reference: b.target.value || void 0 })
2971
+ })]
2972
+ })
2973
+ ]
2974
+ }),
2975
+ /* @__PURE__ */ r(ne, {
2976
+ tone: "suggest",
2977
+ label: "Suggest",
2978
+ hint: "suggestions to display when the problem occurs",
2979
+ children: /* @__PURE__ */ r(ke, {
2980
+ ariaLabel: "Suggestions",
2981
+ values: f.suggest ?? [],
2982
+ placeholder: "add a suggestion…",
2983
+ onChange: (b) => y({ suggest: b.length ? b : void 0 })
2984
+ })
2985
+ })
2986
+ ] })]
2987
+ });
2988
+ }
2989
+ var Oo = n.div`
2990
+ background: var(--bg-color, #ffffff);
2991
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
2992
+ border-radius: 16px;
2993
+ overflow: hidden;
2994
+ flex-shrink: 0;
2995
+
2996
+ ${(e) => e.$selected && Ne`
2997
+ border-color: var(--color-primary-base, #2563eb);
2998
+ `}
2999
+ `, zo = n.div`
3000
+ display: flex;
3001
+ align-items: center;
3002
+ gap: 10px;
3003
+ padding: 11px 14px;
3004
+ cursor: pointer;
3005
+ min-width: 0;
3006
+ `, Bo = n.button`
3007
+ display: inline-flex;
3008
+ align-items: center;
3009
+ justify-content: center;
3010
+ border: none;
3011
+ background: transparent;
3012
+ color: var(--color-warm-grey-6, #94a3b8);
3013
+ padding: 2px;
3014
+ border-radius: 8px;
3015
+ cursor: pointer;
3016
+ flex-shrink: 0;
3017
+
3018
+ &:hover {
3019
+ color: var(--color-primary-base, #2563eb);
3020
+ background: var(--color-warm-grey-1, #fbfbfc);
3021
+ }
3022
+
3023
+ &:focus-visible {
3024
+ outline: 2px solid var(--color-primary-base, #2563eb);
3025
+ }
3026
+ `, No = n.div`
3027
+ display: flex;
3028
+ align-items: center;
3029
+ gap: 6px;
3030
+ min-width: 0;
3031
+ flex: 1;
3032
+ `, jo = n.span`
3033
+ color: var(--color-warm-grey-6, #94a3b8);
3034
+ font-family: ${D};
3035
+ font-size: 13px;
3036
+ flex-shrink: 0;
3037
+ `, qo = n.input`
3038
+ border: none;
3039
+ border-bottom: 1px dashed var(--border-color-primary, #d6dde8);
3040
+ background: transparent;
3041
+ font-family: ${D};
3042
+ font-size: 13px;
3043
+ color: inherit;
3044
+ outline: none;
3045
+ flex: 1;
3046
+ min-width: 80px;
3047
+ max-width: 240px;
3048
+
3049
+ &:focus {
3050
+ border-bottom-color: var(--color-primary-base, #2563eb);
3051
+ }
3052
+ `, Fo = n.span`
3053
+ font-family: ${D};
3054
+ font-size: 13px;
3055
+ font-weight: 600;
3056
+ overflow: hidden;
3057
+ text-overflow: ellipsis;
3058
+ white-space: nowrap;
3059
+ `, _o = n.div`
3060
+ display: flex;
3061
+ align-items: center;
3062
+ gap: 8px;
3063
+ flex-shrink: 0;
3064
+ margin-left: auto;
3065
+ `, ge = n.span`
3066
+ font-size: 12px;
3067
+ font-weight: 600;
3068
+ border-radius: 999px;
3069
+ padding: 4px 12px;
3070
+ white-space: nowrap;
3071
+ display: inline-block;
3072
+ animation: crb-count-pop 0.45s ease-out;
3073
+ opacity: ${(e) => e.$dim ? 0.5 : 1};
3074
+ transition: opacity 0.15s;
3075
+
3076
+ @keyframes crb-count-pop {
3077
+ 0% {
3078
+ transform: scale(0.86);
3079
+ }
3080
+ 55% {
3081
+ transform: scale(1.08);
3082
+ }
3083
+ 100% {
3084
+ transform: scale(1);
3085
+ }
3086
+ }
3087
+ `, Ko = n.button`
3088
+ width: 28px;
3089
+ height: 28px;
3090
+ border-radius: 8px;
3091
+ flex-shrink: 0;
3092
+ border: 1px solid var(--border-color-primary, #d6dde8);
3093
+ background: var(--bg-color, #ffffff);
3094
+ color: var(--color-warm-grey-6, #94a3b8);
3095
+ display: inline-flex;
3096
+ align-items: center;
3097
+ justify-content: center;
3098
+ cursor: pointer;
3099
+
3100
+ &:hover {
3101
+ border-color: var(--color-error-base, #dc2626);
3102
+ background: var(--color-error-bg, #fef2f2);
3103
+ color: var(--color-error-base, #dc2626);
3104
+ }
3105
+
3106
+ &:focus-visible {
3107
+ outline: 2px solid var(--color-primary-base, #2563eb);
3108
+ }
3109
+ `, Uo = n.div`
3110
+ padding: 2px 16px 14px;
3111
+ border-top: 1px solid var(--border-color-secondary, #e5e9f0);
3112
+ `, Wo = n.div`
3113
+ display: flex;
3114
+ flex-direction: column;
3115
+ gap: 8px;
3116
+ background: var(--color-warm-grey-1, #fbfbfc);
3117
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
3118
+ border-left: 3px solid ${H.where.fg};
3119
+ border-radius: 12px;
3120
+ padding: 10px 14px;
3121
+ `, Ho = n.div`
3122
+ display: flex;
3123
+ align-items: center;
3124
+ gap: 10px;
3125
+ `, Go = n.span`
3126
+ font-size: 12.5px;
3127
+ color: ${H.where.fg};
3128
+ font-style: italic;
3129
+ font-weight: 600;
3130
+ `, Yo = n.span`
3131
+ font-size: 11.5px;
3132
+ color: var(--text-color-secondary, #64748b);
3133
+ `, Vo = n.button`
3134
+ background: none;
3135
+ border: none;
3136
+ cursor: pointer;
3137
+ color: var(--color-warm-grey-6, #94a3b8);
3138
+ font-size: 15px;
3139
+ margin-left: auto;
3140
+ line-height: 1;
3141
+
3142
+ &:hover {
3143
+ color: var(--color-error-base, #dc2626);
3144
+ }
3145
+ `, Jo = n.button`
3146
+ align-self: flex-start;
3147
+ margin-top: 8px;
3148
+ background: none;
3149
+ border: none;
3150
+ color: ${(e) => e.$tone};
3151
+ font: inherit;
3152
+ font-size: 13px;
3153
+ font-weight: 600;
3154
+ cursor: pointer;
3155
+ padding: 4px 2px;
3156
+
3157
+ &:focus-visible {
3158
+ outline: 2px solid ${(e) => e.$tone};
3159
+ }
3160
+ `, Qo = n.textarea`
3161
+ flex: 1;
3162
+ min-height: 30px;
3163
+ resize: vertical;
3164
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
3165
+ border-radius: 10px;
3166
+ background: var(--bg-color, #ffffff);
3167
+ color: var(--text-color-primary, #1b2430);
3168
+ font: inherit;
3169
+ font-size: 13px;
3170
+ line-height: 1.4;
3171
+ padding: 4px 8px;
3172
+ box-sizing: border-box;
3173
+
3174
+ &:focus {
3175
+ outline: none;
3176
+ border-color: var(--color-primary-base, #2563eb);
3177
+ }
3178
+
3179
+ &::placeholder {
3180
+ color: var(--text-color-secondary, #64748b);
3181
+ opacity: 0.8;
3182
+ }
3183
+ `, Xo = n(ce)`
3184
+ margin-top: 10px;
3185
+ `, Zo = n.button`
3186
+ font: inherit;
3187
+ font-size: 11px;
3188
+ font-family: ${D};
3189
+ color: ${H.message.fg};
3190
+ background: ${H.message.soft};
3191
+ border: none;
3192
+ border-radius: 8px;
3193
+ padding: 3px 8px;
3194
+ cursor: pointer;
3195
+
3196
+ &:hover {
3197
+ filter: brightness(0.96);
3198
+ }
3199
+
3200
+ &:focus-visible {
3201
+ outline: 2px solid ${H.message.fg};
3202
+ }
3203
+ `;
3204
+ function en({ entries: e, selectedId: t, matchCountById: o, onToggle: i, onChangeEntry: a, onRemove: c, onAdd: s, isEvaluating: l, importProps: p, configPreviewProps: f }) {
3205
+ const m = e.map((h) => h.name);
3206
+ return /* @__PURE__ */ d(rn, { children: [/* @__PURE__ */ d(tn, { children: [
3207
+ /* @__PURE__ */ r(on, { children: "Rules" }),
3208
+ /* @__PURE__ */ r(nn, { children: e.length }),
3209
+ /* @__PURE__ */ r(an, {}),
3210
+ /* @__PURE__ */ r(Jt, { ...p }),
3211
+ /* @__PURE__ */ r(_t, { ...f }),
3212
+ /* @__PURE__ */ r(Ke, {
3213
+ type: "button",
3214
+ onClick: s,
3215
+ children: "+ Add rule"
3216
+ })
3217
+ ] }), /* @__PURE__ */ r(sn, { children: e.map((h) => /* @__PURE__ */ r(Lo, {
3218
+ entry: h,
3219
+ selected: h.id === t,
3220
+ matchCount: o[h.id] ?? 0,
3221
+ isDuplicateName: m.filter((y) => y === h.name).length > 1,
3222
+ isEvaluating: l,
3223
+ onToggle: () => i(h.id),
3224
+ onChange: a,
3225
+ onRemove: () => c(h.id)
3226
+ }, h.id)) })] });
3227
+ }
3228
+ var rn = n.div`
3229
+ display: flex;
3230
+ flex-direction: column;
3231
+ min-height: 0;
3232
+ gap: 12px;
3233
+ `, tn = n.div`
3234
+ display: flex;
3235
+ align-items: center;
3236
+ gap: 10px;
3237
+ flex-shrink: 0;
3238
+ flex-wrap: wrap;
3239
+ background: var(--bg-color, #ffffff);
3240
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
3241
+ border-radius: 12px;
3242
+ padding: 10px 14px;
3243
+ `, on = n.span`
3244
+ font-size: 14.5px;
3245
+ font-weight: 700;
3246
+ color: var(--text-color-primary, #1b2430);
3247
+ `, nn = n.span`
3248
+ background: var(--color-warm-grey-1, #fbfbfc);
3249
+ color: var(--text-color-secondary, #64748b);
3250
+ font-size: 11.5px;
3251
+ font-weight: 700;
3252
+ border-radius: 999px;
3253
+ padding: 2px 9px;
3254
+ `, an = n.span`
3255
+ flex: 1;
3256
+ `, sn = n.div`
3257
+ display: flex;
3258
+ flex-direction: column;
3259
+ gap: 12px;
3260
+ min-height: 0;
3261
+ overflow-y: auto;
3262
+ padding-right: 4px;
3263
+
3264
+ @media (max-width: 1024px) {
3265
+ overflow-y: visible;
3266
+ }
3267
+ `;
3268
+ function ln({ markers: e, totalLines: t, onMarkerClick: o }) {
3269
+ return /* @__PURE__ */ r(cn, { children: e.map((i, a) => /* @__PURE__ */ r(pn, {
3270
+ type: "button",
3271
+ $kind: i.kind,
3272
+ title: i.title,
3273
+ "aria-label": `Jump to line ${i.line}`,
3274
+ style: { top: `${(i.line - 0.5) / t * 100}%` },
3275
+ onClick: () => o(i)
3276
+ }, a)) });
3277
+ }
3278
+ var cn = n.div`
3279
+ position: absolute;
3280
+ top: 0;
3281
+ right: 0;
3282
+ bottom: 0;
3283
+ width: 12px;
3284
+ z-index: 5;
3285
+ pointer-events: none;
3286
+ background: transparent;
3287
+ `, pn = n.button`
3288
+ position: absolute;
3289
+ right: 2px;
3290
+ width: ${(e) => e.$kind === "match" ? "4px" : "8px"};
3291
+ height: 3px;
3292
+ border: none;
3293
+ border-radius: 1px;
3294
+ padding: 0;
3295
+ cursor: pointer;
3296
+ pointer-events: auto;
3297
+ background: ${(e) => e.$kind === "error" ? "var(--color-error-base, #dc2626)" : e.$kind === "warn" ? "var(--color-warning-text, #b45309)" : "color-mix(in srgb, var(--color-info-base, #2563eb) 60%, transparent)"};
3298
+ `, dn = {
3299
+ matchKeys: [],
3300
+ matchBlocks: [],
3301
+ matchProps: [],
3302
+ fails: []
3303
+ }, un = n.div`
3304
+ display: flex;
3305
+ flex-direction: column;
3306
+ min-height: 0;
3307
+ height: 100%;
3308
+ border: 1px solid var(--border-color-secondary, #e5e9f0);
3309
+ border-radius: 16px;
3310
+ background: var(--bg-color, #ffffff);
3311
+ overflow: hidden;
3312
+ `, fn = n.div`
3313
+ display: flex;
3314
+ align-items: center;
3315
+ gap: 8px;
3316
+ padding: 6px 12px;
3317
+ border-bottom: 1px solid var(--border-color-secondary, #e5e9f0);
3318
+ `, mn = n.span`
3319
+ font-family: ${D};
3320
+ font-size: 13px;
3321
+ color: var(--text-color-secondary, #64748b);
3322
+ flex: 1;
3323
+ overflow: hidden;
3324
+ text-overflow: ellipsis;
3325
+ white-space: nowrap;
3326
+ `, hn = n.span`
3327
+ color: var(--color-error-base, #dc2626);
3328
+ font-size: 12px;
3329
+ `, gn = n.button`
3330
+ display: inline-flex;
3331
+ align-items: center;
3332
+ gap: 5px;
3333
+ font: inherit;
3334
+ font-size: 11.5px;
3335
+ font-weight: 700;
3336
+ border: none;
3337
+ border-radius: 999px;
3338
+ padding: 2px 9px;
3339
+ white-space: nowrap;
3340
+ cursor: pointer;
3341
+ color: var(--color-info-base, #2563eb);
3342
+ background: color-mix(in srgb, var(--color-info-base, #2563eb) 12%, transparent);
3343
+
3344
+ &:hover {
3345
+ background: color-mix(in srgb, var(--color-info-base, #2563eb) 20%, transparent);
3346
+ }
3347
+
3348
+ &:focus-visible {
3349
+ outline: 2px solid var(--color-info-base, #2563eb);
3350
+ outline-offset: 1px;
3351
+ }
3352
+ `, vn = n.span`
3353
+ font-weight: 600;
3354
+ opacity: 0.75;
3355
+ `, bn = n.span`
3356
+ display: inline-flex;
3357
+ align-items: center;
3358
+ gap: 5px;
3359
+ font-size: 11.5px;
3360
+ font-weight: 700;
3361
+ border-radius: 999px;
3362
+ padding: 2px 9px;
3363
+ white-space: nowrap;
3364
+ color: var(--color-warning-text, #b45309);
3365
+ background: var(--color-warning-bg, #fef3e2);
3366
+ `, yn = n.span`
3367
+ width: 6px;
3368
+ height: 6px;
3369
+ border-radius: 50%;
3370
+ background: var(--color-warning-text, #b45309);
3371
+ `, xn = n.div`
3372
+ font-size: 12.5px;
3373
+ line-height: 1.45;
3374
+ color: var(--color-warning-text, #b45309);
3375
+ background: var(--color-warning-bg, #fef3e2);
3376
+ border-bottom: 1px solid var(--border-color-secondary, #e5e9f0);
3377
+ padding: 8px 12px;
3378
+ `, kn = n.div`
3379
+ position: relative;
3380
+ flex: 1;
3381
+ min-height: 0;
3382
+
3383
+ .cm-editor {
3384
+ height: 100%;
3385
+ font-size: 13px;
3386
+ }
3387
+
3388
+ .cm-scroller {
3389
+ font-family: ${D};
3390
+ overflow: auto;
3391
+ padding-right: 12px;
3392
+ }
3393
+
3394
+ .cm-rb-match-block {
3395
+ background: color-mix(in srgb, var(--color-info-base, #2563eb) 8%, transparent);
3396
+ }
3397
+
3398
+ .cm-rb-match-key {
3399
+ background: color-mix(in srgb, var(--color-info-base, #2563eb) 16%, transparent);
3400
+ border-radius: 2px;
3401
+ font-weight: 700;
3402
+ }
3403
+
3404
+ .cm-rb-match-prop {
3405
+ background: color-mix(in srgb, var(--color-info-base, #2563eb) 16%, transparent);
3406
+ border-radius: 2px;
3407
+ }
3408
+
3409
+ .cm-rb-fail-error {
3410
+ text-decoration: underline wavy var(--color-error-base, #dc2626);
3411
+ text-decoration-thickness: 2px;
3412
+ text-underline-offset: 3px;
3413
+ }
3414
+
3415
+ .cm-rb-fail-warn {
3416
+ text-decoration: underline wavy var(--color-warning-text, #b45309);
3417
+ text-decoration-thickness: 2px;
3418
+ text-underline-offset: 3px;
3419
+ }
3420
+
3421
+ .cm-rb-line-error {
3422
+ background: color-mix(in srgb, var(--color-error-base, #dc2626) 9%, transparent);
3423
+ box-shadow: inset 3px 0 0 var(--color-error-base, #dc2626);
3424
+ }
3425
+
3426
+ .cm-rb-line-warn {
3427
+ background: color-mix(in srgb, var(--color-warning-text, #b45309) 12%, transparent);
3428
+ box-shadow: inset 3px 0 0 var(--color-warning-text, #b45309);
3429
+ }
3430
+
3431
+ .cm-rb-gutter {
3432
+ width: 18px;
3433
+ background: var(--bg-color, #ffffff);
3434
+ }
3435
+
3436
+ .cm-rb-gutter-marker {
3437
+ display: flex;
3438
+ align-items: center;
3439
+ justify-content: center;
3440
+ height: 100%;
3441
+ width: 100%;
3442
+ font-size: 10px;
3443
+ font-weight: 700;
3444
+ line-height: 1;
3445
+ color: #fff;
3446
+ cursor: default;
3447
+ }
3448
+
3449
+ .cm-rb-gutter-marker span {
3450
+ display: flex;
3451
+ align-items: center;
3452
+ justify-content: center;
3453
+ width: 13px;
3454
+ height: 13px;
3455
+ border-radius: 50%;
3456
+ }
3457
+
3458
+ .cm-rb-gutter-error span {
3459
+ background: var(--color-error-base, #dc2626);
3460
+ }
3461
+
3462
+ .cm-rb-gutter-warn span {
3463
+ background: var(--color-warning-text, #b45309);
3464
+ }
3465
+
3466
+ .cm-rb-flash {
3467
+ background: color-mix(in srgb, var(--color-primary-base, #2563eb) 22%, transparent);
3468
+ animation: cm-rb-flash-fade 1.4s ease-out forwards;
3469
+ }
3470
+
3471
+ @keyframes cm-rb-flash-fade {
3472
+ from {
3473
+ background: color-mix(in srgb, var(--color-primary-base, #2563eb) 34%, transparent);
3474
+ }
3475
+ to {
3476
+ background: transparent;
3477
+ }
3478
+ }
3479
+
3480
+ .cm-rb-tooltip {
3481
+ max-width: 420px;
3482
+ padding: 6px 10px;
3483
+ white-space: pre-line;
3484
+ font-family: ${yr};
3485
+ font-size: 12px;
3486
+ line-height: 1.45;
3487
+ color: var(--text-color-primary, #1b2430);
3488
+ background: var(--bg-color, #ffffff);
3489
+ border: 1px solid var(--color-error-base, #dc2626);
3490
+ border-radius: 12px;
3491
+ }
3492
+ `, ze = qe.define(), Be = qe.define(), ve = qe.define(), Rr = class extends Vr {
3493
+ severity;
3494
+ constructor(e) {
3495
+ super(), this.severity = e;
3496
+ }
3497
+ eq(e) {
3498
+ return e.severity === this.severity;
3499
+ }
3500
+ toDOM() {
3501
+ const e = document.createElement("div");
3502
+ e.className = `cm-rb-gutter-marker cm-rb-gutter-${this.severity}`;
3503
+ const t = document.createElement("span");
3504
+ return t.textContent = "!", e.appendChild(t), e;
3505
+ }
3506
+ }, vr = Fe.define({
3507
+ create: () => je.empty,
3508
+ update(e, t) {
3509
+ let o = e.map(t.changes);
3510
+ for (const i of t.effects) i.is(Be) && (o = i.value);
3511
+ return o;
3512
+ }
3513
+ }), wn = Fe.define({
3514
+ create: () => z.none,
3515
+ update(e, t) {
3516
+ let o = e.map(t.changes);
3517
+ for (const i of t.effects) i.is(ze) && (o = i.value);
3518
+ return o;
3519
+ },
3520
+ provide: (e) => ie.decorations.from(e)
3521
+ }), En = z.mark({ class: "cm-rb-flash" }), $n = Fe.define({
3522
+ create: () => z.none,
3523
+ update(e, t) {
3524
+ let o = e.map(t.changes);
3525
+ for (const i of t.effects) i.is(ve) && (o = i.value ? z.set([En.range(i.value.from, i.value.to)]) : z.none);
3526
+ return o;
3527
+ },
3528
+ provide: (e) => ie.decorations.from(e)
3529
+ }), Cn = {
3530
+ error: z.line({ class: "cm-rb-line-error" }),
3531
+ warn: z.line({ class: "cm-rb-line-warn" })
3532
+ };
3533
+ function Sn(e, t) {
3534
+ const o = /* @__PURE__ */ new Map();
3535
+ for (const i of e) {
3536
+ if (i.from > t.length) continue;
3537
+ const a = t.lineAt(i.from), c = o.get(a.number) ?? {
3538
+ lineFrom: a.from,
3539
+ severity: i.severity,
3540
+ messages: []
3541
+ };
3542
+ i.severity === "error" && (c.severity = "error"), c.messages.push(...i.messages), o.set(a.number, c);
3543
+ }
3544
+ return o;
3545
+ }
3546
+ var ae = {
3547
+ block: z.mark({ class: "cm-rb-match-block" }),
3548
+ matchKey: z.mark({ class: "cm-rb-match-key" }),
3549
+ prop: z.mark({ class: "cm-rb-match-prop" }),
3550
+ failError: z.mark({ class: "cm-rb-fail-error" }),
3551
+ failWarn: z.mark({ class: "cm-rb-fail-warn" })
3552
+ };
3553
+ function Rn(e, t, o) {
3554
+ const i = [], a = (s, l) => {
3555
+ for (const p of s) p.from < p.to && p.to <= t.length && i.push(l.range(p.from, p.to));
3556
+ };
3557
+ for (const s of o.values()) i.push(Cn[s.severity].range(s.lineFrom));
3558
+ const c = (s) => e.fails.some((l) => l.from < s.to && s.from < l.to);
3559
+ return a(e.matchBlocks, ae.block), a(e.matchProps.filter((s) => !c(s)), ae.prop), a(e.matchKeys.filter((s) => !c(s)), ae.matchKey), a(e.fails.filter((s) => s.severity === "error"), ae.failError), a(e.fails.filter((s) => s.severity === "warn"), ae.failWarn), z.set(i, !0);
3560
+ }
3561
+ function In(e) {
3562
+ const t = [];
3563
+ for (const o of e.values()) t.push(new Rr(o.severity).range(o.lineFrom));
3564
+ return je.of(t, !0);
3565
+ }
3566
+ var Mn = 2097152;
3567
+ function Pn({ spec: e, fileName: t, highlights: o, rulerMarkers: i, matchTargets: a, totalLines: c, jump: s, matchCount: l, showMatchStatus: p, isEvaluating: f, onSpecChange: m, onResetSpec: h, uploadError: y, onUploadError: u, host: g }) {
3568
+ const x = A(null), C = A(null), $ = A(null), v = A(o.fails);
3569
+ v.current = o.fails;
3570
+ const P = A(m);
3571
+ P.current = m;
3572
+ const b = A(void 0), [R, T] = I(-1), _ = (w) => {
3573
+ const M = C.current;
3574
+ if (!M) return;
3575
+ const L = Math.min(w.to, M.state.doc.length), j = Math.min(w.from, L);
3576
+ j >= L || (M.dispatch({ effects: [ie.scrollIntoView(j, { y: "center" }), ve.of({
3577
+ from: j,
3578
+ to: L
3579
+ })] }), clearTimeout(b.current), b.current = setTimeout(() => {
3580
+ C.current?.dispatch({ effects: ve.of(null) });
3581
+ }, 1400));
3582
+ };
3583
+ N(() => {
3584
+ T(-1);
3585
+ }, [a]);
3586
+ const G = async () => {
3587
+ if (!g?.pickSpecFile) {
3588
+ $.current?.click();
3589
+ return;
3590
+ }
3591
+ try {
3592
+ const w = await g.pickSpecFile();
3593
+ if (!w) return;
3594
+ u(void 0), m(w.content, w.name);
3595
+ } catch (w) {
3596
+ u(w instanceof Error ? w.message : "Could not read the file");
3597
+ }
3598
+ }, Z = () => {
3599
+ if (!a.length) return;
3600
+ const w = (R + 1) % a.length;
3601
+ T(w), _(a[w]);
3602
+ }, pe = Y(() => Qr((w, M) => {
3603
+ const L = v.current.filter((j) => M >= j.from && M <= j.to);
3604
+ return L.length ? {
3605
+ pos: M,
3606
+ above: !0,
3607
+ create: () => {
3608
+ const j = document.createElement("div");
3609
+ j.className = "cm-rb-tooltip";
3610
+ for (const Ee of L) for (const ee of Ee.messages) {
3611
+ const re = document.createElement("div");
3612
+ re.textContent = `✗ ${ee}`, j.appendChild(re);
3613
+ }
3614
+ return { dom: j };
3615
+ }
3616
+ } : null;
3617
+ }), []);
3618
+ return N(() => {
3619
+ if (!x.current) return;
3620
+ const w = new ie({
3621
+ parent: x.current,
3622
+ state: Yr.create({
3623
+ doc: e,
3624
+ extensions: [
3625
+ vr,
3626
+ Jr({
3627
+ class: "cm-rb-gutter",
3628
+ markers: (M) => M.state.field(vr),
3629
+ initialSpacer: () => new Rr("error")
3630
+ }),
3631
+ Zr(),
3632
+ Kr(),
3633
+ Xr.of([..._r, ...Ur]),
3634
+ Wr(),
3635
+ Gr(Hr),
3636
+ wn,
3637
+ $n,
3638
+ pe,
3639
+ ie.updateListener.of((M) => {
3640
+ M.docChanged && P.current(M.state.doc.toString());
3641
+ })
3642
+ ]
3643
+ })
3644
+ });
3645
+ return C.current = w, () => {
3646
+ w.destroy(), C.current = null;
3647
+ };
3648
+ }, [pe]), N(() => {
3649
+ const w = C.current;
3650
+ !w || w.state.doc.toString() === e || w.dispatch({
3651
+ changes: {
3652
+ from: 0,
3653
+ to: w.state.doc.length,
3654
+ insert: e
3655
+ },
3656
+ effects: [
3657
+ ze.of(z.none),
3658
+ Be.of(je.empty),
3659
+ ve.of(null)
3660
+ ]
3661
+ });
3662
+ }, [e]), N(() => {
3663
+ const w = C.current;
3664
+ if (!w) return;
3665
+ const M = Sn(o.fails, w.state.doc);
3666
+ w.dispatch({ effects: [ze.of(Rn(o, w.state.doc, M)), Be.of(In(M))] });
3667
+ }, [o]), N(() => {
3668
+ s && _(s);
3669
+ }, [s]), N(() => () => clearTimeout(b.current), []), /* @__PURE__ */ d(un, { children: [
3670
+ /* @__PURE__ */ d(fn, { children: [
3671
+ /* @__PURE__ */ r(mn, { children: t }),
3672
+ p && (l > 0 ? /* @__PURE__ */ d(gn, {
3673
+ type: "button",
3674
+ onClick: Z,
3675
+ disabled: !a.length,
3676
+ title: "Jump to the next matched node",
3677
+ children: [
3678
+ l,
3679
+ " node",
3680
+ l === 1 ? "" : "s",
3681
+ " matched",
3682
+ R >= 0 && /* @__PURE__ */ d(vn, {
3683
+ "aria-label": `showing match ${R + 1} of ${a.length}`,
3684
+ children: [
3685
+ R + 1,
3686
+ "/",
3687
+ a.length
3688
+ ]
3689
+ })
3690
+ ]
3691
+ }) : /* @__PURE__ */ d(bn, {
3692
+ role: "status",
3693
+ children: [/* @__PURE__ */ r(yn, { "aria-hidden": !0 }), "Nothing matched"]
3694
+ })),
3695
+ y && /* @__PURE__ */ r(hn, {
3696
+ role: "alert",
3697
+ children: y
3698
+ }),
3699
+ /* @__PURE__ */ r(or, {
3700
+ type: "button",
3701
+ onClick: () => {
3702
+ G();
3703
+ },
3704
+ children: "Upload"
3705
+ }),
3706
+ /* @__PURE__ */ r(or, {
3707
+ type: "button",
3708
+ onClick: h,
3709
+ children: "Reset sample"
3710
+ }),
3711
+ /* @__PURE__ */ r("input", {
3712
+ ref: $,
3713
+ type: "file",
3714
+ accept: ".yaml,.yml,.json",
3715
+ hidden: !0,
3716
+ "aria-label": "Upload OpenAPI document",
3717
+ onChange: (w) => {
3718
+ const M = w.target.files?.[0];
3719
+ if (w.target.value = "", !M) return;
3720
+ if (M.size > Mn) {
3721
+ u("File is too large (max 2 MB)");
3722
+ return;
3723
+ }
3724
+ const L = new FileReader();
3725
+ L.onload = () => {
3726
+ u(void 0), m(String(L.result ?? ""), M.name);
3727
+ }, L.onerror = () => u("Could not read the file"), L.readAsText(M);
3728
+ }
3729
+ })
3730
+ ] }),
3731
+ p && l === 0 && !f && /* @__PURE__ */ r(xn, {
3732
+ role: "status",
3733
+ children: "No nodes in this document match the rule’s subject and where conditions — widen the node type or relax the conditions."
3734
+ }),
3735
+ /* @__PURE__ */ r(kn, {
3736
+ ref: x,
3737
+ role: "region",
3738
+ "aria-label": "OpenAPI document editor",
3739
+ children: /* @__PURE__ */ r(ln, {
3740
+ markers: i,
3741
+ totalLines: c,
3742
+ onMarkerClick: _
3743
+ })
3744
+ })
3745
+ ] });
3746
+ }
3747
+ var Tn = n.div`
3748
+ font-family: ${yr};
3749
+ color: var(--text-color-primary, #1b2430);
3750
+ display: flex;
3751
+ flex-direction: column;
3752
+ background: var(--color-warm-grey-1, #f3f5f8);
3753
+ border-radius: 16px;
3754
+ `, An = n.div`
3755
+ display: flex;
3756
+ width: 30px;
3757
+ height: 30px;
3758
+ justify-content: center;
3759
+ align-items: center;
3760
+ border-radius: 8px;
3761
+ background: var(--color-primary-base, #2563eb);
3762
+ color: #fff;
3763
+ font-size: 14px;
3764
+ font-weight: 800;
3765
+ `, br = n.div`
3766
+ display: flex;
3767
+ height: 56px;
3768
+ padding: 0 20px;
3769
+ align-items: center;
3770
+ gap: 12px;
3771
+ align-self: stretch;
3772
+
3773
+ a {
3774
+ color: var(--text-color-secondary, #64748b);
3775
+ font-size: 12.5px;
3776
+ font-weight: 600;
3777
+ text-decoration: none;
3778
+ }
3779
+ `, Dn = n.span`
3780
+ display: inline-block;
3781
+ width: 6px;
3782
+ height: 6px;
3783
+ border-radius: 50%;
3784
+ background: currentColor;
3785
+ margin-right: 6px;
3786
+ `, Ln = n.div`
3787
+ display: flex;
3788
+ justify-content: space-between;
3789
+ align-items: center;
3790
+ border-top-left-radius: 16px;
3791
+ border-top-right-radius: 16px;
3792
+ border-bottom: 1px solid var(--border-color-secondary, #e5e9f0);
3793
+ background: var(--bg-color, #ffffff);
3794
+ `, On = n.div`
3795
+ display: grid;
3796
+ grid-template-columns: minmax(380px, 5fr) minmax(420px, 6fr);
3797
+ gap: 16px;
3798
+ align-items: stretch;
3799
+ height: ${(e) => e.$height}px;
3800
+ min-height: 420px;
3801
+ padding: 16px;
3802
+
3803
+ > * {
3804
+ min-width: 0;
3805
+ }
3806
+
3807
+ @media (max-width: 1024px) {
3808
+ grid-template-columns: 1fr;
3809
+ height: auto;
3810
+ min-height: 0;
3811
+ }
3812
+ `, zn = n.div`
3813
+ display: flex;
3814
+ flex-direction: column;
3815
+ gap: 12px;
3816
+ min-height: 0;
3817
+ min-width: 0;
3818
+ `, Bn = n.div`
3819
+ flex: 1;
3820
+ min-height: 240px;
3821
+ min-width: 0;
3822
+
3823
+ @media (max-width: 1024px) {
3824
+ flex: none;
3825
+ height: 60vh;
3826
+ }
3827
+ `, Nn = n.div`
3828
+ display: flex;
3829
+ flex-direction: column;
3830
+ gap: 1px;
3831
+
3832
+ h4 {
3833
+ margin: 0;
3834
+ color: var(--text-color-primary, #1b2430);
3835
+ font-size: 14.5px;
3836
+ font-weight: 700;
3837
+ line-height: 17.4px;
3838
+ }
3839
+
3840
+ p {
3841
+ margin: 0;
3842
+ font-size: 12px;
3843
+ font-weight: 400;
3844
+ line-height: 1.5;
3845
+ color: var(--text-color-secondary, #64748b);
3846
+ }
3847
+ `, jn = {
3848
+ subject: {
3849
+ type: "Operation",
3850
+ property: "summary"
3851
+ },
3852
+ assertions: {
3853
+ defined: !0,
3854
+ maxLength: 20
3855
+ },
3856
+ severity: "warn",
3857
+ message: "Operation summary of {{key}} must be defined and under 20 characters."
3858
+ }, qn = {
3859
+ matches: [],
3860
+ problems: [],
3861
+ ruleErrors: []
3862
+ };
3863
+ function Xn({ defaultSpec: e, defaultSpecFileName: t, initialRule: o, initialRuleName: i, onRuleChange: a, host: c, height: s = 640 }) {
3864
+ const l = e ?? et, p = t ?? "museum-api.yaml", [f, m] = I(() => [{
3865
+ id: we(),
3866
+ name: i ?? "operation-summary",
3867
+ rule: o ? structuredClone(o) : structuredClone(jn)
3868
+ }]), [h, y] = I(() => f[0]?.id ?? null), [u, g] = I({
3869
+ text: l,
3870
+ fileName: p
3871
+ }), [x, C] = I(() => ({
3872
+ result: qn,
3873
+ resolver: er(l),
3874
+ ruleIds: []
3875
+ })), [$, v] = I(!1), [P, b] = I(), [R, T] = I(), _ = A(0), G = Y(() => nt(f), [f]), Z = Y(() => st(G), [G]);
3876
+ N(() => {
3877
+ const E = ++_.current;
3878
+ v(!0);
3879
+ const k = setTimeout(() => {
3880
+ const B = f.map((K) => K.id);
3881
+ tt(u.text, G, u.fileName).then((K) => {
3882
+ _.current === E && (C({
3883
+ result: K,
3884
+ resolver: er(u.text),
3885
+ ruleIds: B
3886
+ }), v(!1));
3887
+ });
3888
+ }, 250);
3889
+ return () => clearTimeout(k);
3890
+ }, [
3891
+ u,
3892
+ G,
3893
+ f
3894
+ ]), N(() => {
3895
+ a?.(Z, G);
3896
+ }, [
3897
+ Z,
3898
+ G,
3899
+ a
3900
+ ]);
3901
+ const pe = f.findIndex((E) => E.id === h), { highlights: w, problemsWithLines: M, matchCountById: L, rulerMarkers: j, matchTargets: Ee, firstMatchRange: ee, firstProblemRange: re } = Y(() => {
3902
+ const { result: E, resolver: k, ruleIds: B } = x, K = {
3903
+ matchKeys: [],
3904
+ matchBlocks: [],
3905
+ matchProps: [],
3906
+ fails: []
3907
+ }, te = [], J = [], Se = /* @__PURE__ */ new Map();
3908
+ let fe;
3909
+ const Re = [];
3910
+ for (const S of E.problems) {
3911
+ const O = k.resolve(S.pointer, S.reportOnKey);
3912
+ if (!O) {
3913
+ Re.push(S);
3914
+ continue;
3915
+ }
3916
+ const oe = `${O.from}-${O.to}`, U = Se.get(oe) ?? {
3917
+ ...O,
3918
+ messages: [],
3919
+ severity: S.severity
3920
+ };
3921
+ U.messages.push([`${S.ruleId}: ${S.message}`, ...S.suggest.map((me) => `→ ${me}`)].join(`
3922
+ `)), S.severity === "error" && (U.severity = "error"), Se.set(oe, U), B[S.ruleIndex] === h && (!fe || O.from < fe.from) && (fe = O), Re.push({
3923
+ ...S,
3924
+ line: k.lineAt(O.from)
3925
+ });
3926
+ }
3927
+ K.fails = Array.from(Se.values());
3928
+ for (const S of K.fails) te.push({
3929
+ line: k.lineAt(S.from),
3930
+ from: S.from,
3931
+ to: S.to,
3932
+ kind: S.severity,
3933
+ title: S.messages.join(`
3934
+ `)
3935
+ });
3936
+ const Ie = {};
3937
+ for (const S of E.matches) {
3938
+ const O = B[S.ruleIndex];
3939
+ if (!O || (Ie[O] = (Ie[O] ?? 0) + 1, O !== h)) continue;
3940
+ if (S.nodeType === "Root") {
3941
+ const W = k.lineRange(1);
3942
+ J.push(W), te.push({
3943
+ line: 1,
3944
+ ...W,
3945
+ kind: "match",
3946
+ title: "Matched Root"
3947
+ });
3948
+ continue;
3949
+ }
3950
+ const oe = S.propertyPointers.flatMap((W) => {
3951
+ const Q = k.resolve(W, !1);
3952
+ return Q ? [{
3953
+ key: k.resolve(W, !0),
3954
+ value: Q
3955
+ }] : [];
3956
+ });
3957
+ if (oe.length) {
3958
+ for (const { key: W, value: Q } of oe) {
3959
+ W && K.matchKeys.push(W), K.matchProps.push(Q);
3960
+ const Ge = W ?? Q, Ye = {
3961
+ from: Ge.from,
3962
+ to: Q.to
3963
+ };
3964
+ J.push(Ye), te.push({
3965
+ line: k.lineAt(Ge.from),
3966
+ ...Ye,
3967
+ kind: "match",
3968
+ title: `Matched ${S.nodeType} property`
3969
+ });
3970
+ }
3971
+ continue;
3972
+ }
3973
+ const U = k.resolve(S.pointer, !0), me = k.resolve(S.pointer, !1);
3974
+ U && (K.matchKeys.push(U), J.push(U), te.push({
3975
+ line: k.lineAt(U.from),
3976
+ from: U.from,
3977
+ to: U.to,
3978
+ kind: "match",
3979
+ title: `Matched ${S.nodeType}`
3980
+ })), me && K.matchBlocks.push(me);
3981
+ }
3982
+ return J.sort((S, O) => S.from - O.from), {
3983
+ highlights: K,
3984
+ problemsWithLines: Re,
3985
+ matchCountById: Ie,
3986
+ rulerMarkers: te,
3987
+ matchTargets: J,
3988
+ firstMatchRange: J[0],
3989
+ firstProblemRange: fe
3990
+ };
3991
+ }, [x, h]), q = f[pe], Ir = q ? L[q.id] ?? 0 : 0, Mr = !!q, de = Y(() => q ? JSON.stringify({
3992
+ id: q.id,
3993
+ subject: q.rule.subject,
3994
+ where: q.rule.where
3995
+ }) : "", [q]), ue = Y(() => q ? JSON.stringify({
3996
+ assertions: q.rule.assertions,
3997
+ severity: q.rule.severity
3998
+ }) : "", [q]), We = A(de), He = A(ue), [$e, Ce] = I(null);
3999
+ N(() => {
4000
+ const E = We.current !== de, k = He.current !== ue;
4001
+ We.current = de, He.current = ue, E ? Ce("match") : k && Ce("problem");
4002
+ }, [de, ue]), N(() => {
4003
+ if (!$e || $) return;
4004
+ Ce(null);
4005
+ const E = $e === "problem" ? re ?? ee : ee;
4006
+ E && b({ ...E });
4007
+ }, [
4008
+ $e,
4009
+ $,
4010
+ ee,
4011
+ re
4012
+ ]);
4013
+ const Pr = (E) => {
4014
+ const k = x.resolver.resolve(E.pointer, E.reportOnKey);
4015
+ k && b({ ...k });
4016
+ }, Tr = (E) => {
4017
+ m((k) => k.filter((B) => B.id !== E)), E === h && y(f.find((k) => k.id !== E)?.id ?? null);
4018
+ }, Ar = (E) => {
4019
+ const k = E.map(at);
4020
+ m((B) => [...B, ...k]), k[0] && y(k[0].id);
4021
+ };
4022
+ return /* @__PURE__ */ d(Tn, { children: [/* @__PURE__ */ d(Ln, { children: [/* @__PURE__ */ d(br, { children: [/* @__PURE__ */ r(An, { children: "R" }), /* @__PURE__ */ d(Nn, { children: [/* @__PURE__ */ r("h4", { children: "Rules Builder" }), /* @__PURE__ */ r("p", { children: "Build rule/* entries visually · evaluated by @redocly/openapi-core in your browser" })] })] }), /* @__PURE__ */ d(br, { children: [/* @__PURE__ */ d(ge, {
4023
+ style: {
4024
+ background: be.bg,
4025
+ color: be.fg
4026
+ },
4027
+ children: [/* @__PURE__ */ r(Dn, {}), "Live linting"]
4028
+ }), /* @__PURE__ */ r("a", {
4029
+ href: "https://redocly.com/docs/cli/rules/configurable-rules",
4030
+ target: "_blank",
4031
+ rel: "noopener noreferrer",
4032
+ children: "Docs ↗"
4033
+ })] })] }), /* @__PURE__ */ d(On, {
4034
+ $height: s,
4035
+ children: [/* @__PURE__ */ r(en, {
4036
+ entries: f,
4037
+ selectedId: h,
4038
+ matchCountById: L,
4039
+ onToggle: (E) => y((k) => k === E ? null : E),
4040
+ onChangeEntry: (E) => m((k) => k.map((B) => B.id === E.id ? E : B)),
4041
+ onRemove: Tr,
4042
+ onAdd: () => {
4043
+ const E = it(f.map((k) => k.name));
4044
+ m((k) => [...k, E]), y(E.id);
4045
+ },
4046
+ isEvaluating: $,
4047
+ importProps: { onImport: Ar },
4048
+ configPreviewProps: {
4049
+ yaml: Z,
4050
+ host: c
4051
+ }
4052
+ }), /* @__PURE__ */ d(zn, { children: [/* @__PURE__ */ r(Bn, { children: /* @__PURE__ */ r(Pn, {
4053
+ host: c,
4054
+ spec: u.text,
4055
+ fileName: u.fileName,
4056
+ highlights: x.result.specError ? dn : w,
4057
+ rulerMarkers: x.result.specError ? [] : j,
4058
+ matchTargets: x.result.specError ? [] : Ee,
4059
+ totalLines: x.resolver.lineCount,
4060
+ jump: P,
4061
+ matchCount: Ir,
4062
+ showMatchStatus: Mr && !x.result.specError,
4063
+ isEvaluating: $,
4064
+ uploadError: R,
4065
+ onUploadError: T,
4066
+ onSpecChange: (E, k) => g((B) => ({
4067
+ text: E,
4068
+ fileName: k ?? B.fileName
4069
+ })),
4070
+ onResetSpec: () => g({
4071
+ text: l,
4072
+ fileName: p
4073
+ })
4074
+ }) }), /* @__PURE__ */ r(lt, {
4075
+ problems: M,
4076
+ ruleErrors: x.result.ruleErrors,
4077
+ specError: x.result.specError,
4078
+ isRunning: $,
4079
+ onSelect: Pr
4080
+ })] })]
4081
+ })] });
4082
+ }
4083
+ export {
4084
+ et as DEFAULT_SPEC,
4085
+ Xn as RulesBuilder,
4086
+ tt as evaluateRules,
4087
+ Gt as parseImportedRules,
4088
+ st as serializeRules
4089
+ };
4090
+
4091
+ //# sourceMappingURL=config-rules-builder.js.map