@lodado/sdui-template 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +253 -3
  2. package/dist/cjs/client/index.cjs +1 -1
  3. package/dist/es/client/_virtual/_tslib.mjs +1 -0
  4. package/dist/es/client/node_modules/.pnpm/@testing-library_dom@10.4.1/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.mjs +1 -0
  5. package/dist/es/client/node_modules/.pnpm/@testing-library_react@16.3.1_@testing-library_dom@10.4.1_@types_react-dom@18.3.7_@types_reac_bxcobvx7qxffu3uqpqwx2mjx3m/node_modules/@testing-library/react/dist/@testing-library/react.esm.mjs +1 -0
  6. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/accessible-description.mjs +1 -0
  7. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/accessible-name-and-description.mjs +1 -0
  8. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/accessible-name.mjs +1 -0
  9. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/getRole.mjs +1 -0
  10. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/polyfills/SetLike.mjs +1 -0
  11. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/polyfills/array.from.mjs +1 -0
  12. package/dist/es/client/node_modules/.pnpm/dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/util.mjs +1 -0
  13. package/dist/es/client/src/__tests__/index.mjs +1 -0
  14. package/dist/es/client/src/__tests__/utils/dev-utils.mjs +1 -0
  15. package/dist/es/client/src/components/DefaultNodeComponent.mjs +2 -0
  16. package/dist/es/client/src/components/componentMap.mjs +1 -1
  17. package/dist/es/client/src/components/defaultComponentFactory.mjs +1 -0
  18. package/dist/es/client/src/index.mjs +1 -1
  19. package/dist/es/client/src/react-wrapper/components/SduiLayoutRenderer.mjs +1 -1
  20. package/dist/es/client/src/react-wrapper/hooks/useRenderNode.mjs +1 -1
  21. package/dist/es/client/src/react-wrapper/hooks/useSduiNodeReference.mjs +2 -0
  22. package/dist/es/client/src/react-wrapper/hooks/useSduiNodeSubscription.mjs +1 -1
  23. package/dist/es/client/src/react-wrapper/hooks/useSduiNodeSubscriptionSync.mjs +2 -0
  24. package/dist/es/client/src/store/SduiLayoutStore.mjs +1 -1
  25. package/dist/es/client/src/store/managers/LayoutStateRepository.mjs +1 -1
  26. package/dist/es/client/src/store/managers/SubscriptionManager.mjs +1 -1
  27. package/dist/es/client/src/utils/normalize/denormalize.mjs +1 -1
  28. package/dist/es/client/src/utils/normalize/normalize.mjs +1 -1
  29. package/dist/es/client/src/utils/parentPath.mjs +1 -0
  30. package/dist/types/src/__tests__/index.d.ts +7 -0
  31. package/dist/types/src/__tests__/utils/dev-utils.d.ts +48 -0
  32. package/dist/types/src/components/DefaultNodeComponent.d.ts +15 -0
  33. package/dist/types/src/components/componentMap.d.ts +12 -9
  34. package/dist/types/src/components/defaultComponentFactory.d.ts +14 -0
  35. package/dist/types/src/components/index.d.ts +3 -2
  36. package/dist/types/src/components/types.d.ts +30 -8
  37. package/dist/types/src/index.d.ts +5 -3
  38. package/dist/types/src/react-wrapper/components/SduiLayoutRenderer.d.ts +9 -9
  39. package/dist/types/src/react-wrapper/context/SduiLayoutContext.d.ts +8 -8
  40. package/dist/types/src/react-wrapper/context/index.d.ts +1 -1
  41. package/dist/types/src/react-wrapper/hooks/index.d.ts +2 -0
  42. package/dist/types/src/react-wrapper/hooks/useRenderNode.d.ts +47 -6
  43. package/dist/types/src/react-wrapper/hooks/useSduiLayoutAction.d.ts +2 -2
  44. package/dist/types/src/react-wrapper/hooks/useSduiNodeReference.d.ts +67 -0
  45. package/dist/types/src/react-wrapper/hooks/useSduiNodeSubscription.d.ts +34 -17
  46. package/dist/types/src/react-wrapper/hooks/useSduiNodeSubscriptionSync.d.ts +37 -0
  47. package/dist/types/src/schema/base.d.ts +17 -15
  48. package/dist/types/src/schema/document.d.ts +5 -5
  49. package/dist/types/src/schema/index.d.ts +1 -1
  50. package/dist/types/src/schema/node.d.ts +11 -7
  51. package/dist/types/src/store/SduiLayoutStore.d.ts +126 -83
  52. package/dist/types/src/store/index.d.ts +1 -1
  53. package/dist/types/src/store/managers/DocumentManager.d.ts +22 -22
  54. package/dist/types/src/store/managers/LayoutStateRepository.d.ts +111 -37
  55. package/dist/types/src/store/managers/SubscriptionManager.d.ts +31 -17
  56. package/dist/types/src/store/managers/VariablesManager.d.ts +11 -11
  57. package/dist/types/src/store/managers/index.d.ts +1 -1
  58. package/dist/types/src/store/types.d.ts +26 -20
  59. package/dist/types/src/utils/normalize/denormalize.d.ts +10 -10
  60. package/dist/types/src/utils/normalize/normalize.d.ts +8 -8
  61. package/dist/types/src/utils/normalize/types.d.ts +4 -4
  62. package/dist/types/src/utils/parentPath.d.ts +58 -0
  63. package/package.json +54 -33
  64. package/src/__tests__/index.ts +7 -0
  65. package/src/__tests__/scenario/boundary-values.test.tsx +250 -0
  66. package/src/__tests__/scenario/component-override.test.tsx +68 -0
  67. package/src/__tests__/scenario/dynamic-document-merge.test.tsx +405 -0
  68. package/src/__tests__/scenario/error-handling.test.tsx +35 -0
  69. package/src/__tests__/scenario/node-not-found.test.tsx +236 -0
  70. package/src/__tests__/scenario/node-reference-subscription.test.tsx +461 -0
  71. package/src/__tests__/scenario/node-reference.test.tsx +670 -0
  72. package/src/__tests__/scenario/parent-path.test.tsx +198 -0
  73. package/src/__tests__/scenario/recursive-rendering.test.tsx +260 -0
  74. package/src/__tests__/scenario/render-document.test.tsx +98 -0
  75. package/src/__tests__/scenario/reset-to-initial.test.tsx +227 -0
  76. package/src/__tests__/scenario/store-reset.test.tsx +54 -0
  77. package/src/__tests__/scenario/subscription.test.tsx +146 -0
  78. package/src/__tests__/scenario/sync-external-store.test.tsx +392 -0
  79. package/src/__tests__/scenario/test-coverage.md +95 -0
  80. package/src/__tests__/scenario/timestamp-snapshot.test.tsx +420 -0
  81. package/src/__tests__/scenario/update-layout.test.tsx +103 -0
  82. package/src/__tests__/scenario/zod-validation.test.tsx +298 -0
  83. package/src/__tests__/utils/dev-utils.tsx +175 -0
package/README.md CHANGED
@@ -32,6 +32,7 @@ In these situations, implementing state management, subscription systems, and co
32
32
  - 🧩 **Modular**: Clean architecture with separated concerns
33
33
  - 🚀 **Next.js Compatible**: Works seamlessly with Next.js App Router
34
34
  - 🔧 **Flexible State Management**: Update component state programmatically
35
+ - 🔗 **Node References**: Reference other nodes to access their state and subscribe to changes
35
36
 
36
37
  ## Installation
37
38
 
@@ -43,6 +44,16 @@ pnpm add @lodado/sdui-template
43
44
  yarn add @lodado/sdui-template
44
45
  ```
45
46
 
47
+ This package uses the latest **zod v4** types. Make sure you install a compatible zod version alongside it:
48
+
49
+ ```bash
50
+ pnpm add zod@^4.3.6
51
+ # or
52
+ npm install zod@^4.3.6
53
+ # or
54
+ yarn add zod@^4.3.6
55
+ ```
56
+
46
57
  ## Quick Start
47
58
 
48
59
  ### Basic Usage
@@ -261,6 +272,161 @@ export default function Page() {
261
272
  - ✅ Server controls initial state, client handles interactions
262
273
  - ✅ Easy to extend with more components
263
274
 
275
+ ### Node References
276
+
277
+ Nodes can reference other nodes to access their state and subscribe to changes. This is useful for components that need to display or react to other components' state.
278
+
279
+ ```tsx
280
+ 'use client'
281
+
282
+ import {
283
+ SduiLayoutRenderer,
284
+ useSduiNodeSubscription,
285
+ useSduiNodeReference,
286
+ useSduiLayoutAction,
287
+ type ComponentFactory,
288
+ } from '@lodado/sdui-template'
289
+ import { z } from 'zod'
290
+
291
+ // Toggle state schema
292
+ const toggleStateSchema = z.object({
293
+ checked: z.boolean(),
294
+ label: z.string().optional(),
295
+ })
296
+
297
+ // Toggle component: manages its own state
298
+ function Toggle({ id }: { id: string }) {
299
+ const { state } = useSduiNodeSubscription({
300
+ nodeId: id,
301
+ schema: toggleStateSchema,
302
+ })
303
+ const store = useSduiLayoutAction()
304
+
305
+ const handleClick = () => {
306
+ store.updateNodeState(id, { checked: !state.checked })
307
+ }
308
+
309
+ return (
310
+ <div>
311
+ <button onClick={handleClick}>{state.label || 'Toggle'}</button>
312
+ <span>{state.checked ? 'ON' : 'OFF'}</span>
313
+ </div>
314
+ )
315
+ }
316
+
317
+ // StatusDisplay component: displays state from referenced toggle
318
+ function StatusDisplay({ id }: { id: string }) {
319
+ const { referencedNodesMap } = useSduiNodeReference({
320
+ nodeId: id,
321
+ schema: toggleStateSchema, // Validates referenced node's state
322
+ })
323
+
324
+ // Access referenced node by ID
325
+ const toggleNode = referencedNodesMap['toggle-node']
326
+
327
+ if (!toggleNode) {
328
+ return <div>No reference</div>
329
+ }
330
+
331
+ return (
332
+ <div>
333
+ <div>Status: {toggleNode.state.checked ? 'ON' : 'OFF'}</div>
334
+ {toggleNode.state.label && <div>Label: {toggleNode.state.label}</div>}
335
+ </div>
336
+ )
337
+ }
338
+
339
+ const document = {
340
+ version: '1.0.0',
341
+ root: {
342
+ id: 'root',
343
+ type: 'Container',
344
+ children: [
345
+ {
346
+ id: 'toggle-node',
347
+ type: 'Toggle',
348
+ state: {
349
+ checked: false,
350
+ label: 'Power',
351
+ },
352
+ },
353
+ {
354
+ id: 'status-display',
355
+ type: 'StatusDisplay',
356
+ reference: 'toggle-node', // Reference to toggle-node
357
+ },
358
+ ],
359
+ },
360
+ }
361
+
362
+ export default function Page() {
363
+ return (
364
+ <SduiLayoutRenderer
365
+ document={document}
366
+ components={{
367
+ Toggle: (id) => <Toggle id={id} />,
368
+ StatusDisplay: (id) => <StatusDisplay id={id} />,
369
+ }}
370
+ />
371
+ )
372
+ }
373
+ ```
374
+
375
+ **Multiple References:**
376
+
377
+ You can also reference multiple nodes:
378
+
379
+ ```tsx
380
+ const document = {
381
+ version: '1.0.0',
382
+ root: {
383
+ id: 'root',
384
+ type: 'Container',
385
+ children: [
386
+ {
387
+ id: 'source-node',
388
+ type: 'Card',
389
+ reference: ['target-1', 'target-2'], // Multiple references
390
+ },
391
+ {
392
+ id: 'target-1',
393
+ type: 'Card',
394
+ state: { count: 10 },
395
+ },
396
+ {
397
+ id: 'target-2',
398
+ type: 'Card',
399
+ state: { count: 20 },
400
+ },
401
+ ],
402
+ },
403
+ }
404
+
405
+ function Card({ id }: { id: string }) {
406
+ const { referencedNodesMap, referencedNodes } = useSduiNodeReference({ nodeId: id })
407
+
408
+ // Access by ID (O(1))
409
+ const node1 = referencedNodesMap['target-1']
410
+ const node2 = referencedNodesMap['target-2']
411
+
412
+ // Or iterate over array
413
+ return (
414
+ <div>
415
+ {referencedNodes.map((node) => (
416
+ <div key={node.id}>Count: {String(node.state.count)}</div>
417
+ ))}
418
+ </div>
419
+ )
420
+ }
421
+ ```
422
+
423
+ **Key Benefits:**
424
+
425
+ - ✅ Automatically subscribes to referenced nodes' changes
426
+ - ✅ Type-safe access to referenced nodes' state
427
+ - ✅ Efficient O(1) access via `referencedNodesMap`
428
+ - ✅ Supports both single and multiple references
429
+
264
430
  ### Component Overrides
265
431
 
266
432
  ```tsx
@@ -344,18 +510,100 @@ Subscribes to a specific node's changes and returns node information.
344
510
  - `state: T` - Layout state (inferred from schema if provided, otherwise `BaseLayoutState`)
345
511
  - `childrenIds: string[]` - Array of child node IDs
346
512
  - `attributes: Record<string, unknown> | undefined` - Node attributes
513
+ - `reference: string | string[] | undefined` - Reference to other node(s)
347
514
  - `exists: boolean` - Whether the node exists
348
515
 
349
516
  ```tsx
350
- const { node, state, childrenIds, attributes, exists } = useSduiNodeSubscription({
517
+ const { node, state, childrenIds, attributes, reference, exists } = useSduiNodeSubscription({
351
518
  nodeId: 'node-1',
352
519
  schema: baseLayoutStateSchema, // optional - validates and types state
353
520
  })
354
521
  ```
355
522
 
356
- #### `useRenderNode(componentMap?: Record<string, ComponentFactory>): RenderNodeFn`
523
+ #### `useSduiNodeReference<T>(params: { nodeId: string, schema?: ZodSchema }): ReferencedNodesData`
357
524
 
358
- Returns a function to render child nodes (internal use).
525
+ Accesses referenced nodes' information and subscribes to their changes. Use this hook when a node has a `reference` field pointing to other nodes.
526
+
527
+ **Parameters:**
528
+
529
+ - `nodeId: string` - Node ID that has a reference field
530
+ - `schema?: ZodSchema` - Optional Zod schema for referenced nodes' state validation and type inference
531
+
532
+ **Returns:**
533
+
534
+ - `referencedNodes: Array<ReferencedNodeInfo>` - Array of referenced node information (for iteration)
535
+ - `referencedNodesMap: Record<string, ReferencedNodeInfo>` - Map of referenced nodes by ID (for O(1) access)
536
+ - `reference: string | string[] | undefined` - Original reference value
537
+ - `hasReference: boolean` - Whether the node has any references
538
+
539
+ **ReferencedNodeInfo includes:**
540
+
541
+ - `id: string` - Referenced node ID
542
+ - `node: SduiLayoutNode | undefined` - Node entity
543
+ - `type: string | undefined` - Node type
544
+ - `state: T` - Layout state (inferred from schema if provided)
545
+ - `attributes: Record<string, unknown> | undefined` - Node attributes
546
+ - `exists: boolean` - Whether the node exists
547
+
548
+ ```tsx
549
+ // Single reference
550
+ const { referencedNodesMap } = useSduiNodeReference({ nodeId: 'source-node' })
551
+ const targetNode = referencedNodesMap['target-node-id']
552
+ if (targetNode) {
553
+ console.log(targetNode.state.title)
554
+ }
555
+
556
+ // Multiple references
557
+ const { referencedNodes, referencedNodesMap } = useSduiNodeReference({
558
+ nodeId: 'source-node',
559
+ schema: cardStateSchema, // optional - validates referenced nodes' state
560
+ })
561
+ referencedNodes.forEach((node) => {
562
+ console.log(node.state.title)
563
+ })
564
+ // Or access by ID
565
+ const node1 = referencedNodesMap['target-1']
566
+ const node2 = referencedNodesMap['target-2']
567
+ ```
568
+
569
+ #### `useRenderNode(params): UseRenderNodeReturn`
570
+
571
+ Returns an object with `renderNode` function and node information including automatically calculated `currentPath`.
572
+
573
+ **Parameters:**
574
+
575
+ - `params.nodeId: string` - Current node ID (required)
576
+ - `params.componentMap?: Record<string, ComponentFactory>` - Optional component map
577
+ - `params.parentPath?: ParentPath` - Parent node ID path (default: `[]`)
578
+
579
+ **Returns:**
580
+
581
+ ```typescript
582
+ {
583
+ renderNode: RenderNodeFn // Function to render child nodes
584
+ currentPath: ParentPath // Current path array (automatically calculated)
585
+ pathString: string // Current path string (automatically calculated)
586
+ nodeId: string // Current node ID
587
+ parentPath: ParentPath // Parent node ID path
588
+ }
589
+ ```
590
+
591
+ **Example:**
592
+
593
+ ```tsx
594
+ function Container({ id }: { id: string }) {
595
+ const { childrenIds } = useSduiNodeSubscription({ nodeId: id })
596
+ const { renderNode, currentPath } = useRenderNode({ nodeId: id, parentPath: [] })
597
+
598
+ return (
599
+ <div>
600
+ {childrenIds.map((childId) => (
601
+ <div key={childId}>{renderNode(childId, currentPath)}</div>
602
+ ))}
603
+ </div>
604
+ )
605
+ }
606
+ ```
359
607
 
360
608
  ### Store
361
609
 
@@ -379,6 +627,7 @@ Main store class for managing SDUI layout state.
379
627
  - `getChildrenIdsById(nodeId: string): string[]` - Get children IDs by node ID
380
628
  - `getLayoutStateById(nodeId: string): BaseLayoutState | undefined` - Get layout state by ID
381
629
  - `getAttributesById(nodeId: string): Record<string, unknown> | undefined` - Get attributes by ID
630
+ - `getReferenceById(nodeId: string): string | string[] | undefined` - Get reference by node ID
382
631
  - `getRootId(): string | undefined` - Get root node ID
383
632
  - `getDocument(): SduiLayoutDocument | null` - Convert current state to document
384
633
 
@@ -387,6 +636,7 @@ Main store class for managing SDUI layout state.
387
636
  - `updateLayout(document: SduiLayoutDocument): void` - Update layout document
388
637
  - `updateNodeState(nodeId: string, state: Partial<BaseLayoutState>): void` - Update node state
389
638
  - `updateNodeAttributes(nodeId: string, attributes: Partial<Record<string, unknown>>): void` - Update node attributes
639
+ - `updateNodeReference(nodeId: string, reference: string | string[] | undefined): void` - Update node reference (set to undefined to remove)
390
640
  - `updateVariables(variables: Record<string, unknown>): void` - Update global variables
391
641
  - `updateVariable(key: string, value: unknown): void` - Update single variable
392
642
  - `deleteVariable(key: string): void` - Delete variable
@@ -1 +1 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),s=require("lodash-es"),r=require("normalizr");const i=t.createContext(null),o=({store:s,children:r})=>{const o=t.useMemo(()=>({store:s}),[s]);return e.jsx(i.Provider,{value:o,children:r})},n=()=>{const e=t.useContext(i);if(!e)throw new Error("useSduiLayoutContext must be used within SduiLayoutProvider");return e},d=()=>{const{store:e}=n();return e},a=e=>e+1;function c(e){const{nodeId:s,schema:r}=e,[,i]=t.useReducer(a,0),o=d();let n;t.useEffect(()=>o.subscribeNode(s,i),[o,s]);let c,u,h=[];try{n=o.getNodeById(s),h=(null==n?void 0:n.childrenIds)||[]}catch(e){n=void 0,h=[]}try{c=o.getLayoutStateById(s)}catch(e){c=void 0}try{u=o.getAttributesById(s)}catch(e){u=void 0}const l=t.useMemo(()=>{if(!r)return c;if(!c)throw new Error(`State not found for node "${s}". Schema was provided but state is missing.`);const e=r.safeParse(c);if(!e.success)throw new Error(`State validation failed for node "${s}": ${e.error.message}`);return e.data},[c,r,s]);return{node:n,type:null==n?void 0:n.type,state:l,childrenIds:h,attributes:u,exists:!!n}}const u={},h=({id:t,renderNode:s})=>{const{type:r,childrenIds:i}=c({nodeId:t});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]}),i&&i.length>0&&e.jsx("div",{children:i.map(t=>e.jsx("div",{children:s(t)},t))})]}):null},l=(t,s)=>e.jsx(h,{id:t,renderNode:s});class p extends Error{constructor(e){super(`Node not found: "${e}"`),this.name="NodeNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,p)}}class y extends Error{constructor(){super("Root node ID not found"),this.name="RootNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,y)}}class g extends Error{constructor(){super("Metadata not found"),this.name="MetadataNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,g)}}function b(e,t){var s;const r=null===(s=t.nodes)||void 0===s?void 0:s[e];if(!r)return null;const i=[];r.childrenIds&&i.push(...r.childrenIds);const o=i.map(e=>b(e,t)).filter(e=>null!==e);return Object.assign({id:r.id,type:r.type,state:r.state||{},attributes:r.attributes||{}},o.length>0&&{children:o})}const _=new r.schema.Entity("nodes",{},{idAttribute:"id",processStrategy:e=>({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}})});function v(e){const t=e.children||[],s=t.length>0?r.normalize(t,[_]):{entities:{nodes:{}}},i={id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},o=r.normalize(i,_),n={nodes:Object.assign(Object.assign({},o.entities.nodes),s.entities.nodes)},d=e=>{var t,s;n.nodes&&n.nodes[e.id]?n.nodes[e.id]=Object.assign(Object.assign({},n.nodes[e.id]),{childrenIds:(null===(t=e.children)||void 0===t?void 0:t.map(e=>e.id))||[]}):n.nodes&&(n.nodes[e.id]={id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{},childrenIds:(null===(s=e.children)||void 0===s?void 0:s.map(e=>e.id))||[]}),e.children&&e.children.forEach(d)};return d(e),{result:o.result,entities:n}}function m(e){const{result:t,entities:s}=v(e.root);return{result:t,entities:s}}_.define({children:[_]});class I{constructor(){this._cached={},this._originalCached={}}cacheDocument(e){var t;const r=(null===(t=e.metadata)||void 0===t?void 0:t.id)||e.root.id;this._cached[r]=e,this._originalCached[r]||(this._originalCached[r]=s.cloneDeep(e))}setMetadata(e){this._metadata=e}getMetadata(){return this._metadata}getOriginalDocument(e){return this._originalCached[e]}getDocumentId(e){var t;return(null===(t=this._metadata)||void 0===t?void 0:t.id)||e}getDocument(e){const t=e.getRootId();if(!t)return null;const s=b(t,{nodes:e.nodes});return s?{version:"1.0.0",metadata:this._metadata,root:s}:null}clearCache(){this._cached={},this._originalCached={}}reset(){this._metadata=void 0,this.clearCache()}}class N{constructor(){this._state={version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{}}}get state(){return this._state}get nodes(){return this._state.nodes}getNodeById(e){return this._state.nodes[e]}getNodeTypeById(e){var t;return null===(t=this._state.nodes[e])||void 0===t?void 0:t.type}getChildrenIdsById(e){var t;return(null===(t=this._state.nodes[e])||void 0===t?void 0:t.childrenIds)||[]}getRootId(){return this._state.rootId}initializeState(e){this._state=Object.assign({version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{}},e)}updateNodes(e){this._state.nodes=e}updateNodeState(e,t){const s=this._state.nodes[e];s&&(this._state.nodes[e]=Object.assign(Object.assign({},s),{state:t}))}updateNodeAttributes(e,t){const s=this._state.nodes[e];s&&(this._state.nodes[e]=Object.assign(Object.assign({},s),{attributes:t}))}setRootId(e){this._state.rootId=e}setSelectedNodeId(e){const t=this._state.selectedNodeId;return this._state.selectedNodeId=e,t}setEdited(e){this._state.isEdited=e}updateVariables(e){this._state.variables=e}incrementVersion(){this._state.version+=1}reset(){this._state.nodes={},this._state.rootId=void 0,this._state.isEdited=!1,this._state.selectedNodeId=void 0,this._state.variables={},this._state.version+=1}}class f{constructor(){this._nodeListeners=new Map,this._versionListeners=new Set}subscribeNode(e,t){return this._nodeListeners.has(e)||this._nodeListeners.set(e,new Set),this._nodeListeners.get(e).add(t),()=>{var s,r;null===(s=this._nodeListeners.get(e))||void 0===s||s.delete(t),0===(null===(r=this._nodeListeners.get(e))||void 0===r?void 0:r.size)&&this._nodeListeners.delete(e)}}subscribeVersion(e){return this._versionListeners.add(e),()=>{this._versionListeners.delete(e)}}notifyNode(e){var t;null===(t=this._nodeListeners.get(e))||void 0===t||t.forEach(e=>e())}notifyNodes(e){[...new Set(e)].forEach(e=>this.notifyNode(e))}notifyVersion(){this._versionListeners.forEach(e=>e())}}class M{constructor(e,t){this.repository=e,this.subscriptionManager=t}updateVariables(e){this.repository.updateVariables(s.cloneDeep(e)),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}updateVariable(e,t){const r=this.repository.state.variables;this.repository.updateVariables(Object.assign(Object.assign({},s.cloneDeep(r)),{[e]:s.cloneDeep(t)})),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}deleteVariable(e){const t=s.cloneDeep(this.repository.state.variables);delete t[e],this.repository.updateVariables(t),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}}class E{constructor(e,t){this._subscriptionManager=new f,this._repository=new N,this._documentManager=new I,this._componentOverrides={},this._repository.initializeState(e),this._variablesManager=new M(this._repository,this._subscriptionManager),this._componentOverrides=(null==t?void 0:t.componentOverrides)||{}}subscribeNode(e,t){return this._subscriptionManager.subscribeNode(e,t)}subscribeVersion(e){return this._subscriptionManager.subscribeVersion(e)}get state(){return this._repository.state}get nodes(){return this._repository.nodes}get metadata(){const e=this._documentManager.getMetadata();if(!e)throw new g;return e}getComponentOverrides(){return this._componentOverrides}getNodeById(e){const t=this._repository.getNodeById(e);if(!t)throw new p(e);return t}getNodeTypeById(e){const t=this._repository.getNodeTypeById(e);if(!t)throw new p(e);return t}getChildrenIdsById(e){if(!this._repository.getNodeById(e))throw new p(e);return this._repository.getChildrenIdsById(e)}getLayoutStateById(e){return this.getNodeById(e).state||{}}getAttributesById(e){return this.getNodeById(e).attributes||{}}getRootId(){const e=this._repository.getRootId();if(!e)throw new y;return e}updateLayout(e){const{entities:t}=m(e);this._repository.updateNodes(t.nodes||{}),this._repository.setRootId(e.root.id),this._repository.setEdited(!1),this._repository.updateVariables(e.variables?s.cloneDeep(e.variables):{}),this._repository.incrementVersion(),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._subscriptionManager.notifyVersion()}cancelEdit(e){const t=this._repository.getRootId(),s=e||(t?this._documentManager.getDocumentId(t):void 0);if(!s)return;const r=this._documentManager.getOriginalDocument(s);r&&this.updateLayout(r)}updateNodeState(e,t){const s=this.getNodeById(e);this._repository.updateNodeState(e,Object.assign(Object.assign({},s.state||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeAttributes(e,t){const s=this.getNodeById(e);this._repository.updateNodeAttributes(e,Object.assign(Object.assign({},s.attributes||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateVariables(e){this._variablesManager.updateVariables(e)}updateVariable(e,t){this._variablesManager.updateVariable(e,t)}deleteVariable(e){this._variablesManager.deleteVariable(e)}setSelectedNodeId(e){const t=this._repository.setSelectedNodeId(e);t&&this._subscriptionManager.notifyNode(t),e&&this._subscriptionManager.notifyNode(e)}getDocument(){return this._documentManager.getDocument(this._repository)}clearCache(){this._documentManager.clearCache(),this.reset()}reset(){this._documentManager.reset(),this._repository.reset(),this._subscriptionManager.notifyVersion()}}const S=e=>{const{store:s}=n(),{nodes:r}=s,i=t.useRef(null),o=t.useCallback(t=>{const o=r[t];if(!o)return null;const n=s.getComponentOverrides(),d=e||{};return(n[t]||n[o.type]||d[o.type]||l)(t,i.current)},[r,s,e]);return i.current=o,o},w=({id:e,componentMap:t})=>S(t)(e);exports.SduiLayoutProvider=o,exports.SduiLayoutRenderer=({document:s,components:r,componentOverrides:i,onLayoutChange:n,onError:d})=>{var a;const c=t.useMemo(()=>{try{if(!s||!s.root)throw new Error("Invalid document: missing root");if(!s.root.id)throw new Error("Invalid document: root.id is required");const e={componentOverrides:Object.assign(Object.assign(Object.assign({},r),null==i?void 0:i.byNodeType),null==i?void 0:i.byNodeId)},t=new E(void 0,e);return t.updateLayout(s),t}catch(e){return d&&d(e instanceof Error?e:new Error(String(e))),new E}},[s,r,i,d]),h=t.useMemo(()=>Object.assign(Object.assign({},u),r),[r]),l=null===(a=null==s?void 0:s.root)||void 0===a?void 0:a.id;return l?e.jsx(o,{store:c,children:e.jsx(w,{id:l,componentMap:h})}):null},exports.SduiLayoutStore=E,exports.denormalizeSduiLayout=function(e,t,s){const r=b(e,t);return r?{version:"1.0.0",metadata:s,root:r}:null},exports.denormalizeSduiNode=b,exports.normalizeSduiLayout=m,exports.normalizeSduiNode=v,exports.useRenderNode=S,exports.useSduiLayoutAction=d,exports.useSduiNodeSubscription=c;
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("react-dom/test-utils"),r=require("react-dom"),o=require("react-dom/client"),i=require("pretty-format"),a=require("aria-query"),s=require("lz-string"),l=require("lodash-es"),u=require("normalizr");function c(e){var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var d=c(t),b=c(n),p=c(o),f=c(i),h=Object.prototype.toString;var y=Math.pow(2,53)-1;function m(e){var t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),y)}function v(e,t){var n=Array,r=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");for(var o,i,a=m(r.length),s="function"==typeof(o=n)||"[object Function]"===h.call(o)?Object(new n(a)):new Array(a),l=0;l<a;)i=r[l],s[l]=i,l+=1;return s.length=a,s}function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function E(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,w(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function w(e){var t=function(e,t){if("object"!==g(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===g(t)?t:String(t)}var T="undefined"==typeof Set?Set:function(){function e(){var t,n,r,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r=void 0,(n=w(n="items"))in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,this.items=o}return E(e,[{key:"add",value:function(e){return!1===this.has(e)&&this.items.push(e),this}},{key:"clear",value:function(){this.items=[]}},{key:"delete",value:function(e){var t=this.items.length;return this.items=this.items.filter(function(t){return t!==e}),t!==this.items.length}},{key:"forEach",value:function(e){var t=this;this.items.forEach(function(n){e(n,n,t)})}},{key:"has",value:function(e){return-1!==this.items.indexOf(e)}},{key:"size",get:function(){return this.items.length}}]),e}();function I(e){var t;return null!==(t=e.localName)&&void 0!==t?t:e.tagName.toLowerCase()}var S={article:"article",aside:"complementary",button:"button",datalist:"listbox",dd:"definition",details:"group",dialog:"dialog",dt:"term",fieldset:"group",figure:"figure",form:"form",footer:"contentinfo",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",header:"banner",hr:"separator",html:"document",legend:"legend",li:"listitem",math:"math",main:"main",menu:"list",nav:"navigation",ol:"list",optgroup:"group",option:"option",output:"status",progress:"progressbar",section:"region",summary:"button",table:"table",tbody:"rowgroup",textarea:"textbox",tfoot:"rowgroup",td:"cell",th:"columnheader",thead:"rowgroup",tr:"row",ul:"list"},A={caption:new Set(["aria-label","aria-labelledby"]),code:new Set(["aria-label","aria-labelledby"]),deletion:new Set(["aria-label","aria-labelledby"]),emphasis:new Set(["aria-label","aria-labelledby"]),generic:new Set(["aria-label","aria-labelledby","aria-roledescription"]),insertion:new Set(["aria-label","aria-labelledby"]),paragraph:new Set(["aria-label","aria-labelledby"]),presentation:new Set(["aria-label","aria-labelledby"]),strong:new Set(["aria-label","aria-labelledby"]),subscript:new Set(["aria-label","aria-labelledby"]),superscript:new Set(["aria-label","aria-labelledby"])};function _(e,t){return function(e,t){return["aria-atomic","aria-busy","aria-controls","aria-current","aria-describedby","aria-details","aria-dropeffect","aria-flowto","aria-grabbed","aria-hidden","aria-keyshortcuts","aria-label","aria-labelledby","aria-live","aria-owns","aria-relevant","aria-roledescription"].some(function(n){var r;return e.hasAttribute(n)&&!(null!==(r=A[t])&&void 0!==r&&r.has(n))})}(e,t)}function O(e){var t=function(e){var t=e.getAttribute("role");if(null!==t){var n=t.trim().split(" ")[0];if(n.length>0)return n}return null}(e);if(null===t||"presentation"===t){var n=function(e){var t=S[I(e)];if(void 0!==t)return t;switch(I(e)){case"a":case"area":case"link":if(e.hasAttribute("href"))return"link";break;case"img":return""!==e.getAttribute("alt")||_(e,"img")?"img":"presentation";case"input":var n=e.type;switch(n){case"button":case"image":case"reset":case"submit":return"button";case"checkbox":case"radio":return n;case"range":return"slider";case"email":case"tel":case"text":case"url":return e.hasAttribute("list")?"combobox":"textbox";case"search":return e.hasAttribute("list")?"combobox":"searchbox";case"number":return"spinbutton";default:return null}case"select":return e.hasAttribute("multiple")||e.size>1?"listbox":"combobox"}return null}(e);if("presentation"!==t||_(e,n||""))return n}return t}function x(e){return null!==e&&e.nodeType===e.ELEMENT_NODE}function j(e){return x(e)&&"caption"===I(e)}function N(e){return x(e)&&"input"===I(e)}function M(e){return x(e)&&"legend"===I(e)}function C(e){return function(e){return x(e)&&void 0!==e.ownerSVGElement}(e)&&"title"===I(e)}function D(e,t){if(x(e)&&e.hasAttribute(t)){var n=e.getAttribute(t).split(" "),r=e.getRootNode?e.getRootNode():e.ownerDocument;return n.map(function(e){return r.getElementById(e)}).filter(function(e){return null!==e})}return[]}function k(e,t){return!!x(e)&&-1!==t.indexOf(O(e))}function P(e,t){if(!x(e))return!1;if("range"===t)return k(e,["meter","progressbar","scrollbar","slider","spinbutton"]);throw new TypeError("No knowledge about abstract role '".concat(t,"'. This is likely a bug :("))}function B(e,t){var n=v(e.querySelectorAll(t));return D(e,"aria-owns").forEach(function(e){n.push.apply(n,v(e.querySelectorAll(t)))}),n}function L(e){return x(t=e)&&"select"===I(t)?e.selectedOptions||B(e,"[selected]"):B(e,'[aria-selected="true"]');var t}function R(e){return N(e)||x(t=e)&&"textarea"===I(t)?e.value:e.textContent||"";var t}function q(e){var t=e.getPropertyValue("content");return/^["'].*["']$/.test(t)?t.slice(1,-1):""}function V(e){var t=I(e);return"button"===t||"input"===t&&"hidden"!==e.getAttribute("type")||"meter"===t||"output"===t||"progress"===t||"select"===t||"textarea"===t}function F(e){if(V(e))return e;var t=null;return e.childNodes.forEach(function(e){if(null===t&&x(e)){var n=F(e);null!==n&&(t=n)}}),t}function W(e){if(void 0!==e.control)return e.control;var t=e.getAttribute("for");return null!==t?e.ownerDocument.getElementById(t):F(e)}function z(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new T,r=function(e){var t=(null===e.ownerDocument?e:e.ownerDocument).defaultView;if(null===t)throw new TypeError("no window available");return t}(e),o=t.compute,i=void 0===o?"name":o,a=t.computedStyleSupportsPseudoElements,s=void 0===a?void 0!==t.getComputedStyle:a,l=t.getComputedStyle,u=void 0===l?r.getComputedStyle.bind(r):l,c=t.hidden,d=void 0!==c&&c;function b(e,t){var n,r,o="";if(x(e)&&s){var i=q(u(e,"::before"));o="".concat(i," ").concat(o)}if((function(e){return x(e)&&"slot"===I(e)}(e)?0===(r=(n=e).assignedNodes()).length?v(n.childNodes):r:v(e.childNodes).concat(D(e,"aria-owns"))).forEach(function(e){var n=h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),r="inline"!==(x(e)?u(e).getPropertyValue("display"):"inline")?" ":"";o+="".concat(r).concat(n).concat(r)}),x(e)&&s){var a=q(u(e,"::after"));o="".concat(o," ").concat(a)}return o.trim()}function p(e,t){var r=e.getAttributeNode(t);return null===r||n.has(r)||""===r.value.trim()?null:(n.add(r),r.value)}function f(e){if(!x(e))return null;if(function(e){return x(e)&&"fieldset"===I(e)}(e)){n.add(e);for(var t=v(e.childNodes),r=0;r<t.length;r+=1){var o=t[r];if(M(o))return h(o,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(function(e){return x(e)&&"table"===I(e)}(e)){n.add(e);for(var i=v(e.childNodes),a=0;a<i.length;a+=1){var s=i[a];if(j(s))return h(s,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else{if(function(e){return x(e)&&"svg"===I(e)}(e)){n.add(e);for(var l=v(e.childNodes),u=0;u<l.length;u+=1){var c=l[u];if(C(c))return c.textContent}return null}if("img"===I(e)||"area"===I(e)){var d=p(e,"alt");if(null!==d)return d}else if(function(e){return x(e)&&"optgroup"===I(e)}(e)){var f=p(e,"label");if(null!==f)return f}}if(N(e)&&("button"===e.type||"submit"===e.type||"reset"===e.type)){var y=p(e,"value");if(null!==y)return y;if("submit"===e.type)return"Submit";if("reset"===e.type)return"Reset"}var m,g,E=null===(g=(m=e).labels)?g:void 0!==g?v(g):V(m)?v(m.ownerDocument.querySelectorAll("label")).filter(function(e){return W(e)===m}):null;if(null!==E&&0!==E.length)return n.add(e),v(E).map(function(e){return h(e,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(e){return e.length>0}).join(" ");if(N(e)&&"image"===e.type){var w=p(e,"alt");if(null!==w)return w;var T=p(e,"title");return null!==T?T:"Submit Query"}if(k(e,["button"])){var S=b(e,{isEmbeddedInLabel:!1});if(""!==S)return S}return null}function h(e,t){if(n.has(e))return"";if(!d&&function(e,t){if(!x(e))return!1;if(e.hasAttribute("hidden")||"true"===e.getAttribute("aria-hidden"))return!0;var n=t(e);return"none"===n.getPropertyValue("display")||"hidden"===n.getPropertyValue("visibility")}(e,u)&&!t.isReferenced)return n.add(e),"";var r=x(e)?e.getAttributeNode("aria-labelledby"):null,o=null===r||n.has(r)?[]:D(e,"aria-labelledby");if("name"===i&&!t.isReferenced&&o.length>0)return n.add(r),o.map(function(e){return h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(" ");var a,s=t.recursion&&(k(a=e,["button","combobox","listbox","textbox"])||P(a,"range"))&&"name"===i;if(!s){var l=(x(e)&&e.getAttribute("aria-label")||"").trim();if(""!==l&&"name"===i)return n.add(e),l;if(!function(e){return k(e,["none","presentation"])}(e)){var c=f(e);if(null!==c)return n.add(e),c}}if(k(e,["menu"]))return n.add(e),"";if(s||t.isEmbeddedInLabel||t.isReferenced){if(k(e,["combobox","listbox"])){n.add(e);var y=L(e);return 0===y.length?N(e)?e.value:"":v(y).map(function(e){return h(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(" ")}if(P(e,"range"))return n.add(e),e.hasAttribute("aria-valuetext")?e.getAttribute("aria-valuetext"):e.hasAttribute("aria-valuenow")?e.getAttribute("aria-valuenow"):e.getAttribute("value")||"";if(k(e,["textbox"]))return n.add(e),R(e)}if(function(e){return k(e,["button","cell","checkbox","columnheader","gridcell","heading","label","legend","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"])}(e)||x(e)&&t.isReferenced||function(e){return j(e)}(e)){var m=b(e,{isEmbeddedInLabel:t.isEmbeddedInLabel});if(""!==m)return n.add(e),m}if(e.nodeType===e.TEXT_NODE)return n.add(e),e.textContent||"";if(t.recursion)return n.add(e),b(e,{isEmbeddedInLabel:t.isEmbeddedInLabel});var g=function(e){return x(e)?p(e,"title"):null}(e);return null!==g?(n.add(e),g):(n.add(e),"")}return h(e,{isEmbeddedInLabel:!1,isReferenced:"description"===i,recursion:!1}).trim().replace(/\s\s+/g," ")}function U(e){return U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(e)}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach(function(t){G(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G(e,t,n){return(t=function(e){var t=function(e,t){if("object"!==U(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!==U(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===U(t)?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=D(e,"aria-describedby").map(function(e){return z(e,$($({},t),{},{compute:"description"}))}).join(" ");if(""===n){var r=e.getAttribute("title");n=null===r?"":r}return n}function X(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(e,["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"])?"":z(e,t)}function J(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}const Q=(e,t)=>{const n=t.colors.content;return n.open+J(e)+n.close},Y=/^((HTML|SVG)\w*)?Element$/,Z=e=>{const{tagName:t}=e;return Boolean("string"==typeof t&&t.includes("-")||"function"==typeof e.hasAttribute&&e.hasAttribute("is"))};function ee(e){return 11===e.nodeType}function te(e){return{test:e=>{var t;return((null==e||null==(t=e.constructor)?void 0:t.name)||Z(e))&&(e=>{const t=e.constructor.name,{nodeType:n}=e;return 1===n&&(Y.test(t)||Z(e))||3===n&&"Text"===t||8===n&&"Comment"===t||11===n&&"DocumentFragment"===t})(e)},serialize:(t,n,r,o,i,a)=>{if(function(e){return 3===e.nodeType}(t))return Q(t.data,n);if(function(e){return 8===e.nodeType}(t))return((e,t)=>{const n=t.colors.comment;return n.open+"\x3c!--"+J(e)+"--\x3e"+n.close})(t.data,n);const s=ee(t)?"DocumentFragment":t.tagName.toLowerCase();return++o>n.maxDepth?((e,t)=>{const n=t.colors.tag;return n.open+"<"+e+n.close+" …"+n.open+" />"+n.close})(s,n):((e,t,n,r,o)=>{const i=r.colors.tag;return i.open+"<"+e+(t&&i.close+t+r.spacingOuter+o+i.open)+(n?">"+i.close+n+r.spacingOuter+o+i.open+"</"+e:(t&&!r.min?"":" ")+"/")+">"+i.close})(s,((e,t,n,r,o,i,a)=>{const s=r+n.indent,l=n.colors;return e.map(e=>{const u=t[e];let c=a(u,n,s,o,i);return"string"!=typeof u&&(-1!==c.indexOf("\n")&&(c=n.spacingOuter+s+c+n.spacingOuter+r),c="{"+c+"}"),n.spacingInner+r+l.prop.open+e+l.prop.close+"="+l.value.open+c+l.value.close}).join("")})(ee(t)?[]:Array.from(t.attributes).map(e=>e.name).sort(),ee(t)?{}:Array.from(t.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),n,r+n.indent,o,i,a),((e,t,n,r,o,i)=>e.map(e=>{const a="string"==typeof e?Q(e,t):i(e,t,n,r,o);return""===a&&"object"==typeof e&&null!==e&&3!==e.nodeType?"":t.spacingOuter+n+a}).join(""))(Array.prototype.slice.call(t.childNodes||t.children).filter(e),n,r+n.indent,o,i,a),n,r)}}}let ne=null,re=null,oe=null;try{const e=module&&module.require;re=e.call(module,"fs").readFileSync,oe=e.call(module,"@babel/code-frame").codeFrameColumns,ne=e.call(module,"picocolors")}catch{}function ie(){if(!re||!oe)return"";return function(e){const t=e.indexOf("(")+1,n=e.indexOf(")"),r=e.slice(t,n),o=r.split(":"),[i,a,s]=[o[0],parseInt(o[1],10),parseInt(o[2],10)];let l="";try{l=re(i,"utf-8")}catch{return""}const u=oe(l,{start:{line:a,column:s}},{highlightCode:!0,linesBelow:0});return ne.dim(r)+"\n"+u+"\n"}((new Error).stack.split("\n").slice(1).find(e=>!e.includes("node_modules/")))}function ae(){return"undefined"!=typeof jest&&null!==jest&&(!0===setTimeout._isMockFunction||Object.prototype.hasOwnProperty.call(setTimeout,"clock"))}function se(){if("undefined"==typeof window)throw new Error("Could not find default container");return window.document}function le(e){if(e.defaultView)return e.defaultView;if(e.ownerDocument&&e.ownerDocument.defaultView)return e.ownerDocument.defaultView;if(e.window)return e.window;throw e.ownerDocument&&null===e.ownerDocument.defaultView?new Error("It looks like the window object is not available for the provided node."):e.then instanceof Function?new Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?"):Array.isArray(e)?new Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?"):"function"==typeof e.debug&&"function"==typeof e.logTestingPlaygroundURL?new Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?"):new Error("The given node is not an Element, the node type is: "+typeof e+".")}function ue(e){if(!e||"function"!=typeof e.querySelector||"function"!=typeof e.querySelectorAll)throw new TypeError("Expected container to be an Element, a Document or a DocumentFragment but got "+function(e){if("object"==typeof e)return null===e?"null":e.constructor.name;return typeof e}(e)+".")}const ce=()=>{if("undefined"==typeof process)return!1;let e;try{var t;const n=null==(t=process.env)?void 0:t.COLORS;n&&(e=JSON.parse(n))}catch{}return"boolean"==typeof e?e:void 0!==process.versions&&void 0!==process.versions.node},{DOMCollection:de}=f.plugins;function be(e){return 8!==e.nodeType&&(1!==e.nodeType||!e.matches(ye().defaultIgnore))}function pe(e,t,n){if(void 0===n&&(n={}),e||(e=se().body),"number"!=typeof t&&(t="undefined"!=typeof process&&void 0!==process.env&&process.env.DEBUG_PRINT_LIMIT||7e3),0===t)return"";e.documentElement&&(e=e.documentElement);let r=typeof e;if("object"===r?r=e.constructor.name:e={},!("outerHTML"in e))throw new TypeError("Expected an element or document but got "+r);const{filterNode:o=be,...i}=n,a=f.format(e,{plugins:[te(o),de],printFunctionName:!1,highlight:ce(),...i});return void 0!==t&&e.outerHTML.length>t?a.slice(0,t)+"...":a}const fe=function(){const e=ie();e?console.log(pe(...arguments)+"\n\n"+e):console.log(pe(...arguments))};let he={testIdAttribute:"data-testid",asyncUtilTimeout:1e3,asyncWrapper:e=>e(),unstable_advanceTimersWrapper:e=>e(),eventWrapper:e=>e(),defaultHidden:!1,defaultIgnore:"script, style",showOriginalStackTrace:!1,throwSuggestions:!1,getElementError(e,t){const n=pe(t),r=new Error([e,"Ignored nodes: comments, "+he.defaultIgnore+"\n"+n].filter(Boolean).join("\n\n"));return r.name="TestingLibraryElementError",r},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1};function ye(){return he}const me=["button","meter","output","progress","select","textarea","input"];function ve(e){return me.includes(e.nodeName.toLowerCase())?"":3===e.nodeType?e.textContent:Array.from(e.childNodes).map(e=>ve(e)).join("")}function ge(e){let t;return t="label"===e.tagName.toLowerCase()?ve(e):e.value||e.textContent,t}function Ee(e){var t;if(void 0!==e.labels)return null!=(t=e.labels)?t:[];if(!function(e){return/BUTTON|METER|OUTPUT|PROGRESS|SELECT|TEXTAREA/.test(e.tagName)||"INPUT"===e.tagName&&"hidden"!==e.getAttribute("type")}(e))return[];const n=e.ownerDocument.querySelectorAll("label");return Array.from(n).filter(t=>t.control===e)}function we(e,t,n){let{selector:r="*"}=void 0===n?{}:n;const o=t.getAttribute("aria-labelledby"),i=o?o.split(" "):[];return i.length?i.map(t=>{const n=e.querySelector('[id="'+t+'"]');return n?{content:ge(n),formControl:null}:{content:"",formControl:null}}):Array.from(Ee(t)).map(e=>({content:ge(e),formControl:Array.from(e.querySelectorAll("button, input, meter, output, progress, select, textarea")).filter(e=>e.matches(r))[0]}))}function Te(e){if(null==e)throw new Error("It looks like "+e+" was passed instead of a matcher. Did you do something like getByText("+e+")?")}function Ie(e,t,n,r){if("string"!=typeof e)return!1;Te(n);const o=r(e);return"string"==typeof n||"number"==typeof n?o.toLowerCase().includes(n.toString().toLowerCase()):"function"==typeof n?n(o,t):Oe(n,o)}function Se(e,t,n,r){if("string"!=typeof e)return!1;Te(n);const o=r(e);return n instanceof Function?n(o,t):n instanceof RegExp?Oe(n,o):o===String(n)}function Ae(e){let{trim:t=!0,collapseWhitespace:n=!0}=void 0===e?{}:e;return e=>{let r=e;return r=t?r.trim():r,r=n?r.replace(/\s+/g," "):r,r}}function _e(e){let{trim:t,collapseWhitespace:n,normalizer:r}=e;if(!r)return Ae({trim:t,collapseWhitespace:n});if(void 0!==t||void 0!==n)throw new Error('trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer');return r}function Oe(e,t){const n=e.test(t);return e.global&&0!==e.lastIndex&&(console.warn("To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp."),e.lastIndex=0),n}function xe(e){return e.matches("input[type=submit], input[type=button], input[type=reset]")?e.value:Array.from(e.childNodes).filter(e=>3===e.nodeType&&Boolean(e.textContent)).map(e=>e.textContent).join("")}const je=function(e){function t(e){let{attributes:t=[]}=e;return t.length}function n(e){let{attributes:t=[]}=e;const n=t.findIndex(e=>e.value&&"type"===e.name&&"text"===e.value);n>=0&&(t=[...t.slice(0,n),...t.slice(n+1)]);const r=function(e){let{name:t,attributes:n}=e;return""+t+n.map(e=>{let{name:t,value:n,constraints:r=[]}=e;const o=-1!==r.indexOf("undefined"),i=-1!==r.indexOf("set");return void 0!==n?"["+t+'="'+n+'"]':o?":not(["+t+"])":i?"["+t+"]:not(["+t+'=""])':"["+t+"]"}).join("")}({...e,attributes:t});return e=>!(n>=0&&"text"!==e.type)&&e.matches(r)}let r=[];for(const[o,i]of e.entries())r=[...r,{match:n(o),roles:Array.from(i),specificity:t(o)}];return r.sort(function(e,t){let{specificity:n}=e,{specificity:r}=t;return r-n})}(a.elementRoles);function Ne(e){if(!0===e.hidden)return!0;if("true"===e.getAttribute("aria-hidden"))return!0;return"none"===e.ownerDocument.defaultView.getComputedStyle(e).display}function Me(e,t){void 0===t&&(t={});const{isSubtreeInaccessible:n=Ne}=t;if("hidden"===e.ownerDocument.defaultView.getComputedStyle(e).visibility)return!0;let r=e;for(;r;){if(n(r))return!0;r=r.parentElement}return!1}function Ce(e){for(const{match:t,roles:n}of je)if(t(e))return[...n];return[]}function De(e,t){let{hidden:n,includeDescription:r}=t;const o=function(e,t){let{hidden:n=!1}=void 0===t?{}:t;return function e(t){return[t,...Array.from(t.children).reduce((t,n)=>[...t,...e(n)],[])]}(e).filter(e=>!1!==n||!1===Me(e)).reduce((e,t)=>{let n=[];return n=t.hasAttribute("role")?t.getAttribute("role").split(" ").slice(0,1):Ce(t),n.reduce((e,n)=>Array.isArray(e[n])?{...e,[n]:[...e[n],t]}:{...e,[n]:[t]},e)},{})}(e,{hidden:n});return Object.entries(o).filter(e=>{let[t]=e;return"generic"!==t}).map(e=>{let[t,n]=e;const o="-".repeat(50);return t+":\n\n"+n.map(e=>{const t='Name "'+X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})+'":\n',n=pe(e.cloneNode(!1));if(r){return""+t+('Description "'+K(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})+'":\n')+n}return""+t+n}).join("\n\n")+"\n\n"+o}).join("\n")}function ke(e,t){const n=e.getAttribute(t);return"true"===n||"false"!==n&&void 0}const Pe=Ae();function Be(e){return new RegExp(function(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}(e.toLowerCase()),"i")}function Le(e,t,n,r){let{variant:o,name:i}=r,a="";const s={},l=[["Role","TestId"].includes(e)?n:Be(n)];i&&(s.name=Be(i)),"Role"===e&&Me(t)&&(s.hidden=!0,a="Element is inaccessible. This means that the element and all its children are invisible to screen readers.\n If you are using the aria-hidden prop, make sure this is the right choice for your case.\n "),Object.keys(s).length>0&&l.push(s);const u=o+"By"+e;return{queryName:e,queryMethod:u,queryArgs:l,variant:o,warning:a,toString(){a&&console.warn(a);let[e,t]=l;return e="string"==typeof e?"'"+e+"'":e,t=t?", { "+Object.entries(t).map(e=>{let[t,n]=e;return t+": "+n}).join(", ")+" }":"",u+"("+e+t+")"}}}function Re(e,t,n){return n&&!0}function qe(e,t,n){var r,o;if(void 0===t&&(t="get"),e.matches(ye().defaultIgnore))return;const i=null!=(r=e.getAttribute("role"))?r:null==(o=Ce(e))?void 0:o[0];if("generic"!==i&&Re(0,0,i))return Le("Role",e,i,{variant:t,name:X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements})});const a=we(document,e).map(e=>e.content).join(" ");if(Re(0,0,a))return Le("LabelText",e,a,{variant:t});const s=e.getAttribute("placeholder");if(Re(0,0,s))return Le("PlaceholderText",e,s,{variant:t});const l=Pe(xe(e));if(Re(0,0,l))return Le("Text",e,l,{variant:t});if(Re(0,0,e.value))return Le("DisplayValue",e,Pe(e.value),{variant:t});const u=e.getAttribute("alt");if(Re(0,0,u))return Le("AltText",e,u,{variant:t});const c=e.getAttribute("title");if(Re(0,0,c))return Le("Title",e,c,{variant:t});const d=e.getAttribute(ye().testIdAttribute);return Re(0,0,d)?Le("TestId",e,d,{variant:t}):void 0}function Ve(e,t){e.stack=t.stack.replace(t.message,e.message)}function Fe(e,t){let{container:n=se(),timeout:r=ye().asyncUtilTimeout,showOriginalStackTrace:o=ye().showOriginalStackTrace,stackTraceError:i,interval:a=50,onTimeout:s=e=>(Object.defineProperty(e,"message",{value:ye().getElementError(e.message,n).message}),e),mutationObserverOptions:l={subtree:!0,childList:!0,attributes:!0,characterData:!0}}=t;if("function"!=typeof e)throw new TypeError("Received `callback` arg must be a function");return new Promise(async(t,u)=>{let c,d,b,p=!1,f="idle";const h=setTimeout(function(){let e;c?(e=c,o||"TestingLibraryElementError"!==e.name||Ve(e,i)):(e=new Error("Timed out in waitFor."),o||Ve(e,i));m(s(e),null)},r),y=ae();if(y){const{unstable_advanceTimersWrapper:e}=ye();for(g();!p;){if(!ae()){const e=new Error("Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Ve(e,i),void u(e)}if(await e(async()=>{jest.advanceTimersByTime(a)}),p)break;g()}}else{try{ue(n)}catch(e){return void u(e)}d=setInterval(v,a);const{MutationObserver:e}=le(n);b=new e(v),b.observe(n,l),g()}function m(e,n){p=!0,clearTimeout(h),y||(clearInterval(d),b.disconnect()),e?u(e):t(n)}function v(){if(ae()){const e=new Error("Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Ve(e,i),u(e)}return g()}function g(){if("pending"!==f)try{const t=function(e){try{return he._disableExpensiveErrorDiagnostics=!0,e()}finally{he._disableExpensiveErrorDiagnostics=!1}}(e);"function"==typeof(null==t?void 0:t.then)?(f="pending",t.then(e=>{f="resolved",m(null,e)},e=>{f="rejected",c=e})):m(null,t)}catch(e){c=e}}})}function We(e,t){return ye().getElementError(e,t)}function ze(e,t,n,r){let{exact:o=!0,collapseWhitespace:i,trim:a,normalizer:s}=void 0===r?{}:r;const l=o?Se:Ie,u=_e({collapseWhitespace:i,trim:a,normalizer:s});return Array.from(t.querySelectorAll("["+e+"]")).filter(t=>l(t.getAttribute(e),t,n,u))}function Ue(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];const a=e(n,...o);if(a.length>1){const e=a.map(e=>We(null,e).message).join("\n\n");throw function(e,t){return We(e+"\n\n(If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)).",t)}(t(n,...o)+"\n\nHere are the matching elements:\n\n"+e,n)}return a[0]||null}}function He(e,t){return ye().getElementError("A better query is available, try this:\n"+e.toString()+"\n",t)}function $e(e){return(t,n,r,o)=>function(e,t){const n=new Error("STACK_TRACE_MESSAGE");return ye().asyncWrapper(()=>Fe(e,{stackTraceError:n,...t}))}(()=>e(t,n,r),{container:t,...o})}const Ge=(e,t,n)=>function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];const s=e(r,...i),[{suggest:l=ye().throwSuggestions}={}]=i.slice(-1);if(s&&l){const e=qe(s,n);if(e&&!t.endsWith(e.queryName))throw He(e.toString(),r)}return s},Ke=(e,t,n)=>function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];const s=e(r,...i),[{suggest:l=ye().throwSuggestions}={}]=i.slice(-1);if(s.length&&l){const e=[...new Set(s.map(e=>{var t;return null==(t=qe(e,n))?void 0:t.toString()}))];if(1===e.length&&!t.endsWith(qe(s[0],n).queryName))throw He(e[0],r)}return s};function Xe(e,t,n){const r=Ge(Ue(e,t),e.name,"query"),o=function(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];const a=e(n,...o);if(!a.length)throw ye().getElementError(t(n,...o),n);return a}}(e,n),i=Ue(o,t),a=Ge(i,e.name,"get");return[r,Ke(o,e.name.replace("query","get"),"getAll"),a,$e(Ke(o,e.name,"findAll")),$e(Ge(i,e.name,"find"))]}const Je=function(e,t,n){let{exact:r=!0,trim:o,collapseWhitespace:i,normalizer:a}=void 0===n?{}:n;const s=r?Se:Ie,l=_e({collapseWhitespace:i,trim:o,normalizer:a}),u=function(e){return Array.from(e.querySelectorAll("label,input")).map(e=>({node:e,textToMatch:ge(e)})).filter(e=>{let{textToMatch:t}=e;return null!==t})}(e);return u.filter(e=>{let{node:n,textToMatch:r}=e;return s(r,n,t,l)}).map(e=>{let{node:t}=e;return t})},Qe=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:i,trim:a,normalizer:s}=void 0===n?{}:n;ue(e);const l=o?Se:Ie,u=_e({collapseWhitespace:i,trim:a,normalizer:s}),c=Array.from(e.querySelectorAll("*")).filter(e=>Ee(e).length||e.hasAttribute("aria-labelledby")).reduce((n,o)=>{const i=we(e,o,{selector:r});i.filter(e=>Boolean(e.formControl)).forEach(e=>{l(e.content,e.formControl,t,u)&&e.formControl&&n.push(e.formControl)});const a=i.filter(e=>Boolean(e.content)).map(e=>e.content);return l(a.join(" "),o,t,u)&&n.push(o),a.length>1&&a.forEach((e,r)=>{l(e,o,t,u)&&n.push(o);const i=[...a];i.splice(r,1),i.length>1&&l(i.join(" "),o,t,u)&&n.push(o)}),n},[]).concat(ze("aria-label",e,t,{exact:o,normalizer:u}));return Array.from(new Set(c)).filter(e=>e.matches(r))},Ye=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const i=Qe(e,t,...r);if(!i.length){const n=Je(e,t,...r);if(n.length){const r=n.map(t=>function(e,t){const n=t.getAttribute("for");if(!n)return null;const r=e.querySelector('[id="'+n+'"]');return r?r.tagName.toLowerCase():null}(e,t)).filter(e=>!!e);throw r.length?ye().getElementError(r.map(e=>"Found a label with the text of: "+t+", however the element associated with this label (<"+e+" />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <"+e+" />, you can use aria-label or aria-labelledby instead.").join("\n\n"),e):ye().getElementError("Found a label with the text of: "+t+', however no form control was found associated to that label. Make sure you\'re using the "for" attribute or "aria-labelledby" attribute correctly.',e)}throw ye().getElementError("Unable to find a label with the text of: "+t,e)}return i};const Ze=(e,t)=>"Found multiple elements with the text of: "+t,et=Ge(Ue(Qe,Ze),Qe.name,"query"),tt=Ue(Ye,Ze),nt=$e(Ke(Ye,Ye.name,"findAll")),rt=$e(Ge(tt,Ye.name,"find")),ot=Ke(Ye,Ye.name,"getAll"),it=Ge(tt,Ye.name,"get"),at=Ke(Qe,Qe.name,"queryAll"),st=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ue(t[0]),ze("placeholder",...t)},lt=Ke(st,st.name,"queryAll"),[ut,ct,dt,bt,pt]=Xe(st,(e,t)=>"Found multiple elements with the placeholder text of: "+t,(e,t)=>"Unable to find an element with the placeholder text of: "+t),ft=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:i,trim:a,ignore:s=ye().defaultIgnore,normalizer:l}=void 0===n?{}:n;ue(e);const u=o?Se:Ie,c=_e({collapseWhitespace:i,trim:a,normalizer:l});let d=[];return"function"==typeof e.matches&&e.matches(r)&&(d=[e]),[...d,...Array.from(e.querySelectorAll(r))].filter(e=>!s||!e.matches(s)).filter(e=>u(xe(e),e,t,c))},ht=Ke(ft,ft.name,"queryAll"),[yt,mt,vt,gt,Et]=Xe(ft,(e,t)=>"Found multiple elements with the text: "+t,function(e,t,n){void 0===n&&(n={});const{collapseWhitespace:r,trim:o,normalizer:i,selector:a}=n,s=_e({collapseWhitespace:r,trim:o,normalizer:i})(t.toString());return"Unable to find an element with the text: "+(s!==t.toString()?s+" (normalized from '"+t+"')":t)+("*"!==(null!=a?a:"*")?", which matches selector '"+a+"'":"")+". This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible."}),wt=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:i,normalizer:a}=void 0===n?{}:n;ue(e);const s=r?Se:Ie,l=_e({collapseWhitespace:o,trim:i,normalizer:a});return Array.from(e.querySelectorAll("input,textarea,select")).filter(e=>{if("SELECT"===e.tagName){return Array.from(e.options).filter(e=>e.selected).some(e=>s(xe(e),e,t,l))}return s(e.value,e,t,l)})},Tt=Ke(wt,wt.name,"queryAll"),[It,St,At,_t,Ot]=Xe(wt,(e,t)=>"Found multiple elements with the display value: "+t+".",(e,t)=>"Unable to find an element with the display value: "+t+"."),xt=/^(img|input|area|.+-.+)$/i,jt=function(e,t,n){return void 0===n&&(n={}),ue(e),ze("alt",e,t,n).filter(e=>xt.test(e.tagName))},Nt=Ke(jt,jt.name,"queryAll"),[Mt,Ct,Dt,kt,Pt]=Xe(jt,(e,t)=>"Found multiple elements with the alt text: "+t,(e,t)=>"Unable to find an element with the alt text: "+t),Bt=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:i,normalizer:a}=void 0===n?{}:n;ue(e);const s=r?Se:Ie,l=_e({collapseWhitespace:o,trim:i,normalizer:a});return Array.from(e.querySelectorAll("[title], svg > title")).filter(e=>s(e.getAttribute("title"),e,t,l)||(e=>{var t;return"title"===e.tagName.toLowerCase()&&"svg"===(null==(t=e.parentElement)?void 0:t.tagName.toLowerCase())})(e)&&s(xe(e),e,t,l))},Lt=Ke(Bt,Bt.name,"queryAll"),[Rt,qt,Vt,Ft,Wt]=Xe(Bt,(e,t)=>"Found multiple elements with the title: "+t+".",(e,t)=>"Unable to find an element with the title: "+t+"."),zt=function(e,t,n){let{hidden:r=ye().defaultHidden,name:o,description:i,queryFallbacks:s=!1,selected:l,busy:u,checked:c,pressed:d,current:b,level:p,expanded:f,value:{now:h,min:y,max:m,text:v}={}}=void 0===n?{}:n;var g,E,w,T,I,S,A,_,O,x;if((ue(e),void 0!==l)&&void 0===(null==(g=a.roles.get(t))?void 0:g.props["aria-selected"]))throw new Error('"aria-selected" is not supported on role "'+t+'".');if(void 0!==u&&void 0===(null==(E=a.roles.get(t))?void 0:E.props["aria-busy"]))throw new Error('"aria-busy" is not supported on role "'+t+'".');if(void 0!==c&&void 0===(null==(w=a.roles.get(t))?void 0:w.props["aria-checked"]))throw new Error('"aria-checked" is not supported on role "'+t+'".');if(void 0!==d&&void 0===(null==(T=a.roles.get(t))?void 0:T.props["aria-pressed"]))throw new Error('"aria-pressed" is not supported on role "'+t+'".');if(void 0!==b&&void 0===(null==(I=a.roles.get(t))?void 0:I.props["aria-current"]))throw new Error('"aria-current" is not supported on role "'+t+'".');if(void 0!==p&&"heading"!==t)throw new Error('Role "'+t+'" cannot have "level" property.');if(void 0!==h&&void 0===(null==(S=a.roles.get(t))?void 0:S.props["aria-valuenow"]))throw new Error('"aria-valuenow" is not supported on role "'+t+'".');if(void 0!==m&&void 0===(null==(A=a.roles.get(t))?void 0:A.props["aria-valuemax"]))throw new Error('"aria-valuemax" is not supported on role "'+t+'".');if(void 0!==y&&void 0===(null==(_=a.roles.get(t))?void 0:_.props["aria-valuemin"]))throw new Error('"aria-valuemin" is not supported on role "'+t+'".');if(void 0!==v&&void 0===(null==(O=a.roles.get(t))?void 0:O.props["aria-valuetext"]))throw new Error('"aria-valuetext" is not supported on role "'+t+'".');if(void 0!==f&&void 0===(null==(x=a.roles.get(t))?void 0:x.props["aria-expanded"]))throw new Error('"aria-expanded" is not supported on role "'+t+'".');const j=new WeakMap;function N(e){return j.has(e)||j.set(e,Ne(e)),j.get(e)}return Array.from(e.querySelectorAll(function(e){var t;const n='*[role~="'+e+'"]',r=null!=(t=a.roleElements.get(e))?t:new Set,o=new Set(Array.from(r).map(e=>{let{name:t}=e;return t}));return[n].concat(Array.from(o)).join(",")}(t))).filter(e=>{if(e.hasAttribute("role")){const n=e.getAttribute("role");if(s)return n.split(" ").filter(Boolean).some(e=>e===t);const[r]=n.split(" ");return r===t}return Ce(e).some(e=>e===t)}).filter(e=>{if(void 0!==l)return l===function(e){return"OPTION"===e.tagName?e.selected:ke(e,"aria-selected")}(e);if(void 0!==u)return u===function(e){return"true"===e.getAttribute("aria-busy")}(e);if(void 0!==c)return c===function(e){if(!("indeterminate"in e)||!e.indeterminate)return"checked"in e?e.checked:ke(e,"aria-checked")}(e);if(void 0!==d)return d===function(e){return ke(e,"aria-pressed")}(e);if(void 0!==b)return b===function(e){var t,n;return null!=(t=null!=(n=ke(e,"aria-current"))?n:e.getAttribute("aria-current"))&&t}(e);if(void 0!==f)return f===function(e){return ke(e,"aria-expanded")}(e);if(void 0!==p)return p===function(e){return e.getAttribute("aria-level")&&Number(e.getAttribute("aria-level"))||{H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[e.tagName]}(e);if(void 0!==h||void 0!==m||void 0!==y||void 0!==v){let n=!0;var t;if(void 0!==h&&n&&(n=h===function(e){const t=e.getAttribute("aria-valuenow");return null===t?void 0:+t}(e)),void 0!==m&&n&&(n=m===function(e){const t=e.getAttribute("aria-valuemax");return null===t?void 0:+t}(e)),void 0!==y&&n&&(n=y===function(e){const t=e.getAttribute("aria-valuemin");return null===t?void 0:+t}(e)),void 0!==v)n&&(n=Se(null!=(t=function(e){const t=e.getAttribute("aria-valuetext");return null===t?void 0:t}(e))?t:null,e,v,e=>e));return n}return!0}).filter(e=>void 0===o||Se(X(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements}),e,o,e=>e)).filter(e=>void 0===i||Se(K(e,{computedStyleSupportsPseudoElements:ye().computedStyleSupportsPseudoElements}),e,i,e=>e)).filter(e=>!1!==r||!1===Me(e,{isSubtreeInaccessible:N}))};const Ut=e=>{let t="";return t=void 0===e?"":"string"==typeof e?' and name "'+e+'"':" and name `"+e+"`",t},Ht=Ke(zt,zt.name,"queryAll"),[$t,Gt,Kt,Xt,Jt]=Xe(zt,function(e,t,n){let{name:r}=void 0===n?{}:n;return'Found multiple elements with the role "'+t+'"'+Ut(r)},function(e,t,n){let{hidden:r=ye().defaultHidden,name:o,description:i}=void 0===n?{}:n;if(ye()._disableExpensiveErrorDiagnostics)return'Unable to find role="'+t+'"'+Ut(o);let a,s="";Array.from(e.children).forEach(e=>{s+=De(e,{hidden:r,includeDescription:void 0!==i})}),a=0===s.length?!1===r?"There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole":"There are no available roles.":("\nHere are the "+(!1===r?"accessible":"available")+" roles:\n\n "+s.replace(/\n/g,"\n ").replace(/\n\s\s\n/g,"\n\n")+"\n").trim();let l="";l=void 0===o?"":"string"==typeof o?' and name "'+o+'"':" and name `"+o+"`";let u="";return u=void 0===i?"":"string"==typeof i?' and description "'+i+'"':" and description `"+i+"`",("\nUnable to find an "+(!1===r?"accessible ":"")+'element with the role "'+t+'"'+l+u+"\n\n"+a).trim()}),Qt=()=>ye().testIdAttribute,Yt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ue(t[0]),ze(Qt(),...t)},Zt=Ke(Yt,Yt.name,"queryAll"),[en,tn,nn,rn,on]=Xe(Yt,(e,t)=>"Found multiple elements by: ["+Qt()+'="'+t+'"]',(e,t)=>"Unable to find an element by: ["+Qt()+'="'+t+'"]');var an=Object.freeze({__proto__:null,queryAllByLabelText:at,queryByLabelText:et,getAllByLabelText:ot,getByLabelText:it,findAllByLabelText:nt,findByLabelText:rt,queryByPlaceholderText:ut,queryAllByPlaceholderText:lt,getByPlaceholderText:dt,getAllByPlaceholderText:ct,findAllByPlaceholderText:bt,findByPlaceholderText:pt,queryByText:yt,queryAllByText:ht,getByText:vt,getAllByText:mt,findAllByText:gt,findByText:Et,queryByDisplayValue:It,queryAllByDisplayValue:Tt,getByDisplayValue:At,getAllByDisplayValue:St,findAllByDisplayValue:_t,findByDisplayValue:Ot,queryByAltText:Mt,queryAllByAltText:Nt,getByAltText:Dt,getAllByAltText:Ct,findAllByAltText:kt,findByAltText:Pt,queryByTitle:Rt,queryAllByTitle:Lt,getByTitle:Vt,getAllByTitle:qt,findAllByTitle:Ft,findByTitle:Wt,queryByRole:$t,queryAllByRole:Ht,getAllByRole:Gt,getByRole:Kt,findAllByRole:Xt,findByRole:Jt,queryByTestId:en,queryAllByTestId:Zt,getByTestId:nn,getAllByTestId:tn,findAllByTestId:rn,findByTestId:on});function sn(e,t,n){return void 0===t&&(t=an),void 0===n&&(n={}),Object.keys(t).reduce((n,r)=>{const o=t[r];return n[r]=o.bind(null,e),n},n)}const ln={copy:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},cut:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionEnd:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionStart:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionUpdate:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyDown:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyPress:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyUp:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},focus:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},blur:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusIn:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusOut:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},change:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},input:{EventType:"InputEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},invalid:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!0}},submit:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},reset:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},click:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,button:0,composed:!0}},contextMenu:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblClick:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drag:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragEnd:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragEnter:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragExit:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragLeave:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragOver:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragStart:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drop:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseDown:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseEnter:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseLeave:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseMove:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOut:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOver:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseUp:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},select:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},touchCancel:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},touchEnd:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchMove:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchStart:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},resize:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},scroll:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},wheel:{EventType:"WheelEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},abort:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlay:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlayThrough:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},durationChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},emptied:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},encrypted:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},ended:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedData:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedMetadata:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadStart:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},pause:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},play:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},playing:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},progress:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},rateChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeked:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeking:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},stalled:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},suspend:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},timeUpdate:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},volumeChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},waiting:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},load:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},error:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},animationStart:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationEnd:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationIteration:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionCancel:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionEnd:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},transitionRun:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionStart:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},pointerOver:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerEnter:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},pointerDown:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerMove:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerUp:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerCancel:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerOut:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerLeave:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},gotPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},lostPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},popState:{EventType:"PopStateEvent",defaultInit:{bubbles:!0,cancelable:!1}},offline:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},online:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},pageHide:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},pageShow:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}}},un={doubleClick:"dblClick"};function cn(e,t){return ye().eventWrapper(()=>{if(!t)throw new Error("Unable to fire an event - please provide an event object.");if(!e)throw new Error('Unable to fire a "'+t.type+'" event - please provide a DOM element.');return e.dispatchEvent(t)})}function dn(e,t,n,r){let{EventType:o="Event",defaultInit:i={}}=void 0===r?{}:r;if(!t)throw new Error('Unable to fire a "'+e+'" event - please provide a DOM element.');const a={...i,...n},{target:{value:s,files:l,...u}={}}=a;void 0!==s&&function(e,t){const{set:n}=Object.getOwnPropertyDescriptor(e,"value")||{},r=Object.getPrototypeOf(e),{set:o}=Object.getOwnPropertyDescriptor(r,"value")||{};if(o&&n!==o)o.call(e,t);else{if(!n)throw new Error("The given element does not have a value setter");n.call(e,t)}}(t,s),void 0!==l&&Object.defineProperty(t,"files",{configurable:!0,enumerable:!0,writable:!0,value:l}),Object.assign(t,u);const c=le(t),d=c[o]||c.Event;let b;if("function"==typeof d)b=new d(e,a);else{b=c.document.createEvent(o);const{bubbles:t,cancelable:n,detail:r,...i}=a;b.initEvent(e,t,n,r),Object.keys(i).forEach(e=>{b[e]=i[e]})}return["dataTransfer","clipboardData"].forEach(e=>{const t=a[e];"object"==typeof t&&("function"==typeof c.DataTransfer?Object.defineProperty(b,e,{value:Object.getOwnPropertyNames(t).reduce((e,n)=>(Object.defineProperty(e,n,{value:t[n]}),e),new c.DataTransfer)}):Object.defineProperty(b,e,{value:t}))}),b}function bn(e){return"https://testing-playground.com/#markup="+(t=e,s.compressToEncodedURIComponent(t.replace(/[ \t]*[\n][ \t]*/g,"\n")));var t}Object.keys(ln).forEach(e=>{const{EventType:t,defaultInit:n}=ln[e],r=e.toLowerCase();dn[e]=(e,o)=>dn(r,e,o,{EventType:t,defaultInit:n}),cn[e]=(t,n)=>cn(t,dn[e](t,n))}),Object.keys(un).forEach(e=>{const t=un[e];cn[e]=function(){return cn[t](...arguments)}});const pn={debug:(e,t,n)=>Array.isArray(e)?e.forEach(e=>fe(e,t,n)):fe(e,t,n),logTestingPlaygroundURL:function(e){if(void 0===e&&(e=se().body),!e||!("innerHTML"in e))return void console.log("The element you're providing isn't a valid DOM element.");if(!e.innerHTML)return void console.log("The provided element doesn't have any children.");const t=bn(e.innerHTML);return console.log("Open this URL in your browser\n\n"+t),t}};"undefined"!=typeof document&&document.body?sn(document.body,an,pn):Object.keys(an).reduce((e,t)=>(e[t]=()=>{throw new TypeError("For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error")},e),pn);const fn="function"==typeof d.act?d.act:b.act;function hn(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function yn(e){hn().IS_REACT_ACT_ENVIRONMENT=e}function mn(){return hn().IS_REACT_ACT_ENVIRONMENT}const vn=(gn=fn,e=>{const t=mn();yn(!0);try{let n=!1;const r=gn(()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(n=!0),t});if(n){const e=r;return{then:(n,r)=>{e.then(e=>{yn(t),n(e)},e=>{yn(t),r(e)})}}}return yn(t),r}catch(e){throw yn(t),e}});var gn;Object.keys(cn).forEach(e=>{});let En={reactStrictMode:!1};var wn;"function"==typeof(wn={unstable_advanceTimersWrapper:e=>vn(e),asyncWrapper:async e=>{const t=mn();yn(!1);try{const t=await e();return await new Promise(e=>{setTimeout(()=>{e()},0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)}),t}finally{yn(t)}},eventWrapper:e=>{let t;return vn(()=>{t=e()}),t}})&&(wn=wn(he)),he={...he,...wn};const Tn=new Set,In=[];function Sn(e,t){return t??{...ye(),...En}.reactStrictMode?d.createElement(d.StrictMode,null,e):e}function An(e,t){return t?d.createElement(t,null,e):e}function _n(e,{hydrate:t,onCaughtError:n,onRecoverableError:r,ui:o,wrapper:i,reactStrictMode:a}){let s;return t?vn(()=>{s=p.hydrateRoot(e,Sn(An(o,i),a),{onCaughtError:n,onRecoverableError:r})}):s=p.createRoot(e,{onCaughtError:n,onRecoverableError:r}),{hydrate(){if(!t)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){s.render(e)},unmount(){s.unmount()}}}function On(e){return{hydrate(t){r.hydrate(t,e)},render(t){r.render(t,e)},unmount(){r.unmountComponentAtNode(e)}}}function xn(e,{baseElement:t,container:n,hydrate:r,queries:o,root:i,wrapper:a,reactStrictMode:s}){return vn(()=>{r?i.hydrate(Sn(An(e,a),s),n):i.render(Sn(An(e,a),s),n)}),{container:n,baseElement:t,debug:(e=t,n,r)=>Array.isArray(e)?e.forEach(e=>console.log(pe(e,n,r))):console.log(pe(e,n,r)),unmount:()=>{vn(()=>{i.unmount()})},rerender:e=>{xn(e,{container:n,baseElement:t,root:i,wrapper:a,reactStrictMode:s})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...sn(t,o)}}function jn(e,{container:t,baseElement:n=t,legacyRoot:o=!1,onCaughtError:i,onUncaughtError:a,onRecoverableError:s,queries:l,hydrate:u=!1,wrapper:c,reactStrictMode:d}={}){if(void 0!==a)throw new Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(o&&"function"!=typeof r.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,jn),e}let b;if(n||(n=document.body),t||(t=n.appendChild(document.createElement("div"))),Tn.has(t))In.forEach(e=>{e.container===t&&(b=e.root)});else{b=(o?On:_n)(t,{hydrate:u,onCaughtError:i,onRecoverableError:s,ui:e,wrapper:c,reactStrictMode:d}),In.push({container:t,root:b}),Tn.add(t)}return xn(e,{container:t,baseElement:n,queries:l,hydrate:u,wrapper:c,root:b,reactStrictMode:d})}function Nn(){In.forEach(({root:e,container:t})=>{vn(()=>{e.unmount()}),t.parentNode===document.body&&document.body.removeChild(t)}),In.length=0,Tn.clear()}if(("undefined"==typeof process||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach(()=>{Nn()}):"function"==typeof teardown&&teardown(()=>{Nn()}),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=mn();beforeAll(()=>{e=mn(),yn(!0)}),afterAll(()=>{yn(e)})}class Mn extends Error{constructor(e){super(`Node not found: "${e}"`),this.name="NodeNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Mn)}}class Cn extends Error{constructor(){super("Root node ID not found"),this.name="RootNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Cn)}}class Dn extends Error{constructor(){super("Metadata not found"),this.name="MetadataNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,Dn)}}function kn(e,t){var n;const r=null===(n=t.nodes)||void 0===n?void 0:n[e];if(!r)return null;const o=[];r.childrenIds&&o.push(...r.childrenIds);const i=o.map(e=>kn(e,t)).filter(e=>null!==e);return Object.assign(Object.assign({id:r.id,type:r.type,state:r.state||{},attributes:r.attributes||{}},void 0!==r.reference&&{reference:r.reference}),i.length>0&&{children:i})}const Pn=new u.schema.Entity("nodes",{},{idAttribute:"id",processStrategy:e=>Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference})});function Bn(e){const{result:t,entities:n}=function(e){const t=e.children||[],n=t.length>0?u.normalize(t,[Pn]):{entities:{nodes:{}}},r=Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference}),o=u.normalize(r,Pn),i={nodes:Object.assign(Object.assign({},o.entities.nodes),n.entities.nodes)},a=(e,t)=>{var n,r;i.nodes&&i.nodes[e.id]?i.nodes[e.id]=Object.assign(Object.assign({},i.nodes[e.id]),{childrenIds:(null===(n=e.children)||void 0===n?void 0:n.map(e=>e.id))||[],parentId:t}):i.nodes&&(i.nodes[e.id]=Object.assign(Object.assign({id:e.id,type:e.type,state:e.state||{},attributes:e.attributes||{}},void 0!==e.reference&&{reference:e.reference}),{childrenIds:(null===(r=e.children)||void 0===r?void 0:r.map(e=>e.id))||[],parentId:t})),e.children&&e.children.forEach(t=>a(t,e.id))};return a(e,void 0),{result:o.result,entities:i}}(e.root);return{result:t,entities:n}}Pn.define({children:[Pn]});class Ln{constructor(){this._cached={},this._originalCached={}}cacheDocument(e){var t;const n=(null===(t=e.metadata)||void 0===t?void 0:t.id)||e.root.id;this._cached[n]=e,this._originalCached[n]||(this._originalCached[n]=l.cloneDeep(e))}setMetadata(e){this._metadata=e}getMetadata(){return this._metadata}getOriginalDocument(e){return this._originalCached[e]}getDocumentId(e){var t;return(null===(t=this._metadata)||void 0===t?void 0:t.id)||e}getDocument(e){const t=e.getRootId();if(!t)return null;const n=kn(t,{nodes:e.nodes});return n?{version:"1.0.0",metadata:this._metadata,root:n}:null}clearCache(){this._cached={},this._originalCached={}}reset(){this._metadata=void 0,this.clearCache()}}function Rn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;class qn{constructor(){this._state={version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{},lastModified:{}}}get state(){return this._state}get nodes(){return this._state.nodes}getNodeById(e){return this._state.nodes[e]}getNodeTypeById(e){var t;return null===(t=this._state.nodes[e])||void 0===t?void 0:t.type}getChildrenIdsById(e){var t;return(null===(t=this._state.nodes[e])||void 0===t?void 0:t.childrenIds)||[]}getRootId(){return this._state.rootId}getLastModified(e){return this._state.lastModified[e]}initializeState(e){this._state=Object.assign({version:0,rootId:void 0,nodes:{},selectedNodeId:void 0,isEdited:!1,variables:{},lastModified:{}},e)}updateNodes(e){this._state.nodes=e;const t=(new Date).toISOString(),n={};Object.keys(e).forEach(e=>{n[e]=t}),this._state.lastModified=n}deleteNode(e){const t=this._state.nodes,n=e;t[n];const r=Rn(t,["symbol"==typeof n?n:n+""]);this._state.nodes=r;const o=this._state.lastModified,i=e;o[i];const a=Rn(o,["symbol"==typeof i?i:i+""]);this._state.lastModified=a}deleteNodes(e){if(0===e.length)return;const t={},n=new Set(e);Object.keys(this._state.nodes).forEach(e=>{n.has(e)||(t[e]=this._state.nodes[e])}),this._state.nodes=t;const r={};Object.keys(this._state.lastModified).forEach(e=>{n.has(e)||(r[e]=this._state.lastModified[e])}),this._state.lastModified=r}mergeNodes(e){const t=new Set(Object.keys(this._state.nodes)),n=new Set(Object.keys(e)),r=[...t].filter(e=>!n.has(e)),o=(new Date).toISOString(),i={},{lastModified:a}=this._state,s=Object.assign({},a),l=new Set;return Object.keys(e).forEach(t=>{const n=this._state.nodes[t],r=e[t],{parentId:a}=r;n?i[t]=Object.assign(Object.assign({},r),{state:n.state||r.state||{}}):(i[t]=r,s[t]=o),a&&l.add(a)}),l.forEach(e=>{(i[e]||this._state.nodes[e])&&(s[e]=o)}),this._state.nodes=i,this._state.lastModified=s,r}updateNodeState(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{state:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}updateNodeAttributes(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{attributes:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}updateNodeReference(e,t){const n=this._state.nodes[e];n&&(this._state.nodes[e]=Object.assign(Object.assign({},n),{reference:t}),this._state.lastModified=Object.assign(Object.assign({},this._state.lastModified),{[e]:(new Date).toISOString()}))}setRootId(e){this._state.rootId=e}setSelectedNodeId(e){const t=this._state.selectedNodeId;return this._state.selectedNodeId=e,t}setEdited(e){this._state.isEdited=e}updateVariables(e){this._state.variables=e}incrementVersion(){this._state.version+=1}reset(){this._state.nodes={},this._state.rootId=void 0,this._state.isEdited=!1,this._state.selectedNodeId=void 0,this._state.variables={},this._state.lastModified={},this._state.version+=1}}class Vn{constructor(){this._nodeListeners=new Map,this._versionListeners=new Set}subscribeNode(e,t){return this._nodeListeners.has(e)||this._nodeListeners.set(e,new Set),this._nodeListeners.get(e).add(t),()=>{var n,r;null===(n=this._nodeListeners.get(e))||void 0===n||n.delete(t),0===(null===(r=this._nodeListeners.get(e))||void 0===r?void 0:r.size)&&this._nodeListeners.delete(e)}}subscribeVersion(e){return this._versionListeners.add(e),()=>{this._versionListeners.delete(e)}}notifyNode(e){var t;null===(t=this._nodeListeners.get(e))||void 0===t||t.forEach(e=>e())}notifyNodes(e){[...new Set(e)].forEach(e=>this.notifyNode(e))}notifyVersion(){this._versionListeners.forEach(e=>e())}cleanupNode(e){this._nodeListeners.delete(e)}cleanupNodes(e){e.forEach(e=>{this._nodeListeners.delete(e)})}}class Fn{constructor(e,t){this.repository=e,this.subscriptionManager=t}updateVariables(e){this.repository.updateVariables(l.cloneDeep(e)),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}updateVariable(e,t){const n=this.repository.state.variables;this.repository.updateVariables(Object.assign(Object.assign({},l.cloneDeep(n)),{[e]:l.cloneDeep(t)})),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}deleteVariable(e){const t=l.cloneDeep(this.repository.state.variables);delete t[e],this.repository.updateVariables(t),this.repository.setEdited(!0),this.repository.incrementVersion(),this.subscriptionManager.notifyVersion()}}class Wn{constructor(e,t){this._subscriptionManager=new Vn,this._repository=new qn,this._documentManager=new Ln,this._componentOverrides={},this._repository.initializeState(e),this._variablesManager=new Fn(this._repository,this._subscriptionManager),this._componentOverrides=(null==t?void 0:t.componentOverrides)||{}}subscribeNode(e,t){return this._subscriptionManager.subscribeNode(e,t)}subscribeVersion(e){return this._subscriptionManager.subscribeVersion(e)}get state(){return this._repository.state}getSnapshot(){return this._repository.state.lastModified}getServerSnapshot(){return this.getSnapshot()}get nodes(){return this._repository.nodes}get metadata(){const e=this._documentManager.getMetadata();if(!e)throw new Dn;return e}getComponentOverrides(){return this._componentOverrides}getNodeById(e){const t=this._repository.getNodeById(e);if(!t)throw new Mn(e);return t}getNodeTypeById(e){const t=this._repository.getNodeTypeById(e);if(!t)throw new Mn(e);return t}getChildrenIdsById(e){if(!this._repository.getNodeById(e))throw new Mn(e);return this._repository.getChildrenIdsById(e)}getLayoutStateById(e){return this.getNodeById(e).state||{}}getAttributesById(e){return this.getNodeById(e).attributes||{}}getReferenceById(e){return this.getNodeById(e).reference}getRootId(){const e=this._repository.getRootId();if(!e)throw new Cn;return e}updateLayout(e){const{entities:t}=Bn(e);this._repository.updateNodes(t.nodes||{}),this._repository.setRootId(e.root.id),this._repository.setEdited(!1),this._repository.updateVariables(e.variables?l.cloneDeep(e.variables):{}),this._repository.incrementVersion(),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._subscriptionManager.notifyVersion()}mergeLayout(e){const{entities:t}=Bn(e),n=t.nodes||{},r=this._repository.mergeNodes(n),o=this._repository.state.selectedNodeId;o&&r.includes(o)&&this._repository.setSelectedNodeId(void 0),r.length>0&&this._subscriptionManager.cleanupNodes(r),this._repository.setRootId(e.root.id),this._repository.updateVariables(e.variables?l.cloneDeep(e.variables):{}),this._repository.setEdited(!1),this._documentManager.setMetadata(e.metadata),this._documentManager.cacheDocument(e),this._repository.incrementVersion(),this._subscriptionManager.notifyVersion()}cancelEdit(e){const t=this._repository.getRootId(),n=e||(t?this._documentManager.getDocumentId(t):void 0);if(!n)return;const r=this._documentManager.getOriginalDocument(n);r&&this.updateLayout(r)}updateNodeState(e,t){const n=this.getNodeById(e);this._repository.updateNodeState(e,Object.assign(Object.assign({},n.state||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeAttributes(e,t){const n=this.getNodeById(e);this._repository.updateNodeAttributes(e,Object.assign(Object.assign({},n.attributes||{}),t)),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateNodeReference(e,t){this.getNodeById(e),this._repository.updateNodeReference(e,t),this._repository.setEdited(!0),this._subscriptionManager.notifyNode(e)}updateVariables(e){this._variablesManager.updateVariables(e)}updateVariable(e,t){this._variablesManager.updateVariable(e,t)}deleteVariable(e){this._variablesManager.deleteVariable(e)}setSelectedNodeId(e){const t=this._repository.setSelectedNodeId(e);t&&this._subscriptionManager.notifyNode(t),e&&this._subscriptionManager.notifyNode(e)}getDocument(){return this._documentManager.getDocument(this._repository)}reset(){this._documentManager.reset(),this._repository.reset(),this._subscriptionManager.notifyVersion()}resetToInitial(){const e=this._repository.getRootId();if(!e)throw new Error("Root ID is not available. Cannot reset to initial state.");const t=this._documentManager.getDocumentId(e);if(!t)throw new Error("Document ID is not available. Cannot reset to initial state.");const n=this._documentManager.getOriginalDocument(t);if(!n)throw new Error("Initial document is not available. Cannot reset to initial state.");this.updateLayout(n)}}const zn=t.createContext(null),Un=({store:n,children:r})=>{const o=t.useMemo(()=>({store:n}),[n]);return e.jsx(zn.Provider,{value:o,children:r})},Hn=()=>{const e=t.useContext(zn);if(!e)throw new Error("useSduiLayoutContext must be used within SduiLayoutProvider");return e};const $n="none";function Gn(e){const{nodeId:n,schema:r}=e,o=(()=>{const{store:e}=Hn();return e})();return function(e,n){const r=t.useRef(null),o=t.useRef(null);t.useSyncExternalStore(t=>{const r=e.subscribeNode(n,t),o=e.subscribeVersion(t);return()=>{r(),o()}},()=>{var t;const o=null!==(t=e.getSnapshot()[n])&&void 0!==t?t:$n;return r.current===o?r.current:(r.current=o,o)},()=>{var t;return null===o.current&&(o.current=null!==(t=e.getServerSnapshot()[n])&&void 0!==t?t:$n),o.current})}(o,n),function(e,t,n){var r;const{nodes:o}=e.state,i=o[t],a=null!==(r=null==i?void 0:i.childrenIds)&&void 0!==r?r:[],s=null==i?void 0:i.state,l=null==i?void 0:i.attributes,u=null==i?void 0:i.reference;let c;if(n)if(i&&void 0!==s){const e=n.safeParse(s);if(!e.success)throw new Error(`State validation failed for node "${t}": ${e.error.message}`);c=e.data}else c={};else c=null!=s?s:{};return{node:i,type:null==i?void 0:i.type,state:c,childrenIds:a,attributes:l,reference:u,exists:!!i}}(o,n,r)}function Kn(e){return Gn(e)}const Xn=({nodeId:t,parentPath:n=[]})=>{const{type:r}=Kn({nodeId:t});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]})]}):null};Xn.displayName="DefaultNodeComponent";const Jn=(t,n)=>e.jsx(Xn,{nodeId:t,parentPath:n});function Qn(e,t){return[...e,t]}const Yn=({nodeId:e,componentMap:n,parentPath:r=[]})=>{const{store:o}=Hn(),{nodes:i}=o.state,a=t.useMemo(()=>Qn(r,e),[r,e]),s=t.useMemo(()=>function(e,t,n=" > "){return function(e,t=" > "){return e.join(t)}(Qn(e,t),n)}(r,e),[r,e]),l=t.useCallback((e,t=[])=>{const r=i[e];if(!r)return null;const a=o.getComponentOverrides(),s=n||{};return(a[e]||a[r.type]||s[r.type]||Jn)(e,t)},[i,o,n]),u=t.useCallback(e=>e.map(e=>{const n=l(e,a);return t.isValidElement(n)?t.cloneElement(n,{key:e}):n}),[l,a]);return{renderNode:l,renderChildren:u,currentPath:a,pathString:s,nodeId:e,parentPath:r}},Zn=({id:e,componentMap:t})=>{const{renderNode:n}=Yn({nodeId:e,componentMap:t,parentPath:[]});return n(e,[])},er=({nodeId:t,parentPath:n=[]})=>{const{type:r,childrenIds:o}=Kn({nodeId:t}),{renderNode:i,currentPath:a}=Yn({nodeId:t,parentPath:n});return r?e.jsxs("div",{"data-sdui-node-id":t,"data-sdui-node-type":r,children:[e.jsxs("div",{children:["Type: ",r]}),e.jsxs("div",{children:["ID: ",t]}),o&&o.length>0&&e.jsx("div",{children:o.map(t=>e.jsx("div",{children:i(t,a)},t))})]}):null};exports.TestDefaultNodeComponent=er,exports.createNestedTestDocument=function(){return{version:"1.0.0",metadata:{id:"nested-doc",name:"Nested Document"},root:{id:"root",type:"Container",children:[{id:"child-1",type:"Card",children:[{id:"grandchild-1",type:"Panel"}]},{id:"child-2",type:"Card"}]}}},exports.createTestDocument=function(e){const t={id:"root",type:"Container",children:[]},n=(null==e?void 0:e.root)?Object.assign(Object.assign({},t),e.root):t;return Object.assign(Object.assign({version:"1.0.0",metadata:{id:"test-doc",name:"Test Document"}},e),{root:n})},exports.defaultTestComponentFactory=(t,n)=>e.jsx(er,{nodeId:t,parentPath:n}),exports.renderWithSduiLayout=function(t,n,r){var o;const{components:i,componentOverrides:a,onError:s}=n||{},l={componentOverrides:Object.assign(Object.assign({},i),a)},u=new Wn(void 0,l);try{u.updateLayout(t)}catch(e){s&&s(e instanceof Error?e:new Error(String(e)))}const c=i||{},d=null===(o=null==t?void 0:t.root)||void 0===o?void 0:o.id;return jn(d?e.jsxs(Un,{store:u,children:[e.jsx(Zn,{id:d,componentMap:c}),r]}):e.jsx("div",{children:"Invalid document: missing root.id"}))};
@@ -0,0 +1 @@
1
+ function r(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]])}return t}"function"==typeof SuppressedError&&SuppressedError;export{r as __rest};
@@ -0,0 +1 @@
1
+ import*as e from"pretty-format";export{e as prettyFormat};import{computeAccessibleDescription as t}from"../../../../../../dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/accessible-description.mjs";import{computeAccessibleName as n}from"../../../../../../dom-accessibility-api@0.5.16/node_modules/dom-accessibility-api/dist/accessible-name.mjs";import{roles as r,roleElements as o,elementRoles as l}from"aria-query";import a from"lz-string";function i(e){return e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}const u=(e,t)=>{const n=t.colors.content;return n.open+i(e)+n.close},s=/^((HTML|SVG)\w*)?Element$/,c=e=>{const{tagName:t}=e;return Boolean("string"==typeof t&&t.includes("-")||"function"==typeof e.hasAttribute&&e.hasAttribute("is"))};function d(e){return 11===e.nodeType}function b(e){return{test:e=>{var t;return((null==e||null==(t=e.constructor)?void 0:t.name)||c(e))&&(e=>{const t=e.constructor.name,{nodeType:n}=e;return 1===n&&(s.test(t)||c(e))||3===n&&"Text"===t||8===n&&"Comment"===t||11===n&&"DocumentFragment"===t})(e)},serialize:(t,n,r,o,l,a)=>{if(function(e){return 3===e.nodeType}(t))return u(t.data,n);if(function(e){return 8===e.nodeType}(t))return((e,t)=>{const n=t.colors.comment;return n.open+"\x3c!--"+i(e)+"--\x3e"+n.close})(t.data,n);const s=d(t)?"DocumentFragment":t.tagName.toLowerCase();return++o>n.maxDepth?((e,t)=>{const n=t.colors.tag;return n.open+"<"+e+n.close+" …"+n.open+" />"+n.close})(s,n):((e,t,n,r,o)=>{const l=r.colors.tag;return l.open+"<"+e+(t&&l.close+t+r.spacingOuter+o+l.open)+(n?">"+l.close+n+r.spacingOuter+o+l.open+"</"+e:(t&&!r.min?"":" ")+"/")+">"+l.close})(s,((e,t,n,r,o,l,a)=>{const i=r+n.indent,u=n.colors;return e.map(e=>{const s=t[e];let c=a(s,n,i,o,l);return"string"!=typeof s&&(-1!==c.indexOf("\n")&&(c=n.spacingOuter+i+c+n.spacingOuter+r),c="{"+c+"}"),n.spacingInner+r+u.prop.open+e+u.prop.close+"="+u.value.open+c+u.value.close}).join("")})(d(t)?[]:Array.from(t.attributes).map(e=>e.name).sort(),d(t)?{}:Array.from(t.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),n,r+n.indent,o,l,a),((e,t,n,r,o,l)=>e.map(e=>{const a="string"==typeof e?u(e,t):l(e,t,n,r,o);return""===a&&"object"==typeof e&&null!==e&&3!==e.nodeType?"":t.spacingOuter+n+a}).join(""))(Array.prototype.slice.call(t.childNodes||t.children).filter(e),n,r+n.indent,o,l,a),n,r)}}}let p=null,f=null,m=null;try{const e=module&&module.require;f=e.call(module,"fs").readFileSync,m=e.call(module,"@babel/code-frame").codeFrameColumns,p=e.call(module,"picocolors")}catch{}function y(){if(!f||!m)return"";return function(e){const t=e.indexOf("(")+1,n=e.indexOf(")"),r=e.slice(t,n),o=r.split(":"),[l,a,i]=[o[0],parseInt(o[1],10),parseInt(o[2],10)];let u="";try{u=f(l,"utf-8")}catch{return""}const s=m(u,{start:{line:a,column:i}},{highlightCode:!0,linesBelow:0});return p.dim(r)+"\n"+s+"\n"}((new Error).stack.split("\n").slice(1).find(e=>!e.includes("node_modules/")))}function v(){return"undefined"!=typeof jest&&null!==jest&&(!0===setTimeout._isMockFunction||Object.prototype.hasOwnProperty.call(setTimeout,"clock"))}function h(){if("undefined"==typeof window)throw new Error("Could not find default container");return window.document}function g(e){if(e.defaultView)return e.defaultView;if(e.ownerDocument&&e.ownerDocument.defaultView)return e.ownerDocument.defaultView;if(e.window)return e.window;throw e.ownerDocument&&null===e.ownerDocument.defaultView?new Error("It looks like the window object is not available for the provided node."):e.then instanceof Function?new Error("It looks like you passed a Promise object instead of a DOM node. Did you do something like `fireEvent.click(screen.findBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`, or await the findBy query `fireEvent.click(await screen.findBy...`?"):Array.isArray(e)?new Error("It looks like you passed an Array instead of a DOM node. Did you do something like `fireEvent.click(screen.getAllBy...` when you meant to use a `getBy` query `fireEvent.click(screen.getBy...`?"):"function"==typeof e.debug&&"function"==typeof e.logTestingPlaygroundURL?new Error("It looks like you passed a `screen` object. Did you do something like `fireEvent.click(screen, ...` when you meant to use a query, e.g. `fireEvent.click(screen.getBy..., `?"):new Error("The given node is not an Element, the node type is: "+typeof e+".")}function E(e){if(!e||"function"!=typeof e.querySelector||"function"!=typeof e.querySelectorAll)throw new TypeError("Expected container to be an Element, a Document or a DocumentFragment but got "+function(e){if("object"==typeof e)return null===e?"null":e.constructor.name;return typeof e}(e)+".")}const T=()=>{if("undefined"==typeof process)return!1;let e;try{var t;const n=null==(t=process.env)?void 0:t.COLORS;n&&(e=JSON.parse(n))}catch{}return"boolean"==typeof e?e:void 0!==process.versions&&void 0!==process.versions.node},{DOMCollection:w}=e.plugins;function A(e){return 8!==e.nodeType&&(1!==e.nodeType||!e.matches(k().defaultIgnore))}function I(t,n,r){if(void 0===r&&(r={}),t||(t=h().body),"number"!=typeof n&&(n="undefined"!=typeof process&&void 0!==process.env&&process.env.DEBUG_PRINT_LIMIT||7e3),0===n)return"";t.documentElement&&(t=t.documentElement);let o=typeof t;if("object"===o?o=t.constructor.name:t={},!("outerHTML"in t))throw new TypeError("Expected an element or document but got "+o);const{filterNode:l=A,...a}=r,i=e.format(t,{plugins:[b(l),w],printFunctionName:!1,highlight:T(),...a});return void 0!==n&&t.outerHTML.length>n?i.slice(0,n)+"...":i}const x=function(){const e=y();e?console.log(I(...arguments)+"\n\n"+e):console.log(I(...arguments))};let B={testIdAttribute:"data-testid",asyncUtilTimeout:1e3,asyncWrapper:e=>e(),unstable_advanceTimersWrapper:e=>e(),eventWrapper:e=>e(),defaultHidden:!1,defaultIgnore:"script, style",showOriginalStackTrace:!1,throwSuggestions:!1,getElementError(e,t){const n=I(t),r=new Error([e,"Ignored nodes: comments, "+B.defaultIgnore+"\n"+n].filter(Boolean).join("\n\n"));return r.name="TestingLibraryElementError",r},_disableExpensiveErrorDiagnostics:!1,computedStyleSupportsPseudoElements:!1};function S(e){"function"==typeof e&&(e=e(B)),B={...B,...e}}function k(){return B}const q=["button","meter","output","progress","select","textarea","input"];function O(e){return q.includes(e.nodeName.toLowerCase())?"":3===e.nodeType?e.textContent:Array.from(e.childNodes).map(e=>O(e)).join("")}function P(e){let t;return t="label"===e.tagName.toLowerCase()?O(e):e.value||e.textContent,t}function D(e){var t;if(void 0!==e.labels)return null!=(t=e.labels)?t:[];if(!function(e){return/BUTTON|METER|OUTPUT|PROGRESS|SELECT|TEXTAREA/.test(e.tagName)||"INPUT"===e.tagName&&"hidden"!==e.getAttribute("type")}(e))return[];const n=e.ownerDocument.querySelectorAll("label");return Array.from(n).filter(t=>t.control===e)}function C(e,t,n){let{selector:r="*"}=void 0===n?{}:n;const o=t.getAttribute("aria-labelledby"),l=o?o.split(" "):[];return l.length?l.map(t=>{const n=e.querySelector('[id="'+t+'"]');return n?{content:P(n),formControl:null}:{content:"",formControl:null}}):Array.from(D(t)).map(e=>({content:P(e),formControl:Array.from(e.querySelectorAll("button, input, meter, output, progress, select, textarea")).filter(e=>e.matches(r))[0]}))}function j(e){if(null==e)throw new Error("It looks like "+e+" was passed instead of a matcher. Did you do something like getByText("+e+")?")}function L(e,t,n,r){if("string"!=typeof e)return!1;j(n);const o=r(e);return"string"==typeof n||"number"==typeof n?o.toLowerCase().includes(n.toString().toLowerCase()):"function"==typeof n?n(o,t):W(n,o)}function M(e,t,n,r){if("string"!=typeof e)return!1;j(n);const o=r(e);return n instanceof Function?n(o,t):n instanceof RegExp?W(n,o):o===String(n)}function F(e){let{trim:t=!0,collapseWhitespace:n=!0}=void 0===e?{}:e;return e=>{let r=e;return r=t?r.trim():r,r=n?r.replace(/\s+/g," "):r,r}}function N(e){let{trim:t,collapseWhitespace:n,normalizer:r}=e;if(!r)return F({trim:t,collapseWhitespace:n});if(void 0!==t||void 0!==n)throw new Error('trim and collapseWhitespace are not supported with a normalizer. If you want to use the default trim and collapseWhitespace logic in your normalizer, use "getDefaultNormalizer({trim, collapseWhitespace})" and compose that into your normalizer');return r}function W(e,t){const n=e.test(t);return e.global&&0!==e.lastIndex&&(console.warn("To match all elements we had to reset the lastIndex of the RegExp because the global flag is enabled. We encourage to remove the global flag from the RegExp."),e.lastIndex=0),n}function U(e){return e.matches("input[type=submit], input[type=button], input[type=reset]")?e.value:Array.from(e.childNodes).filter(e=>3===e.nodeType&&Boolean(e.textContent)).map(e=>e.textContent).join("")}const R=function(e){function t(e){let{attributes:t=[]}=e;return t.length}function n(e){let{attributes:t=[]}=e;const n=t.findIndex(e=>e.value&&"type"===e.name&&"text"===e.value);n>=0&&(t=[...t.slice(0,n),...t.slice(n+1)]);const r=function(e){let{name:t,attributes:n}=e;return""+t+n.map(e=>{let{name:t,value:n,constraints:r=[]}=e;const o=-1!==r.indexOf("undefined"),l=-1!==r.indexOf("set");return void 0!==n?"["+t+'="'+n+'"]':o?":not(["+t+"])":l?"["+t+"]:not(["+t+'=""])':"["+t+"]"}).join("")}({...e,attributes:t});return e=>!(n>=0&&"text"!==e.type)&&e.matches(r)}let r=[];for(const[o,l]of e.entries())r=[...r,{match:n(o),roles:Array.from(l),specificity:t(o)}];return r.sort(function(e,t){let{specificity:n}=e,{specificity:r}=t;return r-n})}(l);function z(e){if(!0===e.hidden)return!0;if("true"===e.getAttribute("aria-hidden"))return!0;return"none"===e.ownerDocument.defaultView.getComputedStyle(e).display}function H(e,t){void 0===t&&(t={});const{isSubtreeInaccessible:n=z}=t;if("hidden"===e.ownerDocument.defaultView.getComputedStyle(e).visibility)return!0;let r=e;for(;r;){if(n(r))return!0;r=r.parentElement}return!1}function _(e){for(const{match:t,roles:n}of R)if(t(e))return[...n];return[]}function V(e,t){let{hidden:n=!1}=void 0===t?{}:t;return function e(t){return[t,...Array.from(t.children).reduce((t,n)=>[...t,...e(n)],[])]}(e).filter(e=>!1!==n||!1===H(e)).reduce((e,t)=>{let n=[];return n=t.hasAttribute("role")?t.getAttribute("role").split(" ").slice(0,1):_(t),n.reduce((e,n)=>Array.isArray(e[n])?{...e,[n]:[...e[n],t]}:{...e,[n]:[t]},e)},{})}function G(e,t){const n=e.getAttribute(t);return"true"===n||"false"!==n&&void 0}const K=F();function $(e){return new RegExp(function(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}(e.toLowerCase()),"i")}function J(e,t,n,r){let{variant:o,name:l}=r,a="";const i={},u=[["Role","TestId"].includes(e)?n:$(n)];l&&(i.name=$(l)),"Role"===e&&H(t)&&(i.hidden=!0,a="Element is inaccessible. This means that the element and all its children are invisible to screen readers.\n If you are using the aria-hidden prop, make sure this is the right choice for your case.\n "),Object.keys(i).length>0&&u.push(i);const s=o+"By"+e;return{queryName:e,queryMethod:s,queryArgs:u,variant:o,warning:a,toString(){a&&console.warn(a);let[e,t]=u;return e="string"==typeof e?"'"+e+"'":e,t=t?", { "+Object.entries(t).map(e=>{let[t,n]=e;return t+": "+n}).join(", ")+" }":"",s+"("+e+t+")"}}}function X(e,t,n){return n&&!0}function Q(e,t,r){var o,l;if(void 0===t&&(t="get"),e.matches(k().defaultIgnore))return;const a=null!=(o=e.getAttribute("role"))?o:null==(l=_(e))?void 0:l[0];if("generic"!==a&&X(0,0,a))return J("Role",e,a,{variant:t,name:n(e,{computedStyleSupportsPseudoElements:k().computedStyleSupportsPseudoElements})});const i=C(document,e).map(e=>e.content).join(" ");if(X(0,0,i))return J("LabelText",e,i,{variant:t});const u=e.getAttribute("placeholder");if(X(0,0,u))return J("PlaceholderText",e,u,{variant:t});const s=K(U(e));if(X(0,0,s))return J("Text",e,s,{variant:t});if(X(0,0,e.value))return J("DisplayValue",e,K(e.value),{variant:t});const c=e.getAttribute("alt");if(X(0,0,c))return J("AltText",e,c,{variant:t});const d=e.getAttribute("title");if(X(0,0,d))return J("Title",e,d,{variant:t});const b=e.getAttribute(k().testIdAttribute);return X(0,0,b)?J("TestId",e,b,{variant:t}):void 0}function Y(e,t){e.stack=t.stack.replace(t.message,e.message)}function Z(e,t){let{container:n=h(),timeout:r=k().asyncUtilTimeout,showOriginalStackTrace:o=k().showOriginalStackTrace,stackTraceError:l,interval:a=50,onTimeout:i=e=>(Object.defineProperty(e,"message",{value:k().getElementError(e.message,n).message}),e),mutationObserverOptions:u={subtree:!0,childList:!0,attributes:!0,characterData:!0}}=t;if("function"!=typeof e)throw new TypeError("Received `callback` arg must be a function");return new Promise(async(t,s)=>{let c,d,b,p=!1,f="idle";const m=setTimeout(function(){let e;c?(e=c,o||"TestingLibraryElementError"!==e.name||Y(e,l)):(e=new Error("Timed out in waitFor."),o||Y(e,l));h(i(e),null)},r),y=v();if(y){const{unstable_advanceTimersWrapper:e}=k();for(w();!p;){if(!v()){const e=new Error("Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Y(e,l),void s(e)}if(await e(async()=>{jest.advanceTimersByTime(a)}),p)break;w()}}else{try{E(n)}catch(e){return void s(e)}d=setInterval(T,a);const{MutationObserver:e}=g(n);b=new e(T),b.observe(n,u),w()}function h(e,n){p=!0,clearTimeout(m),y||(clearInterval(d),b.disconnect()),e?s(e):t(n)}function T(){if(v()){const e=new Error("Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830");return o||Y(e,l),s(e)}return w()}function w(){if("pending"!==f)try{const t=function(e){try{return B._disableExpensiveErrorDiagnostics=!0,e()}finally{B._disableExpensiveErrorDiagnostics=!1}}(e);"function"==typeof(null==t?void 0:t.then)?(f="pending",t.then(e=>{f="resolved",h(null,e)},e=>{f="rejected",c=e})):h(null,t)}catch(e){c=e}}})}function ee(e,t){const n=new Error("STACK_TRACE_MESSAGE");return k().asyncWrapper(()=>Z(e,{stackTraceError:n,...t}))}function te(e,t){return k().getElementError(e,t)}function ne(e,t){return te(e+"\n\n(If this is intentional, then use the `*AllBy*` variant of the query (like `queryAllByText`, `getAllByText`, or `findAllByText`)).",t)}function re(e,t,n,r){let{exact:o=!0,collapseWhitespace:l,trim:a,normalizer:i}=void 0===r?{}:r;const u=o?M:L,s=N({collapseWhitespace:l,trim:a,normalizer:i});return Array.from(t.querySelectorAll("["+e+"]")).filter(t=>u(t.getAttribute(e),t,n,s))}function oe(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];const a=e(n,...o);if(a.length>1){const e=a.map(e=>te(null,e).message).join("\n\n");throw ne(t(n,...o)+"\n\nHere are the matching elements:\n\n"+e,n)}return a[0]||null}}function le(e,t){return k().getElementError("A better query is available, try this:\n"+e.toString()+"\n",t)}function ae(e,t){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];const a=e(n,...o);if(!a.length)throw k().getElementError(t(n,...o),n);return a}}function ie(e){return(t,n,r,o)=>ee(()=>e(t,n,r),{container:t,...o})}const ue=(e,t,n)=>function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),a=1;a<o;a++)l[a-1]=arguments[a];const i=e(r,...l),[{suggest:u=k().throwSuggestions}={}]=l.slice(-1);if(i&&u){const e=Q(i,n);if(e&&!t.endsWith(e.queryName))throw le(e.toString(),r)}return i},se=(e,t,n)=>function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),a=1;a<o;a++)l[a-1]=arguments[a];const i=e(r,...l),[{suggest:u=k().throwSuggestions}={}]=l.slice(-1);if(i.length&&u){const e=[...new Set(i.map(e=>{var t;return null==(t=Q(e,n))?void 0:t.toString()}))];if(1===e.length&&!t.endsWith(Q(i[0],n).queryName))throw le(e[0],r)}return i};function ce(e,t,n){const r=ue(oe(e,t),e.name,"query"),o=ae(e,n),l=oe(o,t),a=ue(l,e.name,"get");return[r,se(o,e.name.replace("query","get"),"getAll"),a,ie(se(o,e.name,"findAll")),ie(ue(l,e.name,"find"))]}const de=function(e,t,n){let{exact:r=!0,trim:o,collapseWhitespace:l,normalizer:a}=void 0===n?{}:n;const i=r?M:L,u=N({collapseWhitespace:l,trim:o,normalizer:a}),s=function(e){return Array.from(e.querySelectorAll("label,input")).map(e=>({node:e,textToMatch:P(e)})).filter(e=>{let{textToMatch:t}=e;return null!==t})}(e);return s.filter(e=>{let{node:n,textToMatch:r}=e;return i(r,n,t,u)}).map(e=>{let{node:t}=e;return t})},be=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:l,trim:a,normalizer:i}=void 0===n?{}:n;E(e);const u=o?M:L,s=N({collapseWhitespace:l,trim:a,normalizer:i}),c=Array.from(e.querySelectorAll("*")).filter(e=>D(e).length||e.hasAttribute("aria-labelledby")).reduce((n,o)=>{const l=C(e,o,{selector:r});l.filter(e=>Boolean(e.formControl)).forEach(e=>{u(e.content,e.formControl,t,s)&&e.formControl&&n.push(e.formControl)});const a=l.filter(e=>Boolean(e.content)).map(e=>e.content);return u(a.join(" "),o,t,s)&&n.push(o),a.length>1&&a.forEach((e,r)=>{u(e,o,t,s)&&n.push(o);const l=[...a];l.splice(r,1),l.length>1&&u(l.join(" "),o,t,s)&&n.push(o)}),n},[]).concat(re("aria-label",e,t,{exact:o,normalizer:s}));return Array.from(new Set(c)).filter(e=>e.matches(r))},pe=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const l=be(e,t,...r);if(!l.length){const n=de(e,t,...r);if(n.length){const r=n.map(t=>function(e,t){const n=t.getAttribute("for");if(!n)return null;const r=e.querySelector('[id="'+n+'"]');return r?r.tagName.toLowerCase():null}(e,t)).filter(e=>!!e);throw r.length?k().getElementError(r.map(e=>"Found a label with the text of: "+t+", however the element associated with this label (<"+e+" />) is non-labellable [https://html.spec.whatwg.org/multipage/forms.html#category-label]. If you really need to label a <"+e+" />, you can use aria-label or aria-labelledby instead.").join("\n\n"),e):k().getElementError("Found a label with the text of: "+t+', however no form control was found associated to that label. Make sure you\'re using the "for" attribute or "aria-labelledby" attribute correctly.',e)}throw k().getElementError("Unable to find a label with the text of: "+t,e)}return l};const fe=(e,t)=>"Found multiple elements with the text of: "+t,me=ue(oe(be,fe),be.name,"query"),ye=oe(pe,fe),ve=ie(se(pe,pe.name,"findAll")),he=ie(ue(ye,pe.name,"find")),ge=se(pe,pe.name,"getAll"),Ee=ue(ye,pe.name,"get"),Te=se(be,be.name,"queryAll"),we=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return E(t[0]),re("placeholder",...t)},Ae=se(we,we.name,"queryAll"),[Ie,xe,Be,Se,ke]=ce(we,(e,t)=>"Found multiple elements with the placeholder text of: "+t,(e,t)=>"Unable to find an element with the placeholder text of: "+t),qe=function(e,t,n){let{selector:r="*",exact:o=!0,collapseWhitespace:l,trim:a,ignore:i=k().defaultIgnore,normalizer:u}=void 0===n?{}:n;E(e);const s=o?M:L,c=N({collapseWhitespace:l,trim:a,normalizer:u});let d=[];return"function"==typeof e.matches&&e.matches(r)&&(d=[e]),[...d,...Array.from(e.querySelectorAll(r))].filter(e=>!i||!e.matches(i)).filter(e=>s(U(e),e,t,c))},Oe=se(qe,qe.name,"queryAll"),[Pe,De,Ce,je,Le]=ce(qe,(e,t)=>"Found multiple elements with the text: "+t,function(e,t,n){void 0===n&&(n={});const{collapseWhitespace:r,trim:o,normalizer:l,selector:a}=n,i=N({collapseWhitespace:r,trim:o,normalizer:l})(t.toString());return"Unable to find an element with the text: "+(i!==t.toString()?i+" (normalized from '"+t+"')":t)+("*"!==(null!=a?a:"*")?", which matches selector '"+a+"'":"")+". This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible."}),Me=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:l,normalizer:a}=void 0===n?{}:n;E(e);const i=r?M:L,u=N({collapseWhitespace:o,trim:l,normalizer:a});return Array.from(e.querySelectorAll("input,textarea,select")).filter(e=>{if("SELECT"===e.tagName){return Array.from(e.options).filter(e=>e.selected).some(e=>i(U(e),e,t,u))}return i(e.value,e,t,u)})},Fe=se(Me,Me.name,"queryAll"),[Ne,We,Ue,Re,ze]=ce(Me,(e,t)=>"Found multiple elements with the display value: "+t+".",(e,t)=>"Unable to find an element with the display value: "+t+"."),He=/^(img|input|area|.+-.+)$/i,_e=function(e,t,n){return void 0===n&&(n={}),E(e),re("alt",e,t,n).filter(e=>He.test(e.tagName))},Ve=se(_e,_e.name,"queryAll"),[Ge,Ke,$e,Je,Xe]=ce(_e,(e,t)=>"Found multiple elements with the alt text: "+t,(e,t)=>"Unable to find an element with the alt text: "+t),Qe=function(e,t,n){let{exact:r=!0,collapseWhitespace:o,trim:l,normalizer:a}=void 0===n?{}:n;E(e);const i=r?M:L,u=N({collapseWhitespace:o,trim:l,normalizer:a});return Array.from(e.querySelectorAll("[title], svg > title")).filter(e=>i(e.getAttribute("title"),e,t,u)||(e=>{var t;return"title"===e.tagName.toLowerCase()&&"svg"===(null==(t=e.parentElement)?void 0:t.tagName.toLowerCase())})(e)&&i(U(e),e,t,u))},Ye=se(Qe,Qe.name,"queryAll"),[Ze,et,tt,nt,rt]=ce(Qe,(e,t)=>"Found multiple elements with the title: "+t+".",(e,t)=>"Unable to find an element with the title: "+t+"."),ot=function(e,l,a){let{hidden:i=k().defaultHidden,name:u,description:s,queryFallbacks:c=!1,selected:d,busy:b,checked:p,pressed:f,current:m,level:y,expanded:v,value:{now:h,min:g,max:T,text:w}={}}=void 0===a?{}:a;var A,I,x,B,S,q,O,P,D,C;if((E(e),void 0!==d)&&void 0===(null==(A=r.get(l))?void 0:A.props["aria-selected"]))throw new Error('"aria-selected" is not supported on role "'+l+'".');if(void 0!==b&&void 0===(null==(I=r.get(l))?void 0:I.props["aria-busy"]))throw new Error('"aria-busy" is not supported on role "'+l+'".');if(void 0!==p&&void 0===(null==(x=r.get(l))?void 0:x.props["aria-checked"]))throw new Error('"aria-checked" is not supported on role "'+l+'".');if(void 0!==f&&void 0===(null==(B=r.get(l))?void 0:B.props["aria-pressed"]))throw new Error('"aria-pressed" is not supported on role "'+l+'".');if(void 0!==m&&void 0===(null==(S=r.get(l))?void 0:S.props["aria-current"]))throw new Error('"aria-current" is not supported on role "'+l+'".');if(void 0!==y&&"heading"!==l)throw new Error('Role "'+l+'" cannot have "level" property.');if(void 0!==h&&void 0===(null==(q=r.get(l))?void 0:q.props["aria-valuenow"]))throw new Error('"aria-valuenow" is not supported on role "'+l+'".');if(void 0!==T&&void 0===(null==(O=r.get(l))?void 0:O.props["aria-valuemax"]))throw new Error('"aria-valuemax" is not supported on role "'+l+'".');if(void 0!==g&&void 0===(null==(P=r.get(l))?void 0:P.props["aria-valuemin"]))throw new Error('"aria-valuemin" is not supported on role "'+l+'".');if(void 0!==w&&void 0===(null==(D=r.get(l))?void 0:D.props["aria-valuetext"]))throw new Error('"aria-valuetext" is not supported on role "'+l+'".');if(void 0!==v&&void 0===(null==(C=r.get(l))?void 0:C.props["aria-expanded"]))throw new Error('"aria-expanded" is not supported on role "'+l+'".');const j=new WeakMap;function L(e){return j.has(e)||j.set(e,z(e)),j.get(e)}return Array.from(e.querySelectorAll(function(e){var t;const n='*[role~="'+e+'"]',r=null!=(t=o.get(e))?t:new Set,l=new Set(Array.from(r).map(e=>{let{name:t}=e;return t}));return[n].concat(Array.from(l)).join(",")}(l))).filter(e=>{if(e.hasAttribute("role")){const t=e.getAttribute("role");if(c)return t.split(" ").filter(Boolean).some(e=>e===l);const[n]=t.split(" ");return n===l}return _(e).some(e=>e===l)}).filter(e=>{if(void 0!==d)return d===function(e){return"OPTION"===e.tagName?e.selected:G(e,"aria-selected")}(e);if(void 0!==b)return b===function(e){return"true"===e.getAttribute("aria-busy")}(e);if(void 0!==p)return p===function(e){if(!("indeterminate"in e)||!e.indeterminate)return"checked"in e?e.checked:G(e,"aria-checked")}(e);if(void 0!==f)return f===function(e){return G(e,"aria-pressed")}(e);if(void 0!==m)return m===function(e){var t,n;return null!=(t=null!=(n=G(e,"aria-current"))?n:e.getAttribute("aria-current"))&&t}(e);if(void 0!==v)return v===function(e){return G(e,"aria-expanded")}(e);if(void 0!==y)return y===function(e){return e.getAttribute("aria-level")&&Number(e.getAttribute("aria-level"))||{H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[e.tagName]}(e);if(void 0!==h||void 0!==T||void 0!==g||void 0!==w){let n=!0;var t;if(void 0!==h&&n&&(n=h===function(e){const t=e.getAttribute("aria-valuenow");return null===t?void 0:+t}(e)),void 0!==T&&n&&(n=T===function(e){const t=e.getAttribute("aria-valuemax");return null===t?void 0:+t}(e)),void 0!==g&&n&&(n=g===function(e){const t=e.getAttribute("aria-valuemin");return null===t?void 0:+t}(e)),void 0!==w)n&&(n=M(null!=(t=function(e){const t=e.getAttribute("aria-valuetext");return null===t?void 0:t}(e))?t:null,e,w,e=>e));return n}return!0}).filter(e=>void 0===u||M(n(e,{computedStyleSupportsPseudoElements:k().computedStyleSupportsPseudoElements}),e,u,e=>e)).filter(e=>void 0===s||M(t(e,{computedStyleSupportsPseudoElements:k().computedStyleSupportsPseudoElements}),e,s,e=>e)).filter(e=>!1!==i||!1===H(e,{isSubtreeInaccessible:L}))};const lt=e=>{let t="";return t=void 0===e?"":"string"==typeof e?' and name "'+e+'"':" and name `"+e+"`",t},at=se(ot,ot.name,"queryAll"),[it,ut,st,ct,dt]=ce(ot,function(e,t,n){let{name:r}=void 0===n?{}:n;return'Found multiple elements with the role "'+t+'"'+lt(r)},function(e,r,o){let{hidden:l=k().defaultHidden,name:a,description:i}=void 0===o?{}:o;if(k()._disableExpensiveErrorDiagnostics)return'Unable to find role="'+r+'"'+lt(a);let u,s="";Array.from(e.children).forEach(e=>{s+=function(e,r){let{hidden:o,includeDescription:l}=r;const a=V(e,{hidden:o});return Object.entries(a).filter(e=>{let[t]=e;return"generic"!==t}).map(e=>{let[r,o]=e;const a="-".repeat(50);return r+":\n\n"+o.map(e=>{const r='Name "'+n(e,{computedStyleSupportsPseudoElements:k().computedStyleSupportsPseudoElements})+'":\n',o=I(e.cloneNode(!1));return l?r+('Description "'+t(e,{computedStyleSupportsPseudoElements:k().computedStyleSupportsPseudoElements})+'":\n')+o:""+r+o}).join("\n\n")+"\n\n"+a}).join("\n")}(e,{hidden:l,includeDescription:void 0!==i})}),u=0===s.length?!1===l?"There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole":"There are no available roles.":("\nHere are the "+(!1===l?"accessible":"available")+" roles:\n\n "+s.replace(/\n/g,"\n ").replace(/\n\s\s\n/g,"\n\n")+"\n").trim();let c="";c=void 0===a?"":"string"==typeof a?' and name "'+a+'"':" and name `"+a+"`";let d="";return d=void 0===i?"":"string"==typeof i?' and description "'+i+'"':" and description `"+i+"`",("\nUnable to find an "+(!1===l?"accessible ":"")+'element with the role "'+r+'"'+c+d+"\n\n"+u).trim()}),bt=()=>k().testIdAttribute,pt=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return E(t[0]),re(bt(),...t)},ft=se(pt,pt.name,"queryAll"),[mt,yt,vt,ht,gt]=ce(pt,(e,t)=>"Found multiple elements by: ["+bt()+'="'+t+'"]',(e,t)=>"Unable to find an element by: ["+bt()+'="'+t+'"]');var Et=Object.freeze({__proto__:null,queryAllByLabelText:Te,queryByLabelText:me,getAllByLabelText:ge,getByLabelText:Ee,findAllByLabelText:ve,findByLabelText:he,queryByPlaceholderText:Ie,queryAllByPlaceholderText:Ae,getByPlaceholderText:Be,getAllByPlaceholderText:xe,findAllByPlaceholderText:Se,findByPlaceholderText:ke,queryByText:Pe,queryAllByText:Oe,getByText:Ce,getAllByText:De,findAllByText:je,findByText:Le,queryByDisplayValue:Ne,queryAllByDisplayValue:Fe,getByDisplayValue:Ue,getAllByDisplayValue:We,findAllByDisplayValue:Re,findByDisplayValue:ze,queryByAltText:Ge,queryAllByAltText:Ve,getByAltText:$e,getAllByAltText:Ke,findAllByAltText:Je,findByAltText:Xe,queryByTitle:Ze,queryAllByTitle:Ye,getByTitle:tt,getAllByTitle:et,findAllByTitle:nt,findByTitle:rt,queryByRole:it,queryAllByRole:at,getAllByRole:ut,getByRole:st,findAllByRole:ct,findByRole:dt,queryByTestId:mt,queryAllByTestId:ft,getByTestId:vt,getAllByTestId:yt,findAllByTestId:ht,findByTestId:gt});function Tt(e,t,n){return void 0===t&&(t=Et),void 0===n&&(n={}),Object.keys(t).reduce((n,r)=>{const o=t[r];return n[r]=o.bind(null,e),n},n)}const wt={copy:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},cut:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},paste:{EventType:"ClipboardEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionEnd:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionStart:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},compositionUpdate:{EventType:"CompositionEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},keyDown:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyPress:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},keyUp:{EventType:"KeyboardEvent",defaultInit:{bubbles:!0,cancelable:!0,charCode:0,composed:!0}},focus:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},blur:{EventType:"FocusEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},focusIn:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},focusOut:{EventType:"FocusEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},change:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},input:{EventType:"InputEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},invalid:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!0}},submit:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},reset:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!0}},click:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,button:0,composed:!0}},contextMenu:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dblClick:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drag:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragEnd:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragEnter:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragExit:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragLeave:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},dragOver:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},dragStart:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},drop:{EventType:"DragEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseDown:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseEnter:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseLeave:{EventType:"MouseEvent",defaultInit:{bubbles:!1,cancelable:!1,composed:!0}},mouseMove:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOut:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseOver:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},mouseUp:{EventType:"MouseEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},select:{EventType:"Event",defaultInit:{bubbles:!0,cancelable:!1}},touchCancel:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},touchEnd:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchMove:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},touchStart:{EventType:"TouchEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},resize:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},scroll:{EventType:"UIEvent",defaultInit:{bubbles:!1,cancelable:!1}},wheel:{EventType:"WheelEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},abort:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlay:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},canPlayThrough:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},durationChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},emptied:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},encrypted:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},ended:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedData:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadedMetadata:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},loadStart:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},pause:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},play:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},playing:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},progress:{EventType:"ProgressEvent",defaultInit:{bubbles:!1,cancelable:!1}},rateChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeked:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},seeking:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},stalled:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},suspend:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},timeUpdate:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},volumeChange:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},waiting:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},load:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},error:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},animationStart:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationEnd:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},animationIteration:{EventType:"AnimationEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionCancel:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionEnd:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},transitionRun:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},transitionStart:{EventType:"TransitionEvent",defaultInit:{bubbles:!0,cancelable:!1}},pointerOver:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerEnter:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},pointerDown:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerMove:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerUp:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerCancel:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},pointerOut:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!0,composed:!0}},pointerLeave:{EventType:"PointerEvent",defaultInit:{bubbles:!1,cancelable:!1}},gotPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},lostPointerCapture:{EventType:"PointerEvent",defaultInit:{bubbles:!0,cancelable:!1,composed:!0}},popState:{EventType:"PopStateEvent",defaultInit:{bubbles:!0,cancelable:!1}},offline:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},online:{EventType:"Event",defaultInit:{bubbles:!1,cancelable:!1}},pageHide:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}},pageShow:{EventType:"PageTransitionEvent",defaultInit:{bubbles:!0,cancelable:!0}}},At={doubleClick:"dblClick"};function It(e,t){return k().eventWrapper(()=>{if(!t)throw new Error("Unable to fire an event - please provide an event object.");if(!e)throw new Error('Unable to fire a "'+t.type+'" event - please provide a DOM element.');return e.dispatchEvent(t)})}function xt(e,t,n,r){let{EventType:o="Event",defaultInit:l={}}=void 0===r?{}:r;if(!t)throw new Error('Unable to fire a "'+e+'" event - please provide a DOM element.');const a={...l,...n},{target:{value:i,files:u,...s}={}}=a;void 0!==i&&function(e,t){const{set:n}=Object.getOwnPropertyDescriptor(e,"value")||{},r=Object.getPrototypeOf(e),{set:o}=Object.getOwnPropertyDescriptor(r,"value")||{};if(o&&n!==o)o.call(e,t);else{if(!n)throw new Error("The given element does not have a value setter");n.call(e,t)}}(t,i),void 0!==u&&Object.defineProperty(t,"files",{configurable:!0,enumerable:!0,writable:!0,value:u}),Object.assign(t,s);const c=g(t),d=c[o]||c.Event;let b;if("function"==typeof d)b=new d(e,a);else{b=c.document.createEvent(o);const{bubbles:t,cancelable:n,detail:r,...l}=a;b.initEvent(e,t,n,r),Object.keys(l).forEach(e=>{b[e]=l[e]})}return["dataTransfer","clipboardData"].forEach(e=>{const t=a[e];"object"==typeof t&&("function"==typeof c.DataTransfer?Object.defineProperty(b,e,{value:Object.getOwnPropertyNames(t).reduce((e,n)=>(Object.defineProperty(e,n,{value:t[n]}),e),new c.DataTransfer)}):Object.defineProperty(b,e,{value:t}))}),b}function Bt(e){return"https://testing-playground.com/#markup="+(t=e,a.compressToEncodedURIComponent(t.replace(/[ \t]*[\n][ \t]*/g,"\n")));var t}Object.keys(wt).forEach(e=>{const{EventType:t,defaultInit:n}=wt[e],r=e.toLowerCase();xt[e]=(e,o)=>xt(r,e,o,{EventType:t,defaultInit:n}),It[e]=(t,n)=>It(t,xt[e](t,n))}),Object.keys(At).forEach(e=>{const t=At[e];It[e]=function(){return It[t](...arguments)}});const St={debug:(e,t,n)=>Array.isArray(e)?e.forEach(e=>x(e,t,n)):x(e,t,n),logTestingPlaygroundURL:function(e){if(void 0===e&&(e=h().body),!e||!("innerHTML"in e))return void console.log("The element you're providing isn't a valid DOM element.");if(!e.innerHTML)return void console.log("The provided element doesn't have any children.");const t=Bt(e.innerHTML);return console.log("Open this URL in your browser\n\n"+t),t}};"undefined"!=typeof document&&document.body?Tt(document.body,Et,St):Object.keys(Et).reduce((e,t)=>(e[t]=()=>{throw new TypeError("For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error")},e),St);export{ce as buildQueries,S as configure,xt as createEvent,Je as findAllByAltText,Re as findAllByDisplayValue,ve as findAllByLabelText,Se as findAllByPlaceholderText,ct as findAllByRole,ht as findAllByTestId,je as findAllByText,nt as findAllByTitle,Xe as findByAltText,ze as findByDisplayValue,he as findByLabelText,ke as findByPlaceholderText,dt as findByRole,gt as findByTestId,Le as findByText,rt as findByTitle,It as fireEvent,Ke as getAllByAltText,We as getAllByDisplayValue,ge as getAllByLabelText,xe as getAllByPlaceholderText,ut as getAllByRole,yt as getAllByTestId,De as getAllByText,et as getAllByTitle,$e as getByAltText,Ue as getByDisplayValue,Ee as getByLabelText,Be as getByPlaceholderText,st as getByRole,vt as getByTestId,Ce as getByText,tt as getByTitle,k as getConfig,F as getDefaultNormalizer,te as getElementError,ne as getMultipleElementsFoundError,U as getNodeText,Tt as getQueriesForElement,V as getRoles,Q as getSuggestedQuery,H as isInaccessible,x as logDOM,ie as makeFindQuery,ae as makeGetAllQuery,oe as makeSingleQuery,I as prettyDOM,Et as queries,Ve as queryAllByAltText,re as queryAllByAttribute,Fe as queryAllByDisplayValue,Te as queryAllByLabelText,Ae as queryAllByPlaceholderText,at as queryAllByRole,ft as queryAllByTestId,Oe as queryAllByText,Ye as queryAllByTitle,Ge as queryByAltText,Ne as queryByDisplayValue,me as queryByLabelText,Ie as queryByPlaceholderText,it as queryByRole,mt as queryByTestId,Pe as queryByText,Ze as queryByTitle,ee as waitFor,Tt as within,se as wrapAllByQueryWithSuggestion,ue as wrapSingleQueryWithSuggestion};