@storybook/addon-a11y 9.1.0-alpha.5 → 9.1.0-alpha.7

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.
package/dist/manager.js CHANGED
@@ -10,4 +10,4 @@ import { flushSync, findDOMNode } from 'react-dom';
10
10
 
11
11
  var RuleType={VIOLATION:"violations",PASS:"passes",INCOMPLETION:"incomplete"};var axeRuleMapping_wcag_2_0_a_aa={"area-alt":{title:"<area> alt text",axeSummary:"Ensure <area> elements of image maps have alternative text",friendlySummary:"Add alt text to all <area> elements of image maps."},"aria-allowed-attr":{title:"Supported ARIA attributes",axeSummary:"Ensure an element's role supports its ARIA attributes",friendlySummary:"Only use ARIA attributes that are permitted for the element's role."},"aria-braille-equivalent":{title:"Braille equivalent",axeSummary:"Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent",friendlySummary:"If you use braille ARIA labels, also provide a matching non-braille label."},"aria-command-name":{title:"ARIA command name",axeSummary:"Ensure every ARIA button, link and menuitem has an accessible name",friendlySummary:"Every ARIA button, link, or menuitem needs a label or accessible name."},"aria-conditional-attr":{title:"ARIA attribute valid for role",axeSummary:"Ensure ARIA attributes are used as described in the specification of the element's role",friendlySummary:"Follow the element role's specification when using ARIA attributes."},"aria-deprecated-role":{title:"Deprecated ARIA role",axeSummary:"Ensure elements do not use deprecated roles",friendlySummary:"Don't use deprecated ARIA roles on elements."},"aria-hidden-body":{title:"Hidden body",axeSummary:'Ensure aria-hidden="true" is not present on the document <body>',friendlySummary:'Never set aria-hidden="true" on the <body> element.'},"aria-hidden-focus":{title:"Hidden element focus",axeSummary:"Ensure aria-hidden elements are not focusable nor contain focusable elements",friendlySummary:"Elements marked hidden (aria-hidden) should not be focusable or contain focusable items."},"aria-input-field-name":{title:"ARIA input field name",axeSummary:"Ensure every ARIA input field has an accessible name",friendlySummary:"Give each ARIA text input or field a label or accessible name."},"aria-meter-name":{title:"ARIA meter name",axeSummary:"Ensure every ARIA meter node has an accessible name",friendlySummary:'Give each element with role="meter" a label or accessible name.'},"aria-progressbar-name":{title:"ARIA progressbar name",axeSummary:"Ensure every ARIA progressbar node has an accessible name",friendlySummary:'Give each element with role="progressbar" a label or accessible name.'},"aria-prohibited-attr":{title:"ARIA prohibited attributes",axeSummary:"Ensure ARIA attributes are not prohibited for an element's role",friendlySummary:"Don't use ARIA attributes that are forbidden for that element's role."},"aria-required-attr":{title:"ARIA required attributes",axeSummary:"Ensure elements with ARIA roles have all required ARIA attributes",friendlySummary:"Include all required ARIA attributes for elements with that ARIA role."},"aria-required-children":{title:"ARIA required children",axeSummary:"Ensure elements with an ARIA role that require child roles contain them",friendlySummary:"If an ARIA role requires specific child roles, include those child elements."},"aria-required-parent":{title:"ARIA required parent",axeSummary:"Ensure elements with an ARIA role that require parent roles are contained by them",friendlySummary:"Place elements with certain ARIA roles inside the required parent role element."},"aria-roles":{title:"ARIA role value",axeSummary:"Ensure all elements with a role attribute use a valid value",friendlySummary:"Use only valid values in the role attribute (no typos or invalid roles)."},"aria-toggle-field-name":{title:"ARIA toggle field name",axeSummary:"Ensure every ARIA toggle field has an accessible name",friendlySummary:"Every ARIA toggle field (elements with the checkbox, radio, or switch roles) needs an accessible name."},"aria-tooltip-name":{title:"ARIA tooltip name",axeSummary:"Ensure every ARIA tooltip node has an accessible name",friendlySummary:'Give each element with role="tooltip" a descriptive accessible name.'},"aria-valid-attr-value":{title:"ARIA attribute values valid",axeSummary:"Ensure all ARIA attributes have valid values",friendlySummary:"Use only valid values for ARIA attributes (no typos or invalid values)."},"aria-valid-attr":{title:"ARIA attribute valid",axeSummary:"Ensure attributes that begin with aria- are valid ARIA attributes",friendlySummary:"Use only valid aria-* attributes (make sure the attribute name is correct)."},blink:{title:"<blink> element",axeSummary:"Ensure <blink> elements are not used",friendlySummary:"Don't use the deprecated <blink> element."},"button-name":{title:"Button name",axeSummary:"Ensure buttons have discernible text",friendlySummary:"Every <button> needs a visible label or accessible name."},bypass:{title:"Navigation bypass",axeSummary:"Ensure each page has at least one mechanism to bypass navigation and jump to content",friendlySummary:'Provide a way to skip repetitive navigation (e.g. a "Skip to content" link).'},"color-contrast":{title:"Color contrast",axeSummary:"Ensure the contrast between foreground and background text meets WCAG 2 AA minimum thresholds",friendlySummary:"The color contrast between text and its background meets WCAG AA contrast ratio."},"definition-list":{title:"Definition list structure",axeSummary:"Ensure <dl> elements are structured correctly",friendlySummary:"Definition lists (<dl>) should directly contain <dt> and <dd> elements in order."},dlitem:{title:"Definition list items",axeSummary:"Ensure <dt> and <dd> elements are contained by a <dl>",friendlySummary:"Ensure <dt> and <dd> elements are contained by a <dl>"},"document-title":{title:"Document title",axeSummary:"Ensure each HTML document contains a non-empty <title> element",friendlySummary:"Include a non-empty <title> element for every page."},"duplicate-id-aria":{title:"Unique id",axeSummary:"Ensure every id attribute value used in ARIA and in labels is unique",friendlySummary:"Every id used for ARIA or form labels should be unique on the page."},"form-field-multiple-labels":{title:"Multiple form field labels",axeSummary:"Ensure a form field does not have multiple <label> elements",friendlySummary:"Don't give a single form field more than one <label>."},"frame-focusable-content":{title:"Focusable frames",axeSummary:'Ensure <frame> and <iframe> with focusable content do not have tabindex="-1"',friendlySummary:`Don't set tabindex="-1" on a <frame> or <iframe> that contains focusable elements.`},"frame-title-unique":{title:"Unique frame title",axeSummary:"Ensure <iframe> and <frame> elements contain a unique title attribute",friendlySummary:"Use a unique title attribute for each <frame> or <iframe> on the page."},"frame-title":{title:"Frame title",axeSummary:"Ensure <iframe> and <frame> elements have an accessible name",friendlySummary:"Every <frame> and <iframe> needs a title or accessible name."},"html-has-lang":{title:"<html> has lang",axeSummary:"Ensure every HTML document has a lang attribute",friendlySummary:"Add a lang attribute to the <html> element."},"html-lang-valid":{title:"<html> lang valid",axeSummary:"Ensure the <html lang> attribute has a valid value",friendlySummary:"Use a valid language code in the <html lang> attribute."},"html-xml-lang-mismatch":{title:"HTML and XML lang mismatch",axeSummary:"Ensure that HTML elements with both lang and xml:lang agree on the page's language",friendlySummary:"If using both lang and xml:lang on <html>, make sure they are the same language."},"image-alt":{title:"Image alt text",axeSummary:"Ensure <img> elements have alternative text or a role of none/presentation",friendlySummary:'Give every image alt text or mark it as decorative with alt="".'},"input-button-name":{title:"Input button name",axeSummary:"Ensure input buttons have discernible text",friendlySummary:'Give each <input type="button"> or similar a clear label (text or aria-label).'},"input-image-alt":{title:"Input image alt",axeSummary:'Ensure <input type="image"> elements have alternative text',friendlySummary:'<input type="image"> must have alt text describing its image.'},label:{title:"Form label",axeSummary:"Ensure every form element has a label",friendlySummary:"Every form field needs an associated label."},"link-in-text-block":{title:"Identifiable links",axeSummary:"Ensure links are distinguishable from surrounding text without relying on color",friendlySummary:"Make sure links are obviously identifiable without relying only on color."},"link-name":{title:"Link name",axeSummary:"Ensure links have discernible text",friendlySummary:"Give each link meaningful text or an aria-label so its purpose is clear."},list:{title:"List structure",axeSummary:"Ensure that lists are structured correctly",friendlySummary:"Use proper list structure. Only use <li> inside <ul> or <ol>."},listitem:{title:"List item",axeSummary:"Ensure <li> elements are used semantically",friendlySummary:"Only use <li> tags inside <ul> or <ol> lists."},marquee:{title:"<marquee> element",axeSummary:"Ensure <marquee> elements are not used",friendlySummary:"Don't use the deprecated <marquee> element."},"meta-refresh":{title:"<meta> refresh",axeSummary:'Ensure <meta http-equiv="refresh"> is not used for delayed refresh',friendlySummary:'Avoid auto-refreshing or redirecting pages using <meta http-equiv="refresh">.'},"meta-viewport":{title:"<meta> viewport scaling",axeSummary:'Ensure <meta name="viewport"> does not disable text scaling and zooming',friendlySummary:`Don't disable user zooming in <meta name="viewport"> to allow scaling.`},"nested-interactive":{title:"Nested interactive controls",axeSummary:"Ensure interactive controls are not nested (nesting causes screen reader/focus issues)",friendlySummary:"Do not nest interactive elements; it can confuse screen readers and keyboard focus."},"no-autoplay-audio":{title:"Autoplaying video",axeSummary:"Ensure <video> or <audio> do not autoplay audio > 3 seconds without a control to stop/mute",friendlySummary:"Don't autoplay audio for more than 3 seconds without providing a way to stop or mute it."},"object-alt":{title:"<object> alt text",axeSummary:"Ensure <object> elements have alternative text",friendlySummary:"Provide alternative text or content for <object> elements."},"role-img-alt":{title:'role="img" alt text',axeSummary:'Ensure elements with role="img" have alternative text',friendlySummary:'Any element with role="img" needs alt text.'},"scrollable-region-focusable":{title:"Scrollable element focusable",axeSummary:"Ensure elements with scrollable content are keyboard-accessible",friendlySummary:"If an area can scroll, ensure it can be focused and scrolled via keyboard."},"select-name":{title:"<select> name",axeSummary:"Ensure <select> elements have an accessible name",friendlySummary:"Give each <select> field a label or other accessible name."},"server-side-image-map":{title:"Server-side image map",axeSummary:"Ensure that server-side image maps are not used",friendlySummary:"Don't use server-side image maps."},"svg-img-alt":{title:"SVG image alt text",axeSummary:"Ensure <svg> images/graphics have accessible text",friendlySummary:'SVG images with role="img" or similar need a text description.'},"td-headers-attr":{title:"Table headers attribute",axeSummary:"Ensure each cell in a table using headers only refers to <th> in that table",friendlySummary:"In tables using the headers attribute, only reference other cells in the same table."},"th-has-data-cells":{title:"<th> has data cell",axeSummary:"Ensure <th> (or header role) elements have data cells they describe",friendlySummary:"Every table header (<th> or header role) should correspond to at least one data cell."},"valid-lang":{title:"Valid lang",axeSummary:"Ensure lang attributes have valid values",friendlySummary:"Use valid language codes in all lang attributes."},"video-caption":{title:"<video> captions",axeSummary:"Ensure <video> elements have captions",friendlySummary:"Provide captions for all <video> content."}},axeRuleMapping_wcag_2_1_a_aa={"autocomplete-valid":{title:"autocomplete attribute valid",axeSummary:"Ensure the autocomplete attribute is correct and suitable for the form field",friendlySummary:"Use valid autocomplete values that match the form field's purpose."},"avoid-inline-spacing":{title:"Forced inline spacing",axeSummary:"Ensure that text spacing set via inline styles can be adjusted with custom CSS",friendlySummary:"Don't lock in text spacing with forced (!important) inline styles\u2014allow user CSS to adjust text spacing."}},axeRuleMapping_wcag_2_2_a_aa={"target-size":{title:"Touch target size",axeSummary:"Ensure touch targets have sufficient size and space",friendlySummary:"Make sure interactive elements are big enough and not too close together for touch."}},axeRuleMapping_best_practices={accesskeys:{title:"Unique accesskey",axeSummary:"Ensure every accesskey attribute value is unique",friendlySummary:"Use unique values for all accesskey attributes."},"aria-allowed-role":{title:"Appropriate role value",axeSummary:"Ensure the role attribute has an appropriate value for the element",friendlySummary:"ARIA roles should have a valid value for the element."},"aria-dialog-name":{title:"ARIA dialog name",axeSummary:"Ensure every ARIA dialog and alertdialog has an accessible name",friendlySummary:"Give each ARIA dialog or alertdialog a title or accessible name."},"aria-text":{title:'ARIA role="text"',axeSummary:'Ensure role="text" is used on elements with no focusable descendants',friendlySummary:`Only use role="text" on elements that don't contain focusable elements.`},"aria-treeitem-name":{title:"ARIA treeitem name",axeSummary:"Ensure every ARIA treeitem node has an accessible name",friendlySummary:"Give each ARIA treeitem a label or accessible name."},"empty-heading":{title:"Empty heading",axeSummary:"Ensure headings have discernible text",friendlySummary:"Don't leave heading elements empty or hide them."},"empty-table-header":{title:"Empty table header",axeSummary:"Ensure table headers have discernible text",friendlySummary:"Make sure table header cells have visible text."},"frame-tested":{title:"Test all frames",axeSummary:"Ensure <iframe> and <frame> elements contain the axe-core script",friendlySummary:"Make sure axe-core is injected into all frames or iframes so they are tested."},"heading-order":{title:"Heading order",axeSummary:"Ensure the order of headings is semantically correct (no skipping levels)",friendlySummary:"Use proper heading order (don't skip heading levels)."},"image-redundant-alt":{title:"Redundant image alt text",axeSummary:"Ensure image alternative text is not repeated as nearby text",friendlySummary:"Avoid repeating the same information in both an image's alt text and nearby text."},"label-title-only":{title:"Visible form element label",axeSummary:"Ensure each form element has a visible label (not only title/ARIA)",friendlySummary:"Every form input needs a visible label (not only a title attribute or hidden text)."},"landmark-banner-is-top-level":{title:"Top-level landmark banner",axeSummary:"Ensure the banner landmark is at top level (not nested)",friendlySummary:"Use the banner landmark (e.g. site header) only at the top level of the page, not inside another landmark."},"landmark-complementary-is-top-level":{title:"Top-level <aside>",axeSummary:"Ensure the complementary landmark (<aside>) is top level",friendlySummary:'The complementary landmark <aside> or role="complementary" should be a top-level region, not nested in another landmark.'},"landmark-contentinfo-is-top-level":{title:"Top-level contentinfo",axeSummary:"Ensure the contentinfo landmark (footer) is top level",friendlySummary:"Make sure the contentinfo landmark (footer) is at the top level of the page and not contained in another landmark."},"landmark-main-is-top-level":{title:"Top-level main",axeSummary:"Ensure the main landmark is at top level",friendlySummary:"The main landmark should be a top-level element and not nested inside another landmark."},"landmark-no-duplicate-banner":{title:"Duplicate banner landmark",axeSummary:"Ensure the document has at most one banner landmark",friendlySummary:'Have only one role="banner" or <header> on a page.'},"landmark-no-duplicate-contentinfo":{title:"Duplicate contentinfo",axeSummary:"Ensure the document has at most one contentinfo landmark",friendlySummary:'Have only one role="contentinfo" or <footer> on a page.'},"landmark-no-duplicate-main":{title:"Duplicate main",axeSummary:"Ensure the document has at most one main landmark",friendlySummary:'Have only one role="main" or <main> on a page.'},"landmark-one-main":{title:"main landmark",axeSummary:"Ensure the document has a main landmark",friendlySummary:'Include a main landmark on each page using a <main> region or role="main".'},"landmark-unique":{title:"Unique landmark",axeSummary:"Ensure landmarks have a unique role or role/label combination",friendlySummary:"If you use multiple landmarks of the same type, give them unique labels (names)."},"meta-viewport-large":{title:"Significant viewport scaling",axeSummary:'Ensure <meta name="viewport"> can scale a significant amount (e.g. 500%)',friendlySummary:'<meta name="viewport"> should allow users to significantly scale content.'},"page-has-heading-one":{title:"Has <h1>",axeSummary:"Ensure the page (or at least one frame) contains a level-one heading",friendlySummary:"Every page or frame should have at least one <h1> heading."},"presentation-role-conflict":{title:"Presentational content",axeSummary:'Ensure elements with role="presentation"/"none" have no ARIA or tabindex',friendlySummary:`Don't give elements with role="none"/"presentation" any ARIA attributes or a tabindex.`},region:{title:"Landmark regions",axeSummary:"Ensure all page content is contained by landmarks",friendlySummary:"Wrap all page content in appropriate landmark regions (<header>, <main>, <footer>, etc.)."},"scope-attr-valid":{title:"scope attribute",axeSummary:"Ensure the scope attribute is used correctly on tables",friendlySummary:"Use the scope attribute only on <th> elements, with proper values (col, row, etc.)."},"skip-link":{title:"Skip link",axeSummary:'Ensure all "skip" links have a focusable target',friendlySummary:'Make sure any "skip to content" link targets an existing, focusable element.'},tabindex:{title:"tabindex values",axeSummary:"Ensure tabindex attribute values are not greater than 0",friendlySummary:"Don't use tabindex values greater than 0."},"table-duplicate-name":{title:"Duplicate names for table",axeSummary:"Ensure the <caption> does not duplicate the summary attribute text",friendlySummary:"Don't use the same text in both a table's <caption> and its summary attribute."}},axeRuleMapping_wcag_2_x_aaa={"color-contrast-enhanced":{title:"Enhanced color contrast",axeSummary:"Ensure contrast between text and background meets WCAG 2 AAA enhanced contrast thresholds",friendlySummary:"Use extra-high contrast for text and background to meet WCAG AAA level."},"identical-links-same-purpose":{title:"Same link name, same purpose",axeSummary:"Ensure links with the same accessible name serve a similar purpose",friendlySummary:"If two links have the same text, they should do the same thing (lead to the same content)."},"meta-refresh-no-exceptions":{title:'No <meta http-equiv="refresh">',axeSummary:'Ensure <meta http-equiv="refresh"> is not used for delayed refresh (no exceptions)',friendlySummary:`Don't auto-refresh or redirect pages using <meta http-equiv="refresh"> even with a delay.`}},axeRuleMapping_experimental={"css-orientation-lock":{title:"CSS orientation lock",axeSummary:"Ensure content is not locked to a specific display orientation (works in all orientations)",friendlySummary:"Don't lock content to one screen orientation; support both portrait and landscape modes."},"focus-order-semantics":{title:"Focus order semantic role",axeSummary:"Ensure elements in the tab order have a role appropriate for interactive content",friendlySummary:"Ensure elements in the tab order have a role appropriate for interactive content"},"hidden-content":{title:"Hidden content",axeSummary:"Informs users about hidden content",friendlySummary:"Display hidden content on the page for test analysis."},"label-content-name-mismatch":{title:"Content name mismatch",axeSummary:"Ensure elements labeled by their content include that text in their accessible name",friendlySummary:"If an element's visible text serves as its label, include that text in its accessible name."},"p-as-heading":{title:"No <p> headings",axeSummary:"Ensure <p> elements aren't styled to look like headings (use real headings)",friendlySummary:"Don't just style a <p> to look like a heading \u2013 use an actual heading tag for headings."},"table-fake-caption":{title:"Table caption",axeSummary:"Ensure that tables with a caption use the <caption> element",friendlySummary:"Use a <caption> element for table captions instead of just styled text."},"td-has-header":{title:"<td> has header",axeSummary:"Ensure each non-empty data cell in large tables (3\xD73+) has one or more headers",friendlySummary:"Every data cell in large tables should be associated with at least one header cell."}},axeRuleMapping_deprecated={"aria-roledescription":{title:"aria-roledescription",axeSummary:"Ensure aria-roledescription is only used on elements with an implicit or explicit role",friendlySummary:"Only use aria-roledescription on elements that already have a defined role."}},combinedRulesMap={...axeRuleMapping_wcag_2_0_a_aa,...axeRuleMapping_wcag_2_1_a_aa,...axeRuleMapping_wcag_2_2_a_aa,...axeRuleMapping_wcag_2_x_aaa,...axeRuleMapping_best_practices,...axeRuleMapping_experimental,...axeRuleMapping_deprecated};var getTitleForAxeResult=axeResult=>combinedRulesMap[axeResult.id]?.title||axeResult.id,getFriendlySummaryForAxeResult=axeResult=>combinedRulesMap[axeResult.id]?.friendlySummary||axeResult.description;var ADDON_ID="storybook/a11y",PANEL_ID=`${ADDON_ID}/panel`,PARAM_KEY="a11y",RESULT=`${ADDON_ID}/result`,REQUEST=`${ADDON_ID}/request`,RUNNING=`${ADDON_ID}/running`,ERROR=`${ADDON_ID}/error`,MANUAL=`${ADDON_ID}/manual`,SELECT=`${ADDON_ID}/select`,DOCUMENTATION_LINK="writing-tests/accessibility-testing",DOCUMENTATION_DISCREPANCY_LINK=`${DOCUMENTATION_LINK}#why-are-my-tests-failing-in-different-environments`;var EVENTS={RESULT,REQUEST,RUNNING,ERROR,MANUAL,SELECT},STATUS_TYPE_ID_COMPONENT_TEST="storybook/component-test",STATUS_TYPE_ID_A11Y="storybook/a11y";var unhighlightedSelectors=["html","body","main"],theme=convert(themes.light),colorsByType={[RuleType.VIOLATION]:theme.color.negative,[RuleType.PASS]:theme.color.positive,[RuleType.INCOMPLETION]:theme.color.warning},A11yContext=createContext({parameters:{},results:void 0,highlighted:!1,toggleHighlight:()=>{},tab:RuleType.VIOLATION,handleCopyLink:()=>{},setTab:()=>{},setStatus:()=>{},status:"initial",error:void 0,handleManual:()=>{},discrepancy:null,selectedItems:new Map,allExpanded:!1,toggleOpen:()=>{},handleCollapseAll:()=>{},handleExpandAll:()=>{},handleJumpToElement:()=>{},handleSelectionChange:()=>{}}),A11yContextProvider=props=>{let parameters=useParameter("a11y",{}),[globals]=useGlobals()??[],api=useStorybookApi(),getInitialStatus=useCallback((manual2=!1)=>manual2?"manual":"initial",[]),manual=useMemo(()=>globals?.a11y?.manual??!1,[globals?.a11y?.manual]),a11ySelection=useMemo(()=>{let value=api.getQueryParam("a11ySelection");return value&&api.setQueryParams({a11ySelection:""}),value},[api]),[results,setResults]=useAddonState(ADDON_ID),[tab,setTab]=useState(()=>{let[type]=a11ySelection?.split(".")??[];return type&&Object.values(RuleType).includes(type)?type:RuleType.VIOLATION}),[error,setError]=useState(void 0),[status,setStatus]=useState(getInitialStatus(manual)),[highlighted,setHighlighted]=useState(!!a11ySelection),{storyId}=useStorybookState(),currentStoryA11yStatusValue=experimental_useStatusStore(allStatuses=>allStatuses[storyId]?.[STATUS_TYPE_ID_A11Y]?.value);useEffect(()=>experimental_getStatusStore("storybook/component-test").onAllStatusChange((statuses,previousStatuses)=>{let current=statuses[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST],previous=previousStatuses[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST];current?.value==="status-value:error"&&previous?.value!=="status-value:error"&&setStatus("component-test-error");}),[storyId]);let handleToggleHighlight=useCallback(()=>setHighlighted(prevHighlighted=>!prevHighlighted),[]),[selectedItems,setSelectedItems]=useState(()=>{let initialValue=new Map;if(a11ySelection&&/^[a-z]+.[a-z-]+.[0-9]+$/.test(a11ySelection)){let[type,id]=a11ySelection.split(".");initialValue.set(`${type}.${id}`,a11ySelection);}return initialValue}),allExpanded=useMemo(()=>results?.[tab]?.every(result=>selectedItems.has(`${tab}.${result.id}`))??!1,[results,selectedItems,tab]),toggleOpen=useCallback((event,type,item)=>{event.stopPropagation();let key=`${type}.${item.id}`;setSelectedItems(prev=>new Map(prev.delete(key)?prev:prev.set(key,`${key}.1`)));},[]),handleCollapseAll=useCallback(()=>{setSelectedItems(new Map);},[]),handleExpandAll=useCallback(()=>{setSelectedItems(prev=>new Map(results?.[tab]?.map(result=>{let key=`${tab}.${result.id}`;return [key,prev.get(key)??`${key}.1`]})??[]));},[results,tab]),handleSelectionChange=useCallback(key=>{let[type,id]=key.split(".");setSelectedItems(prev=>new Map(prev.set(`${type}.${id}`,key)));},[]),handleError=useCallback(err=>{setStatus("error"),setError(err);},[]),handleResult=useCallback((axeResults,id)=>{storyId===id&&(setStatus("ran"),setResults(axeResults),setTimeout(()=>{if(status==="ran"&&setStatus("ready"),selectedItems.size===1){let[key]=selectedItems.values();document.getElementById(key)?.scrollIntoView({behavior:"smooth",block:"center"});}},900));},[setResults,status,storyId,selectedItems]),handleSelect=useCallback((itemId,details)=>{let[type,id]=itemId.split("."),{helpUrl,nodes}=results?.[type]?.find(r=>r.id===id)||{},openedWindow=helpUrl&&window.open(helpUrl,"_blank","noopener,noreferrer");if(nodes&&!openedWindow){let index=nodes.findIndex(n=>details.selectors.some(s=>s===String(n.target)))??-1;if(index!==-1){let key=`${type}.${id}.${index+1}`;setSelectedItems(new Map([[`${type}.${id}`,key]])),setTimeout(()=>{document.getElementById(key)?.scrollIntoView({behavior:"smooth",block:"center"});},100);}}},[results]),handleReport=useCallback(({reporters})=>{let a11yReport=reporters.find(r=>r.type==="a11y");a11yReport&&("error"in a11yReport.result?handleError(a11yReport.result.error):handleResult(a11yReport.result,storyId));},[handleError,handleResult,storyId]),handleReset=useCallback(({newPhase})=>{newPhase==="loading"&&(setResults(void 0),setStatus(manual?"manual":"initial")),newPhase==="afterEach"&&!manual&&setStatus("running");},[manual,setResults]),emit=useChannel({[EVENTS.RESULT]:handleResult,[EVENTS.ERROR]:handleError,[EVENTS.SELECT]:handleSelect,[STORY_CHANGED]:()=>setSelectedItems(new Map),[STORY_RENDER_PHASE_CHANGED]:handleReset,[STORY_FINISHED]:handleReport,[STORY_HOT_UPDATED]:()=>{setStatus("running"),emit(EVENTS.MANUAL,storyId,parameters);}},[handleReset,handleReport,handleSelect,handleError,handleResult,parameters,storyId]),handleManual=useCallback(()=>{setStatus("running"),emit(EVENTS.MANUAL,storyId,parameters);},[emit,parameters,storyId]),handleCopyLink=useCallback(async linkPath=>{let{createCopyToClipboardFunction}=await import('storybook/internal/components');await createCopyToClipboardFunction()(`${window.location.origin}${linkPath}`);},[]),handleJumpToElement=useCallback(target=>emit(SCROLL_INTO_VIEW,target),[emit]);useEffect(()=>{setStatus(getInitialStatus(manual));},[getInitialStatus,manual]),useEffect(()=>{if(emit(REMOVE_HIGHLIGHT,`${ADDON_ID}/selected`),emit(REMOVE_HIGHLIGHT,`${ADDON_ID}/others`),!highlighted)return;let selected=Array.from(selectedItems.values()).flatMap(key=>{let[type,id,number]=key.split(".");if(type!==tab)return [];let target=results?.[type]?.find(r=>r.id===id)?.nodes[Number(number)-1]?.target;return target?[String(target)]:[]});emit(HIGHLIGHT,{id:`${ADDON_ID}/selected`,priority:1,selectors:selected,styles:{outline:`1px solid color-mix(in srgb, ${colorsByType[tab]}, transparent 30%)`,backgroundColor:"transparent"},hoverStyles:{outlineWidth:"2px"},focusStyles:{backgroundColor:"transparent"},menu:results?.[tab].map(result=>{let selectors=result.nodes.flatMap(n=>n.target).map(String).filter(e=>selected.includes(e));return [{id:`${tab}.${result.id}:info`,title:getTitleForAxeResult(result),description:getFriendlySummaryForAxeResult(result),selectors},{id:`${tab}.${result.id}`,iconLeft:"info",iconRight:"shareAlt",title:"Learn how to resolve this violation",clickEvent:EVENTS.SELECT,selectors}]})});let others=results?.[tab].flatMap(r=>r.nodes.flatMap(n=>n.target).map(String)).filter(e=>![...unhighlightedSelectors,...selected].includes(e));emit(HIGHLIGHT,{id:`${ADDON_ID}/others`,selectors:others,styles:{outline:`1px solid color-mix(in srgb, ${colorsByType[tab]}, transparent 30%)`,backgroundColor:`color-mix(in srgb, ${colorsByType[tab]}, transparent 60%)`},hoverStyles:{outlineWidth:"2px"},focusStyles:{backgroundColor:"transparent"},menu:results?.[tab].map(result=>{let selectors=result.nodes.flatMap(n=>n.target).map(String).filter(e=>!selected.includes(e));return [{id:`${tab}.${result.id}:info`,title:getTitleForAxeResult(result),description:getFriendlySummaryForAxeResult(result),selectors},{id:`${tab}.${result.id}`,iconLeft:"info",iconRight:"shareAlt",title:"Learn how to resolve this violation",clickEvent:EVENTS.SELECT,selectors}]})});},[emit,highlighted,results,tab,selectedItems]);let discrepancy=useMemo(()=>{if(!currentStoryA11yStatusValue)return null;if(currentStoryA11yStatusValue==="status-value:success"&&results?.violations.length)return "cliPassedBrowserFailed";if(currentStoryA11yStatusValue==="status-value:error"&&!results?.violations.length){if(status==="ready"||status==="ran")return "browserPassedCliFailed";if(status==="manual")return "cliFailedButModeManual"}return null},[results?.violations.length,status,currentStoryA11yStatusValue]);return React7__default.createElement(A11yContext.Provider,{value:{parameters,results,highlighted,toggleHighlight:handleToggleHighlight,tab,setTab,handleCopyLink,status,setStatus,error,handleManual,discrepancy,selectedItems,toggleOpen,allExpanded,handleCollapseAll,handleExpandAll,handleJumpToElement,handleSelectionChange},...props})},useA11yContext=()=>useContext(A11yContext);function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(n[r]=t[r]);}return n},_extends.apply(null,arguments)}function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler,ourEventHandler,{checkForDefaultPrevented=!0}={}){return function(event){if(originalEventHandler?.(event),checkForDefaultPrevented===!1||!event.defaultPrevented)return ourEventHandler?.(event)}}function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName,createContextScopeDeps=[]){let defaultContexts=[];function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName,defaultContext){let BaseContext=createContext(defaultContext),index=defaultContexts.length;defaultContexts=[...defaultContexts,defaultContext];function Provider(props){let{scope,children,...context}=props,Context=scope?.[scopeName][index]||BaseContext,value=useMemo(()=>context,Object.values(context));return createElement(Context.Provider,{value},children)}function useContext2(consumerName,scope){let Context=scope?.[scopeName][index]||BaseContext,context=useContext(Context);if(context)return context;if(defaultContext!==void 0)return defaultContext;throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``)}return Provider.displayName=rootComponentName+"Provider",[Provider,useContext2]}let createScope=()=>{let scopeContexts=defaultContexts.map(defaultContext=>createContext(defaultContext));return function(scope){let contexts=scope?.[scopeName]||scopeContexts;return useMemo(()=>({[`__scope${scopeName}`]:{...scope,[scopeName]:contexts}}),[scope,contexts])}};return createScope.scopeName=scopeName,[$c512c27ab02ef895$export$fd42f52fd3ae1109,$c512c27ab02ef895$var$composeContextScopes(createScope,...createContextScopeDeps)]}function $c512c27ab02ef895$var$composeContextScopes(...scopes){let baseScope=scopes[0];if(scopes.length===1)return baseScope;let createScope1=()=>{let scopeHooks=scopes.map(createScope=>({useScope:createScope(),scopeName:createScope.scopeName}));return function(overrideScopes){let nextScopes1=scopeHooks.reduce((nextScopes,{useScope,scopeName})=>{let currentScope=useScope(overrideScopes)[`__scope${scopeName}`];return {...nextScopes,...currentScope}},{});return useMemo(()=>({[`__scope${baseScope.scopeName}`]:nextScopes1}),[nextScopes1])}};return createScope1.scopeName=baseScope.scopeName,createScope1}function $6ed0406888f73fc4$var$setRef(ref,value){typeof ref=="function"?ref(value):ref!=null&&(ref.current=value);}function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs){return node=>refs.forEach(ref=>$6ed0406888f73fc4$var$setRef(ref,node))}function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs){return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs),refs)}var $5e63c961fc1ce211$export$8c6ed5c666ac1360=forwardRef((props,forwardedRef)=>{let{children,...slotProps}=props,childrenArray=Children.toArray(children),slottable=childrenArray.find($5e63c961fc1ce211$var$isSlottable);if(slottable){let newElement=slottable.props.children,newChildren=childrenArray.map(child=>child===slottable?Children.count(newElement)>1?Children.only(null):isValidElement(newElement)?newElement.props.children:null:child);return createElement($5e63c961fc1ce211$var$SlotClone,_extends({},slotProps,{ref:forwardedRef}),isValidElement(newElement)?cloneElement(newElement,void 0,newChildren):null)}return createElement($5e63c961fc1ce211$var$SlotClone,_extends({},slotProps,{ref:forwardedRef}),children)});$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName="Slot";var $5e63c961fc1ce211$var$SlotClone=forwardRef((props,forwardedRef)=>{let{children,...slotProps}=props;return isValidElement(children)?cloneElement(children,{...$5e63c961fc1ce211$var$mergeProps(slotProps,children.props),ref:forwardedRef?$6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef,children.ref):children.ref}):Children.count(children)>1?Children.only(null):null});$5e63c961fc1ce211$var$SlotClone.displayName="SlotClone";var $5e63c961fc1ce211$export$d9f1ccf0bdb05d45=({children})=>createElement(Fragment,null,children);function $5e63c961fc1ce211$var$isSlottable(child){return isValidElement(child)&&child.type===$5e63c961fc1ce211$export$d9f1ccf0bdb05d45}function $5e63c961fc1ce211$var$mergeProps(slotProps,childProps){let overrideProps={...childProps};for(let propName in childProps){let slotPropValue=slotProps[propName],childPropValue=childProps[propName];/^on[A-Z]/.test(propName)?slotPropValue&&childPropValue?overrideProps[propName]=(...args)=>{childPropValue(...args),slotPropValue(...args);}:slotPropValue&&(overrideProps[propName]=slotPropValue):propName==="style"?overrideProps[propName]={...slotPropValue,...childPropValue}:propName==="className"&&(overrideProps[propName]=[slotPropValue,childPropValue].filter(Boolean).join(" "));}return {...slotProps,...overrideProps}}function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name){let PROVIDER_NAME=name+"CollectionProvider",[createCollectionContext,createCollectionScope]=$c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME),[CollectionProviderImpl,useCollectionContext]=createCollectionContext(PROVIDER_NAME,{collectionRef:{current:null},itemMap:new Map}),CollectionProvider=props=>{let{scope,children}=props,ref=React7__default.useRef(null),itemMap=React7__default.useRef(new Map).current;return React7__default.createElement(CollectionProviderImpl,{scope,itemMap,collectionRef:ref},children)},COLLECTION_SLOT_NAME=name+"CollectionSlot",CollectionSlot=React7__default.forwardRef((props,forwardedRef)=>{let{scope,children}=props,context=useCollectionContext(COLLECTION_SLOT_NAME,scope),composedRefs=$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef,context.collectionRef);return React7__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360,{ref:composedRefs},children)}),ITEM_SLOT_NAME=name+"CollectionItemSlot",ITEM_DATA_ATTR="data-radix-collection-item",CollectionItemSlot=React7__default.forwardRef((props,forwardedRef)=>{let{scope,children,...itemData}=props,ref=React7__default.useRef(null),composedRefs=$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef,ref),context=useCollectionContext(ITEM_SLOT_NAME,scope);return React7__default.useEffect(()=>(context.itemMap.set(ref,{ref,...itemData}),()=>void context.itemMap.delete(ref))),React7__default.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360,{[ITEM_DATA_ATTR]:"",ref:composedRefs},children)});function useCollection(scope){let context=useCollectionContext(name+"CollectionConsumer",scope);return React7__default.useCallback(()=>{let collectionNode=context.collectionRef.current;if(!collectionNode)return [];let orderedNodes=Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));return Array.from(context.itemMap.values()).sort((a,b)=>orderedNodes.indexOf(a.ref.current)-orderedNodes.indexOf(b.ref.current))},[context.collectionRef,context.itemMap])}return [{Provider:CollectionProvider,Slot:CollectionSlot,ItemSlot:CollectionItemSlot},useCollection,createCollectionScope]}function $6ed0406888f73fc4$var$setRef2(ref,value){typeof ref=="function"?ref(value):ref!=null&&(ref.current=value);}function $6ed0406888f73fc4$export$43e446d32b3d21af2(...refs){return node=>refs.forEach(ref=>$6ed0406888f73fc4$var$setRef2(ref,node))}function $6ed0406888f73fc4$export$c7b2cbe3552a0d052(...refs){return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af2(...refs),refs)}var $9f79659886946c16$export$e5c5a5f917a5871c=globalThis?.document?useLayoutEffect:()=>{};var $1746a345f3d73bb7$var$useReactId=React7.useId||(()=>{}),$1746a345f3d73bb7$var$count=0;function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId){let[id,setId]=React7.useState($1746a345f3d73bb7$var$useReactId());return $9f79659886946c16$export$e5c5a5f917a5871c(()=>{deterministicId||setId(reactId=>reactId??String($1746a345f3d73bb7$var$count++));},[deterministicId]),deterministicId||(id?`radix-${id}`:"")}var $5e63c961fc1ce211$export$8c6ed5c666ac13602=forwardRef((props,forwardedRef)=>{let{children,...slotProps}=props,childrenArray=Children.toArray(children),slottable=childrenArray.find($5e63c961fc1ce211$var$isSlottable2);if(slottable){let newElement=slottable.props.children,newChildren=childrenArray.map(child=>child===slottable?Children.count(newElement)>1?Children.only(null):isValidElement(newElement)?newElement.props.children:null:child);return createElement($5e63c961fc1ce211$var$SlotClone2,_extends({},slotProps,{ref:forwardedRef}),isValidElement(newElement)?cloneElement(newElement,void 0,newChildren):null)}return createElement($5e63c961fc1ce211$var$SlotClone2,_extends({},slotProps,{ref:forwardedRef}),children)});$5e63c961fc1ce211$export$8c6ed5c666ac13602.displayName="Slot";var $5e63c961fc1ce211$var$SlotClone2=forwardRef((props,forwardedRef)=>{let{children,...slotProps}=props;return isValidElement(children)?cloneElement(children,{...$5e63c961fc1ce211$var$mergeProps2(slotProps,children.props),ref:forwardedRef?$6ed0406888f73fc4$export$43e446d32b3d21af2(forwardedRef,children.ref):children.ref}):Children.count(children)>1?Children.only(null):null});$5e63c961fc1ce211$var$SlotClone2.displayName="SlotClone";var $5e63c961fc1ce211$export$d9f1ccf0bdb05d452=({children})=>createElement(Fragment,null,children);function $5e63c961fc1ce211$var$isSlottable2(child){return isValidElement(child)&&child.type===$5e63c961fc1ce211$export$d9f1ccf0bdb05d452}function $5e63c961fc1ce211$var$mergeProps2(slotProps,childProps){let overrideProps={...childProps};for(let propName in childProps){let slotPropValue=slotProps[propName],childPropValue=childProps[propName];/^on[A-Z]/.test(propName)?slotPropValue&&childPropValue?overrideProps[propName]=(...args)=>{childPropValue(...args),slotPropValue(...args);}:slotPropValue&&(overrideProps[propName]=slotPropValue):propName==="style"?overrideProps[propName]={...slotPropValue,...childPropValue}:propName==="className"&&(overrideProps[propName]=[slotPropValue,childPropValue].filter(Boolean).join(" "));}return {...slotProps,...overrideProps}}var $8927f6f2acc4f386$var$NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$8927f6f2acc4f386$export$250ffa63cdc0d034=$8927f6f2acc4f386$var$NODES.reduce((primitive,node)=>{let Node=forwardRef((props,forwardedRef)=>{let{asChild,...primitiveProps}=props,Comp=asChild?$5e63c961fc1ce211$export$8c6ed5c666ac13602:node;return useEffect(()=>{window[Symbol.for("radix-ui")]=!0;},[]),createElement(Comp,_extends({},primitiveProps,{ref:forwardedRef}))});return Node.displayName=`Primitive.${node}`,{...primitive,[node]:Node}},{});function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback){let callbackRef=useRef(callback);return useEffect(()=>{callbackRef.current=callback;}),useMemo(()=>(...args)=>{var _callbackRef$current;return (_callbackRef$current=callbackRef.current)===null||_callbackRef$current===void 0?void 0:_callbackRef$current.call(callbackRef,...args)},[])}function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a2(callback){let callbackRef=useRef(callback);return useEffect(()=>{callbackRef.current=callback;}),useMemo(()=>(...args)=>{var _callbackRef$current;return (_callbackRef$current=callbackRef.current)===null||_callbackRef$current===void 0?void 0:_callbackRef$current.call(callbackRef,...args)},[])}function $71cd76cc60e0454e$export$6f32135080cb4c3({prop,defaultProp,onChange=()=>{}}){let[uncontrolledProp,setUncontrolledProp]=$71cd76cc60e0454e$var$useUncontrolledState({defaultProp,onChange}),isControlled=prop!==void 0,value1=isControlled?prop:uncontrolledProp,handleChange=$b1b2314f5f9a1d84$export$25bec8c6f54ee79a2(onChange),setValue=useCallback(nextValue=>{if(isControlled){let value=typeof nextValue=="function"?nextValue(prop):nextValue;value!==prop&&handleChange(value);}else setUncontrolledProp(nextValue);},[isControlled,prop,setUncontrolledProp,handleChange]);return [value1,setValue]}function $71cd76cc60e0454e$var$useUncontrolledState({defaultProp,onChange}){let uncontrolledState=useState(defaultProp),[value]=uncontrolledState,prevValueRef=useRef(value),handleChange=$b1b2314f5f9a1d84$export$25bec8c6f54ee79a2(onChange);return useEffect(()=>{prevValueRef.current!==value&&(handleChange(value),prevValueRef.current=value);},[value,prevValueRef,handleChange]),uncontrolledState}var $f631663db3294ace$var$DirectionContext=createContext(void 0);function $f631663db3294ace$export$b39126d51d94e6f3(localDir){let globalDir=useContext($f631663db3294ace$var$DirectionContext);return localDir||globalDir||"ltr"}var $d7bdfb9eb0fdf311$var$ENTRY_FOCUS="rovingFocusGroup.onEntryFocus",$d7bdfb9eb0fdf311$var$EVENT_OPTIONS={bubbles:!1,cancelable:!0},$d7bdfb9eb0fdf311$var$GROUP_NAME="RovingFocusGroup",[$d7bdfb9eb0fdf311$var$Collection,$d7bdfb9eb0fdf311$var$useCollection,$d7bdfb9eb0fdf311$var$createCollectionScope]=$e02a7d9cb1dc128c$export$c74125a8e3af6bb2($d7bdfb9eb0fdf311$var$GROUP_NAME),[$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext,$d7bdfb9eb0fdf311$export$c7109489551a4f4]=$c512c27ab02ef895$export$50c7b4e9d9f19c1($d7bdfb9eb0fdf311$var$GROUP_NAME,[$d7bdfb9eb0fdf311$var$createCollectionScope]),[$d7bdfb9eb0fdf311$var$RovingFocusProvider,$d7bdfb9eb0fdf311$var$useRovingFocusContext]=$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext($d7bdfb9eb0fdf311$var$GROUP_NAME),$d7bdfb9eb0fdf311$export$8699f7c8af148338=forwardRef((props,forwardedRef)=>createElement($d7bdfb9eb0fdf311$var$Collection.Provider,{scope:props.__scopeRovingFocusGroup},createElement($d7bdfb9eb0fdf311$var$Collection.Slot,{scope:props.__scopeRovingFocusGroup},createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl,_extends({},props,{ref:forwardedRef}))))),$d7bdfb9eb0fdf311$var$RovingFocusGroupImpl=forwardRef((props,forwardedRef)=>{let{__scopeRovingFocusGroup,orientation,loop=!1,dir,currentTabStopId:currentTabStopIdProp,defaultCurrentTabStopId,onCurrentTabStopIdChange,onEntryFocus,...groupProps}=props,ref=useRef(null),composedRefs=$6ed0406888f73fc4$export$c7b2cbe3552a0d052(forwardedRef,ref),direction=$f631663db3294ace$export$b39126d51d94e6f3(dir),[currentTabStopId=null,setCurrentTabStopId]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:currentTabStopIdProp,defaultProp:defaultCurrentTabStopId,onChange:onCurrentTabStopIdChange}),[isTabbingBackOut,setIsTabbingBackOut]=useState(!1),handleEntryFocus=$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEntryFocus),getItems=$d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup),isClickFocusRef=useRef(!1),[focusableItemsCount,setFocusableItemsCount]=useState(0);return useEffect(()=>{let node=ref.current;if(node)return node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS,handleEntryFocus),()=>node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS,handleEntryFocus)},[handleEntryFocus]),createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider,{scope:__scopeRovingFocusGroup,orientation,dir:direction,loop,currentTabStopId,onItemFocus:useCallback(tabStopId=>setCurrentTabStopId(tabStopId),[setCurrentTabStopId]),onItemShiftTab:useCallback(()=>setIsTabbingBackOut(!0),[]),onFocusableItemAdd:useCallback(()=>setFocusableItemsCount(prevCount=>prevCount+1),[]),onFocusableItemRemove:useCallback(()=>setFocusableItemsCount(prevCount=>prevCount-1),[])},createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div,_extends({tabIndex:isTabbingBackOut||focusableItemsCount===0?-1:0,"data-orientation":orientation},groupProps,{ref:composedRefs,style:{outline:"none",...props.style},onMouseDown:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown,()=>{isClickFocusRef.current=!0;}),onFocus:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus,event=>{let isKeyboardFocus=!isClickFocusRef.current;if(event.target===event.currentTarget&&isKeyboardFocus&&!isTabbingBackOut){let entryFocusEvent=new CustomEvent($d7bdfb9eb0fdf311$var$ENTRY_FOCUS,$d7bdfb9eb0fdf311$var$EVENT_OPTIONS);if(event.currentTarget.dispatchEvent(entryFocusEvent),!entryFocusEvent.defaultPrevented){let items=getItems().filter(item=>item.focusable),activeItem=items.find(item=>item.active),currentItem=items.find(item=>item.id===currentTabStopId),candidateNodes=[activeItem,currentItem,...items].filter(Boolean).map(item=>item.ref.current);$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes);}}isClickFocusRef.current=!1;}),onBlur:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur,()=>setIsTabbingBackOut(!1))})))}),$d7bdfb9eb0fdf311$var$ITEM_NAME="RovingFocusGroupItem",$d7bdfb9eb0fdf311$export$ab9df7c53fe8454=forwardRef((props,forwardedRef)=>{let{__scopeRovingFocusGroup,focusable=!0,active=!1,tabStopId,...itemProps}=props,autoId=$1746a345f3d73bb7$export$f680877a34711e37(),id=tabStopId||autoId,context=$d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME,__scopeRovingFocusGroup),isCurrentTabStop=context.currentTabStopId===id,getItems=$d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup),{onFocusableItemAdd,onFocusableItemRemove}=context;return useEffect(()=>{if(focusable)return onFocusableItemAdd(),()=>onFocusableItemRemove()},[focusable,onFocusableItemAdd,onFocusableItemRemove]),createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot,{scope:__scopeRovingFocusGroup,id,focusable,active},createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span,_extends({tabIndex:isCurrentTabStop?0:-1,"data-orientation":context.orientation},itemProps,{ref:forwardedRef,onMouseDown:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown,event=>{focusable?context.onItemFocus(id):event.preventDefault();}),onFocus:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus,()=>context.onItemFocus(id)),onKeyDown:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown,event=>{if(event.key==="Tab"&&event.shiftKey){context.onItemShiftTab();return}if(event.target!==event.currentTarget)return;let focusIntent=$d7bdfb9eb0fdf311$var$getFocusIntent(event,context.orientation,context.dir);if(focusIntent!==void 0){event.preventDefault();let candidateNodes=getItems().filter(item=>item.focusable).map(item=>item.ref.current);if(focusIntent==="last")candidateNodes.reverse();else if(focusIntent==="prev"||focusIntent==="next"){focusIntent==="prev"&&candidateNodes.reverse();let currentIndex=candidateNodes.indexOf(event.currentTarget);candidateNodes=context.loop?$d7bdfb9eb0fdf311$var$wrapArray(candidateNodes,currentIndex+1):candidateNodes.slice(currentIndex+1);}setTimeout(()=>$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes));}})})))}),$d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $d7bdfb9eb0fdf311$var$getDirectionAwareKey(key,dir){return dir!=="rtl"?key:key==="ArrowLeft"?"ArrowRight":key==="ArrowRight"?"ArrowLeft":key}function $d7bdfb9eb0fdf311$var$getFocusIntent(event,orientation,dir){let key=$d7bdfb9eb0fdf311$var$getDirectionAwareKey(event.key,dir);if(!(orientation==="vertical"&&["ArrowLeft","ArrowRight"].includes(key))&&!(orientation==="horizontal"&&["ArrowUp","ArrowDown"].includes(key)))return $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT[key]}function $d7bdfb9eb0fdf311$var$focusFirst(candidates){let PREVIOUSLY_FOCUSED_ELEMENT=document.activeElement;for(let candidate of candidates)if(candidate===PREVIOUSLY_FOCUSED_ELEMENT||(candidate.focus(),document.activeElement!==PREVIOUSLY_FOCUSED_ELEMENT))return}function $d7bdfb9eb0fdf311$var$wrapArray(array,startIndex){return array.map((_,index)=>array[(startIndex+index)%array.length])}var $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9=$d7bdfb9eb0fdf311$export$8699f7c8af148338,$d7bdfb9eb0fdf311$export$6d08773d2e66f8f2=$d7bdfb9eb0fdf311$export$ab9df7c53fe8454;function $6ed0406888f73fc4$var$setRef3(ref,value){typeof ref=="function"?ref(value):ref!=null&&(ref.current=value);}function $6ed0406888f73fc4$export$43e446d32b3d21af3(...refs){return node=>refs.forEach(ref=>$6ed0406888f73fc4$var$setRef3(ref,node))}function $6ed0406888f73fc4$export$c7b2cbe3552a0d053(...refs){return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af3(...refs),refs)}var $9f79659886946c16$export$e5c5a5f917a5871c2=globalThis?.document?useLayoutEffect:()=>{};function $fe963b355347cc68$export$3e6543de14f8614f(initialState,machine){return useReducer((state,event)=>{let nextState=machine[state][event];return nextState??state},initialState)}var $921a889cee6df7e8$export$99c2b779aa4e8b8b=props=>{let{present,children}=props,presence=$921a889cee6df7e8$var$usePresence(present),child=typeof children=="function"?children({present:presence.isPresent}):Children.only(children),ref=$6ed0406888f73fc4$export$c7b2cbe3552a0d053(presence.ref,child.ref);return typeof children=="function"||presence.isPresent?cloneElement(child,{ref}):null};$921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName="Presence";function $921a889cee6df7e8$var$usePresence(present){let[node1,setNode]=useState(),stylesRef=useRef({}),prevPresentRef=useRef(present),prevAnimationNameRef=useRef("none"),initialState=present?"mounted":"unmounted",[state,send]=$fe963b355347cc68$export$3e6543de14f8614f(initialState,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return useEffect(()=>{let currentAnimationName=$921a889cee6df7e8$var$getAnimationName(stylesRef.current);prevAnimationNameRef.current=state==="mounted"?currentAnimationName:"none";},[state]),$9f79659886946c16$export$e5c5a5f917a5871c2(()=>{let styles=stylesRef.current,wasPresent=prevPresentRef.current;if(wasPresent!==present){let prevAnimationName=prevAnimationNameRef.current,currentAnimationName=$921a889cee6df7e8$var$getAnimationName(styles);present?send("MOUNT"):currentAnimationName==="none"||styles?.display==="none"?send("UNMOUNT"):send(wasPresent&&prevAnimationName!==currentAnimationName?"ANIMATION_OUT":"UNMOUNT"),prevPresentRef.current=present;}},[present,send]),$9f79659886946c16$export$e5c5a5f917a5871c2(()=>{if(node1){let handleAnimationEnd=event=>{let isCurrentAnimation=$921a889cee6df7e8$var$getAnimationName(stylesRef.current).includes(event.animationName);event.target===node1&&isCurrentAnimation&&flushSync(()=>send("ANIMATION_END"));},handleAnimationStart=event=>{event.target===node1&&(prevAnimationNameRef.current=$921a889cee6df7e8$var$getAnimationName(stylesRef.current));};return node1.addEventListener("animationstart",handleAnimationStart),node1.addEventListener("animationcancel",handleAnimationEnd),node1.addEventListener("animationend",handleAnimationEnd),()=>{node1.removeEventListener("animationstart",handleAnimationStart),node1.removeEventListener("animationcancel",handleAnimationEnd),node1.removeEventListener("animationend",handleAnimationEnd);}}else send("ANIMATION_END");},[node1,send]),{isPresent:["mounted","unmountSuspended"].includes(state),ref:useCallback(node=>{node&&(stylesRef.current=getComputedStyle(node)),setNode(node);},[])}}function $921a889cee6df7e8$var$getAnimationName(styles){return styles?.animationName||"none"}function $6ed0406888f73fc4$var$setRef4(ref,value){typeof ref=="function"?ref(value):ref!=null&&(ref.current=value);}function $6ed0406888f73fc4$export$43e446d32b3d21af4(...refs){return node=>refs.forEach(ref=>$6ed0406888f73fc4$var$setRef4(ref,node))}var $5e63c961fc1ce211$export$8c6ed5c666ac13603=forwardRef((props,forwardedRef)=>{let{children,...slotProps}=props,childrenArray=Children.toArray(children),slottable=childrenArray.find($5e63c961fc1ce211$var$isSlottable3);if(slottable){let newElement=slottable.props.children,newChildren=childrenArray.map(child=>child===slottable?Children.count(newElement)>1?Children.only(null):isValidElement(newElement)?newElement.props.children:null:child);return createElement($5e63c961fc1ce211$var$SlotClone3,_extends({},slotProps,{ref:forwardedRef}),isValidElement(newElement)?cloneElement(newElement,void 0,newChildren):null)}return createElement($5e63c961fc1ce211$var$SlotClone3,_extends({},slotProps,{ref:forwardedRef}),children)});$5e63c961fc1ce211$export$8c6ed5c666ac13603.displayName="Slot";var $5e63c961fc1ce211$var$SlotClone3=forwardRef((props,forwardedRef)=>{let{children,...slotProps}=props;return isValidElement(children)?cloneElement(children,{...$5e63c961fc1ce211$var$mergeProps3(slotProps,children.props),ref:forwardedRef?$6ed0406888f73fc4$export$43e446d32b3d21af4(forwardedRef,children.ref):children.ref}):Children.count(children)>1?Children.only(null):null});$5e63c961fc1ce211$var$SlotClone3.displayName="SlotClone";var $5e63c961fc1ce211$export$d9f1ccf0bdb05d453=({children})=>createElement(Fragment,null,children);function $5e63c961fc1ce211$var$isSlottable3(child){return isValidElement(child)&&child.type===$5e63c961fc1ce211$export$d9f1ccf0bdb05d453}function $5e63c961fc1ce211$var$mergeProps3(slotProps,childProps){let overrideProps={...childProps};for(let propName in childProps){let slotPropValue=slotProps[propName],childPropValue=childProps[propName];/^on[A-Z]/.test(propName)?slotPropValue&&childPropValue?overrideProps[propName]=(...args)=>{childPropValue(...args),slotPropValue(...args);}:slotPropValue&&(overrideProps[propName]=slotPropValue):propName==="style"?overrideProps[propName]={...slotPropValue,...childPropValue}:propName==="className"&&(overrideProps[propName]=[slotPropValue,childPropValue].filter(Boolean).join(" "));}return {...slotProps,...overrideProps}}var $8927f6f2acc4f386$var$NODES2=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],$8927f6f2acc4f386$export$250ffa63cdc0d0342=$8927f6f2acc4f386$var$NODES2.reduce((primitive,node)=>{let Node=forwardRef((props,forwardedRef)=>{let{asChild,...primitiveProps}=props,Comp=asChild?$5e63c961fc1ce211$export$8c6ed5c666ac13603:node;return useEffect(()=>{window[Symbol.for("radix-ui")]=!0;},[]),createElement(Comp,_extends({},primitiveProps,{ref:forwardedRef}))});return Node.displayName=`Primitive.${node}`,{...primitive,[node]:Node}},{});var $69cb30bb0017df05$var$TABS_NAME="Tabs",[$69cb30bb0017df05$var$createTabsContext,$69cb30bb0017df05$export$355f5bd209d7b13a]=$c512c27ab02ef895$export$50c7b4e9d9f19c1($69cb30bb0017df05$var$TABS_NAME,[$d7bdfb9eb0fdf311$export$c7109489551a4f4]),$69cb30bb0017df05$var$useRovingFocusGroupScope=$d7bdfb9eb0fdf311$export$c7109489551a4f4(),[$69cb30bb0017df05$var$TabsProvider,$69cb30bb0017df05$var$useTabsContext]=$69cb30bb0017df05$var$createTabsContext($69cb30bb0017df05$var$TABS_NAME),$69cb30bb0017df05$export$b2539bed5023c21c=forwardRef((props,forwardedRef)=>{let{__scopeTabs,value:valueProp,onValueChange,defaultValue,orientation="horizontal",dir,activationMode="automatic",...tabsProps}=props,direction=$f631663db3294ace$export$b39126d51d94e6f3(dir),[value,setValue]=$71cd76cc60e0454e$export$6f32135080cb4c3({prop:valueProp,onChange:onValueChange,defaultProp:defaultValue});return createElement($69cb30bb0017df05$var$TabsProvider,{scope:__scopeTabs,baseId:$1746a345f3d73bb7$export$f680877a34711e37(),value,onValueChange:setValue,orientation,dir:direction,activationMode},createElement($8927f6f2acc4f386$export$250ffa63cdc0d0342.div,_extends({dir:direction,"data-orientation":orientation},tabsProps,{ref:forwardedRef})))}),$69cb30bb0017df05$var$TAB_LIST_NAME="TabsList",$69cb30bb0017df05$export$9712d22edc0d78c1=forwardRef((props,forwardedRef)=>{let{__scopeTabs,loop=!0,...listProps}=props,context=$69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME,__scopeTabs),rovingFocusGroupScope=$69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);return createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9,_extends({asChild:!0},rovingFocusGroupScope,{orientation:context.orientation,dir:context.dir,loop}),createElement($8927f6f2acc4f386$export$250ffa63cdc0d0342.div,_extends({role:"tablist","aria-orientation":context.orientation},listProps,{ref:forwardedRef})))}),$69cb30bb0017df05$var$TRIGGER_NAME="TabsTrigger",$69cb30bb0017df05$export$8114b9fdfdf9f3ba=forwardRef((props,forwardedRef)=>{let{__scopeTabs,value,disabled=!1,...triggerProps}=props,context=$69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TRIGGER_NAME,__scopeTabs),rovingFocusGroupScope=$69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs),triggerId=$69cb30bb0017df05$var$makeTriggerId(context.baseId,value),contentId=$69cb30bb0017df05$var$makeContentId(context.baseId,value),isSelected=value===context.value;return createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2,_extends({asChild:!0},rovingFocusGroupScope,{focusable:!disabled,active:isSelected}),createElement($8927f6f2acc4f386$export$250ffa63cdc0d0342.button,_extends({type:"button",role:"tab","aria-selected":isSelected,"aria-controls":contentId,"data-state":isSelected?"active":"inactive","data-disabled":disabled?"":void 0,disabled,id:triggerId},triggerProps,{ref:forwardedRef,onMouseDown:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown,event=>{!disabled&&event.button===0&&event.ctrlKey===!1?context.onValueChange(value):event.preventDefault();}),onKeyDown:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown,event=>{[" ","Enter"].includes(event.key)&&context.onValueChange(value);}),onFocus:$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus,()=>{let isAutomaticActivation=context.activationMode!=="manual";!isSelected&&!disabled&&isAutomaticActivation&&context.onValueChange(value);})})))}),$69cb30bb0017df05$var$CONTENT_NAME="TabsContent",$69cb30bb0017df05$export$bd905d70e8fd2ebb=forwardRef((props,forwardedRef)=>{let{__scopeTabs,value,forceMount,children,...contentProps}=props,context=$69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$CONTENT_NAME,__scopeTabs),triggerId=$69cb30bb0017df05$var$makeTriggerId(context.baseId,value),contentId=$69cb30bb0017df05$var$makeContentId(context.baseId,value),isSelected=value===context.value,isMountAnimationPreventedRef=useRef(isSelected);return useEffect(()=>{let rAF=requestAnimationFrame(()=>isMountAnimationPreventedRef.current=!1);return ()=>cancelAnimationFrame(rAF)},[]),createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b,{present:forceMount||isSelected},({present})=>createElement($8927f6f2acc4f386$export$250ffa63cdc0d0342.div,_extends({"data-state":isSelected?"active":"inactive","data-orientation":context.orientation,role:"tabpanel","aria-labelledby":triggerId,hidden:!present,id:contentId,tabIndex:0},contentProps,{ref:forwardedRef,style:{...props.style,animationDuration:isMountAnimationPreventedRef.current?"0s":void 0}}),present&&children))});function $69cb30bb0017df05$var$makeTriggerId(baseId,value){return `${baseId}-trigger-${value}`}function $69cb30bb0017df05$var$makeContentId(baseId,value){return `${baseId}-content-${value}`}var $69cb30bb0017df05$export$be92b6f5f03c0fe9=$69cb30bb0017df05$export$b2539bed5023c21c,$69cb30bb0017df05$export$54c2e3dc7acea9f5=$69cb30bb0017df05$export$9712d22edc0d78c1,$69cb30bb0017df05$export$41fb9f06171c75f4=$69cb30bb0017df05$export$8114b9fdfdf9f3ba,$69cb30bb0017df05$export$7c6e2c02157bb7d2=$69cb30bb0017df05$export$bd905d70e8fd2ebb;var StyledSyntaxHighlighter=styled(SyntaxHighlighter)(({theme:theme2})=>({fontSize:theme2.typography.size.s1}),({language})=>language==="css"&&{".selector ~ span:nth-last-of-type(-n+3)":{display:"none"}}),Info=styled.div({display:"flex",flexDirection:"column"}),RuleId=styled.div(({theme:theme2})=>({display:"block",color:theme2.textMutedColor,fontFamily:theme2.typography.fonts.mono,fontSize:theme2.typography.size.s1,marginTop:-8,marginBottom:12,"@container (min-width: 800px)":{display:"none"}})),Description=styled.p({margin:0}),Wrapper=styled.div({display:"flex",flexDirection:"column",padding:"0 15px 20px 15px",gap:20}),Columns=styled.div({gap:15,"@container (min-width: 800px)":{display:"grid",gridTemplateColumns:"50% 50%"}}),Content=styled.div(({theme:theme2,side})=>({display:side==="left"?"flex":"none",flexDirection:"column",gap:15,margin:side==="left"?"15px 0":0,padding:side==="left"?"0 15px":0,borderLeft:side==="left"?`1px solid ${theme2.color.border}`:"none","&:focus-visible":{outline:"none",borderRadius:4,boxShadow:`0 0 0 1px inset ${theme2.color.secondary}`},"@container (min-width: 800px)":{display:side==="left"?"none":"flex"}})),Item=styled(Button)(({theme:theme2})=>({fontFamily:theme2.typography.fonts.mono,fontWeight:theme2.typography.weight.regular,color:theme2.textMutedColor,height:40,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"block",width:"100%",textAlign:"left",padding:"0 12px",'&[data-state="active"]':{color:theme2.color.secondary,backgroundColor:theme2.background.hoverable}})),Messages=styled.div({display:"flex",flexDirection:"column",gap:10}),Actions=styled.div({display:"flex",gap:10}),CopyButton=({onClick})=>{let[copied,setCopied]=useState(!1),handleClick=useCallback(()=>{onClick(),setCopied(!0);let timeout=setTimeout(()=>setCopied(!1),2e3);return ()=>clearTimeout(timeout)},[onClick]);return React7__default.createElement(Button,{onClick:handleClick},copied?React7__default.createElement(CheckIcon,null):React7__default.createElement(CopyIcon,null)," ",copied?"Copied":"Copy link")},Details=({id,item,type,selection,handleSelectionChange})=>React7__default.createElement(Wrapper,{id},React7__default.createElement(Info,null,React7__default.createElement(RuleId,null,item.id),React7__default.createElement(Description,null,getFriendlySummaryForAxeResult(item)," ",React7__default.createElement(Link,{href:item.helpUrl,target:"_blank",rel:"noopener noreferrer",withArrow:!0},"Learn how to resolve this violation"))),React7__default.createElement($69cb30bb0017df05$export$be92b6f5f03c0fe9,{defaultValue:selection,orientation:"vertical",value:selection,onValueChange:handleSelectionChange,asChild:!0},React7__default.createElement(Columns,null,React7__default.createElement($69cb30bb0017df05$export$54c2e3dc7acea9f5,{"aria-label":type},item.nodes.map((node,index)=>{let key=`${type}.${item.id}.${index+1}`;return React7__default.createElement(Fragment,{key},React7__default.createElement($69cb30bb0017df05$export$41fb9f06171c75f4,{value:key,asChild:!0},React7__default.createElement(Item,{variant:"ghost",size:"medium",id:key},index+1,". ",node.html)),React7__default.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2,{value:key,asChild:!0},React7__default.createElement(Content,{side:"left"},getContent(node))))})),item.nodes.map((node,index)=>{let key=`${type}.${item.id}.${index+1}`;return React7__default.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2,{key,value:key,asChild:!0},React7__default.createElement(Content,{side:"right"},getContent(node)))}))));function getContent(node){let{handleCopyLink,handleJumpToElement}=useA11yContext(),{any,all,none,html,target}=node,rules=[...any,...all,...none];return React7__default.createElement(React7__default.Fragment,null,React7__default.createElement(Messages,null,rules.map(rule=>React7__default.createElement("div",{key:rule.id},`${rule.message}${/(\.|: [^.]+\.*)$/.test(rule.message)?"":"."}`))),React7__default.createElement(Actions,null,React7__default.createElement(Button,{onClick:()=>handleJumpToElement(node.target.toString())},React7__default.createElement(LocationIcon,null)," Jump to element"),React7__default.createElement(CopyButton,{onClick:()=>handleCopyLink(node.linkPath)})),React7__default.createElement(StyledSyntaxHighlighter,{language:"jsx",wrapLongLines:!0},`/* element */
12
12
  ${html}`),React7__default.createElement(StyledSyntaxHighlighter,{language:"css",wrapLongLines:!0},`/* selector */
13
- ${target} {}`))}var impactStatus={minor:"neutral",moderate:"warning",serious:"negative",critical:"critical"},impactLabels={minor:"Minor",moderate:"Moderate",serious:"Serious",critical:"Critical"},Wrapper2=styled.div(({theme:theme2})=>({display:"flex",flexDirection:"column",width:"100%",borderBottom:`1px solid ${theme2.appBorderColor}`,containerType:"inline-size",fontSize:theme2.typography.size.s2})),Icon=styled(ChevronSmallDownIcon)({transition:"transform 0.1s ease-in-out"}),HeaderBar=styled.div(({theme:theme2})=>({display:"flex",justifyContent:"space-between",alignItems:"center",gap:6,padding:"6px 10px 6px 15px",minHeight:40,background:"none",color:"inherit",textAlign:"left",cursor:"pointer",width:"100%","&:hover":{color:theme2.color.secondary}})),Title=styled.div(({theme:theme2})=>({display:"flex",alignItems:"baseline",flexGrow:1,fontSize:theme2.typography.size.s2,gap:8})),RuleId2=styled.div(({theme:theme2})=>({display:"none",color:theme2.textMutedColor,fontFamily:theme2.typography.fonts.mono,fontSize:theme2.typography.size.s1,"@container (min-width: 800px)":{display:"block"}})),Count=styled.div(({theme:theme2})=>({display:"flex",alignItems:"center",justifyContent:"center",color:theme2.textMutedColor,width:28,height:28})),Report=({items,empty,type,handleSelectionChange,selectedItems,toggleOpen})=>React7__default.createElement(React7__default.Fragment,null,items&&items.length?items.map(item=>{let id=`${type}.${item.id}`,detailsId=`details:${id}`,selection=selectedItems.get(id),title=getTitleForAxeResult(item);return React7__default.createElement(Wrapper2,{key:id},React7__default.createElement(HeaderBar,{onClick:event=>toggleOpen(event,type,item),"data-active":!!selection},React7__default.createElement(Title,null,React7__default.createElement("strong",null,title),React7__default.createElement(RuleId2,null,item.id)),item.impact&&React7__default.createElement(Badge,{status:type===RuleType.PASS?"neutral":impactStatus[item.impact]},impactLabels[item.impact]),React7__default.createElement(Count,null,item.nodes.length),React7__default.createElement(IconButton,{onClick:event=>toggleOpen(event,type,item),"aria-label":`${selection?"Collapse":"Expand"} details for ${title}`,"aria-expanded":!!selection,"aria-controls":detailsId},React7__default.createElement(Icon,{style:{transform:`rotate(${selection?-180:0}deg)`}}))),selection?React7__default.createElement(Details,{id:detailsId,item,type,selection,handleSelectionChange}):React7__default.createElement("div",{id:detailsId}))}):React7__default.createElement(EmptyTabContent,{title:empty}));var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2;}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p]);},extendStatics(d,b)};function __extends(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d;}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __);}var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);}return t},__assign.apply(this,arguments)};function __rest(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function isObject$3(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}var isObject_1=isObject$3,freeGlobal$1=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$2=freeGlobal||freeSelf||Function("return this")(),_root=root$2,root$1=_root,now$1=function(){return root$1.Date.now()},now_1=now$1,reWhitespace=/\s/;function trimmedEndIndex$1(string){for(var index=string.length;index--&&reWhitespace.test(string.charAt(index)););return index}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(string){return string&&string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,root=_root,Symbol$2=root.Symbol,_Symbol=Symbol$2,Symbol$1=_Symbol,objectProto$1=Object.prototype,hasOwnProperty=objectProto$1.hasOwnProperty,nativeObjectToString$1=objectProto$1.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag$1(value){var isOwn=hasOwnProperty.call(value,symToStringTag$1),tag=value[symToStringTag$1];try{value[symToStringTag$1]=void 0;var unmasked=!0;}catch{}var result=nativeObjectToString$1.call(value);return unmasked&&(isOwn?value[symToStringTag$1]=tag:delete value[symToStringTag$1]),result}var _getRawTag=getRawTag$1,objectProto=Object.prototype,nativeObjectToString=objectProto.toString;function objectToString$1(value){return nativeObjectToString.call(value)}var _objectToString=objectToString$1,Symbol2=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol2?Symbol2.toStringTag:void 0;function baseGetTag$1(value){return value==null?value===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}var _baseGetTag=baseGetTag$1;function isObjectLike$1(value){return value!=null&&typeof value=="object"}var isObjectLike_1=isObjectLike$1,baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1,symbolTag="[object Symbol]";function isSymbol$1(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}var isSymbol_1=isSymbol$1,baseTrim=_baseTrim,isObject$2=isObject_1,isSymbol=isSymbol_1,NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(value){if(typeof value=="number")return value;if(isSymbol(value))return NAN;if(isObject$2(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject$2(other)?other+"":other;}if(typeof value!="string")return value===0?value:+value;value=baseTrim(value);var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}var toNumber_1=toNumber$1,isObject$1=isObject_1,now=now_1,toNumber=toNumber_1,FUNC_ERROR_TEXT$1="Expected a function",nativeMax=Math.max,nativeMin=Math.min;function debounce$1(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=!1,maxing=!1,trailing=!0;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT$1);wait=toNumber(wait)||0,isObject$1(options)&&(leading=!!options.leading,maxing="maxWait"in options,maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait,trailing="trailing"in options?!!options.trailing:trailing);function invokeFunc(time){var args=lastArgs,thisArg=lastThis;return lastArgs=lastThis=void 0,lastInvokeTime=time,result=func.apply(thisArg,args),result}function leadingEdge(time){return lastInvokeTime=time,timerId=setTimeout(timerExpired,wait),leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===void 0||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time));}function trailingEdge(time){return timerId=void 0,trailing&&lastArgs?invokeFunc(time):(lastArgs=lastThis=void 0,result)}function cancel(){timerId!==void 0&&clearTimeout(timerId),lastInvokeTime=0,lastArgs=lastCallTime=lastThis=timerId=void 0;}function flush(){return timerId===void 0?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);if(lastArgs=arguments,lastThis=this,lastCallTime=time,isInvoking){if(timerId===void 0)return leadingEdge(lastCallTime);if(maxing)return clearTimeout(timerId),timerId=setTimeout(timerExpired,wait),invokeFunc(lastCallTime)}return timerId===void 0&&(timerId=setTimeout(timerExpired,wait)),result}return debounced.cancel=cancel,debounced.flush=flush,debounced}var debounce_1=debounce$1,debounce=debounce_1,isObject=isObject_1,FUNC_ERROR_TEXT="Expected a function";function throttle(func,wait,options){var leading=!0,trailing=!0;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);return isObject(options)&&(leading="leading"in options?!!options.leading:leading,trailing="trailing"in options?!!options.trailing:trailing),debounce(func,wait,{leading,maxWait:wait,trailing})}var throttle_1=throttle,patchResizeHandler=function(resizeCallback,refreshMode,refreshRate,refreshOptions){switch(refreshMode){case"debounce":return debounce_1(resizeCallback,refreshRate,refreshOptions);case"throttle":return throttle_1(resizeCallback,refreshRate,refreshOptions);default:return resizeCallback}},isFunction=function(fn){return typeof fn=="function"},isSSR=function(){return typeof window>"u"},isDOMElement=function(element){return element instanceof Element||element instanceof HTMLDocument},createNotifier=function(onResize,setSize,handleWidth,handleHeight){return function(_a){var width=_a.width,height=_a.height;setSize(function(prev){return prev.width===width&&prev.height===height||prev.width===width&&!handleHeight||prev.height===height&&!handleWidth?prev:(onResize&&isFunction(onResize)&&onResize(width,height),{width,height})});}};(function(_super){__extends(ResizeDetector2,_super);function ResizeDetector2(props){var _this=_super.call(this,props)||this;_this.cancelHandler=function(){_this.resizeHandler&&_this.resizeHandler.cancel&&(_this.resizeHandler.cancel(),_this.resizeHandler=null);},_this.attachObserver=function(){var _a2=_this.props,targetRef=_a2.targetRef,observerOptions=_a2.observerOptions;if(!isSSR()){targetRef&&targetRef.current&&(_this.targetRef.current=targetRef.current);var element=_this.getElement();element&&(_this.observableElement&&_this.observableElement===element||(_this.observableElement=element,_this.resizeObserver.observe(element,observerOptions)));}},_this.getElement=function(){var _a2=_this.props,querySelector=_a2.querySelector,targetDomEl=_a2.targetDomEl;if(isSSR())return null;if(querySelector)return document.querySelector(querySelector);if(targetDomEl&&isDOMElement(targetDomEl))return targetDomEl;if(_this.targetRef&&isDOMElement(_this.targetRef.current))return _this.targetRef.current;var currentElement=findDOMNode(_this);if(!currentElement)return null;var renderType=_this.getRenderType();switch(renderType){case"renderProp":return currentElement;case"childFunction":return currentElement;case"child":return currentElement;case"childArray":return currentElement;default:return currentElement.parentElement}},_this.createResizeHandler=function(entries){var _a2=_this.props,_b=_a2.handleWidth,handleWidth=_b===void 0?!0:_b,_c=_a2.handleHeight,handleHeight=_c===void 0?!0:_c,onResize=_a2.onResize;if(!(!handleWidth&&!handleHeight)){var notifyResize=createNotifier(onResize,_this.setState.bind(_this),handleWidth,handleHeight);entries.forEach(function(entry){var _a3=entry&&entry.contentRect||{},width=_a3.width,height=_a3.height,shouldSetSize=!_this.skipOnMount&&!isSSR();shouldSetSize&&notifyResize({width,height}),_this.skipOnMount=!1;});}},_this.getRenderType=function(){var _a2=_this.props,render=_a2.render,children=_a2.children;return isFunction(render)?"renderProp":isFunction(children)?"childFunction":isValidElement(children)?"child":Array.isArray(children)?"childArray":"parent"};var skipOnMount=props.skipOnMount,refreshMode=props.refreshMode,_a=props.refreshRate,refreshRate=_a===void 0?1e3:_a,refreshOptions=props.refreshOptions;return _this.state={width:void 0,height:void 0},_this.skipOnMount=skipOnMount,_this.targetRef=createRef(),_this.observableElement=null,isSSR()||(_this.resizeHandler=patchResizeHandler(_this.createResizeHandler,refreshMode,refreshRate,refreshOptions),_this.resizeObserver=new window.ResizeObserver(_this.resizeHandler)),_this}return ResizeDetector2.prototype.componentDidMount=function(){this.attachObserver();},ResizeDetector2.prototype.componentDidUpdate=function(){this.attachObserver();},ResizeDetector2.prototype.componentWillUnmount=function(){isSSR()||(this.observableElement=null,this.resizeObserver.disconnect(),this.cancelHandler());},ResizeDetector2.prototype.render=function(){var _a=this.props,render=_a.render,children=_a.children,_b=_a.nodeType,WrapperTag=_b===void 0?"div":_b,_c=this.state,width=_c.width,height=_c.height,childProps={width,height,targetRef:this.targetRef},renderType=this.getRenderType(),typedChildren;switch(renderType){case"renderProp":return render&&render(childProps);case"childFunction":return typedChildren=children,typedChildren(childProps);case"child":if(typedChildren=children,typedChildren.type&&typeof typedChildren.type=="string"){childProps.targetRef;var nativeProps=__rest(childProps,["targetRef"]);return cloneElement(typedChildren,nativeProps)}return cloneElement(typedChildren,childProps);case"childArray":return typedChildren=children,typedChildren.map(function(el){return !!el&&cloneElement(el,childProps)});default:return React7.createElement(WrapperTag,null)}},ResizeDetector2})(PureComponent);var useEnhancedEffect=isSSR()?useEffect:useLayoutEffect;function useResizeDetector(props){props===void 0&&(props={});var _a=props.skipOnMount,skipOnMount=_a===void 0?!1:_a,refreshMode=props.refreshMode,_b=props.refreshRate,refreshRate=_b===void 0?1e3:_b,refreshOptions=props.refreshOptions,_c=props.handleWidth,handleWidth=_c===void 0?!0:_c,_d=props.handleHeight,handleHeight=_d===void 0?!0:_d,targetRef=props.targetRef,observerOptions=props.observerOptions,onResize=props.onResize,skipResize=useRef(skipOnMount),localRef=useRef(null),ref=targetRef??localRef,resizeHandler=useRef(),_e=useState({width:void 0,height:void 0}),size=_e[0],setSize=_e[1];return useEnhancedEffect(function(){if(!isSSR()){var notifyResize=createNotifier(onResize,setSize,handleWidth,handleHeight),resizeCallback=function(entries){!handleWidth&&!handleHeight||entries.forEach(function(entry){var _a2=entry&&entry.contentRect||{},width=_a2.width,height=_a2.height,shouldSetSize=!skipResize.current&&!isSSR();shouldSetSize&&notifyResize({width,height}),skipResize.current=!1;});};resizeHandler.current=patchResizeHandler(resizeCallback,refreshMode,refreshRate,refreshOptions);var resizeObserver=new window.ResizeObserver(resizeHandler.current);return ref.current&&resizeObserver.observe(ref.current,observerOptions),function(){resizeObserver.disconnect();var patchedResizeHandler=resizeHandler.current;patchedResizeHandler&&patchedResizeHandler.cancel&&patchedResizeHandler.cancel();}}},[refreshMode,refreshRate,refreshOptions,handleWidth,handleHeight,onResize,observerOptions,ref.current]),__assign({ref},size)}var Container=styled.div({width:"100%",position:"relative",minHeight:"100%"}),Item2=styled.button(({theme:theme2})=>({textDecoration:"none",padding:"10px 15px",cursor:"pointer",color:theme2.textMutedColor,fontWeight:theme2.typography.weight.bold,fontSize:theme2.typography.size.s2-1,lineHeight:1,height:40,border:"none",borderBottom:"3px solid transparent",background:"transparent","&:focus":{outline:"0 none",borderColor:theme2.color.secondary}}),({active,theme:theme2})=>active?{opacity:1,color:theme2.color.secondary,borderColor:theme2.color.secondary}:{}),Subnav=styled.div(({theme:theme2})=>({boxShadow:`${theme2.appBorderColor} 0 -1px 0 0 inset`,background:theme2.background.app,position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",whiteSpace:"nowrap",overflow:"auto",paddingRight:10,gap:6})),TabsWrapper=styled.div({}),ActionsWrapper=styled.div({display:"flex",flexBasis:"100%",justifyContent:"flex-end",containerType:"inline-size",minWidth:96,gap:6}),ToggleButton=styled(IconButton)({"@container (max-width: 193px)":{span:{display:"none"}}}),Tabs=({tabs})=>{let{ref}=useResizeDetector({refreshMode:"debounce",handleHeight:!1,handleWidth:!0}),{tab:activeTab,setTab,toggleHighlight,highlighted,handleManual,allExpanded,handleCollapseAll,handleExpandAll}=useA11yContext(),handleToggle=React7.useCallback(event=>{setTab(event.currentTarget.getAttribute("data-type"));},[setTab]);return React7.createElement(Container,{ref},React7.createElement(Subnav,null,React7.createElement(TabsWrapper,{role:"tablist"},tabs.map((tab,index)=>React7.createElement(Item2,{role:"tab",key:index,"data-type":tab.type,"data-active":activeTab===tab.type,"aria-selected":activeTab===tab.type,active:activeTab===tab.type,onClick:handleToggle},tab.label))),React7.createElement(ActionsWrapper,null,React7.createElement(WithTooltip,{as:"div",hasChrome:!1,placement:"top",tooltip:React7.createElement(TooltipNote,{note:"Highlight elements with accessibility violations"}),trigger:"hover"},React7.createElement(ToggleButton,{onClick:toggleHighlight,active:highlighted},highlighted?React7.createElement(EyeCloseIcon,null):React7.createElement(EyeIcon,null),React7.createElement("span",null,highlighted?"Hide highlights":"Show highlights"))),React7.createElement(WithTooltip,{as:"div",hasChrome:!1,placement:"top",tooltip:React7.createElement(TooltipNote,{note:allExpanded?"Collapse all":"Expand all"}),trigger:"hover"},React7.createElement(IconButton,{onClick:allExpanded?handleCollapseAll:handleExpandAll,"aria-label":allExpanded?"Collapse all":"Expand all"},allExpanded?React7.createElement(CollapseIcon,null):React7.createElement(ExpandAltIcon,null))),React7.createElement(WithTooltip,{as:"div",hasChrome:!1,placement:"top",tooltip:React7.createElement(TooltipNote,{note:"Rerun the accessibility scan"}),trigger:"hover"},React7.createElement(IconButton,{onClick:handleManual,"aria-label":"Rerun accessibility scan"},React7.createElement(SyncIcon,null))))),React7.createElement(ScrollArea,{vertical:!0,horizontal:!0},tabs.find(t=>t.type===activeTab)?.panel))};var Wrapper3=styled.div(({theme:{color,typography,background}})=>({textAlign:"start",padding:"11px 15px",fontSize:`${typography.size.s2}px`,fontWeight:typography.weight.regular,lineHeight:"1rem",background:background.app,borderBottom:`1px solid ${color.border}`,color:color.defaultText,backgroundClip:"padding-box",position:"relative",code:{fontSize:`${typography.size.s1-1}px`,color:"inherit",margin:"0 0.2em",padding:"0 0.2em",background:"rgba(255, 255, 255, 0.8)",borderRadius:"2px",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.1)"}})),TestDiscrepancyMessage=({discrepancy})=>{let docsUrl=useStorybookApi().getDocsUrl({subpath:DOCUMENTATION_DISCREPANCY_LINK,versioned:!0,renderer:!0}),message=useMemo(()=>{switch(discrepancy){case"browserPassedCliFailed":return "Accessibility checks passed in this browser but failed in the CLI.";case"cliPassedBrowserFailed":return "Accessibility checks passed in the CLI but failed in this browser.";case"cliFailedButModeManual":return "Accessibility checks failed in the CLI. Run the tests manually to see the results.";default:return null}},[discrepancy]);return message?React7__default.createElement(Wrapper3,null,message," ",React7__default.createElement(Link,{href:docsUrl,target:"_blank",withArrow:!0},"Learn what could cause this")):null};var RotatingIcon=styled(SyncIcon)(({theme:theme2})=>({animation:`${theme2.animation.rotate360} 1s linear infinite;`,margin:4})),Tab=styled.div({display:"flex",alignItems:"center",gap:6}),Centered=styled.span(({theme:theme2})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",fontSize:theme2.typography.size.s2,height:"100%",gap:24,div:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},p:{margin:0,color:theme2.textMutedColor},code:{display:"inline-block",fontSize:theme2.typography.size.s2-1,backgroundColor:theme2.background.app,border:`1px solid ${theme2.color.border}`,borderRadius:4,padding:"2px 3px"}})),A11YPanel=()=>{let{parameters,tab,results,status,handleManual,error,discrepancy,handleSelectionChange,selectedItems,toggleOpen}=useA11yContext(),tabs=useMemo(()=>{let{passes,incomplete,violations}=results??{passes:[],incomplete:[],violations:[]};return [{label:React7__default.createElement(Tab,null,"Violations",React7__default.createElement(Badge,{compact:!0,status:tab==="violations"?"active":"neutral"},violations.length)),panel:React7__default.createElement(Report,{items:violations,type:RuleType.VIOLATION,empty:"No accessibility violations found.",handleSelectionChange,selectedItems,toggleOpen}),items:violations,type:RuleType.VIOLATION},{label:React7__default.createElement(Tab,null,"Passes",React7__default.createElement(Badge,{compact:!0,status:tab==="passes"?"active":"neutral"},passes.length)),panel:React7__default.createElement(Report,{items:passes,type:RuleType.PASS,empty:"No passing accessibility checks found.",handleSelectionChange,selectedItems,toggleOpen}),items:passes,type:RuleType.PASS},{label:React7__default.createElement(Tab,null,"Inconclusive",React7__default.createElement(Badge,{compact:!0,status:tab==="incomplete"?"active":"neutral"},incomplete.length)),panel:React7__default.createElement(Report,{items:incomplete,type:RuleType.INCOMPLETION,empty:"No inconclusive accessibility checks found.",handleSelectionChange,selectedItems,toggleOpen}),items:incomplete,type:RuleType.INCOMPLETION}]},[tab,results,handleSelectionChange,selectedItems,toggleOpen]);return parameters.disable||parameters.test==="off"?React7__default.createElement(Centered,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"Accessibility tests are disabled for this story"),React7__default.createElement("p",null,"Update"," ",React7__default.createElement("code",null,parameters.disable?"parameters.a11y.disable":"parameters.a11y.test")," ","to enable accessibility tests."))):React7__default.createElement(React7__default.Fragment,null,discrepancy&&React7__default.createElement(TestDiscrepancyMessage,{discrepancy}),status==="ready"||status==="ran"?React7__default.createElement(Tabs,{key:"tabs",tabs}):React7__default.createElement(Centered,{style:{marginTop:discrepancy?"1em":0}},status==="initial"&&React7__default.createElement("div",null,React7__default.createElement(RotatingIcon,{size:12}),React7__default.createElement("strong",null,"Preparing accessibility scan"),React7__default.createElement("p",null,"Please wait while the addon is initializing...")),status==="manual"&&React7__default.createElement(React7__default.Fragment,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"Accessibility tests run manually for this story"),React7__default.createElement("p",null,"Results will not show when using the testing module. You can still run accessibility tests manually.")),React7__default.createElement(Button,{size:"medium",onClick:handleManual},"Run accessibility scan"),React7__default.createElement("p",null,"Update ",React7__default.createElement("code",null,"globals.a11y.manual")," to disable manual mode.")),status==="running"&&React7__default.createElement("div",null,React7__default.createElement(RotatingIcon,{size:12}),React7__default.createElement("strong",null,"Accessibility scan in progress"),React7__default.createElement("p",null,"Please wait while the accessibility scan is running...")),status==="error"&&React7__default.createElement(React7__default.Fragment,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"The accessibility scan encountered an error"),React7__default.createElement("p",null,typeof error=="string"?error:error instanceof Error?error.toString():JSON.stringify(error,null,2))),React7__default.createElement(Button,{size:"medium",onClick:handleManual},"Rerun accessibility scan")),status==="component-test-error"&&React7__default.createElement(React7__default.Fragment,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"This story's component tests failed"),React7__default.createElement("p",null,"Automated accessibility tests will not run until this is resolved. You can still test manually.")),React7__default.createElement(Button,{size:"medium",onClick:handleManual},"Run accessibility scan"))))};var Filters=props=>React7.createElement("svg",{...props},React7.createElement("defs",null,React7.createElement("filter",{id:"protanopia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.567, 0.433, 0, 0, 0 0.558, 0.442, 0, 0, 0 0, 0.242, 0.758, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"protanomaly"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.817, 0.183, 0, 0, 0 0.333, 0.667, 0, 0, 0 0, 0.125, 0.875, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"deuteranopia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.625, 0.375, 0, 0, 0 0.7, 0.3, 0, 0, 0 0, 0.3, 0.7, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"deuteranomaly"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.8, 0.2, 0, 0, 0 0.258, 0.742, 0, 0, 0 0, 0.142, 0.858, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"tritanopia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.95, 0.05, 0, 0, 0 0, 0.433, 0.567, 0, 0 0, 0.475, 0.525, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"tritanomaly"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.967, 0.033, 0, 0, 0 0, 0.733, 0.267, 0, 0 0, 0.183, 0.817, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"achromatopsia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.299, 0.587, 0.114, 0, 0 0.299, 0.587, 0.114, 0, 0 0.299, 0.587, 0.114, 0, 0 0, 0, 0, 1, 0"}))));var iframeId="storybook-preview-iframe",baseList=[{name:"blurred vision",percentage:22.9},{name:"deuteranomaly",percentage:2.7},{name:"deuteranopia",percentage:.56},{name:"protanomaly",percentage:.66},{name:"protanopia",percentage:.59},{name:"tritanomaly",percentage:.01},{name:"tritanopia",percentage:.016},{name:"achromatopsia",percentage:1e-4},{name:"grayscale"}],getFilter=filterName=>filterName?filterName==="blurred vision"?"blur(2px)":filterName==="grayscale"?"grayscale(100%)":`url('#${filterName}')`:"none",Hidden=styled.div({"&, & svg":{position:"absolute",width:0,height:0}}),ColorIcon=styled.span({background:"linear-gradient(to right, #F44336, #FF9800, #FFEB3B, #8BC34A, #2196F3, #9C27B0)",borderRadius:"1rem",display:"block",height:"1rem",width:"1rem"},({filter})=>({filter:getFilter(filter)}),({theme:theme2})=>({boxShadow:`${theme2.appBorderColor} 0 0 0 1px inset`})),Column=styled.span({display:"flex",flexDirection:"column"}),Title2=styled.span({textTransform:"capitalize"}),Description2=styled.span(({theme:theme2})=>({fontSize:11,color:theme2.textMutedColor})),getColorList=(active,set)=>[...active!==null?[{id:"reset",title:"Reset color filter",onClick:()=>{set(null);},right:void 0,active:!1}]:[],...baseList.map(i=>{let description=i.percentage!==void 0?`${i.percentage}% of users`:void 0;return {id:i.name,title:React7__default.createElement(Column,null,React7__default.createElement(Title2,null,i.name),description&&React7__default.createElement(Description2,null,description)),onClick:()=>{set(i);},right:React7__default.createElement(ColorIcon,{filter:i.name}),active:active===i}})],VisionSimulator=()=>{let[filter,setFilter]=useState(null);return React7__default.createElement(React7__default.Fragment,null,filter&&React7__default.createElement(Global,{styles:{[`#${iframeId}`]:{filter:getFilter(filter.name)}}}),React7__default.createElement(WithTooltip,{placement:"top",tooltip:({onHide})=>{let colorList=getColorList(filter,i=>{setFilter(i),onHide();});return React7__default.createElement(TooltipLinkList,{links:colorList})},closeOnOutsideClick:!0,onDoubleClick:()=>setFilter(null)},React7__default.createElement(IconButton,{key:"filter",active:!!filter,title:"Vision simulator"},React7__default.createElement(AccessibilityIcon,null))),React7__default.createElement(Hidden,null,React7__default.createElement(Filters,null)))};var Title3=()=>{let selectedPanel=useStorybookApi().getSelectedPanel(),[addonState]=useAddonState(ADDON_ID),violationsNb=addonState?.violations?.length||0,incompleteNb=addonState?.incomplete?.length||0,count=violationsNb+incompleteNb;return React7__default.createElement("div",{style:{display:"flex",alignItems:"center",gap:6}},React7__default.createElement("span",null,"Accessibility"),count===0?null:React7__default.createElement(Badge,{compact:!0,status:selectedPanel===PANEL_ID?"active":"neutral"},count))};addons.register(ADDON_ID,api=>{addons.add(PANEL_ID,{title:"",type:types.TOOL,match:({viewMode,tabId})=>viewMode==="story"&&!tabId,render:()=>React7__default.createElement(VisionSimulator,null)}),addons.add(PANEL_ID,{title:Title3,type:types.PANEL,render:({active=!0})=>React7__default.createElement(A11yContextProvider,null,active?React7__default.createElement(A11YPanel,null):null),paramKey:PARAM_KEY});});
13
+ ${target} {}`))}var impactStatus={minor:"neutral",moderate:"warning",serious:"negative",critical:"critical"},impactLabels={minor:"Minor",moderate:"Moderate",serious:"Serious",critical:"Critical"},Wrapper2=styled.div(({theme:theme2})=>({display:"flex",flexDirection:"column",width:"100%",borderBottom:`1px solid ${theme2.appBorderColor}`,containerType:"inline-size",fontSize:theme2.typography.size.s2})),Icon=styled(ChevronSmallDownIcon)({transition:"transform 0.1s ease-in-out"}),HeaderBar=styled.div(({theme:theme2})=>({display:"flex",justifyContent:"space-between",alignItems:"center",gap:6,padding:"6px 10px 6px 15px",minHeight:40,background:"none",color:"inherit",textAlign:"left",cursor:"pointer",width:"100%","&:hover":{color:theme2.color.secondary}})),Title=styled.div(({theme:theme2})=>({display:"flex",alignItems:"baseline",flexGrow:1,fontSize:theme2.typography.size.s2,gap:8})),RuleId2=styled.div(({theme:theme2})=>({display:"none",color:theme2.textMutedColor,fontFamily:theme2.typography.fonts.mono,fontSize:theme2.typography.size.s1,"@container (min-width: 800px)":{display:"block"}})),Count=styled.div(({theme:theme2})=>({display:"flex",alignItems:"center",justifyContent:"center",color:theme2.textMutedColor,width:28,height:28})),Report=({items,empty,type,handleSelectionChange,selectedItems,toggleOpen})=>React7__default.createElement(React7__default.Fragment,null,items&&items.length?items.map(item=>{let id=`${type}.${item.id}`,detailsId=`details:${id}`,selection=selectedItems.get(id),title=getTitleForAxeResult(item);return React7__default.createElement(Wrapper2,{key:id},React7__default.createElement(HeaderBar,{onClick:event=>toggleOpen(event,type,item),"data-active":!!selection},React7__default.createElement(Title,null,React7__default.createElement("strong",null,title),React7__default.createElement(RuleId2,null,item.id)),item.impact&&React7__default.createElement(Badge,{status:type===RuleType.PASS?"neutral":impactStatus[item.impact]},impactLabels[item.impact]),React7__default.createElement(Count,null,item.nodes.length),React7__default.createElement(IconButton,{onClick:event=>toggleOpen(event,type,item),"aria-label":`${selection?"Collapse":"Expand"} details for ${title}`,"aria-expanded":!!selection,"aria-controls":detailsId},React7__default.createElement(Icon,{style:{transform:`rotate(${selection?-180:0}deg)`}}))),selection?React7__default.createElement(Details,{id:detailsId,item,type,selection,handleSelectionChange}):React7__default.createElement("div",{id:detailsId}))}):React7__default.createElement(EmptyTabContent,{title:empty}));var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2;}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p]);},extendStatics(d,b)};function __extends(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d;}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __);}var __assign=function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);}return t},__assign.apply(this,arguments)};function __rest(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]]);return t}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function isObject$3(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}var isObject_1=isObject$3,freeGlobal$1=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,_freeGlobal=freeGlobal$1,freeGlobal=_freeGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root$2=freeGlobal||freeSelf||Function("return this")(),_root=root$2,root$1=_root,now$1=function(){return root$1.Date.now()},now_1=now$1,reWhitespace=/\s/;function trimmedEndIndex$1(string){for(var index=string.length;index--&&reWhitespace.test(string.charAt(index)););return index}var _trimmedEndIndex=trimmedEndIndex$1,trimmedEndIndex=_trimmedEndIndex,reTrimStart=/^\s+/;function baseTrim$1(string){return string&&string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,"")}var _baseTrim=baseTrim$1,root=_root,Symbol$2=root.Symbol,_Symbol=Symbol$2,Symbol$1=_Symbol,objectProto$1=Object.prototype,hasOwnProperty=objectProto$1.hasOwnProperty,nativeObjectToString$1=objectProto$1.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag$1(value){var isOwn=hasOwnProperty.call(value,symToStringTag$1),tag=value[symToStringTag$1];try{value[symToStringTag$1]=void 0;var unmasked=!0;}catch{}var result=nativeObjectToString$1.call(value);return unmasked&&(isOwn?value[symToStringTag$1]=tag:delete value[symToStringTag$1]),result}var _getRawTag=getRawTag$1,objectProto=Object.prototype,nativeObjectToString=objectProto.toString;function objectToString$1(value){return nativeObjectToString.call(value)}var _objectToString=objectToString$1,Symbol2=_Symbol,getRawTag=_getRawTag,objectToString=_objectToString,nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol2?Symbol2.toStringTag:void 0;function baseGetTag$1(value){return value==null?value===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}var _baseGetTag=baseGetTag$1;function isObjectLike$1(value){return value!=null&&typeof value=="object"}var isObjectLike_1=isObjectLike$1,baseGetTag=_baseGetTag,isObjectLike=isObjectLike_1,symbolTag="[object Symbol]";function isSymbol$1(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}var isSymbol_1=isSymbol$1,baseTrim=_baseTrim,isObject$2=isObject_1,isSymbol=isSymbol_1,NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber$1(value){if(typeof value=="number")return value;if(isSymbol(value))return NAN;if(isObject$2(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject$2(other)?other+"":other;}if(typeof value!="string")return value===0?value:+value;value=baseTrim(value);var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}var toNumber_1=toNumber$1,isObject$1=isObject_1,now=now_1,toNumber=toNumber_1,FUNC_ERROR_TEXT$1="Expected a function",nativeMax=Math.max,nativeMin=Math.min;function debounce$1(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=!1,maxing=!1,trailing=!0;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT$1);wait=toNumber(wait)||0,isObject$1(options)&&(leading=!!options.leading,maxing="maxWait"in options,maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait,trailing="trailing"in options?!!options.trailing:trailing);function invokeFunc(time){var args=lastArgs,thisArg=lastThis;return lastArgs=lastThis=void 0,lastInvokeTime=time,result=func.apply(thisArg,args),result}function leadingEdge(time){return lastInvokeTime=time,timerId=setTimeout(timerExpired,wait),leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===void 0||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time));}function trailingEdge(time){return timerId=void 0,trailing&&lastArgs?invokeFunc(time):(lastArgs=lastThis=void 0,result)}function cancel(){timerId!==void 0&&clearTimeout(timerId),lastInvokeTime=0,lastArgs=lastCallTime=lastThis=timerId=void 0;}function flush(){return timerId===void 0?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);if(lastArgs=arguments,lastThis=this,lastCallTime=time,isInvoking){if(timerId===void 0)return leadingEdge(lastCallTime);if(maxing)return clearTimeout(timerId),timerId=setTimeout(timerExpired,wait),invokeFunc(lastCallTime)}return timerId===void 0&&(timerId=setTimeout(timerExpired,wait)),result}return debounced.cancel=cancel,debounced.flush=flush,debounced}var debounce_1=debounce$1,debounce=debounce_1,isObject=isObject_1,FUNC_ERROR_TEXT="Expected a function";function throttle(func,wait,options){var leading=!0,trailing=!0;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);return isObject(options)&&(leading="leading"in options?!!options.leading:leading,trailing="trailing"in options?!!options.trailing:trailing),debounce(func,wait,{leading,maxWait:wait,trailing})}var throttle_1=throttle,patchResizeHandler=function(resizeCallback,refreshMode,refreshRate,refreshOptions){switch(refreshMode){case"debounce":return debounce_1(resizeCallback,refreshRate,refreshOptions);case"throttle":return throttle_1(resizeCallback,refreshRate,refreshOptions);default:return resizeCallback}},isFunction=function(fn){return typeof fn=="function"},isSSR=function(){return typeof window>"u"},isDOMElement=function(element){return element instanceof Element||element instanceof HTMLDocument},createNotifier=function(onResize,setSize,handleWidth,handleHeight){return function(_a){var width=_a.width,height=_a.height;setSize(function(prev){return prev.width===width&&prev.height===height||prev.width===width&&!handleHeight||prev.height===height&&!handleWidth?prev:(onResize&&isFunction(onResize)&&onResize(width,height),{width,height})});}};(function(_super){__extends(ResizeDetector2,_super);function ResizeDetector2(props){var _this=_super.call(this,props)||this;_this.cancelHandler=function(){_this.resizeHandler&&_this.resizeHandler.cancel&&(_this.resizeHandler.cancel(),_this.resizeHandler=null);},_this.attachObserver=function(){var _a2=_this.props,targetRef=_a2.targetRef,observerOptions=_a2.observerOptions;if(!isSSR()){targetRef&&targetRef.current&&(_this.targetRef.current=targetRef.current);var element=_this.getElement();element&&(_this.observableElement&&_this.observableElement===element||(_this.observableElement=element,_this.resizeObserver.observe(element,observerOptions)));}},_this.getElement=function(){var _a2=_this.props,querySelector=_a2.querySelector,targetDomEl=_a2.targetDomEl;if(isSSR())return null;if(querySelector)return document.querySelector(querySelector);if(targetDomEl&&isDOMElement(targetDomEl))return targetDomEl;if(_this.targetRef&&isDOMElement(_this.targetRef.current))return _this.targetRef.current;var currentElement=findDOMNode(_this);if(!currentElement)return null;var renderType=_this.getRenderType();switch(renderType){case"renderProp":return currentElement;case"childFunction":return currentElement;case"child":return currentElement;case"childArray":return currentElement;default:return currentElement.parentElement}},_this.createResizeHandler=function(entries){var _a2=_this.props,_b=_a2.handleWidth,handleWidth=_b===void 0?!0:_b,_c=_a2.handleHeight,handleHeight=_c===void 0?!0:_c,onResize=_a2.onResize;if(!(!handleWidth&&!handleHeight)){var notifyResize=createNotifier(onResize,_this.setState.bind(_this),handleWidth,handleHeight);entries.forEach(function(entry){var _a3=entry&&entry.contentRect||{},width=_a3.width,height=_a3.height,shouldSetSize=!_this.skipOnMount&&!isSSR();shouldSetSize&&notifyResize({width,height}),_this.skipOnMount=!1;});}},_this.getRenderType=function(){var _a2=_this.props,render=_a2.render,children=_a2.children;return isFunction(render)?"renderProp":isFunction(children)?"childFunction":isValidElement(children)?"child":Array.isArray(children)?"childArray":"parent"};var skipOnMount=props.skipOnMount,refreshMode=props.refreshMode,_a=props.refreshRate,refreshRate=_a===void 0?1e3:_a,refreshOptions=props.refreshOptions;return _this.state={width:void 0,height:void 0},_this.skipOnMount=skipOnMount,_this.targetRef=createRef(),_this.observableElement=null,isSSR()||(_this.resizeHandler=patchResizeHandler(_this.createResizeHandler,refreshMode,refreshRate,refreshOptions),_this.resizeObserver=new window.ResizeObserver(_this.resizeHandler)),_this}return ResizeDetector2.prototype.componentDidMount=function(){this.attachObserver();},ResizeDetector2.prototype.componentDidUpdate=function(){this.attachObserver();},ResizeDetector2.prototype.componentWillUnmount=function(){isSSR()||(this.observableElement=null,this.resizeObserver.disconnect(),this.cancelHandler());},ResizeDetector2.prototype.render=function(){var _a=this.props,render=_a.render,children=_a.children,_b=_a.nodeType,WrapperTag=_b===void 0?"div":_b,_c=this.state,width=_c.width,height=_c.height,childProps={width,height,targetRef:this.targetRef},renderType=this.getRenderType(),typedChildren;switch(renderType){case"renderProp":return render&&render(childProps);case"childFunction":return typedChildren=children,typedChildren(childProps);case"child":if(typedChildren=children,typedChildren.type&&typeof typedChildren.type=="string"){childProps.targetRef;var nativeProps=__rest(childProps,["targetRef"]);return cloneElement(typedChildren,nativeProps)}return cloneElement(typedChildren,childProps);case"childArray":return typedChildren=children,typedChildren.map(function(el){return !!el&&cloneElement(el,childProps)});default:return React7.createElement(WrapperTag,null)}},ResizeDetector2})(PureComponent);var useEnhancedEffect=isSSR()?useEffect:useLayoutEffect;function useResizeDetector(props){props===void 0&&(props={});var _a=props.skipOnMount,skipOnMount=_a===void 0?!1:_a,refreshMode=props.refreshMode,_b=props.refreshRate,refreshRate=_b===void 0?1e3:_b,refreshOptions=props.refreshOptions,_c=props.handleWidth,handleWidth=_c===void 0?!0:_c,_d=props.handleHeight,handleHeight=_d===void 0?!0:_d,targetRef=props.targetRef,observerOptions=props.observerOptions,onResize=props.onResize,skipResize=useRef(skipOnMount),localRef=useRef(null),ref=targetRef??localRef,resizeHandler=useRef(),_e=useState({width:void 0,height:void 0}),size=_e[0],setSize=_e[1];return useEnhancedEffect(function(){if(!isSSR()){var notifyResize=createNotifier(onResize,setSize,handleWidth,handleHeight),resizeCallback=function(entries){!handleWidth&&!handleHeight||entries.forEach(function(entry){var _a2=entry&&entry.contentRect||{},width=_a2.width,height=_a2.height,shouldSetSize=!skipResize.current&&!isSSR();shouldSetSize&&notifyResize({width,height}),skipResize.current=!1;});};resizeHandler.current=patchResizeHandler(resizeCallback,refreshMode,refreshRate,refreshOptions);var resizeObserver=new window.ResizeObserver(resizeHandler.current);return ref.current&&resizeObserver.observe(ref.current,observerOptions),function(){resizeObserver.disconnect();var patchedResizeHandler=resizeHandler.current;patchedResizeHandler&&patchedResizeHandler.cancel&&patchedResizeHandler.cancel();}}},[refreshMode,refreshRate,refreshOptions,handleWidth,handleHeight,onResize,observerOptions,ref.current]),__assign({ref},size)}var Container=styled.div({width:"100%",position:"relative",minHeight:"100%"}),Item2=styled.button(({theme:theme2})=>({textDecoration:"none",padding:"10px 15px",cursor:"pointer",color:theme2.textMutedColor,fontWeight:theme2.typography.weight.bold,fontSize:theme2.typography.size.s2-1,lineHeight:1,height:40,border:"none",borderBottom:"3px solid transparent",background:"transparent","&:focus":{outline:"0 none",borderColor:theme2.color.secondary}}),({active,theme:theme2})=>active?{opacity:1,color:theme2.color.secondary,borderColor:theme2.color.secondary}:{}),Subnav=styled.div(({theme:theme2})=>({boxShadow:`${theme2.appBorderColor} 0 -1px 0 0 inset`,background:theme2.background.app,position:"sticky",top:0,zIndex:1,display:"flex",alignItems:"center",whiteSpace:"nowrap",overflow:"auto",paddingRight:10,gap:6,scrollbarColor:`${theme2.barTextColor} ${theme2.background.app}`,scrollbarWidth:"thin"})),TabsWrapper=styled.div({}),ActionsWrapper=styled.div({display:"flex",flexBasis:"100%",justifyContent:"flex-end",containerType:"inline-size",minWidth:96,gap:6}),ToggleButton=styled(IconButton)({"@container (max-width: 193px)":{span:{display:"none"}}}),Tabs=({tabs})=>{let{ref}=useResizeDetector({refreshMode:"debounce",handleHeight:!1,handleWidth:!0}),{tab:activeTab,setTab,toggleHighlight,highlighted,handleManual,allExpanded,handleCollapseAll,handleExpandAll}=useA11yContext(),handleToggle=React7.useCallback(event=>{setTab(event.currentTarget.getAttribute("data-type"));},[setTab]);return React7.createElement(Container,{ref},React7.createElement(Subnav,null,React7.createElement(TabsWrapper,{role:"tablist"},tabs.map((tab,index)=>React7.createElement(Item2,{role:"tab",key:index,"data-type":tab.type,"data-active":activeTab===tab.type,"aria-selected":activeTab===tab.type,active:activeTab===tab.type,onClick:handleToggle},tab.label))),React7.createElement(ActionsWrapper,null,React7.createElement(WithTooltip,{as:"div",hasChrome:!1,placement:"top",tooltip:React7.createElement(TooltipNote,{note:"Highlight elements with accessibility violations"}),trigger:"hover"},React7.createElement(ToggleButton,{onClick:toggleHighlight,active:highlighted},highlighted?React7.createElement(EyeCloseIcon,null):React7.createElement(EyeIcon,null),React7.createElement("span",null,highlighted?"Hide highlights":"Show highlights"))),React7.createElement(WithTooltip,{as:"div",hasChrome:!1,placement:"top",tooltip:React7.createElement(TooltipNote,{note:allExpanded?"Collapse all":"Expand all"}),trigger:"hover"},React7.createElement(IconButton,{onClick:allExpanded?handleCollapseAll:handleExpandAll,"aria-label":allExpanded?"Collapse all":"Expand all"},allExpanded?React7.createElement(CollapseIcon,null):React7.createElement(ExpandAltIcon,null))),React7.createElement(WithTooltip,{as:"div",hasChrome:!1,placement:"top",tooltip:React7.createElement(TooltipNote,{note:"Rerun the accessibility scan"}),trigger:"hover"},React7.createElement(IconButton,{onClick:handleManual,"aria-label":"Rerun accessibility scan"},React7.createElement(SyncIcon,null))))),React7.createElement(ScrollArea,{vertical:!0,horizontal:!0},tabs.find(t=>t.type===activeTab)?.panel))};var Wrapper3=styled.div(({theme:{color,typography,background}})=>({textAlign:"start",padding:"11px 15px",fontSize:`${typography.size.s2}px`,fontWeight:typography.weight.regular,lineHeight:"1rem",background:background.app,borderBottom:`1px solid ${color.border}`,color:color.defaultText,backgroundClip:"padding-box",position:"relative",code:{fontSize:`${typography.size.s1-1}px`,color:"inherit",margin:"0 0.2em",padding:"0 0.2em",background:"rgba(255, 255, 255, 0.8)",borderRadius:"2px",boxShadow:"0 0 0 1px rgba(0, 0, 0, 0.1)"}})),TestDiscrepancyMessage=({discrepancy})=>{let docsUrl=useStorybookApi().getDocsUrl({subpath:DOCUMENTATION_DISCREPANCY_LINK,versioned:!0,renderer:!0}),message=useMemo(()=>{switch(discrepancy){case"browserPassedCliFailed":return "Accessibility checks passed in this browser but failed in the CLI.";case"cliPassedBrowserFailed":return "Accessibility checks passed in the CLI but failed in this browser.";case"cliFailedButModeManual":return "Accessibility checks failed in the CLI. Run the tests manually to see the results.";default:return null}},[discrepancy]);return message?React7__default.createElement(Wrapper3,null,message," ",React7__default.createElement(Link,{href:docsUrl,target:"_blank",withArrow:!0},"Learn what could cause this")):null};var RotatingIcon=styled(SyncIcon)(({theme:theme2})=>({animation:`${theme2.animation.rotate360} 1s linear infinite;`,margin:4})),Tab=styled.div({display:"flex",alignItems:"center",gap:6}),Centered=styled.span(({theme:theme2})=>({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",fontSize:theme2.typography.size.s2,height:"100%",gap:24,div:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},p:{margin:0,color:theme2.textMutedColor},code:{display:"inline-block",fontSize:theme2.typography.size.s2-1,backgroundColor:theme2.background.app,border:`1px solid ${theme2.color.border}`,borderRadius:4,padding:"2px 3px"}})),A11YPanel=()=>{let{parameters,tab,results,status,handleManual,error,discrepancy,handleSelectionChange,selectedItems,toggleOpen}=useA11yContext(),tabs=useMemo(()=>{let{passes,incomplete,violations}=results??{passes:[],incomplete:[],violations:[]};return [{label:React7__default.createElement(Tab,null,"Violations",React7__default.createElement(Badge,{compact:!0,status:tab==="violations"?"active":"neutral"},violations.length)),panel:React7__default.createElement(Report,{items:violations,type:RuleType.VIOLATION,empty:"No accessibility violations found.",handleSelectionChange,selectedItems,toggleOpen}),items:violations,type:RuleType.VIOLATION},{label:React7__default.createElement(Tab,null,"Passes",React7__default.createElement(Badge,{compact:!0,status:tab==="passes"?"active":"neutral"},passes.length)),panel:React7__default.createElement(Report,{items:passes,type:RuleType.PASS,empty:"No passing accessibility checks found.",handleSelectionChange,selectedItems,toggleOpen}),items:passes,type:RuleType.PASS},{label:React7__default.createElement(Tab,null,"Inconclusive",React7__default.createElement(Badge,{compact:!0,status:tab==="incomplete"?"active":"neutral"},incomplete.length)),panel:React7__default.createElement(Report,{items:incomplete,type:RuleType.INCOMPLETION,empty:"No inconclusive accessibility checks found.",handleSelectionChange,selectedItems,toggleOpen}),items:incomplete,type:RuleType.INCOMPLETION}]},[tab,results,handleSelectionChange,selectedItems,toggleOpen]);return parameters.disable||parameters.test==="off"?React7__default.createElement(Centered,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"Accessibility tests are disabled for this story"),React7__default.createElement("p",null,"Update"," ",React7__default.createElement("code",null,parameters.disable?"parameters.a11y.disable":"parameters.a11y.test")," ","to enable accessibility tests."))):React7__default.createElement(React7__default.Fragment,null,discrepancy&&React7__default.createElement(TestDiscrepancyMessage,{discrepancy}),status==="ready"||status==="ran"?React7__default.createElement(Tabs,{key:"tabs",tabs}):React7__default.createElement(Centered,{style:{marginTop:discrepancy?"1em":0}},status==="initial"&&React7__default.createElement("div",null,React7__default.createElement(RotatingIcon,{size:12}),React7__default.createElement("strong",null,"Preparing accessibility scan"),React7__default.createElement("p",null,"Please wait while the addon is initializing...")),status==="manual"&&React7__default.createElement(React7__default.Fragment,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"Accessibility tests run manually for this story"),React7__default.createElement("p",null,"Results will not show when using the testing module. You can still run accessibility tests manually.")),React7__default.createElement(Button,{size:"medium",onClick:handleManual},"Run accessibility scan"),React7__default.createElement("p",null,"Update ",React7__default.createElement("code",null,"globals.a11y.manual")," to disable manual mode.")),status==="running"&&React7__default.createElement("div",null,React7__default.createElement(RotatingIcon,{size:12}),React7__default.createElement("strong",null,"Accessibility scan in progress"),React7__default.createElement("p",null,"Please wait while the accessibility scan is running...")),status==="error"&&React7__default.createElement(React7__default.Fragment,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"The accessibility scan encountered an error"),React7__default.createElement("p",null,typeof error=="string"?error:error instanceof Error?error.toString():JSON.stringify(error,null,2))),React7__default.createElement(Button,{size:"medium",onClick:handleManual},"Rerun accessibility scan")),status==="component-test-error"&&React7__default.createElement(React7__default.Fragment,null,React7__default.createElement("div",null,React7__default.createElement("strong",null,"This story's component tests failed"),React7__default.createElement("p",null,"Automated accessibility tests will not run until this is resolved. You can still test manually.")),React7__default.createElement(Button,{size:"medium",onClick:handleManual},"Run accessibility scan"))))};var Filters=props=>React7.createElement("svg",{...props},React7.createElement("defs",null,React7.createElement("filter",{id:"protanopia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.567, 0.433, 0, 0, 0 0.558, 0.442, 0, 0, 0 0, 0.242, 0.758, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"protanomaly"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.817, 0.183, 0, 0, 0 0.333, 0.667, 0, 0, 0 0, 0.125, 0.875, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"deuteranopia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.625, 0.375, 0, 0, 0 0.7, 0.3, 0, 0, 0 0, 0.3, 0.7, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"deuteranomaly"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.8, 0.2, 0, 0, 0 0.258, 0.742, 0, 0, 0 0, 0.142, 0.858, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"tritanopia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.95, 0.05, 0, 0, 0 0, 0.433, 0.567, 0, 0 0, 0.475, 0.525, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"tritanomaly"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.967, 0.033, 0, 0, 0 0, 0.733, 0.267, 0, 0 0, 0.183, 0.817, 0, 0 0, 0, 0, 1, 0"})),React7.createElement("filter",{id:"achromatopsia"},React7.createElement("feColorMatrix",{in:"SourceGraphic",type:"matrix",values:"0.299, 0.587, 0.114, 0, 0 0.299, 0.587, 0.114, 0, 0 0.299, 0.587, 0.114, 0, 0 0, 0, 0, 1, 0"}))));var iframeId="storybook-preview-iframe",baseList=[{name:"blurred vision",percentage:22.9},{name:"deuteranomaly",percentage:2.7},{name:"deuteranopia",percentage:.56},{name:"protanomaly",percentage:.66},{name:"protanopia",percentage:.59},{name:"tritanomaly",percentage:.01},{name:"tritanopia",percentage:.016},{name:"achromatopsia",percentage:1e-4},{name:"grayscale"}],getFilter=filterName=>filterName?filterName==="blurred vision"?"blur(2px)":filterName==="grayscale"?"grayscale(100%)":`url('#${filterName}')`:"none",Hidden=styled.div({"&, & svg":{position:"absolute",width:0,height:0}}),ColorIcon=styled.span({background:"linear-gradient(to right, #F44336, #FF9800, #FFEB3B, #8BC34A, #2196F3, #9C27B0)",borderRadius:"1rem",display:"block",height:"1rem",width:"1rem"},({filter})=>({filter:getFilter(filter)}),({theme:theme2})=>({boxShadow:`${theme2.appBorderColor} 0 0 0 1px inset`})),Column=styled.span({display:"flex",flexDirection:"column"}),Title2=styled.span({textTransform:"capitalize"}),Description2=styled.span(({theme:theme2})=>({fontSize:11,color:theme2.textMutedColor})),getColorList=(active,set)=>[...active!==null?[{id:"reset",title:"Reset color filter",onClick:()=>{set(null);},right:void 0,active:!1}]:[],...baseList.map(i=>{let description=i.percentage!==void 0?`${i.percentage}% of users`:void 0;return {id:i.name,title:React7__default.createElement(Column,null,React7__default.createElement(Title2,null,i.name),description&&React7__default.createElement(Description2,null,description)),onClick:()=>{set(i);},right:React7__default.createElement(ColorIcon,{filter:i.name}),active:active===i}})],VisionSimulator=()=>{let[filter,setFilter]=useState(null);return React7__default.createElement(React7__default.Fragment,null,filter&&React7__default.createElement(Global,{styles:{[`#${iframeId}`]:{filter:getFilter(filter.name)}}}),React7__default.createElement(WithTooltip,{placement:"top",tooltip:({onHide})=>{let colorList=getColorList(filter,i=>{setFilter(i),onHide();});return React7__default.createElement(TooltipLinkList,{links:colorList})},closeOnOutsideClick:!0,onDoubleClick:()=>setFilter(null)},React7__default.createElement(IconButton,{key:"filter",active:!!filter,title:"Vision simulator"},React7__default.createElement(AccessibilityIcon,null))),React7__default.createElement(Hidden,null,React7__default.createElement(Filters,null)))};var Title3=()=>{let selectedPanel=useStorybookApi().getSelectedPanel(),[addonState]=useAddonState(ADDON_ID),violationsNb=addonState?.violations?.length||0,incompleteNb=addonState?.incomplete?.length||0,count=violationsNb+incompleteNb;return React7__default.createElement("div",{style:{display:"flex",alignItems:"center",gap:6}},React7__default.createElement("span",null,"Accessibility"),count===0?null:React7__default.createElement(Badge,{compact:!0,status:selectedPanel===PANEL_ID?"active":"neutral"},count))};addons.register(ADDON_ID,api=>{addons.add(PANEL_ID,{title:"",type:types.TOOL,match:({viewMode,tabId})=>viewMode==="story"&&!tabId,render:()=>React7__default.createElement(VisionSimulator,null)}),addons.add(PANEL_ID,{title:Title3,type:types.PANEL,render:({active=!0})=>React7__default.createElement(A11yContextProvider,null,active?React7__default.createElement(A11YPanel,null):null),paramKey:PARAM_KEY});});
@@ -51,7 +51,7 @@ Please rename it to one of: ${correctEncodings}.`)},TEXT_ENCODINGS=new Set(["utf
51
51
  ${error.message}`,error}},fixCwdError=(originalMessage,cwd)=>{if(cwd===getDefaultCwd())return originalMessage;let cwdStat;try{cwdStat=fs.statSync(cwd);}catch(error){return `The "cwd" option is invalid: ${cwd}.
52
52
  ${error.message}
53
53
  ${originalMessage}`}return cwdStat.isDirectory()?originalMessage:`The "cwd" option is not a directory: ${cwd}.
54
- ${originalMessage}`};var normalizeOptions=(filePath,rawArguments,rawOptions)=>{rawOptions.cwd=normalizeCwd(rawOptions.cwd);let[processedFile,processedArguments,processedOptions]=handleNodeOption(filePath,rawArguments,rawOptions),{command:file,args:commandArguments,options:initialOptions}=import_cross_spawn.default._parse(processedFile,processedArguments,processedOptions),fdOptions=normalizeFdSpecificOptions(initialOptions),options=addDefaultOptions(fdOptions);return validateTimeout(options),validateEncoding(options),validateIpcInputOption(options),validateCancelSignal(options),validateGracefulCancel(options),options.shell=normalizeFileUrl(options.shell),options.env=getEnv(options),options.killSignal=normalizeKillSignal(options.killSignal),options.forceKillAfterDelay=normalizeForceKillAfterDelay(options.forceKillAfterDelay),options.lines=options.lines.map((lines,fdNumber)=>lines&&!BINARY_ENCODINGS.has(options.encoding)&&options.buffer[fdNumber]),process4__default.default.platform==="win32"&&path2__default.default.basename(file,".exe")==="cmd"&&commandArguments.unshift("/q"),{file,commandArguments,options}},addDefaultOptions=({extendEnv=!0,preferLocal=!1,cwd,localDir:localDirectory=cwd,encoding="utf8",reject=!0,cleanup=!0,all=!1,windowsHide=!0,killSignal="SIGTERM",forceKillAfterDelay=!0,gracefulCancel=!1,ipcInput,ipc=ipcInput!==void 0||gracefulCancel,serialization="advanced",...options})=>({...options,extendEnv,preferLocal,cwd,localDirectory,encoding,reject,cleanup,all,windowsHide,killSignal,forceKillAfterDelay,gracefulCancel,ipcInput,ipc,serialization}),getEnv=({env:envOption,extendEnv,preferLocal,node,localDirectory,nodePath})=>{let env=extendEnv?{...process4__default.default.env,...envOption}:envOption;return preferLocal||node?npmRunPathEnv({env,cwd:localDirectory,execPath:nodePath,preferLocal,addExecPath:node}):env};function stripFinalNewline(input){if(typeof input=="string")return stripFinalNewlineString(input);if(!(ArrayBuffer.isView(input)&&input.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return stripFinalNewlineBinary(input)}var stripFinalNewlineString=input=>input.at(-1)===LF?input.slice(0,input.at(-2)===CR?-2:-1):input,stripFinalNewlineBinary=input=>input.at(-1)===LF_BINARY?input.subarray(0,input.at(-2)===CR_BINARY?-2:-1):input,LF=`
54
+ ${originalMessage}`};var normalizeOptions=(filePath,rawArguments,rawOptions)=>{rawOptions.cwd=normalizeCwd(rawOptions.cwd);let[processedFile,processedArguments,processedOptions]=handleNodeOption(filePath,rawArguments,rawOptions),{command:file,args:commandArguments,options:initialOptions}=import_cross_spawn.default._parse(processedFile,processedArguments,processedOptions),fdOptions=normalizeFdSpecificOptions(initialOptions),options=addDefaultOptions(fdOptions);return validateTimeout(options),validateEncoding(options),validateIpcInputOption(options),validateCancelSignal(options),validateGracefulCancel(options),options.shell=normalizeFileUrl(options.shell),options.env=getEnv(options),options.killSignal=normalizeKillSignal(options.killSignal),options.forceKillAfterDelay=normalizeForceKillAfterDelay(options.forceKillAfterDelay),options.lines=options.lines.map((lines,fdNumber)=>lines&&!BINARY_ENCODINGS.has(options.encoding)&&options.buffer[fdNumber]),process4__default.default.platform==="win32"&&path2__default.default.basename(file,".exe")==="cmd"&&commandArguments.unshift("/q"),{file,commandArguments,options}},addDefaultOptions=({extendEnv=!0,preferLocal=!1,cwd,localDir:localDirectory=cwd,encoding="utf8",reject=!0,cleanup=!0,all=!1,windowsHide=!0,killSignal="SIGTERM",forceKillAfterDelay=!0,gracefulCancel=!1,ipcInput,ipc=ipcInput!==void 0||gracefulCancel,serialization="advanced",...options})=>({...options,extendEnv,preferLocal,cwd,localDirectory,encoding,reject,cleanup,all,windowsHide,killSignal,forceKillAfterDelay,gracefulCancel,ipcInput,ipc,serialization}),getEnv=({env:envOption,extendEnv,preferLocal,node,localDirectory,nodePath})=>{let env=extendEnv?{...process4__default.default.env,...envOption}:envOption;return preferLocal||node?npmRunPathEnv({env,cwd:localDirectory,execPath:nodePath,preferLocal,addExecPath:node}):env};var concatenateShell=(file,commandArguments,options)=>options.shell&&commandArguments.length>0?[[file,...commandArguments].join(" "),[],options]:[file,commandArguments,options];function stripFinalNewline(input){if(typeof input=="string")return stripFinalNewlineString(input);if(!(ArrayBuffer.isView(input)&&input.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return stripFinalNewlineBinary(input)}var stripFinalNewlineString=input=>input.at(-1)===LF?input.slice(0,input.at(-2)===CR?-2:-1):input,stripFinalNewlineBinary=input=>input.at(-1)===LF_BINARY?input.subarray(0,input.at(-2)===CR_BINARY?-2:-1):input,LF=`
55
55
  `,LF_BINARY=LF.codePointAt(0),CR="\r",CR_BINARY=CR.codePointAt(0);function isStream(stream,{checkOpen=!0}={}){return stream!==null&&typeof stream=="object"&&(stream.writable||stream.readable||!checkOpen||stream.writable===void 0&&stream.readable===void 0)&&typeof stream.pipe=="function"}function isWritableStream(stream,{checkOpen=!0}={}){return isStream(stream,{checkOpen})&&(stream.writable||!checkOpen)&&typeof stream.write=="function"&&typeof stream.end=="function"&&typeof stream.writable=="boolean"&&typeof stream.writableObjectMode=="boolean"&&typeof stream.destroy=="function"&&typeof stream.destroyed=="boolean"}function isReadableStream(stream,{checkOpen=!0}={}){return isStream(stream,{checkOpen})&&(stream.readable||!checkOpen)&&typeof stream.read=="function"&&typeof stream.readable=="boolean"&&typeof stream.readableObjectMode=="boolean"&&typeof stream.destroy=="function"&&typeof stream.destroyed=="boolean"}function isDuplexStream(stream,options){return isWritableStream(stream,options)&&isReadableStream(stream,options)}var a=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),c=class{#t;#n;#r=!1;#e=void 0;constructor(e,t){this.#t=e,this.#n=t;}next(){let e=()=>this.#s();return this.#e=this.#e?this.#e.then(e,e):e(),this.#e}return(e){let t=()=>this.#i(e);return this.#e?this.#e.then(t,t):t()}async#s(){if(this.#r)return {done:!0,value:void 0};let e;try{e=await this.#t.read();}catch(t){throw this.#e=void 0,this.#r=!0,this.#t.releaseLock(),t}return e.done&&(this.#e=void 0,this.#r=!0,this.#t.releaseLock()),e}async#i(e){if(this.#r)return {done:!0,value:e};if(this.#r=!0,!this.#n){let t=this.#t.cancel(e);return this.#t.releaseLock(),await t,{done:!0,value:e}}return this.#t.releaseLock(),{done:!0,value:e}}},n=Symbol();function i(){return this[n].next()}Object.defineProperty(i,"name",{value:"next"});function o(r){return this[n].return(r)}Object.defineProperty(o,"name",{value:"return"});var u=Object.create(a,{next:{enumerable:!0,configurable:!0,writable:!0,value:i},return:{enumerable:!0,configurable:!0,writable:!0,value:o}});function h({preventCancel:r=!1}={}){let e=this.getReader(),t=new c(e,r),s=Object.create(u);return s[n]=t,s}var getAsyncIterable=stream=>{if(isReadableStream(stream,{checkOpen:!1})&&nodeImports.on!==void 0)return getStreamIterable(stream);if(typeof stream?.[Symbol.asyncIterator]=="function")return stream;if(toString.call(stream)==="[object ReadableStream]")return h.call(stream);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString}=Object.prototype,getStreamIterable=async function*(stream){let controller=new AbortController,state={};handleStreamEnd(stream,controller,state);try{for await(let[chunk]of nodeImports.on(stream,"data",{signal:controller.signal}))yield chunk;}catch(error){if(state.error!==void 0)throw state.error;if(!controller.signal.aborted)throw error}finally{stream.destroy();}},handleStreamEnd=async(stream,controller,state)=>{try{await nodeImports.finished(stream,{cleanup:!0,readable:!0,writable:!1,error:!1});}catch(error){state.error=error;}finally{controller.abort();}},nodeImports={};var getStreamContents=async(stream,{init,convertChunk,getSize,truncateChunk,addChunk,getFinalChunk,finalize},{maxBuffer=Number.POSITIVE_INFINITY}={})=>{let asyncIterable=getAsyncIterable(stream),state=init();state.length=0;try{for await(let chunk of asyncIterable){let chunkType=getChunkType(chunk),convertedChunk=convertChunk[chunkType](chunk,state);appendChunk({convertedChunk,state,getSize,truncateChunk,addChunk,maxBuffer});}return appendFinalChunk({state,convertChunk,getSize,truncateChunk,addChunk,getFinalChunk,maxBuffer}),finalize(state)}catch(error){let normalizedError=typeof error=="object"&&error!==null?error:new Error(error);throw normalizedError.bufferedData=finalize(state),normalizedError}},appendFinalChunk=({state,getSize,truncateChunk,addChunk,getFinalChunk,maxBuffer})=>{let convertedChunk=getFinalChunk(state);convertedChunk!==void 0&&appendChunk({convertedChunk,state,getSize,truncateChunk,addChunk,maxBuffer});},appendChunk=({convertedChunk,state,getSize,truncateChunk,addChunk,maxBuffer})=>{let chunkSize=getSize(convertedChunk),newLength=state.length+chunkSize;if(newLength<=maxBuffer){addNewChunk(convertedChunk,state,addChunk,newLength);return}let truncatedChunk=truncateChunk(convertedChunk,maxBuffer-state.length);throw truncatedChunk!==void 0&&addNewChunk(truncatedChunk,state,addChunk,maxBuffer),new MaxBufferError},addNewChunk=(convertedChunk,state,addChunk,newLength)=>{state.contents=addChunk(convertedChunk,state,newLength),state.length=newLength;},getChunkType=chunk=>{let typeOfChunk=typeof chunk;if(typeOfChunk==="string")return "string";if(typeOfChunk!=="object"||chunk===null)return "others";if(globalThis.Buffer?.isBuffer(chunk))return "buffer";let prototypeName=objectToString2.call(chunk);return prototypeName==="[object ArrayBuffer]"?"arrayBuffer":prototypeName==="[object DataView]"?"dataView":Number.isInteger(chunk.byteLength)&&Number.isInteger(chunk.byteOffset)&&objectToString2.call(chunk.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:objectToString2}=Object.prototype,MaxBufferError=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded");}};var identity2=value=>value,noop=()=>{},getContentsProperty=({contents})=>contents,throwObjectStream=chunk=>{throw new Error(`Streams in object mode are not supported: ${String(chunk)}`)},getLengthProperty=convertedChunk=>convertedChunk.length;async function getStreamAsArray(stream,options){return getStreamContents(stream,arrayMethods,options)}var initArray=()=>({contents:[]}),increment=()=>1,addArrayChunk=(convertedChunk,{contents})=>(contents.push(convertedChunk),contents),arrayMethods={init:initArray,convertChunk:{string:identity2,buffer:identity2,arrayBuffer:identity2,dataView:identity2,typedArray:identity2,others:identity2},getSize:increment,truncateChunk:noop,addChunk:addArrayChunk,getFinalChunk:noop,finalize:getContentsProperty};async function getStreamAsArrayBuffer(stream,options){return getStreamContents(stream,arrayBufferMethods,options)}var initArrayBuffer=()=>({contents:new ArrayBuffer(0)}),useTextEncoder=chunk=>textEncoder2.encode(chunk),textEncoder2=new TextEncoder,useUint8Array=chunk=>new Uint8Array(chunk),useUint8ArrayWithOffset=chunk=>new Uint8Array(chunk.buffer,chunk.byteOffset,chunk.byteLength),truncateArrayBufferChunk=(convertedChunk,chunkSize)=>convertedChunk.slice(0,chunkSize),addArrayBufferChunk=(convertedChunk,{contents,length:previousLength},length)=>{let newContents=hasArrayBufferResize()?resizeArrayBuffer(contents,length):resizeArrayBufferSlow(contents,length);return new Uint8Array(newContents).set(convertedChunk,previousLength),newContents},resizeArrayBufferSlow=(contents,length)=>{if(length<=contents.byteLength)return contents;let arrayBuffer=new ArrayBuffer(getNewContentsLength(length));return new Uint8Array(arrayBuffer).set(new Uint8Array(contents),0),arrayBuffer},resizeArrayBuffer=(contents,length)=>{if(length<=contents.maxByteLength)return contents.resize(length),contents;let arrayBuffer=new ArrayBuffer(length,{maxByteLength:getNewContentsLength(length)});return new Uint8Array(arrayBuffer).set(new Uint8Array(contents),0),arrayBuffer},getNewContentsLength=length=>SCALE_FACTOR**Math.ceil(Math.log(length)/Math.log(SCALE_FACTOR)),SCALE_FACTOR=2,finalizeArrayBuffer=({contents,length})=>hasArrayBufferResize()?contents:contents.slice(0,length),hasArrayBufferResize=()=>"resize"in ArrayBuffer.prototype,arrayBufferMethods={init:initArrayBuffer,convertChunk:{string:useTextEncoder,buffer:useUint8Array,arrayBuffer:useUint8Array,dataView:useUint8ArrayWithOffset,typedArray:useUint8ArrayWithOffset,others:throwObjectStream},getSize:getLengthProperty,truncateChunk:truncateArrayBufferChunk,addChunk:addArrayBufferChunk,getFinalChunk:noop,finalize:finalizeArrayBuffer};async function getStreamAsString(stream,options){return getStreamContents(stream,stringMethods,options)}var initString=()=>({contents:"",textDecoder:new TextDecoder}),useTextDecoder=(chunk,{textDecoder:textDecoder2})=>textDecoder2.decode(chunk,{stream:!0}),addStringChunk=(convertedChunk,{contents})=>contents+convertedChunk,truncateStringChunk=(convertedChunk,chunkSize)=>convertedChunk.slice(0,chunkSize),getFinalStringChunk=({textDecoder:textDecoder2})=>{let finalChunk=textDecoder2.decode();return finalChunk===""?void 0:finalChunk},stringMethods={init:initString,convertChunk:{string:identity2,buffer:useTextDecoder,arrayBuffer:useTextDecoder,dataView:useTextDecoder,typedArray:useTextDecoder,others:throwObjectStream},getSize:getLengthProperty,truncateChunk:truncateStringChunk,addChunk:addStringChunk,getFinalChunk:getFinalStringChunk,finalize:getContentsProperty};Object.assign(nodeImports,{on: events.on,finished: promises.finished});var handleMaxBuffer=({error,stream,readableObjectMode,lines,encoding,fdNumber})=>{if(!(error instanceof MaxBufferError))throw error;if(fdNumber==="all")return error;let unit=getMaxBufferUnit(readableObjectMode,lines,encoding);throw error.maxBufferInfo={fdNumber,unit},stream.destroy(),error},getMaxBufferUnit=(readableObjectMode,lines,encoding)=>readableObjectMode?"objects":lines?"lines":encoding==="buffer"?"bytes":"characters",checkIpcMaxBuffer=(subprocess,ipcOutput,maxBuffer)=>{if(ipcOutput.length!==maxBuffer)return;let error=new MaxBufferError;throw error.maxBufferInfo={fdNumber:"ipc"},error},getMaxBufferMessage=(error,maxBuffer)=>{let{streamName,threshold,unit}=getMaxBufferInfo(error,maxBuffer);return `Command's ${streamName} was larger than ${threshold} ${unit}`},getMaxBufferInfo=(error,maxBuffer)=>{if(error?.maxBufferInfo===void 0)return {streamName:"output",threshold:maxBuffer[1],unit:"bytes"};let{maxBufferInfo:{fdNumber,unit}}=error;delete error.maxBufferInfo;let threshold=getFdSpecificValue(maxBuffer,fdNumber);return fdNumber==="ipc"?{streamName:"IPC output",threshold,unit:"messages"}:{streamName:getStreamName(fdNumber),threshold,unit}},isMaxBufferSync=(resultError,output,maxBuffer)=>resultError?.code==="ENOBUFS"&&output!==null&&output.some(result=>result!==null&&result.length>getMaxBufferSync(maxBuffer)),truncateMaxBufferSync=(result,isMaxBuffer,maxBuffer)=>{if(!isMaxBuffer)return result;let maxBufferValue=getMaxBufferSync(maxBuffer);return result.length>maxBufferValue?result.slice(0,maxBufferValue):result},getMaxBufferSync=([,stdoutMaxBuffer])=>stdoutMaxBuffer;var createMessages=({stdio,all,ipcOutput,originalError,signal,signalDescription,exitCode,escapedCommand,timedOut,isCanceled,isGracefullyCanceled,isMaxBuffer,isForcefullyTerminated,forceKillAfterDelay,killSignal,maxBuffer,timeout,cwd})=>{let errorCode=originalError?.code,prefix=getErrorPrefix({originalError,timedOut,timeout,isMaxBuffer,maxBuffer,errorCode,signal,signalDescription,exitCode,isCanceled,isGracefullyCanceled,isForcefullyTerminated,forceKillAfterDelay,killSignal}),originalMessage=getOriginalMessage(originalError,cwd),suffix=originalMessage===void 0?"":`
56
56
  ${originalMessage}`,shortMessage=`${prefix}: ${escapedCommand}${suffix}`,messageStdio=all===void 0?[stdio[2],stdio[1]]:[all],message=[shortMessage,...messageStdio,...stdio.slice(3),ipcOutput.map(ipcMessage=>serializeIpcMessage(ipcMessage)).join(`
57
57
  `)].map(messagePart=>escapeLines(stripFinalNewline(serializeMessagePart(messagePart)))).filter(Boolean).join(`
@@ -64,6 +64,6 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
64
64
  `,LF:`
65
65
  `,concatBytes:concatString},concatUint8Array=(firstChunk,secondChunk)=>{let chunk=new Uint8Array(firstChunk.length+secondChunk.length);return chunk.set(firstChunk,0),chunk.set(secondChunk,firstChunk.length),chunk},linesUint8ArrayInfo={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:concatUint8Array};var getValidateTransformInput=(writableObjectMode,optionName)=>writableObjectMode?void 0:validateStringTransformInput.bind(void 0,optionName),validateStringTransformInput=function*(optionName,chunk){if(typeof chunk!="string"&&!isUint8Array(chunk)&&!buffer.Buffer.isBuffer(chunk))throw new TypeError(`The \`${optionName}\` option's transform must use "objectMode: true" to receive as input: ${typeof chunk}.`);yield chunk;},getValidateTransformReturn=(readableObjectMode,optionName)=>readableObjectMode?validateObjectTransformReturn.bind(void 0,optionName):validateStringTransformReturn.bind(void 0,optionName),validateObjectTransformReturn=function*(optionName,chunk){validateEmptyReturn(optionName,chunk),yield chunk;},validateStringTransformReturn=function*(optionName,chunk){if(validateEmptyReturn(optionName,chunk),typeof chunk!="string"&&!isUint8Array(chunk))throw new TypeError(`The \`${optionName}\` option's function must yield a string or an Uint8Array, not ${typeof chunk}.`);yield chunk;},validateEmptyReturn=(optionName,chunk)=>{if(chunk==null)throw new TypeError(`The \`${optionName}\` option's function must not call \`yield ${chunk}\`.
66
66
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
67
- if (condition) { yield value; }`)};var getEncodingTransformGenerator=(binary,encoding,skipped)=>{if(skipped)return;if(binary)return {transform:encodingUint8ArrayGenerator.bind(void 0,new TextEncoder)};let stringDecoder=new string_decoder.StringDecoder(encoding);return {transform:encodingStringGenerator.bind(void 0,stringDecoder),final:encodingStringFinal.bind(void 0,stringDecoder)}},encodingUint8ArrayGenerator=function*(textEncoder3,chunk){buffer.Buffer.isBuffer(chunk)?yield bufferToUint8Array(chunk):typeof chunk=="string"?yield textEncoder3.encode(chunk):yield chunk;},encodingStringGenerator=function*(stringDecoder,chunk){yield isUint8Array(chunk)?stringDecoder.write(chunk):chunk;},encodingStringFinal=function*(stringDecoder){let lastChunk=stringDecoder.end();lastChunk!==""&&(yield lastChunk);};var pushChunks=util.callbackify(async(getChunks,state,getChunksArguments,transformStream)=>{state.currentIterable=getChunks(...getChunksArguments);try{for await(let chunk of state.currentIterable)transformStream.push(chunk);}finally{delete state.currentIterable;}}),transformChunk=async function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator}=generators[index];for await(let transformedChunk of transform(chunk))yield*transformChunk(transformedChunk,generators,index+1);},finalChunks=async function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunks(final,Number(index),generators);},generatorFinalChunks=async function*(final,index,generators){if(final!==void 0)for await(let finalChunk of final())yield*transformChunk(finalChunk,generators,index+1);},destroyTransform=util.callbackify(async({currentIterable},error)=>{if(currentIterable!==void 0){await(error?currentIterable.throw(error):currentIterable.return());return}if(error)throw error}),identityGenerator=function*(chunk){yield chunk;};var pushChunksSync=(getChunksSync,getChunksArguments,transformStream,done)=>{try{for(let chunk of getChunksSync(...getChunksArguments))transformStream.push(chunk);done();}catch(error){done(error);}},runTransformSync=(generators,chunks)=>[...chunks.flatMap(chunk=>[...transformChunkSync(chunk,generators,0)]),...finalChunksSync(generators)],transformChunkSync=function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator2}=generators[index];for(let transformedChunk of transform(chunk))yield*transformChunkSync(transformedChunk,generators,index+1);},finalChunksSync=function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunksSync(final,Number(index),generators);},generatorFinalChunksSync=function*(final,index,generators){if(final!==void 0)for(let finalChunk of final())yield*transformChunkSync(finalChunk,generators,index+1);},identityGenerator2=function*(chunk){yield chunk;};var generatorToStream=({value,value:{transform,final,writableObjectMode,readableObjectMode},optionName},{encoding})=>{let state={},generators=addInternalGenerators(value,encoding,optionName),transformAsync=isAsyncGenerator(transform),finalAsync=isAsyncGenerator(final),transformMethod=transformAsync?pushChunks.bind(void 0,transformChunk,state):pushChunksSync.bind(void 0,transformChunkSync),finalMethod=transformAsync||finalAsync?pushChunks.bind(void 0,finalChunks,state):pushChunksSync.bind(void 0,finalChunksSync),destroyMethod=transformAsync||finalAsync?destroyTransform.bind(void 0,state):void 0;return {stream:new stream.Transform({writableObjectMode,writableHighWaterMark:stream.getDefaultHighWaterMark(writableObjectMode),readableObjectMode,readableHighWaterMark:stream.getDefaultHighWaterMark(readableObjectMode),transform(chunk,encoding2,done){transformMethod([chunk,generators,0],this,done);},flush(done){finalMethod([generators],this,done);},destroy:destroyMethod})}},runGeneratorsSync=(chunks,stdioItems,encoding,isInput)=>{let generators=stdioItems.filter(({type})=>type==="generator"),reversedGenerators=isInput?generators.reverse():generators;for(let{value,optionName}of reversedGenerators){let generators2=addInternalGenerators(value,encoding,optionName);chunks=runTransformSync(generators2,chunks);}return chunks},addInternalGenerators=({transform,final,binary,writableObjectMode,readableObjectMode,preserveNewlines},encoding,optionName)=>{let state={};return [{transform:getValidateTransformInput(writableObjectMode,optionName)},getEncodingTransformGenerator(binary,encoding,writableObjectMode),getSplitLinesGenerator(binary,preserveNewlines,writableObjectMode,state),{transform,final},{transform:getValidateTransformReturn(readableObjectMode,optionName)},getAppendNewlineGenerator({binary,preserveNewlines,readableObjectMode,state})].filter(Boolean)};var addInputOptionsSync=(fileDescriptors,options)=>{for(let fdNumber of getInputFdNumbers(fileDescriptors))addInputOptionSync(fileDescriptors,fdNumber,options);},getInputFdNumbers=fileDescriptors=>new Set(Object.entries(fileDescriptors).filter(([,{direction}])=>direction==="input").map(([fdNumber])=>Number(fdNumber))),addInputOptionSync=(fileDescriptors,fdNumber,options)=>{let{stdioItems}=fileDescriptors[fdNumber],allStdioItems=stdioItems.filter(({contents})=>contents!==void 0);if(allStdioItems.length===0)return;if(fdNumber!==0){let[{type,optionName}]=allStdioItems;throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`)}let transformedContents=allStdioItems.map(({contents})=>contents).map(contents=>applySingleInputGeneratorsSync(contents,stdioItems));options.input=joinToUint8Array(transformedContents);},applySingleInputGeneratorsSync=(contents,stdioItems)=>{let newContents=runGeneratorsSync(contents,stdioItems,"utf8",!0);return validateSerializable(newContents),joinToUint8Array(newContents)},validateSerializable=newContents=>{let invalidItem=newContents.find(item=>typeof item!="string"&&!isUint8Array(item));if(invalidItem!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${invalidItem}.`)};var shouldLogOutput=({stdioItems,encoding,verboseInfo,fdNumber})=>fdNumber!=="all"&&isFullVerbose(verboseInfo,fdNumber)&&!BINARY_ENCODINGS.has(encoding)&&fdUsesVerbose(fdNumber)&&(stdioItems.some(({type,value})=>type==="native"&&PIPED_STDIO_VALUES.has(value))||stdioItems.every(({type})=>TRANSFORM_TYPES.has(type))),fdUsesVerbose=fdNumber=>fdNumber===1||fdNumber===2,PIPED_STDIO_VALUES=new Set(["pipe","overlapped"]),logLines=async(linesIterable,stream,fdNumber,verboseInfo)=>{for await(let line of linesIterable)isPipingStream(stream)||logLine(line,fdNumber,verboseInfo);},logLinesSync=(linesArray,fdNumber,verboseInfo)=>{for(let line of linesArray)logLine(line,fdNumber,verboseInfo);},isPipingStream=stream=>stream._readableState.pipes.length>0,logLine=(line,fdNumber,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(line);verboseLog({type:"output",verboseMessage,fdNumber,verboseInfo});};var transformOutputSync=({fileDescriptors,syncResult:{output},options,isMaxBuffer,verboseInfo})=>{if(output===null)return {output:Array.from({length:3})};let state={},outputFiles=new Set([]);return {output:output.map((result,fdNumber)=>transformOutputResultSync({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},options)),...state}},transformOutputResultSync=({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},{buffer,encoding,lines,stripFinalNewline:stripFinalNewline2,maxBuffer})=>{if(result===null)return;let truncatedResult=truncateMaxBufferSync(result,isMaxBuffer,maxBuffer),uint8ArrayResult=bufferToUint8Array(truncatedResult),{stdioItems,objectMode}=fileDescriptors[fdNumber],chunks=runOutputGeneratorsSync([uint8ArrayResult],stdioItems,encoding,state),{serializedResult,finalResult=serializedResult}=serializeChunks({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber});logOutputSync({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode});let returnedResult=buffer[fdNumber]?finalResult:void 0;try{return state.error===void 0&&writeToFiles(serializedResult,stdioItems,outputFiles),returnedResult}catch(error){return state.error=error,returnedResult}},runOutputGeneratorsSync=(chunks,stdioItems,encoding,state)=>{try{return runGeneratorsSync(chunks,stdioItems,encoding,!1)}catch(error){return state.error=error,chunks}},serializeChunks=({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber})=>{if(objectMode)return {serializedResult:chunks};if(encoding==="buffer")return {serializedResult:joinToUint8Array(chunks)};let serializedResult=joinToString(chunks,encoding);return lines[fdNumber]?{serializedResult,finalResult:splitLinesSync(serializedResult,!stripFinalNewline2[fdNumber],objectMode)}:{serializedResult}},logOutputSync=({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode})=>{if(!shouldLogOutput({stdioItems,encoding,verboseInfo,fdNumber}))return;let linesArray=splitLinesSync(serializedResult,!1,objectMode);try{logLinesSync(linesArray,fdNumber,verboseInfo);}catch(error){state.error??=error;}},writeToFiles=(serializedResult,stdioItems,outputFiles)=>{for(let{path:path6,append}of stdioItems.filter(({type})=>FILE_TYPES.has(type))){let pathString=typeof path6=="string"?path6:path6.toString();append||outputFiles.has(pathString)?fs.appendFileSync(path6,serializedResult):(outputFiles.add(pathString),fs.writeFileSync(path6,serializedResult));}};var getAllSync=([,stdout,stderr],options)=>{if(options.all)return stdout===void 0?stderr:stderr===void 0?stdout:Array.isArray(stdout)?Array.isArray(stderr)?[...stdout,...stderr]:[...stdout,stripNewline(stderr,options,"all")]:Array.isArray(stderr)?[stripNewline(stdout,options,"all"),...stderr]:isUint8Array(stdout)&&isUint8Array(stderr)?concatUint8Arrays([stdout,stderr]):`${stdout}${stderr}`};var waitForExit=async(subprocess,context)=>{let[exitCode,signal]=await waitForExitOrError(subprocess);return context.isForcefullyTerminated??=!1,[exitCode,signal]},waitForExitOrError=async subprocess=>{let[spawnPayload,exitPayload]=await Promise.allSettled([events.once(subprocess,"spawn"),events.once(subprocess,"exit")]);return spawnPayload.status==="rejected"?[]:exitPayload.status==="rejected"?waitForSubprocessExit(subprocess):exitPayload.value},waitForSubprocessExit=async subprocess=>{try{return await events.once(subprocess,"exit")}catch{return waitForSubprocessExit(subprocess)}},waitForSuccessfulExit=async exitPromise=>{let[exitCode,signal]=await exitPromise;if(!isSubprocessErrorExit(exitCode,signal)&&isFailedExit(exitCode,signal))throw new DiscardedError;return [exitCode,signal]},isSubprocessErrorExit=(exitCode,signal)=>exitCode===void 0&&signal===void 0,isFailedExit=(exitCode,signal)=>exitCode!==0||signal!==null;var getExitResultSync=({error,status:exitCode,signal,output},{maxBuffer})=>{let resultError=getResultError(error,exitCode,signal),timedOut=resultError?.code==="ETIMEDOUT",isMaxBuffer=isMaxBufferSync(resultError,output,maxBuffer);return {resultError,exitCode,signal,timedOut,isMaxBuffer}},getResultError=(error,exitCode,signal)=>error!==void 0?error:isFailedExit(exitCode,signal)?new DiscardedError:void 0;var execaCoreSync=(rawFile,rawArguments,rawOptions)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleSyncArguments(rawFile,rawArguments,rawOptions),result=spawnSubprocessSync({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime});return handleResult(result,verboseInfo,options)},handleSyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),syncOptions=normalizeSyncOptions(rawOptions),{file,commandArguments,options}=normalizeOptions(rawFile,rawArguments,syncOptions);validateSyncOptions(options);let fileDescriptors=handleStdioSync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},normalizeSyncOptions=options=>options.node&&!options.ipc?{...options,ipc:!1}:options,validateSyncOptions=({ipc,ipcInput,detached,cancelSignal})=>{ipcInput&&throwInvalidSyncOption("ipcInput"),ipc&&throwInvalidSyncOption("ipc: true"),detached&&throwInvalidSyncOption("detached: true"),cancelSignal&&throwInvalidSyncOption("cancelSignal");},throwInvalidSyncOption=value=>{throw new TypeError(`The "${value}" option cannot be used with synchronous methods.`)},spawnSubprocessSync=({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime})=>{let syncResult=runSubprocessSync({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime});if(syncResult.failed)return syncResult;let{resultError,exitCode,signal,timedOut,isMaxBuffer}=getExitResultSync(syncResult,options),{output,error=resultError}=transformOutputSync({fileDescriptors,syncResult,options,isMaxBuffer,verboseInfo}),stdio=output.map((stdioOutput,fdNumber)=>stripNewline(stdioOutput,options,fdNumber)),all=stripNewline(getAllSync(output,options),options,"all");return getSyncResult({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})},runSubprocessSync=({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime})=>{try{addInputOptionsSync(fileDescriptors,options);let normalizedOptions=normalizeSpawnSyncOptions(options);return child_process.spawnSync(file,commandArguments,normalizedOptions)}catch(error){return makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!0})}},normalizeSpawnSyncOptions=({encoding,maxBuffer,...options})=>({...options,encoding:"buffer",maxBuffer:getMaxBufferSync(maxBuffer)}),getSyncResult=({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})=>error===void 0?makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput:[],options,startTime}):makeError({error,command,escapedCommand,timedOut,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer,isForcefullyTerminated:!1,exitCode,signal,stdio,all,ipcOutput:[],options,startTime,isSync:!0});var getOneMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0,filter}={})=>(validateIpcMethod({methodName:"getOneMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),getOneMessageAsync({anyProcess,channel,isSubprocess,filter,reference})),getOneMessageAsync=async({anyProcess,channel,isSubprocess,filter,reference})=>{addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController;try{return await Promise.race([getMessage(ipcEmitter,filter,controller),throwOnDisconnect2(ipcEmitter,isSubprocess,controller),throwOnStrictError(ipcEmitter,isSubprocess,controller)])}catch(error){throw disconnect(anyProcess),error}finally{controller.abort(),removeReference(channel,reference);}},getMessage=async(ipcEmitter,filter,{signal})=>{if(filter===void 0){let[message]=await events.once(ipcEmitter,"message",{signal});return message}for await(let[message]of events.on(ipcEmitter,"message",{signal}))if(filter(message))return message},throwOnDisconnect2=async(ipcEmitter,isSubprocess,{signal})=>{await events.once(ipcEmitter,"disconnect",{signal}),throwOnEarlyDisconnect(isSubprocess);},throwOnStrictError=async(ipcEmitter,isSubprocess,{signal})=>{let[error]=await events.once(ipcEmitter,"strict:error",{signal});throw getStrictResponseError(error,isSubprocess)};var getEachMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0}={})=>loopOnMessages({anyProcess,channel,isSubprocess,ipc,shouldAwait:!isSubprocess,reference}),loopOnMessages=({anyProcess,channel,isSubprocess,ipc,shouldAwait,reference})=>{validateIpcMethod({methodName:"getEachMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController,state={};return stopOnDisconnect(anyProcess,ipcEmitter,controller),abortOnStrictError({ipcEmitter,isSubprocess,controller,state}),iterateOnMessages({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference})},stopOnDisconnect=async(anyProcess,ipcEmitter,controller)=>{try{await events.once(ipcEmitter,"disconnect",{signal:controller.signal}),controller.abort();}catch{}},abortOnStrictError=async({ipcEmitter,isSubprocess,controller,state})=>{try{let[error]=await events.once(ipcEmitter,"strict:error",{signal:controller.signal});state.error=getStrictResponseError(error,isSubprocess),controller.abort();}catch{}},iterateOnMessages=async function*({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference}){try{for await(let[message]of events.on(ipcEmitter,"message",{signal:controller.signal}))throwIfStrictError(state),yield message;}catch{throwIfStrictError(state);}finally{controller.abort(),removeReference(channel,reference),isSubprocess||disconnect(anyProcess),shouldAwait&&await anyProcess;}},throwIfStrictError=({error})=>{if(error)throw error};var addIpcMethods=(subprocess,{ipc})=>{Object.assign(subprocess,getIpcMethods(subprocess,!1,ipc));},getIpcExport=()=>{let anyProcess=process4__default.default,isSubprocess=!0,ipc=process4__default.default.channel!==void 0;return {...getIpcMethods(anyProcess,isSubprocess,ipc),getCancelSignal:getCancelSignal.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})}},getIpcMethods=(anyProcess,isSubprocess,ipc)=>({sendMessage:sendMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getOneMessage:getOneMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getEachMessage:getEachMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})});var handleEarlyError=({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})=>{cleanupCustomStreams(fileDescriptors);let subprocess=new child_process.ChildProcess;createDummyStreams(subprocess,fileDescriptors),Object.assign(subprocess,{readable,writable,duplex});let earlyError=makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!1}),promise=handleDummyPromise(earlyError,verboseInfo,options);return {subprocess,promise}},createDummyStreams=(subprocess,fileDescriptors)=>{let stdin=createDummyStream(),stdout=createDummyStream(),stderr=createDummyStream(),extraStdio=Array.from({length:fileDescriptors.length-3},createDummyStream),all=createDummyStream(),stdio=[stdin,stdout,stderr,...extraStdio];Object.assign(subprocess,{stdin,stdout,stderr,all,stdio});},createDummyStream=()=>{let stream$1=new stream.PassThrough;return stream$1.end(),stream$1},readable=()=>new stream.Readable({read(){}}),writable=()=>new stream.Writable({write(){}}),duplex=()=>new stream.Duplex({read(){},write(){}}),handleDummyPromise=async(error,verboseInfo,options)=>handleResult(error,verboseInfo,options);var handleStdioAsync=(options,verboseInfo)=>handleStdio(addPropertiesAsync,options,verboseInfo,!1),forbiddenIfAsync=({type,optionName})=>{throw new TypeError(`The \`${optionName}\` option cannot be ${TYPE_TO_MESSAGE[type]}.`)},addProperties2={fileNumber:forbiddenIfAsync,generator:generatorToStream,asyncGenerator:generatorToStream,nodeStream:({value})=>({stream:value}),webTransform({value:{transform,writableObjectMode,readableObjectMode}}){let objectMode=writableObjectMode||readableObjectMode;return {stream:stream.Duplex.fromWeb(transform,{objectMode})}},duplex:({value:{transform}})=>({stream:transform}),native(){}},addPropertiesAsync={input:{...addProperties2,fileUrl:({value})=>({stream:fs.createReadStream(value)}),filePath:({value:{file}})=>({stream:fs.createReadStream(file)}),webStream:({value})=>({stream:stream.Readable.fromWeb(value)}),iterable:({value})=>({stream:stream.Readable.from(value)}),asyncIterable:({value})=>({stream:stream.Readable.from(value)}),string:({value})=>({stream:stream.Readable.from(value)}),uint8Array:({value})=>({stream:stream.Readable.from(buffer.Buffer.from(value))})},output:{...addProperties2,fileUrl:({value})=>({stream:fs.createWriteStream(value)}),filePath:({value:{file,append}})=>({stream:fs.createWriteStream(file,append?{flags:"a"}:{})}),webStream:({value})=>({stream:stream.Writable.fromWeb(value)}),iterable:forbiddenIfAsync,asyncIterable:forbiddenIfAsync,string:forbiddenIfAsync,uint8Array:forbiddenIfAsync}};function mergeStreams(streams){if(!Array.isArray(streams))throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);for(let stream of streams)validateStream(stream);let objectMode=streams.some(({readableObjectMode})=>readableObjectMode),highWaterMark=getHighWaterMark(streams,objectMode),passThroughStream=new MergedStream({objectMode,writableHighWaterMark:highWaterMark,readableHighWaterMark:highWaterMark});for(let stream of streams)passThroughStream.add(stream);return passThroughStream}var getHighWaterMark=(streams,objectMode)=>{if(streams.length===0)return stream.getDefaultHighWaterMark(objectMode);let highWaterMarks=streams.filter(({readableObjectMode})=>readableObjectMode===objectMode).map(({readableHighWaterMark})=>readableHighWaterMark);return Math.max(...highWaterMarks)},MergedStream=class extends stream.PassThrough{#streams=new Set([]);#ended=new Set([]);#aborted=new Set([]);#onFinished;#unpipeEvent=Symbol("unpipe");#streamPromises=new WeakMap;add(stream){if(validateStream(stream),this.#streams.has(stream))return;this.#streams.add(stream),this.#onFinished??=onMergedStreamFinished(this,this.#streams,this.#unpipeEvent);let streamPromise=endWhenStreamsDone({passThroughStream:this,stream,streams:this.#streams,ended:this.#ended,aborted:this.#aborted,onFinished:this.#onFinished,unpipeEvent:this.#unpipeEvent});this.#streamPromises.set(stream,streamPromise),stream.pipe(this,{end:!1});}async remove(stream){if(validateStream(stream),!this.#streams.has(stream))return !1;let streamPromise=this.#streamPromises.get(stream);return streamPromise===void 0?!1:(this.#streamPromises.delete(stream),stream.unpipe(this),await streamPromise,!0)}},onMergedStreamFinished=async(passThroughStream,streams,unpipeEvent)=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_COUNT);let controller=new AbortController;try{await Promise.race([onMergedStreamEnd(passThroughStream,controller),onInputStreamsUnpipe(passThroughStream,streams,unpipeEvent,controller)]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_COUNT);}},onMergedStreamEnd=async(passThroughStream,{signal})=>{try{await promises.finished(passThroughStream,{signal,cleanup:!0});}catch(error){throw errorOrAbortStream(passThroughStream,error),error}},onInputStreamsUnpipe=async(passThroughStream,streams,unpipeEvent,{signal})=>{for await(let[unpipedStream]of events.on(passThroughStream,"unpipe",{signal}))streams.has(unpipedStream)&&unpipedStream.emit(unpipeEvent);},validateStream=stream=>{if(typeof stream?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`)},endWhenStreamsDone=async({passThroughStream,stream,streams,ended,aborted:aborted2,onFinished,unpipeEvent})=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_PER_STREAM);let controller=new AbortController;try{await Promise.race([afterMergedStreamFinished(onFinished,stream,controller),onInputStreamEnd({passThroughStream,stream,streams,ended,aborted:aborted2,controller}),onInputStreamUnpipe({stream,streams,ended,aborted:aborted2,unpipeEvent,controller})]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_PER_STREAM);}streams.size>0&&streams.size===ended.size+aborted2.size&&(ended.size===0&&aborted2.size>0?abortStream(passThroughStream):endStream(passThroughStream));},afterMergedStreamFinished=async(onFinished,stream,{signal})=>{try{await onFinished,signal.aborted||abortStream(stream);}catch(error){signal.aborted||errorOrAbortStream(stream,error);}},onInputStreamEnd=async({passThroughStream,stream,streams,ended,aborted:aborted2,controller:{signal}})=>{try{await promises.finished(stream,{signal,cleanup:!0,readable:!0,writable:!1}),streams.has(stream)&&ended.add(stream);}catch(error){if(signal.aborted||!streams.has(stream))return;isAbortError(error)?aborted2.add(stream):errorStream(passThroughStream,error);}},onInputStreamUnpipe=async({stream,streams,ended,aborted:aborted2,unpipeEvent,controller:{signal}})=>{if(await events.once(stream,unpipeEvent,{signal}),!stream.readable)return events.once(signal,"abort",{signal});streams.delete(stream),ended.delete(stream),aborted2.delete(stream);},endStream=stream=>{stream.writable&&stream.end();},errorOrAbortStream=(stream,error)=>{isAbortError(error)?abortStream(stream):errorStream(stream,error);},isAbortError=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",abortStream=stream=>{(stream.readable||stream.writable)&&stream.destroy();},errorStream=(stream,error)=>{stream.destroyed||(stream.once("error",noop2),stream.destroy(error));},noop2=()=>{},updateMaxListeners=(passThroughStream,increment2)=>{let maxListeners=passThroughStream.getMaxListeners();maxListeners!==0&&maxListeners!==Number.POSITIVE_INFINITY&&passThroughStream.setMaxListeners(maxListeners+increment2);},PASSTHROUGH_LISTENERS_COUNT=2,PASSTHROUGH_LISTENERS_PER_STREAM=1;var pipeStreams=(source,destination)=>{source.pipe(destination),onSourceFinish(source,destination),onDestinationFinish(source,destination);},onSourceFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(source,{cleanup:!0,readable:!0,writable:!1});}catch{}endDestinationStream(destination);}},endDestinationStream=destination=>{destination.writable&&destination.end();},onDestinationFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(destination,{cleanup:!0,readable:!1,writable:!0});}catch{}abortSourceStream(source);}},abortSourceStream=source=>{source.readable&&source.destroy();};var pipeOutputAsync=(subprocess,fileDescriptors,controller)=>{let pipeGroups=new Map;for(let[fdNumber,{stdioItems,direction}]of Object.entries(fileDescriptors)){for(let{stream}of stdioItems.filter(({type})=>TRANSFORM_TYPES.has(type)))pipeTransform(subprocess,stream,direction,fdNumber);for(let{stream}of stdioItems.filter(({type})=>!TRANSFORM_TYPES.has(type)))pipeStdioItem({subprocess,stream,direction,fdNumber,pipeGroups,controller});}for(let[outputStream,inputStreams]of pipeGroups.entries()){let inputStream=inputStreams.length===1?inputStreams[0]:mergeStreams(inputStreams);pipeStreams(inputStream,outputStream);}},pipeTransform=(subprocess,stream,direction,fdNumber)=>{direction==="output"?pipeStreams(subprocess.stdio[fdNumber],stream):pipeStreams(stream,subprocess.stdio[fdNumber]);let streamProperty=SUBPROCESS_STREAM_PROPERTIES[fdNumber];streamProperty!==void 0&&(subprocess[streamProperty]=stream),subprocess.stdio[fdNumber]=stream;},SUBPROCESS_STREAM_PROPERTIES=["stdin","stdout","stderr"],pipeStdioItem=({subprocess,stream,direction,fdNumber,pipeGroups,controller})=>{if(stream===void 0)return;setStandardStreamMaxListeners(stream,controller);let[inputStream,outputStream]=direction==="output"?[stream,subprocess.stdio[fdNumber]]:[subprocess.stdio[fdNumber],stream],outputStreams=pipeGroups.get(inputStream)??[];pipeGroups.set(inputStream,[...outputStreams,outputStream]);},setStandardStreamMaxListeners=(stream,{signal})=>{isStandardStream(stream)&&incrementMaxListeners(stream,MAX_LISTENERS_INCREMENT,signal);},MAX_LISTENERS_INCREMENT=2;var signals=[];signals.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var processOk=process10=>!!process10&&typeof process10=="object"&&typeof process10.removeListener=="function"&&typeof process10.emit=="function"&&typeof process10.reallyExit=="function"&&typeof process10.listeners=="function"&&typeof process10.kill=="function"&&typeof process10.pid=="number"&&typeof process10.on=="function",kExitEmitter=Symbol.for("signal-exit emitter"),global2=globalThis,ObjectDefineProperty=Object.defineProperty.bind(Object),Emitter=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(global2[kExitEmitter])return global2[kExitEmitter];ObjectDefineProperty(global2,kExitEmitter,{value:this,writable:!1,enumerable:!1,configurable:!1});}on(ev,fn){this.listeners[ev].push(fn);}removeListener(ev,fn){let list=this.listeners[ev],i2=list.indexOf(fn);i2!==-1&&(i2===0&&list.length===1?list.length=0:list.splice(i2,1));}emit(ev,code,signal){if(this.emitted[ev])return !1;this.emitted[ev]=!0;let ret=!1;for(let fn of this.listeners[ev])ret=fn(code,signal)===!0||ret;return ev==="exit"&&(ret=this.emit("afterExit",code,signal)||ret),ret}},SignalExitBase=class{},signalExitWrap=handler=>({onExit(cb,opts){return handler.onExit(cb,opts)},load(){return handler.load()},unload(){return handler.unload()}}),SignalExitFallback=class extends SignalExitBase{onExit(){return ()=>{}}load(){}unload(){}},SignalExit=class extends SignalExitBase{#hupSig=process9.platform==="win32"?"SIGINT":"SIGHUP";#emitter=new Emitter;#process;#originalProcessEmit;#originalProcessReallyExit;#sigListeners={};#loaded=!1;constructor(process10){super(),this.#process=process10,this.#sigListeners={};for(let sig of signals)this.#sigListeners[sig]=()=>{let listeners=this.#process.listeners(sig),{count:count2}=this.#emitter,p=process10;if(typeof p.__signal_exit_emitter__=="object"&&typeof p.__signal_exit_emitter__.count=="number"&&(count2+=p.__signal_exit_emitter__.count),listeners.length===count2){this.unload();let ret=this.#emitter.emit("exit",null,sig),s=sig==="SIGHUP"?this.#hupSig:sig;ret||process10.kill(process10.pid,s);}};this.#originalProcessReallyExit=process10.reallyExit,this.#originalProcessEmit=process10.emit;}onExit(cb,opts){if(!processOk(this.#process))return ()=>{};this.#loaded===!1&&this.load();let ev=opts?.alwaysLast?"afterExit":"exit";return this.#emitter.on(ev,cb),()=>{this.#emitter.removeListener(ev,cb),this.#emitter.listeners.exit.length===0&&this.#emitter.listeners.afterExit.length===0&&this.unload();}}load(){if(!this.#loaded){this.#loaded=!0,this.#emitter.count+=1;for(let sig of signals)try{let fn=this.#sigListeners[sig];fn&&this.#process.on(sig,fn);}catch{}this.#process.emit=(ev,...a2)=>this.#processEmit(ev,...a2),this.#process.reallyExit=code=>this.#processReallyExit(code);}}unload(){this.#loaded&&(this.#loaded=!1,signals.forEach(sig=>{let listener=this.#sigListeners[sig];if(!listener)throw new Error("Listener not defined for signal: "+sig);try{this.#process.removeListener(sig,listener);}catch{}}),this.#process.emit=this.#originalProcessEmit,this.#process.reallyExit=this.#originalProcessReallyExit,this.#emitter.count-=1);}#processReallyExit(code){return processOk(this.#process)?(this.#process.exitCode=code||0,this.#emitter.emit("exit",this.#process.exitCode,null),this.#originalProcessReallyExit.call(this.#process,this.#process.exitCode)):0}#processEmit(ev,...args){let og=this.#originalProcessEmit;if(ev==="exit"&&processOk(this.#process)){typeof args[0]=="number"&&(this.#process.exitCode=args[0]);let ret=og.call(this.#process,ev,...args);return this.#emitter.emit("exit",this.#process.exitCode,null),ret}else return og.call(this.#process,ev,...args)}},process9=globalThis.process,{onExit,load,unload}=signalExitWrap(processOk(process9)?new SignalExit(process9):new SignalExitFallback);var cleanupOnExit=(subprocess,{cleanup,detached},{signal})=>{if(!cleanup||detached)return;let removeExitHandler=onExit(()=>{subprocess.kill();});events.addAbortListener(signal,()=>{removeExitHandler();});};var normalizePipeArguments=({source,sourcePromise,boundOptions,createNested},...pipeArguments)=>{let startTime=getStartTime(),{destination,destinationStream,destinationError,from,unpipeSignal}=getDestinationStream(boundOptions,createNested,pipeArguments),{sourceStream,sourceError}=getSourceStream(source,from),{options:sourceOptions,fileDescriptors}=SUBPROCESS_OPTIONS.get(source);return {sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime}},getDestinationStream=(boundOptions,createNested,pipeArguments)=>{try{let{destination,pipeOptions:{from,to,unpipeSignal}={}}=getDestination(boundOptions,createNested,...pipeArguments),destinationStream=getToStream(destination,to);return {destination,destinationStream,from,unpipeSignal}}catch(error){return {destinationError:error}}},getDestination=(boundOptions,createNested,firstArgument,...pipeArguments)=>{if(Array.isArray(firstArgument))return {destination:createNested(mapDestinationArguments,boundOptions)(firstArgument,...pipeArguments),pipeOptions:boundOptions};if(typeof firstArgument=="string"||firstArgument instanceof URL||isDenoExecPath(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[rawFile,rawArguments,rawOptions]=normalizeParameters(firstArgument,...pipeArguments);return {destination:createNested(mapDestinationArguments)(rawFile,rawArguments,rawOptions),pipeOptions:rawOptions}}if(SUBPROCESS_OPTIONS.has(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return {destination:firstArgument,pipeOptions:pipeArguments[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${firstArgument}`)},mapDestinationArguments=({options})=>({options:{...options,stdin:"pipe",piped:!0}}),getSourceStream=(source,from)=>{try{return {sourceStream:getFromStream(source,from)}}catch(error){return {sourceError:error}}};var handlePipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime})=>{let error=getPipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError});if(error!==void 0)throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})},getPipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError})=>{if(sourceError!==void 0&&destinationError!==void 0)return destinationError;if(destinationError!==void 0)return abortSourceStream(sourceStream),destinationError;if(sourceError!==void 0)return endDestinationStream(destinationStream),sourceError},createNonCommandError=({error,fileDescriptors,sourceOptions,startTime})=>makeEarlyError({error,command:PIPE_COMMAND_MESSAGE,escapedCommand:PIPE_COMMAND_MESSAGE,fileDescriptors,options:sourceOptions,startTime,isSync:!1}),PIPE_COMMAND_MESSAGE="source.pipe(destination)";var waitForBothSubprocesses=async subprocessPromises=>{let[{status:sourceStatus,reason:sourceReason,value:sourceResult=sourceReason},{status:destinationStatus,reason:destinationReason,value:destinationResult=destinationReason}]=await subprocessPromises;if(destinationResult.pipedFrom.includes(sourceResult)||destinationResult.pipedFrom.push(sourceResult),destinationStatus==="rejected")throw destinationResult;if(sourceStatus==="rejected")throw sourceResult;return destinationResult};var pipeSubprocessStream=(sourceStream,destinationStream,maxListenersController)=>{let mergedStream=MERGED_STREAMS.has(destinationStream)?pipeMoreSubprocessStream(sourceStream,destinationStream):pipeFirstSubprocessStream(sourceStream,destinationStream);return incrementMaxListeners(sourceStream,SOURCE_LISTENERS_PER_PIPE,maxListenersController.signal),incrementMaxListeners(destinationStream,DESTINATION_LISTENERS_PER_PIPE,maxListenersController.signal),cleanupMergedStreamsMap(destinationStream),mergedStream},pipeFirstSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=mergeStreams([sourceStream]);return pipeStreams(mergedStream,destinationStream),MERGED_STREAMS.set(destinationStream,mergedStream),mergedStream},pipeMoreSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=MERGED_STREAMS.get(destinationStream);return mergedStream.add(sourceStream),mergedStream},cleanupMergedStreamsMap=async destinationStream=>{try{await promises.finished(destinationStream,{cleanup:!0,readable:!1,writable:!0});}catch{}MERGED_STREAMS.delete(destinationStream);},MERGED_STREAMS=new WeakMap,SOURCE_LISTENERS_PER_PIPE=2,DESTINATION_LISTENERS_PER_PIPE=1;var unpipeOnAbort=(unpipeSignal,unpipeContext)=>unpipeSignal===void 0?[]:[unpipeOnSignalAbort(unpipeSignal,unpipeContext)],unpipeOnSignalAbort=async(unpipeSignal,{sourceStream,mergedStream,fileDescriptors,sourceOptions,startTime})=>{await util.aborted(unpipeSignal,sourceStream),await mergedStream.remove(sourceStream);let error=new Error("Pipe canceled by `unpipeSignal` option.");throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})};var pipeToSubprocess=(sourceInfo,...pipeArguments)=>{if(isPlainObject(pipeArguments[0]))return pipeToSubprocess.bind(void 0,{...sourceInfo,boundOptions:{...sourceInfo.boundOptions,...pipeArguments[0]}});let{destination,...normalizedInfo}=normalizePipeArguments(sourceInfo,...pipeArguments),promise=handlePipePromise({...normalizedInfo,destination});return promise.pipe=pipeToSubprocess.bind(void 0,{...sourceInfo,source:destination,sourcePromise:promise,boundOptions:{}}),promise},handlePipePromise=async({sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime})=>{let subprocessPromises=getSubprocessPromises(sourcePromise,destination);handlePipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime});let maxListenersController=new AbortController;try{let mergedStream=pipeSubprocessStream(sourceStream,destinationStream,maxListenersController);return await Promise.race([waitForBothSubprocesses(subprocessPromises),...unpipeOnAbort(unpipeSignal,{sourceStream,mergedStream,sourceOptions,fileDescriptors,startTime})])}finally{maxListenersController.abort();}},getSubprocessPromises=(sourcePromise,destination)=>Promise.allSettled([sourcePromise,destination]);var iterateOnSubprocessStream=({subprocessStdout,subprocess,binary,shouldEncode,encoding,preserveNewlines})=>{let controller=new AbortController;return stopReadingOnExit(subprocess,controller),iterateOnStream({stream:subprocessStdout,controller,binary,shouldEncode:!subprocessStdout.readableObjectMode&&shouldEncode,encoding,shouldSplit:!subprocessStdout.readableObjectMode,preserveNewlines})},stopReadingOnExit=async(subprocess,controller)=>{try{await subprocess;}catch{}finally{controller.abort();}},iterateForResult=({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewline2,allMixed})=>{let controller=new AbortController;stopReadingOnStreamEnd(onStreamEnd,controller,stream);let objectMode=stream.readableObjectMode&&!allMixed;return iterateOnStream({stream,controller,binary:encoding==="buffer",shouldEncode:!objectMode,encoding,shouldSplit:!objectMode&&lines,preserveNewlines:!stripFinalNewline2})},stopReadingOnStreamEnd=async(onStreamEnd,controller,stream)=>{try{await onStreamEnd;}catch{stream.destroy();}finally{controller.abort();}},iterateOnStream=({stream,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>{let onStdoutChunk=events.on(stream,"data",{signal:controller.signal,highWaterMark:HIGH_WATER_MARK,highWatermark:HIGH_WATER_MARK});return iterateOnData({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})},DEFAULT_OBJECT_HIGH_WATER_MARK=stream.getDefaultHighWaterMark(!0),HIGH_WATER_MARK=DEFAULT_OBJECT_HIGH_WATER_MARK,iterateOnData=async function*({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines}){let generators=getGenerators({binary,shouldEncode,encoding,shouldSplit,preserveNewlines});try{for await(let[chunk]of onStdoutChunk)yield*transformChunkSync(chunk,generators,0);}catch(error){if(!controller.signal.aborted)throw error}finally{yield*finalChunksSync(generators);}},getGenerators=({binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>[getEncodingTransformGenerator(binary,encoding,!shouldEncode),getSplitLinesGenerator(binary,preserveNewlines,!shouldSplit,{})].filter(Boolean);var getStreamOutput=async({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{let logPromise=logOutputAsync({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo});if(!buffer){await Promise.all([resumeStream(stream),logPromise]);return}let stripFinalNewlineValue=getStripFinalNewline(stripFinalNewline2,fdNumber),iterable=iterateForResult({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewlineValue,allMixed}),[output]=await Promise.all([getStreamContents2({stream,iterable,fdNumber,encoding,maxBuffer,lines}),logPromise]);return output},logOutputAsync=async({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo:{fileDescriptors}})=>{if(!shouldLogOutput({stdioItems:fileDescriptors[fdNumber]?.stdioItems,encoding,verboseInfo,fdNumber}))return;let linesIterable=iterateForResult({stream,onStreamEnd,lines:!0,encoding,stripFinalNewline:!0,allMixed});await logLines(linesIterable,stream,fdNumber,verboseInfo);},resumeStream=async stream=>{await promises$1.setImmediate(),stream.readableFlowing===null&&stream.resume();},getStreamContents2=async({stream,stream:{readableObjectMode},iterable,fdNumber,encoding,maxBuffer,lines})=>{try{return readableObjectMode||lines?await getStreamAsArray(iterable,{maxBuffer}):encoding==="buffer"?new Uint8Array(await getStreamAsArrayBuffer(iterable,{maxBuffer})):await getStreamAsString(iterable,{maxBuffer})}catch(error){return handleBufferedData(handleMaxBuffer({error,stream,readableObjectMode,lines,encoding,fdNumber}))}},getBufferedData=async streamPromise=>{try{return await streamPromise}catch(error){return handleBufferedData(error)}},handleBufferedData=({bufferedData})=>isArrayBuffer(bufferedData)?new Uint8Array(bufferedData):bufferedData;var waitForStream=async(stream,fdNumber,streamInfo,{isSameDirection,stopOnExit=!1}={})=>{let state=handleStdinDestroy(stream,streamInfo),abortController=new AbortController;try{await Promise.race([...stopOnExit?[streamInfo.exitPromise]:[],promises.finished(stream,{cleanup:!0,signal:abortController.signal})]);}catch(error){state.stdinCleanedUp||handleStreamError(error,fdNumber,streamInfo,isSameDirection);}finally{abortController.abort();}},handleStdinDestroy=(stream,{originalStreams:[originalStdin],subprocess})=>{let state={stdinCleanedUp:!1};return stream===originalStdin&&spyOnStdinDestroy(stream,subprocess,state),state},spyOnStdinDestroy=(subprocessStdin,subprocess,state)=>{let{_destroy}=subprocessStdin;subprocessStdin._destroy=(...destroyArguments)=>{setStdinCleanedUp(subprocess,state),_destroy.call(subprocessStdin,...destroyArguments);};},setStdinCleanedUp=({exitCode,signalCode},state)=>{(exitCode!==null||signalCode!==null)&&(state.stdinCleanedUp=!0);},handleStreamError=(error,fdNumber,streamInfo,isSameDirection)=>{if(!shouldIgnoreStreamError(error,fdNumber,streamInfo,isSameDirection))throw error},shouldIgnoreStreamError=(error,fdNumber,streamInfo,isSameDirection=!0)=>streamInfo.propagating?isStreamEpipe(error)||isStreamAbort(error):(streamInfo.propagating=!0,isInputFileDescriptor(streamInfo,fdNumber)===isSameDirection?isStreamEpipe(error):isStreamAbort(error)),isInputFileDescriptor=({fileDescriptors},fdNumber)=>fdNumber!=="all"&&fileDescriptors[fdNumber].direction==="input",isStreamAbort=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",isStreamEpipe=error=>error?.code==="EPIPE";var waitForStdioStreams=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>subprocess.stdio.map((stream,fdNumber)=>waitForSubprocessStream({stream,fdNumber,encoding,buffer:buffer[fdNumber],maxBuffer:maxBuffer[fdNumber],lines:lines[fdNumber],allMixed:!1,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})),waitForSubprocessStream=async({stream,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{if(!stream)return;let onStreamEnd=waitForStream(stream,fdNumber,streamInfo);if(isInputFileDescriptor(streamInfo,fdNumber)){await onStreamEnd;return}let[output]=await Promise.all([getStreamOutput({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),onStreamEnd]);return output};var makeAllStream=({stdout,stderr},{all})=>all&&(stdout||stderr)?mergeStreams([stdout,stderr].filter(Boolean)):void 0,waitForAllStream=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>waitForSubprocessStream({...getAllStream(subprocess,buffer),fdNumber:"all",encoding,maxBuffer:maxBuffer[1]+maxBuffer[2],lines:lines[1]||lines[2],allMixed:getAllMixed(subprocess),stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),getAllStream=({stdout,stderr,all},[,bufferStdout,bufferStderr])=>{let buffer=bufferStdout||bufferStderr;return buffer?bufferStdout?bufferStderr?{stream:all,buffer}:{stream:stdout,buffer}:{stream:stderr,buffer}:{stream:all,buffer}},getAllMixed=({all,stdout,stderr})=>all&&stdout&&stderr&&stdout.readableObjectMode!==stderr.readableObjectMode;var shouldLogIpc=verboseInfo=>isFullVerbose(verboseInfo,"ipc"),logIpcOutput=(message,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(message);verboseLog({type:"ipc",verboseMessage,fdNumber:"ipc",verboseInfo});};var waitForIpcOutput=async({subprocess,buffer:bufferArray,maxBuffer:maxBufferArray,ipc,ipcOutput,verboseInfo})=>{if(!ipc)return ipcOutput;let isVerbose2=shouldLogIpc(verboseInfo),buffer=getFdSpecificValue(bufferArray,"ipc"),maxBuffer=getFdSpecificValue(maxBufferArray,"ipc");for await(let message of loopOnMessages({anyProcess:subprocess,channel:subprocess.channel,isSubprocess:!1,ipc,shouldAwait:!1,reference:!0}))buffer&&(checkIpcMaxBuffer(subprocess,ipcOutput,maxBuffer),ipcOutput.push(message)),isVerbose2&&logIpcOutput(message,verboseInfo);return ipcOutput},getBufferedIpcOutput=async(ipcOutputPromise,ipcOutput)=>(await Promise.allSettled([ipcOutputPromise]),ipcOutput);var waitForSubprocessResult=async({subprocess,options:{encoding,buffer,maxBuffer,lines,timeoutDuration:timeout,cancelSignal,gracefulCancel,forceKillAfterDelay,stripFinalNewline:stripFinalNewline2,ipc,ipcInput},context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller})=>{let exitPromise=waitForExit(subprocess,context),streamInfo={originalStreams,fileDescriptors,subprocess,exitPromise,propagating:!1},stdioPromises=waitForStdioStreams({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),allPromise=waitForAllStream({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),ipcOutput=[],ipcOutputPromise=waitForIpcOutput({subprocess,buffer,maxBuffer,ipc,ipcOutput,verboseInfo}),originalPromises=waitForOriginalStreams(originalStreams,subprocess,streamInfo),customStreamsEndPromises=waitForCustomStreamsEnd(fileDescriptors,streamInfo);try{return await Promise.race([Promise.all([{},waitForSuccessfulExit(exitPromise),Promise.all(stdioPromises),allPromise,ipcOutputPromise,sendIpcInput(subprocess,ipcInput),...originalPromises,...customStreamsEndPromises]),onInternalError,throwOnSubprocessError(subprocess,controller),...throwOnTimeout(subprocess,timeout,context,controller),...throwOnCancel({subprocess,cancelSignal,gracefulCancel,context,controller}),...throwOnGracefulCancel({subprocess,cancelSignal,gracefulCancel,forceKillAfterDelay,context,controller})])}catch(error){return context.terminationReason??="other",Promise.all([{error},exitPromise,Promise.all(stdioPromises.map(stdioPromise=>getBufferedData(stdioPromise))),getBufferedData(allPromise),getBufferedIpcOutput(ipcOutputPromise,ipcOutput),Promise.allSettled(originalPromises),Promise.allSettled(customStreamsEndPromises)])}},waitForOriginalStreams=(originalStreams,subprocess,streamInfo)=>originalStreams.map((stream,fdNumber)=>stream===subprocess.stdio[fdNumber]?void 0:waitForStream(stream,fdNumber,streamInfo)),waitForCustomStreamsEnd=(fileDescriptors,streamInfo)=>fileDescriptors.flatMap(({stdioItems},fdNumber)=>stdioItems.filter(({value,stream=value})=>isStream(stream,{checkOpen:!1})&&!isStandardStream(stream)).map(({type,value,stream=value})=>waitForStream(stream,fdNumber,streamInfo,{isSameDirection:TRANSFORM_TYPES.has(type),stopOnExit:type==="native"}))),throwOnSubprocessError=async(subprocess,{signal})=>{let[error]=await events.once(subprocess,"error",{signal});throw error};var initializeConcurrentStreams=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),addConcurrentStream=(concurrentStreams,stream,waitName)=>{let weakMap=concurrentStreams[waitName];weakMap.has(stream)||weakMap.set(stream,[]);let promises=weakMap.get(stream),promise=createDeferred();return promises.push(promise),{resolve:promise.resolve.bind(promise),promises}},waitForConcurrentStreams=async({resolve,promises},subprocess)=>{resolve();let[isSubprocessExit]=await Promise.race([Promise.allSettled([!0,subprocess]),Promise.all([!1,...promises])]);return !isSubprocessExit};var safeWaitForSubprocessStdin=async subprocessStdin=>{if(subprocessStdin!==void 0)try{await waitForSubprocessStdin(subprocessStdin);}catch{}},safeWaitForSubprocessStdout=async subprocessStdout=>{if(subprocessStdout!==void 0)try{await waitForSubprocessStdout(subprocessStdout);}catch{}},waitForSubprocessStdin=async subprocessStdin=>{await promises.finished(subprocessStdin,{cleanup:!0,readable:!1,writable:!0});},waitForSubprocessStdout=async subprocessStdout=>{await promises.finished(subprocessStdout,{cleanup:!0,readable:!0,writable:!1});},waitForSubprocess=async(subprocess,error)=>{if(await subprocess,error)throw error},destroyOtherStream=(stream,isOpen,error)=>{error&&!isStreamAbort(error)?stream.destroy(error):isOpen&&stream.destroy();};var createReadable=({subprocess,concurrentStreams,encoding},{from,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),readable2=new stream.Readable({read,destroy:util.callbackify(onReadableDestroy.bind(void 0,{subprocessStdout,subprocess,waitReadableDestroy})),highWaterMark:readableHighWaterMark,objectMode:readableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess}),readable2},getSubprocessStdout=(subprocess,from,concurrentStreams)=>{let subprocessStdout=getFromStream(subprocess,from),waitReadableDestroy=addConcurrentStream(concurrentStreams,subprocessStdout,"readableDestroy");return {subprocessStdout,waitReadableDestroy}},getReadableOptions=({readableEncoding,readableObjectMode,readableHighWaterMark},binary)=>binary?{readableEncoding,readableObjectMode,readableHighWaterMark}:{readableEncoding,readableObjectMode:!0,readableHighWaterMark:DEFAULT_OBJECT_HIGH_WATER_MARK},getReadableMethods=({subprocessStdout,subprocess,binary,encoding,preserveNewlines})=>{let onStdoutDataDone=createDeferred(),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!binary,encoding,preserveNewlines});return {read(){onRead(this,onStdoutData,onStdoutDataDone);},onStdoutDataDone}},onRead=async(readable2,onStdoutData,onStdoutDataDone)=>{try{let{value,done}=await onStdoutData.next();done?onStdoutDataDone.resolve():readable2.push(value);}catch{}},onStdoutFinished=async({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess,subprocessStdin})=>{try{await waitForSubprocessStdout(subprocessStdout),await subprocess,await safeWaitForSubprocessStdin(subprocessStdin),await onStdoutDataDone,readable2.readable&&readable2.push(null);}catch(error){await safeWaitForSubprocessStdin(subprocessStdin),destroyOtherReadable(readable2,error);}},onReadableDestroy=async({subprocessStdout,subprocess,waitReadableDestroy},error)=>{await waitForConcurrentStreams(waitReadableDestroy,subprocess)&&(destroyOtherReadable(subprocessStdout,error),await waitForSubprocess(subprocess,error));},destroyOtherReadable=(stream,error)=>{destroyOtherStream(stream,stream.readable,error);};var createWritable=({subprocess,concurrentStreams},{to}={})=>{let{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),writable2=new stream.Writable({...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onWritableDestroy.bind(void 0,{subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy})),highWaterMark:subprocessStdin.writableHighWaterMark,objectMode:subprocessStdin.writableObjectMode});return onStdinFinished(subprocessStdin,writable2),writable2},getSubprocessStdin=(subprocess,to,concurrentStreams)=>{let subprocessStdin=getToStream(subprocess,to),waitWritableFinal=addConcurrentStream(concurrentStreams,subprocessStdin,"writableFinal"),waitWritableDestroy=addConcurrentStream(concurrentStreams,subprocessStdin,"writableDestroy");return {subprocessStdin,waitWritableFinal,waitWritableDestroy}},getWritableMethods=(subprocessStdin,subprocess,waitWritableFinal)=>({write:onWrite.bind(void 0,subprocessStdin),final:util.callbackify(onWritableFinal.bind(void 0,subprocessStdin,subprocess,waitWritableFinal))}),onWrite=(subprocessStdin,chunk,encoding,done)=>{subprocessStdin.write(chunk,encoding)?done():subprocessStdin.once("drain",done);},onWritableFinal=async(subprocessStdin,subprocess,waitWritableFinal)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess)&&(subprocessStdin.writable&&subprocessStdin.end(),await subprocess);},onStdinFinished=async(subprocessStdin,writable2,subprocessStdout)=>{try{await waitForSubprocessStdin(subprocessStdin),writable2.writable&&writable2.end();}catch(error){await safeWaitForSubprocessStdout(subprocessStdout),destroyOtherWritable(writable2,error);}},onWritableDestroy=async({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess),await waitForConcurrentStreams(waitWritableDestroy,subprocess)&&(destroyOtherWritable(subprocessStdin,error),await waitForSubprocess(subprocess,error));},destroyOtherWritable=(stream,error)=>{destroyOtherStream(stream,stream.writable,error);};var createDuplex=({subprocess,concurrentStreams,encoding},{from,to,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),duplex2=new stream.Duplex({read,...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onDuplexDestroy.bind(void 0,{subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy})),readableHighWaterMark,writableHighWaterMark:subprocessStdin.writableHighWaterMark,readableObjectMode,writableObjectMode:subprocessStdin.writableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:duplex2,subprocess,subprocessStdin}),onStdinFinished(subprocessStdin,duplex2,subprocessStdout),duplex2},onDuplexDestroy=async({subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy},error)=>{await Promise.all([onReadableDestroy({subprocessStdout,subprocess,waitReadableDestroy},error),onWritableDestroy({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)]);};var createIterable=(subprocess,encoding,{from,binary:binaryOption=!1,preserveNewlines=!1}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),subprocessStdout=getFromStream(subprocess,from),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!0,encoding,preserveNewlines});return iterateOnStdoutData(onStdoutData,subprocessStdout,subprocess)},iterateOnStdoutData=async function*(onStdoutData,subprocessStdout,subprocess){try{yield*onStdoutData;}finally{subprocessStdout.readable&&subprocessStdout.destroy(),await subprocess;}};var addConvertedStreams=(subprocess,{encoding})=>{let concurrentStreams=initializeConcurrentStreams();subprocess.readable=createReadable.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.writable=createWritable.bind(void 0,{subprocess,concurrentStreams}),subprocess.duplex=createDuplex.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.iterable=createIterable.bind(void 0,subprocess,encoding),subprocess[Symbol.asyncIterator]=createIterable.bind(void 0,subprocess,encoding,{});};var mergePromise=(subprocess,promise)=>{for(let[property,descriptor]of descriptors){let value=descriptor.value.bind(promise);Reflect.defineProperty(subprocess,property,{...descriptor,value});}},nativePromisePrototype=(async()=>{})().constructor.prototype,descriptors=["then","catch","finally"].map(property=>[property,Reflect.getOwnPropertyDescriptor(nativePromisePrototype,property)]);var execaCoreAsync=(rawFile,rawArguments,rawOptions,createNested)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleAsyncArguments(rawFile,rawArguments,rawOptions),{subprocess,promise}=spawnSubprocessAsync({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors});return subprocess.pipe=pipeToSubprocess.bind(void 0,{source:subprocess,sourcePromise:promise,boundOptions:{},createNested}),mergePromise(subprocess,promise),SUBPROCESS_OPTIONS.set(subprocess,{options,fileDescriptors}),subprocess},handleAsyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),{file,commandArguments,options:normalizedOptions}=normalizeOptions(rawFile,rawArguments,rawOptions),options=handleAsyncOptions(normalizedOptions),fileDescriptors=handleStdioAsync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},handleAsyncOptions=({timeout,signal,...options})=>{if(signal!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return {...options,timeoutDuration:timeout}},spawnSubprocessAsync=({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors})=>{let subprocess;try{subprocess=child_process.spawn(file,commandArguments,options);}catch(error){return handleEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})}let controller=new AbortController;events.setMaxListeners(Number.POSITIVE_INFINITY,controller.signal);let originalStreams=[...subprocess.stdio];pipeOutputAsync(subprocess,fileDescriptors,controller),cleanupOnExit(subprocess,options,controller);let context={},onInternalError=createDeferred();subprocess.kill=subprocessKill.bind(void 0,{kill:subprocess.kill.bind(subprocess),options,onInternalError,context,controller}),subprocess.all=makeAllStream(subprocess,options),addConvertedStreams(subprocess,options),addIpcMethods(subprocess,options);let promise=handlePromise({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller});return {subprocess,promise}},handlePromise=async({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller})=>{let[errorInfo,[exitCode,signal],stdioResults,allResult,ipcOutput]=await waitForSubprocessResult({subprocess,options,context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller});controller.abort(),onInternalError.resolve();let stdio=stdioResults.map((stdioResult,fdNumber)=>stripNewline(stdioResult,options,fdNumber)),all=stripNewline(allResult,options,"all"),result=getAsyncResult({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime});return handleResult(result,verboseInfo,options)},getAsyncResult=({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime})=>"error"in errorInfo?makeError({error:errorInfo.error,command,escapedCommand,timedOut:context.terminationReason==="timeout",isCanceled:context.terminationReason==="cancel"||context.terminationReason==="gracefulCancel",isGracefullyCanceled:context.terminationReason==="gracefulCancel",isMaxBuffer:errorInfo.error instanceof MaxBufferError,isForcefullyTerminated:context.isForcefullyTerminated,exitCode,signal,stdio,all,ipcOutput,options,startTime,isSync:!1}):makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput,options,startTime});var mergeOptions=(boundOptions,options)=>{let newOptions=Object.fromEntries(Object.entries(options).map(([optionName,optionValue])=>[optionName,mergeOption(optionName,boundOptions[optionName],optionValue)]));return {...boundOptions,...newOptions}},mergeOption=(optionName,boundOptionValue,optionValue)=>DEEP_OPTIONS.has(optionName)&&isPlainObject(boundOptionValue)&&isPlainObject(optionValue)?{...boundOptionValue,...optionValue}:optionValue,DEEP_OPTIONS=new Set(["env",...FD_SPECIFIC_OPTIONS]);var createExeca=(mapArguments,boundOptions,deepOptions,setBoundExeca)=>{let createNested=(mapArguments2,boundOptions2,setBoundExeca2)=>createExeca(mapArguments2,boundOptions2,deepOptions,setBoundExeca2),boundExeca=(...execaArguments)=>callBoundExeca({mapArguments,deepOptions,boundOptions,setBoundExeca,createNested},...execaArguments);return setBoundExeca!==void 0&&setBoundExeca(boundExeca,createNested,boundOptions),boundExeca},callBoundExeca=({mapArguments,deepOptions={},boundOptions={},setBoundExeca,createNested},firstArgument,...nextArguments)=>{if(isPlainObject(firstArgument))return createNested(mapArguments,mergeOptions(boundOptions,firstArgument),setBoundExeca);let{file,commandArguments,options,isSync}=parseArguments({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions});return isSync?execaCoreSync(file,commandArguments,options):execaCoreAsync(file,commandArguments,options,createNested)},parseArguments=({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions})=>{let callArguments=isTemplateString(firstArgument)?parseTemplates(firstArgument,nextArguments):[firstArgument,...nextArguments],[initialFile,initialArguments,initialOptions]=normalizeParameters(...callArguments),mergedOptions=mergeOptions(mergeOptions(deepOptions,boundOptions),initialOptions),{file=initialFile,commandArguments=initialArguments,options=mergedOptions,isSync=!1}=mapArguments({file:initialFile,commandArguments:initialArguments,options:mergedOptions});return {file,commandArguments,options,isSync}};var mapCommandAsync=({file,commandArguments})=>parseCommand(file,commandArguments),mapCommandSync=({file,commandArguments})=>({...parseCommand(file,commandArguments),isSync:!0}),parseCommand=(command,unusedArguments)=>{if(unusedArguments.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${command} ${unusedArguments}.`);let[file,...commandArguments]=parseCommandString(command);return {file,commandArguments}},parseCommandString=command=>{if(typeof command!="string")throw new TypeError(`The command must be a string: ${String(command)}.`);let trimmedCommand=command.trim();if(trimmedCommand==="")return [];let tokens=[];for(let token of trimmedCommand.split(SPACES_REGEXP)){let previousToken=tokens.at(-1);previousToken&&previousToken.endsWith("\\")?tokens[tokens.length-1]=`${previousToken.slice(0,-1)} ${token}`:tokens.push(token);}return tokens},SPACES_REGEXP=/ +/g;var setScriptSync=(boundExeca,createNested,boundOptions)=>{boundExeca.sync=createNested(mapScriptSync,boundOptions),boundExeca.s=boundExeca.sync;},mapScriptAsync=({options})=>getScriptOptions(options),mapScriptSync=({options})=>({...getScriptOptions(options),isSync:!0}),getScriptOptions=options=>({options:{...getScriptStdinOption(options),...options}}),getScriptStdinOption=({input,inputFile,stdio})=>input===void 0&&inputFile===void 0&&stdio===void 0?{stdin:"inherit"}:{},deepScriptOptions={preferLocal:!0};var execa=createExeca(()=>({}));createExeca(()=>({isSync:!0}));createExeca(mapCommandAsync);createExeca(mapCommandSync);createExeca(mapNode);createExeca(mapScriptAsync,{},deepScriptOptions,setScriptSync);getIpcExport();var $2=execa({preferLocal:!0,stdio:"inherit",reject:!1});async function postinstall(options){let command=["storybook","automigrate","addonA11yAddonTest"];options.yes&&command.push("--yes"),options.packageManager&&command.push("--package-manager",options.packageManager),options.configDir&&command.push("--config-dir",options.configDir),await $2`${command.join(" ")}`;}
67
+ if (condition) { yield value; }`)};var getEncodingTransformGenerator=(binary,encoding,skipped)=>{if(skipped)return;if(binary)return {transform:encodingUint8ArrayGenerator.bind(void 0,new TextEncoder)};let stringDecoder=new string_decoder.StringDecoder(encoding);return {transform:encodingStringGenerator.bind(void 0,stringDecoder),final:encodingStringFinal.bind(void 0,stringDecoder)}},encodingUint8ArrayGenerator=function*(textEncoder3,chunk){buffer.Buffer.isBuffer(chunk)?yield bufferToUint8Array(chunk):typeof chunk=="string"?yield textEncoder3.encode(chunk):yield chunk;},encodingStringGenerator=function*(stringDecoder,chunk){yield isUint8Array(chunk)?stringDecoder.write(chunk):chunk;},encodingStringFinal=function*(stringDecoder){let lastChunk=stringDecoder.end();lastChunk!==""&&(yield lastChunk);};var pushChunks=util.callbackify(async(getChunks,state,getChunksArguments,transformStream)=>{state.currentIterable=getChunks(...getChunksArguments);try{for await(let chunk of state.currentIterable)transformStream.push(chunk);}finally{delete state.currentIterable;}}),transformChunk=async function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator}=generators[index];for await(let transformedChunk of transform(chunk))yield*transformChunk(transformedChunk,generators,index+1);},finalChunks=async function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunks(final,Number(index),generators);},generatorFinalChunks=async function*(final,index,generators){if(final!==void 0)for await(let finalChunk of final())yield*transformChunk(finalChunk,generators,index+1);},destroyTransform=util.callbackify(async({currentIterable},error)=>{if(currentIterable!==void 0){await(error?currentIterable.throw(error):currentIterable.return());return}if(error)throw error}),identityGenerator=function*(chunk){yield chunk;};var pushChunksSync=(getChunksSync,getChunksArguments,transformStream,done)=>{try{for(let chunk of getChunksSync(...getChunksArguments))transformStream.push(chunk);done();}catch(error){done(error);}},runTransformSync=(generators,chunks)=>[...chunks.flatMap(chunk=>[...transformChunkSync(chunk,generators,0)]),...finalChunksSync(generators)],transformChunkSync=function*(chunk,generators,index){if(index===generators.length){yield chunk;return}let{transform=identityGenerator2}=generators[index];for(let transformedChunk of transform(chunk))yield*transformChunkSync(transformedChunk,generators,index+1);},finalChunksSync=function*(generators){for(let[index,{final}]of Object.entries(generators))yield*generatorFinalChunksSync(final,Number(index),generators);},generatorFinalChunksSync=function*(final,index,generators){if(final!==void 0)for(let finalChunk of final())yield*transformChunkSync(finalChunk,generators,index+1);},identityGenerator2=function*(chunk){yield chunk;};var generatorToStream=({value,value:{transform,final,writableObjectMode,readableObjectMode},optionName},{encoding})=>{let state={},generators=addInternalGenerators(value,encoding,optionName),transformAsync=isAsyncGenerator(transform),finalAsync=isAsyncGenerator(final),transformMethod=transformAsync?pushChunks.bind(void 0,transformChunk,state):pushChunksSync.bind(void 0,transformChunkSync),finalMethod=transformAsync||finalAsync?pushChunks.bind(void 0,finalChunks,state):pushChunksSync.bind(void 0,finalChunksSync),destroyMethod=transformAsync||finalAsync?destroyTransform.bind(void 0,state):void 0;return {stream:new stream.Transform({writableObjectMode,writableHighWaterMark:stream.getDefaultHighWaterMark(writableObjectMode),readableObjectMode,readableHighWaterMark:stream.getDefaultHighWaterMark(readableObjectMode),transform(chunk,encoding2,done){transformMethod([chunk,generators,0],this,done);},flush(done){finalMethod([generators],this,done);},destroy:destroyMethod})}},runGeneratorsSync=(chunks,stdioItems,encoding,isInput)=>{let generators=stdioItems.filter(({type})=>type==="generator"),reversedGenerators=isInput?generators.reverse():generators;for(let{value,optionName}of reversedGenerators){let generators2=addInternalGenerators(value,encoding,optionName);chunks=runTransformSync(generators2,chunks);}return chunks},addInternalGenerators=({transform,final,binary,writableObjectMode,readableObjectMode,preserveNewlines},encoding,optionName)=>{let state={};return [{transform:getValidateTransformInput(writableObjectMode,optionName)},getEncodingTransformGenerator(binary,encoding,writableObjectMode),getSplitLinesGenerator(binary,preserveNewlines,writableObjectMode,state),{transform,final},{transform:getValidateTransformReturn(readableObjectMode,optionName)},getAppendNewlineGenerator({binary,preserveNewlines,readableObjectMode,state})].filter(Boolean)};var addInputOptionsSync=(fileDescriptors,options)=>{for(let fdNumber of getInputFdNumbers(fileDescriptors))addInputOptionSync(fileDescriptors,fdNumber,options);},getInputFdNumbers=fileDescriptors=>new Set(Object.entries(fileDescriptors).filter(([,{direction}])=>direction==="input").map(([fdNumber])=>Number(fdNumber))),addInputOptionSync=(fileDescriptors,fdNumber,options)=>{let{stdioItems}=fileDescriptors[fdNumber],allStdioItems=stdioItems.filter(({contents})=>contents!==void 0);if(allStdioItems.length===0)return;if(fdNumber!==0){let[{type,optionName}]=allStdioItems;throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`)}let transformedContents=allStdioItems.map(({contents})=>contents).map(contents=>applySingleInputGeneratorsSync(contents,stdioItems));options.input=joinToUint8Array(transformedContents);},applySingleInputGeneratorsSync=(contents,stdioItems)=>{let newContents=runGeneratorsSync(contents,stdioItems,"utf8",!0);return validateSerializable(newContents),joinToUint8Array(newContents)},validateSerializable=newContents=>{let invalidItem=newContents.find(item=>typeof item!="string"&&!isUint8Array(item));if(invalidItem!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${invalidItem}.`)};var shouldLogOutput=({stdioItems,encoding,verboseInfo,fdNumber})=>fdNumber!=="all"&&isFullVerbose(verboseInfo,fdNumber)&&!BINARY_ENCODINGS.has(encoding)&&fdUsesVerbose(fdNumber)&&(stdioItems.some(({type,value})=>type==="native"&&PIPED_STDIO_VALUES.has(value))||stdioItems.every(({type})=>TRANSFORM_TYPES.has(type))),fdUsesVerbose=fdNumber=>fdNumber===1||fdNumber===2,PIPED_STDIO_VALUES=new Set(["pipe","overlapped"]),logLines=async(linesIterable,stream,fdNumber,verboseInfo)=>{for await(let line of linesIterable)isPipingStream(stream)||logLine(line,fdNumber,verboseInfo);},logLinesSync=(linesArray,fdNumber,verboseInfo)=>{for(let line of linesArray)logLine(line,fdNumber,verboseInfo);},isPipingStream=stream=>stream._readableState.pipes.length>0,logLine=(line,fdNumber,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(line);verboseLog({type:"output",verboseMessage,fdNumber,verboseInfo});};var transformOutputSync=({fileDescriptors,syncResult:{output},options,isMaxBuffer,verboseInfo})=>{if(output===null)return {output:Array.from({length:3})};let state={},outputFiles=new Set([]);return {output:output.map((result,fdNumber)=>transformOutputResultSync({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},options)),...state}},transformOutputResultSync=({result,fileDescriptors,fdNumber,state,outputFiles,isMaxBuffer,verboseInfo},{buffer,encoding,lines,stripFinalNewline:stripFinalNewline2,maxBuffer})=>{if(result===null)return;let truncatedResult=truncateMaxBufferSync(result,isMaxBuffer,maxBuffer),uint8ArrayResult=bufferToUint8Array(truncatedResult),{stdioItems,objectMode}=fileDescriptors[fdNumber],chunks=runOutputGeneratorsSync([uint8ArrayResult],stdioItems,encoding,state),{serializedResult,finalResult=serializedResult}=serializeChunks({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber});logOutputSync({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode});let returnedResult=buffer[fdNumber]?finalResult:void 0;try{return state.error===void 0&&writeToFiles(serializedResult,stdioItems,outputFiles),returnedResult}catch(error){return state.error=error,returnedResult}},runOutputGeneratorsSync=(chunks,stdioItems,encoding,state)=>{try{return runGeneratorsSync(chunks,stdioItems,encoding,!1)}catch(error){return state.error=error,chunks}},serializeChunks=({chunks,objectMode,encoding,lines,stripFinalNewline:stripFinalNewline2,fdNumber})=>{if(objectMode)return {serializedResult:chunks};if(encoding==="buffer")return {serializedResult:joinToUint8Array(chunks)};let serializedResult=joinToString(chunks,encoding);return lines[fdNumber]?{serializedResult,finalResult:splitLinesSync(serializedResult,!stripFinalNewline2[fdNumber],objectMode)}:{serializedResult}},logOutputSync=({serializedResult,fdNumber,state,verboseInfo,encoding,stdioItems,objectMode})=>{if(!shouldLogOutput({stdioItems,encoding,verboseInfo,fdNumber}))return;let linesArray=splitLinesSync(serializedResult,!1,objectMode);try{logLinesSync(linesArray,fdNumber,verboseInfo);}catch(error){state.error??=error;}},writeToFiles=(serializedResult,stdioItems,outputFiles)=>{for(let{path:path6,append}of stdioItems.filter(({type})=>FILE_TYPES.has(type))){let pathString=typeof path6=="string"?path6:path6.toString();append||outputFiles.has(pathString)?fs.appendFileSync(path6,serializedResult):(outputFiles.add(pathString),fs.writeFileSync(path6,serializedResult));}};var getAllSync=([,stdout,stderr],options)=>{if(options.all)return stdout===void 0?stderr:stderr===void 0?stdout:Array.isArray(stdout)?Array.isArray(stderr)?[...stdout,...stderr]:[...stdout,stripNewline(stderr,options,"all")]:Array.isArray(stderr)?[stripNewline(stdout,options,"all"),...stderr]:isUint8Array(stdout)&&isUint8Array(stderr)?concatUint8Arrays([stdout,stderr]):`${stdout}${stderr}`};var waitForExit=async(subprocess,context)=>{let[exitCode,signal]=await waitForExitOrError(subprocess);return context.isForcefullyTerminated??=!1,[exitCode,signal]},waitForExitOrError=async subprocess=>{let[spawnPayload,exitPayload]=await Promise.allSettled([events.once(subprocess,"spawn"),events.once(subprocess,"exit")]);return spawnPayload.status==="rejected"?[]:exitPayload.status==="rejected"?waitForSubprocessExit(subprocess):exitPayload.value},waitForSubprocessExit=async subprocess=>{try{return await events.once(subprocess,"exit")}catch{return waitForSubprocessExit(subprocess)}},waitForSuccessfulExit=async exitPromise=>{let[exitCode,signal]=await exitPromise;if(!isSubprocessErrorExit(exitCode,signal)&&isFailedExit(exitCode,signal))throw new DiscardedError;return [exitCode,signal]},isSubprocessErrorExit=(exitCode,signal)=>exitCode===void 0&&signal===void 0,isFailedExit=(exitCode,signal)=>exitCode!==0||signal!==null;var getExitResultSync=({error,status:exitCode,signal,output},{maxBuffer})=>{let resultError=getResultError(error,exitCode,signal),timedOut=resultError?.code==="ETIMEDOUT",isMaxBuffer=isMaxBufferSync(resultError,output,maxBuffer);return {resultError,exitCode,signal,timedOut,isMaxBuffer}},getResultError=(error,exitCode,signal)=>error!==void 0?error:isFailedExit(exitCode,signal)?new DiscardedError:void 0;var execaCoreSync=(rawFile,rawArguments,rawOptions)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleSyncArguments(rawFile,rawArguments,rawOptions),result=spawnSubprocessSync({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime});return handleResult(result,verboseInfo,options)},handleSyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),syncOptions=normalizeSyncOptions(rawOptions),{file,commandArguments,options}=normalizeOptions(rawFile,rawArguments,syncOptions);validateSyncOptions(options);let fileDescriptors=handleStdioSync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},normalizeSyncOptions=options=>options.node&&!options.ipc?{...options,ipc:!1}:options,validateSyncOptions=({ipc,ipcInput,detached,cancelSignal})=>{ipcInput&&throwInvalidSyncOption("ipcInput"),ipc&&throwInvalidSyncOption("ipc: true"),detached&&throwInvalidSyncOption("detached: true"),cancelSignal&&throwInvalidSyncOption("cancelSignal");},throwInvalidSyncOption=value=>{throw new TypeError(`The "${value}" option cannot be used with synchronous methods.`)},spawnSubprocessSync=({file,commandArguments,options,command,escapedCommand,verboseInfo,fileDescriptors,startTime})=>{let syncResult=runSubprocessSync({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime});if(syncResult.failed)return syncResult;let{resultError,exitCode,signal,timedOut,isMaxBuffer}=getExitResultSync(syncResult,options),{output,error=resultError}=transformOutputSync({fileDescriptors,syncResult,options,isMaxBuffer,verboseInfo}),stdio=output.map((stdioOutput,fdNumber)=>stripNewline(stdioOutput,options,fdNumber)),all=stripNewline(getAllSync(output,options),options,"all");return getSyncResult({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})},runSubprocessSync=({file,commandArguments,options,command,escapedCommand,fileDescriptors,startTime})=>{try{addInputOptionsSync(fileDescriptors,options);let normalizedOptions=normalizeSpawnSyncOptions(options);return child_process.spawnSync(...concatenateShell(file,commandArguments,normalizedOptions))}catch(error){return makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!0})}},normalizeSpawnSyncOptions=({encoding,maxBuffer,...options})=>({...options,encoding:"buffer",maxBuffer:getMaxBufferSync(maxBuffer)}),getSyncResult=({error,exitCode,signal,timedOut,isMaxBuffer,stdio,all,options,command,escapedCommand,startTime})=>error===void 0?makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput:[],options,startTime}):makeError({error,command,escapedCommand,timedOut,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer,isForcefullyTerminated:!1,exitCode,signal,stdio,all,ipcOutput:[],options,startTime,isSync:!0});var getOneMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0,filter}={})=>(validateIpcMethod({methodName:"getOneMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),getOneMessageAsync({anyProcess,channel,isSubprocess,filter,reference})),getOneMessageAsync=async({anyProcess,channel,isSubprocess,filter,reference})=>{addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController;try{return await Promise.race([getMessage(ipcEmitter,filter,controller),throwOnDisconnect2(ipcEmitter,isSubprocess,controller),throwOnStrictError(ipcEmitter,isSubprocess,controller)])}catch(error){throw disconnect(anyProcess),error}finally{controller.abort(),removeReference(channel,reference);}},getMessage=async(ipcEmitter,filter,{signal})=>{if(filter===void 0){let[message]=await events.once(ipcEmitter,"message",{signal});return message}for await(let[message]of events.on(ipcEmitter,"message",{signal}))if(filter(message))return message},throwOnDisconnect2=async(ipcEmitter,isSubprocess,{signal})=>{await events.once(ipcEmitter,"disconnect",{signal}),throwOnEarlyDisconnect(isSubprocess);},throwOnStrictError=async(ipcEmitter,isSubprocess,{signal})=>{let[error]=await events.once(ipcEmitter,"strict:error",{signal});throw getStrictResponseError(error,isSubprocess)};var getEachMessage=({anyProcess,channel,isSubprocess,ipc},{reference=!0}={})=>loopOnMessages({anyProcess,channel,isSubprocess,ipc,shouldAwait:!isSubprocess,reference}),loopOnMessages=({anyProcess,channel,isSubprocess,ipc,shouldAwait,reference})=>{validateIpcMethod({methodName:"getEachMessage",isSubprocess,ipc,isConnected:isConnected(anyProcess)}),addReference(channel,reference);let ipcEmitter=getIpcEmitter(anyProcess,channel,isSubprocess),controller=new AbortController,state={};return stopOnDisconnect(anyProcess,ipcEmitter,controller),abortOnStrictError({ipcEmitter,isSubprocess,controller,state}),iterateOnMessages({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference})},stopOnDisconnect=async(anyProcess,ipcEmitter,controller)=>{try{await events.once(ipcEmitter,"disconnect",{signal:controller.signal}),controller.abort();}catch{}},abortOnStrictError=async({ipcEmitter,isSubprocess,controller,state})=>{try{let[error]=await events.once(ipcEmitter,"strict:error",{signal:controller.signal});state.error=getStrictResponseError(error,isSubprocess),controller.abort();}catch{}},iterateOnMessages=async function*({anyProcess,channel,ipcEmitter,isSubprocess,shouldAwait,controller,state,reference}){try{for await(let[message]of events.on(ipcEmitter,"message",{signal:controller.signal}))throwIfStrictError(state),yield message;}catch{throwIfStrictError(state);}finally{controller.abort(),removeReference(channel,reference),isSubprocess||disconnect(anyProcess),shouldAwait&&await anyProcess;}},throwIfStrictError=({error})=>{if(error)throw error};var addIpcMethods=(subprocess,{ipc})=>{Object.assign(subprocess,getIpcMethods(subprocess,!1,ipc));},getIpcExport=()=>{let anyProcess=process4__default.default,isSubprocess=!0,ipc=process4__default.default.channel!==void 0;return {...getIpcMethods(anyProcess,isSubprocess,ipc),getCancelSignal:getCancelSignal.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})}},getIpcMethods=(anyProcess,isSubprocess,ipc)=>({sendMessage:sendMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getOneMessage:getOneMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc}),getEachMessage:getEachMessage.bind(void 0,{anyProcess,channel:anyProcess.channel,isSubprocess,ipc})});var handleEarlyError=({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})=>{cleanupCustomStreams(fileDescriptors);let subprocess=new child_process.ChildProcess;createDummyStreams(subprocess,fileDescriptors),Object.assign(subprocess,{readable,writable,duplex});let earlyError=makeEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,isSync:!1}),promise=handleDummyPromise(earlyError,verboseInfo,options);return {subprocess,promise}},createDummyStreams=(subprocess,fileDescriptors)=>{let stdin=createDummyStream(),stdout=createDummyStream(),stderr=createDummyStream(),extraStdio=Array.from({length:fileDescriptors.length-3},createDummyStream),all=createDummyStream(),stdio=[stdin,stdout,stderr,...extraStdio];Object.assign(subprocess,{stdin,stdout,stderr,all,stdio});},createDummyStream=()=>{let stream$1=new stream.PassThrough;return stream$1.end(),stream$1},readable=()=>new stream.Readable({read(){}}),writable=()=>new stream.Writable({write(){}}),duplex=()=>new stream.Duplex({read(){},write(){}}),handleDummyPromise=async(error,verboseInfo,options)=>handleResult(error,verboseInfo,options);var handleStdioAsync=(options,verboseInfo)=>handleStdio(addPropertiesAsync,options,verboseInfo,!1),forbiddenIfAsync=({type,optionName})=>{throw new TypeError(`The \`${optionName}\` option cannot be ${TYPE_TO_MESSAGE[type]}.`)},addProperties2={fileNumber:forbiddenIfAsync,generator:generatorToStream,asyncGenerator:generatorToStream,nodeStream:({value})=>({stream:value}),webTransform({value:{transform,writableObjectMode,readableObjectMode}}){let objectMode=writableObjectMode||readableObjectMode;return {stream:stream.Duplex.fromWeb(transform,{objectMode})}},duplex:({value:{transform}})=>({stream:transform}),native(){}},addPropertiesAsync={input:{...addProperties2,fileUrl:({value})=>({stream:fs.createReadStream(value)}),filePath:({value:{file}})=>({stream:fs.createReadStream(file)}),webStream:({value})=>({stream:stream.Readable.fromWeb(value)}),iterable:({value})=>({stream:stream.Readable.from(value)}),asyncIterable:({value})=>({stream:stream.Readable.from(value)}),string:({value})=>({stream:stream.Readable.from(value)}),uint8Array:({value})=>({stream:stream.Readable.from(buffer.Buffer.from(value))})},output:{...addProperties2,fileUrl:({value})=>({stream:fs.createWriteStream(value)}),filePath:({value:{file,append}})=>({stream:fs.createWriteStream(file,append?{flags:"a"}:{})}),webStream:({value})=>({stream:stream.Writable.fromWeb(value)}),iterable:forbiddenIfAsync,asyncIterable:forbiddenIfAsync,string:forbiddenIfAsync,uint8Array:forbiddenIfAsync}};function mergeStreams(streams){if(!Array.isArray(streams))throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);for(let stream of streams)validateStream(stream);let objectMode=streams.some(({readableObjectMode})=>readableObjectMode),highWaterMark=getHighWaterMark(streams,objectMode),passThroughStream=new MergedStream({objectMode,writableHighWaterMark:highWaterMark,readableHighWaterMark:highWaterMark});for(let stream of streams)passThroughStream.add(stream);return passThroughStream}var getHighWaterMark=(streams,objectMode)=>{if(streams.length===0)return stream.getDefaultHighWaterMark(objectMode);let highWaterMarks=streams.filter(({readableObjectMode})=>readableObjectMode===objectMode).map(({readableHighWaterMark})=>readableHighWaterMark);return Math.max(...highWaterMarks)},MergedStream=class extends stream.PassThrough{#streams=new Set([]);#ended=new Set([]);#aborted=new Set([]);#onFinished;#unpipeEvent=Symbol("unpipe");#streamPromises=new WeakMap;add(stream){if(validateStream(stream),this.#streams.has(stream))return;this.#streams.add(stream),this.#onFinished??=onMergedStreamFinished(this,this.#streams,this.#unpipeEvent);let streamPromise=endWhenStreamsDone({passThroughStream:this,stream,streams:this.#streams,ended:this.#ended,aborted:this.#aborted,onFinished:this.#onFinished,unpipeEvent:this.#unpipeEvent});this.#streamPromises.set(stream,streamPromise),stream.pipe(this,{end:!1});}async remove(stream){if(validateStream(stream),!this.#streams.has(stream))return !1;let streamPromise=this.#streamPromises.get(stream);return streamPromise===void 0?!1:(this.#streamPromises.delete(stream),stream.unpipe(this),await streamPromise,!0)}},onMergedStreamFinished=async(passThroughStream,streams,unpipeEvent)=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_COUNT);let controller=new AbortController;try{await Promise.race([onMergedStreamEnd(passThroughStream,controller),onInputStreamsUnpipe(passThroughStream,streams,unpipeEvent,controller)]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_COUNT);}},onMergedStreamEnd=async(passThroughStream,{signal})=>{try{await promises.finished(passThroughStream,{signal,cleanup:!0});}catch(error){throw errorOrAbortStream(passThroughStream,error),error}},onInputStreamsUnpipe=async(passThroughStream,streams,unpipeEvent,{signal})=>{for await(let[unpipedStream]of events.on(passThroughStream,"unpipe",{signal}))streams.has(unpipedStream)&&unpipedStream.emit(unpipeEvent);},validateStream=stream=>{if(typeof stream?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`)},endWhenStreamsDone=async({passThroughStream,stream,streams,ended,aborted:aborted2,onFinished,unpipeEvent})=>{updateMaxListeners(passThroughStream,PASSTHROUGH_LISTENERS_PER_STREAM);let controller=new AbortController;try{await Promise.race([afterMergedStreamFinished(onFinished,stream,controller),onInputStreamEnd({passThroughStream,stream,streams,ended,aborted:aborted2,controller}),onInputStreamUnpipe({stream,streams,ended,aborted:aborted2,unpipeEvent,controller})]);}finally{controller.abort(),updateMaxListeners(passThroughStream,-PASSTHROUGH_LISTENERS_PER_STREAM);}streams.size>0&&streams.size===ended.size+aborted2.size&&(ended.size===0&&aborted2.size>0?abortStream(passThroughStream):endStream(passThroughStream));},afterMergedStreamFinished=async(onFinished,stream,{signal})=>{try{await onFinished,signal.aborted||abortStream(stream);}catch(error){signal.aborted||errorOrAbortStream(stream,error);}},onInputStreamEnd=async({passThroughStream,stream,streams,ended,aborted:aborted2,controller:{signal}})=>{try{await promises.finished(stream,{signal,cleanup:!0,readable:!0,writable:!1}),streams.has(stream)&&ended.add(stream);}catch(error){if(signal.aborted||!streams.has(stream))return;isAbortError(error)?aborted2.add(stream):errorStream(passThroughStream,error);}},onInputStreamUnpipe=async({stream,streams,ended,aborted:aborted2,unpipeEvent,controller:{signal}})=>{if(await events.once(stream,unpipeEvent,{signal}),!stream.readable)return events.once(signal,"abort",{signal});streams.delete(stream),ended.delete(stream),aborted2.delete(stream);},endStream=stream=>{stream.writable&&stream.end();},errorOrAbortStream=(stream,error)=>{isAbortError(error)?abortStream(stream):errorStream(stream,error);},isAbortError=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",abortStream=stream=>{(stream.readable||stream.writable)&&stream.destroy();},errorStream=(stream,error)=>{stream.destroyed||(stream.once("error",noop2),stream.destroy(error));},noop2=()=>{},updateMaxListeners=(passThroughStream,increment2)=>{let maxListeners=passThroughStream.getMaxListeners();maxListeners!==0&&maxListeners!==Number.POSITIVE_INFINITY&&passThroughStream.setMaxListeners(maxListeners+increment2);},PASSTHROUGH_LISTENERS_COUNT=2,PASSTHROUGH_LISTENERS_PER_STREAM=1;var pipeStreams=(source,destination)=>{source.pipe(destination),onSourceFinish(source,destination),onDestinationFinish(source,destination);},onSourceFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(source,{cleanup:!0,readable:!0,writable:!1});}catch{}endDestinationStream(destination);}},endDestinationStream=destination=>{destination.writable&&destination.end();},onDestinationFinish=async(source,destination)=>{if(!(isStandardStream(source)||isStandardStream(destination))){try{await promises.finished(destination,{cleanup:!0,readable:!1,writable:!0});}catch{}abortSourceStream(source);}},abortSourceStream=source=>{source.readable&&source.destroy();};var pipeOutputAsync=(subprocess,fileDescriptors,controller)=>{let pipeGroups=new Map;for(let[fdNumber,{stdioItems,direction}]of Object.entries(fileDescriptors)){for(let{stream}of stdioItems.filter(({type})=>TRANSFORM_TYPES.has(type)))pipeTransform(subprocess,stream,direction,fdNumber);for(let{stream}of stdioItems.filter(({type})=>!TRANSFORM_TYPES.has(type)))pipeStdioItem({subprocess,stream,direction,fdNumber,pipeGroups,controller});}for(let[outputStream,inputStreams]of pipeGroups.entries()){let inputStream=inputStreams.length===1?inputStreams[0]:mergeStreams(inputStreams);pipeStreams(inputStream,outputStream);}},pipeTransform=(subprocess,stream,direction,fdNumber)=>{direction==="output"?pipeStreams(subprocess.stdio[fdNumber],stream):pipeStreams(stream,subprocess.stdio[fdNumber]);let streamProperty=SUBPROCESS_STREAM_PROPERTIES[fdNumber];streamProperty!==void 0&&(subprocess[streamProperty]=stream),subprocess.stdio[fdNumber]=stream;},SUBPROCESS_STREAM_PROPERTIES=["stdin","stdout","stderr"],pipeStdioItem=({subprocess,stream,direction,fdNumber,pipeGroups,controller})=>{if(stream===void 0)return;setStandardStreamMaxListeners(stream,controller);let[inputStream,outputStream]=direction==="output"?[stream,subprocess.stdio[fdNumber]]:[subprocess.stdio[fdNumber],stream],outputStreams=pipeGroups.get(inputStream)??[];pipeGroups.set(inputStream,[...outputStreams,outputStream]);},setStandardStreamMaxListeners=(stream,{signal})=>{isStandardStream(stream)&&incrementMaxListeners(stream,MAX_LISTENERS_INCREMENT,signal);},MAX_LISTENERS_INCREMENT=2;var signals=[];signals.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&signals.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&signals.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var processOk=process10=>!!process10&&typeof process10=="object"&&typeof process10.removeListener=="function"&&typeof process10.emit=="function"&&typeof process10.reallyExit=="function"&&typeof process10.listeners=="function"&&typeof process10.kill=="function"&&typeof process10.pid=="number"&&typeof process10.on=="function",kExitEmitter=Symbol.for("signal-exit emitter"),global2=globalThis,ObjectDefineProperty=Object.defineProperty.bind(Object),Emitter=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(global2[kExitEmitter])return global2[kExitEmitter];ObjectDefineProperty(global2,kExitEmitter,{value:this,writable:!1,enumerable:!1,configurable:!1});}on(ev,fn){this.listeners[ev].push(fn);}removeListener(ev,fn){let list=this.listeners[ev],i2=list.indexOf(fn);i2!==-1&&(i2===0&&list.length===1?list.length=0:list.splice(i2,1));}emit(ev,code,signal){if(this.emitted[ev])return !1;this.emitted[ev]=!0;let ret=!1;for(let fn of this.listeners[ev])ret=fn(code,signal)===!0||ret;return ev==="exit"&&(ret=this.emit("afterExit",code,signal)||ret),ret}},SignalExitBase=class{},signalExitWrap=handler=>({onExit(cb,opts){return handler.onExit(cb,opts)},load(){return handler.load()},unload(){return handler.unload()}}),SignalExitFallback=class extends SignalExitBase{onExit(){return ()=>{}}load(){}unload(){}},SignalExit=class extends SignalExitBase{#hupSig=process9.platform==="win32"?"SIGINT":"SIGHUP";#emitter=new Emitter;#process;#originalProcessEmit;#originalProcessReallyExit;#sigListeners={};#loaded=!1;constructor(process10){super(),this.#process=process10,this.#sigListeners={};for(let sig of signals)this.#sigListeners[sig]=()=>{let listeners=this.#process.listeners(sig),{count:count2}=this.#emitter,p=process10;if(typeof p.__signal_exit_emitter__=="object"&&typeof p.__signal_exit_emitter__.count=="number"&&(count2+=p.__signal_exit_emitter__.count),listeners.length===count2){this.unload();let ret=this.#emitter.emit("exit",null,sig),s=sig==="SIGHUP"?this.#hupSig:sig;ret||process10.kill(process10.pid,s);}};this.#originalProcessReallyExit=process10.reallyExit,this.#originalProcessEmit=process10.emit;}onExit(cb,opts){if(!processOk(this.#process))return ()=>{};this.#loaded===!1&&this.load();let ev=opts?.alwaysLast?"afterExit":"exit";return this.#emitter.on(ev,cb),()=>{this.#emitter.removeListener(ev,cb),this.#emitter.listeners.exit.length===0&&this.#emitter.listeners.afterExit.length===0&&this.unload();}}load(){if(!this.#loaded){this.#loaded=!0,this.#emitter.count+=1;for(let sig of signals)try{let fn=this.#sigListeners[sig];fn&&this.#process.on(sig,fn);}catch{}this.#process.emit=(ev,...a2)=>this.#processEmit(ev,...a2),this.#process.reallyExit=code=>this.#processReallyExit(code);}}unload(){this.#loaded&&(this.#loaded=!1,signals.forEach(sig=>{let listener=this.#sigListeners[sig];if(!listener)throw new Error("Listener not defined for signal: "+sig);try{this.#process.removeListener(sig,listener);}catch{}}),this.#process.emit=this.#originalProcessEmit,this.#process.reallyExit=this.#originalProcessReallyExit,this.#emitter.count-=1);}#processReallyExit(code){return processOk(this.#process)?(this.#process.exitCode=code||0,this.#emitter.emit("exit",this.#process.exitCode,null),this.#originalProcessReallyExit.call(this.#process,this.#process.exitCode)):0}#processEmit(ev,...args){let og=this.#originalProcessEmit;if(ev==="exit"&&processOk(this.#process)){typeof args[0]=="number"&&(this.#process.exitCode=args[0]);let ret=og.call(this.#process,ev,...args);return this.#emitter.emit("exit",this.#process.exitCode,null),ret}else return og.call(this.#process,ev,...args)}},process9=globalThis.process,{onExit,load,unload}=signalExitWrap(processOk(process9)?new SignalExit(process9):new SignalExitFallback);var cleanupOnExit=(subprocess,{cleanup,detached},{signal})=>{if(!cleanup||detached)return;let removeExitHandler=onExit(()=>{subprocess.kill();});events.addAbortListener(signal,()=>{removeExitHandler();});};var normalizePipeArguments=({source,sourcePromise,boundOptions,createNested},...pipeArguments)=>{let startTime=getStartTime(),{destination,destinationStream,destinationError,from,unpipeSignal}=getDestinationStream(boundOptions,createNested,pipeArguments),{sourceStream,sourceError}=getSourceStream(source,from),{options:sourceOptions,fileDescriptors}=SUBPROCESS_OPTIONS.get(source);return {sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime}},getDestinationStream=(boundOptions,createNested,pipeArguments)=>{try{let{destination,pipeOptions:{from,to,unpipeSignal}={}}=getDestination(boundOptions,createNested,...pipeArguments),destinationStream=getToStream(destination,to);return {destination,destinationStream,from,unpipeSignal}}catch(error){return {destinationError:error}}},getDestination=(boundOptions,createNested,firstArgument,...pipeArguments)=>{if(Array.isArray(firstArgument))return {destination:createNested(mapDestinationArguments,boundOptions)(firstArgument,...pipeArguments),pipeOptions:boundOptions};if(typeof firstArgument=="string"||firstArgument instanceof URL||isDenoExecPath(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[rawFile,rawArguments,rawOptions]=normalizeParameters(firstArgument,...pipeArguments);return {destination:createNested(mapDestinationArguments)(rawFile,rawArguments,rawOptions),pipeOptions:rawOptions}}if(SUBPROCESS_OPTIONS.has(firstArgument)){if(Object.keys(boundOptions).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return {destination:firstArgument,pipeOptions:pipeArguments[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${firstArgument}`)},mapDestinationArguments=({options})=>({options:{...options,stdin:"pipe",piped:!0}}),getSourceStream=(source,from)=>{try{return {sourceStream:getFromStream(source,from)}}catch(error){return {sourceError:error}}};var handlePipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime})=>{let error=getPipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError});if(error!==void 0)throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})},getPipeArgumentsError=({sourceStream,sourceError,destinationStream,destinationError})=>{if(sourceError!==void 0&&destinationError!==void 0)return destinationError;if(destinationError!==void 0)return abortSourceStream(sourceStream),destinationError;if(sourceError!==void 0)return endDestinationStream(destinationStream),sourceError},createNonCommandError=({error,fileDescriptors,sourceOptions,startTime})=>makeEarlyError({error,command:PIPE_COMMAND_MESSAGE,escapedCommand:PIPE_COMMAND_MESSAGE,fileDescriptors,options:sourceOptions,startTime,isSync:!1}),PIPE_COMMAND_MESSAGE="source.pipe(destination)";var waitForBothSubprocesses=async subprocessPromises=>{let[{status:sourceStatus,reason:sourceReason,value:sourceResult=sourceReason},{status:destinationStatus,reason:destinationReason,value:destinationResult=destinationReason}]=await subprocessPromises;if(destinationResult.pipedFrom.includes(sourceResult)||destinationResult.pipedFrom.push(sourceResult),destinationStatus==="rejected")throw destinationResult;if(sourceStatus==="rejected")throw sourceResult;return destinationResult};var pipeSubprocessStream=(sourceStream,destinationStream,maxListenersController)=>{let mergedStream=MERGED_STREAMS.has(destinationStream)?pipeMoreSubprocessStream(sourceStream,destinationStream):pipeFirstSubprocessStream(sourceStream,destinationStream);return incrementMaxListeners(sourceStream,SOURCE_LISTENERS_PER_PIPE,maxListenersController.signal),incrementMaxListeners(destinationStream,DESTINATION_LISTENERS_PER_PIPE,maxListenersController.signal),cleanupMergedStreamsMap(destinationStream),mergedStream},pipeFirstSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=mergeStreams([sourceStream]);return pipeStreams(mergedStream,destinationStream),MERGED_STREAMS.set(destinationStream,mergedStream),mergedStream},pipeMoreSubprocessStream=(sourceStream,destinationStream)=>{let mergedStream=MERGED_STREAMS.get(destinationStream);return mergedStream.add(sourceStream),mergedStream},cleanupMergedStreamsMap=async destinationStream=>{try{await promises.finished(destinationStream,{cleanup:!0,readable:!1,writable:!0});}catch{}MERGED_STREAMS.delete(destinationStream);},MERGED_STREAMS=new WeakMap,SOURCE_LISTENERS_PER_PIPE=2,DESTINATION_LISTENERS_PER_PIPE=1;var unpipeOnAbort=(unpipeSignal,unpipeContext)=>unpipeSignal===void 0?[]:[unpipeOnSignalAbort(unpipeSignal,unpipeContext)],unpipeOnSignalAbort=async(unpipeSignal,{sourceStream,mergedStream,fileDescriptors,sourceOptions,startTime})=>{await util.aborted(unpipeSignal,sourceStream),await mergedStream.remove(sourceStream);let error=new Error("Pipe canceled by `unpipeSignal` option.");throw createNonCommandError({error,fileDescriptors,sourceOptions,startTime})};var pipeToSubprocess=(sourceInfo,...pipeArguments)=>{if(isPlainObject(pipeArguments[0]))return pipeToSubprocess.bind(void 0,{...sourceInfo,boundOptions:{...sourceInfo.boundOptions,...pipeArguments[0]}});let{destination,...normalizedInfo}=normalizePipeArguments(sourceInfo,...pipeArguments),promise=handlePipePromise({...normalizedInfo,destination});return promise.pipe=pipeToSubprocess.bind(void 0,{...sourceInfo,source:destination,sourcePromise:promise,boundOptions:{}}),promise},handlePipePromise=async({sourcePromise,sourceStream,sourceOptions,sourceError,destination,destinationStream,destinationError,unpipeSignal,fileDescriptors,startTime})=>{let subprocessPromises=getSubprocessPromises(sourcePromise,destination);handlePipeArgumentsError({sourceStream,sourceError,destinationStream,destinationError,fileDescriptors,sourceOptions,startTime});let maxListenersController=new AbortController;try{let mergedStream=pipeSubprocessStream(sourceStream,destinationStream,maxListenersController);return await Promise.race([waitForBothSubprocesses(subprocessPromises),...unpipeOnAbort(unpipeSignal,{sourceStream,mergedStream,sourceOptions,fileDescriptors,startTime})])}finally{maxListenersController.abort();}},getSubprocessPromises=(sourcePromise,destination)=>Promise.allSettled([sourcePromise,destination]);var iterateOnSubprocessStream=({subprocessStdout,subprocess,binary,shouldEncode,encoding,preserveNewlines})=>{let controller=new AbortController;return stopReadingOnExit(subprocess,controller),iterateOnStream({stream:subprocessStdout,controller,binary,shouldEncode:!subprocessStdout.readableObjectMode&&shouldEncode,encoding,shouldSplit:!subprocessStdout.readableObjectMode,preserveNewlines})},stopReadingOnExit=async(subprocess,controller)=>{try{await subprocess;}catch{}finally{controller.abort();}},iterateForResult=({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewline2,allMixed})=>{let controller=new AbortController;stopReadingOnStreamEnd(onStreamEnd,controller,stream);let objectMode=stream.readableObjectMode&&!allMixed;return iterateOnStream({stream,controller,binary:encoding==="buffer",shouldEncode:!objectMode,encoding,shouldSplit:!objectMode&&lines,preserveNewlines:!stripFinalNewline2})},stopReadingOnStreamEnd=async(onStreamEnd,controller,stream)=>{try{await onStreamEnd;}catch{stream.destroy();}finally{controller.abort();}},iterateOnStream=({stream,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>{let onStdoutChunk=events.on(stream,"data",{signal:controller.signal,highWaterMark:HIGH_WATER_MARK,highWatermark:HIGH_WATER_MARK});return iterateOnData({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines})},DEFAULT_OBJECT_HIGH_WATER_MARK=stream.getDefaultHighWaterMark(!0),HIGH_WATER_MARK=DEFAULT_OBJECT_HIGH_WATER_MARK,iterateOnData=async function*({onStdoutChunk,controller,binary,shouldEncode,encoding,shouldSplit,preserveNewlines}){let generators=getGenerators({binary,shouldEncode,encoding,shouldSplit,preserveNewlines});try{for await(let[chunk]of onStdoutChunk)yield*transformChunkSync(chunk,generators,0);}catch(error){if(!controller.signal.aborted)throw error}finally{yield*finalChunksSync(generators);}},getGenerators=({binary,shouldEncode,encoding,shouldSplit,preserveNewlines})=>[getEncodingTransformGenerator(binary,encoding,!shouldEncode),getSplitLinesGenerator(binary,preserveNewlines,!shouldSplit,{})].filter(Boolean);var getStreamOutput=async({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{let logPromise=logOutputAsync({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo});if(!buffer){await Promise.all([resumeStream(stream),logPromise]);return}let stripFinalNewlineValue=getStripFinalNewline(stripFinalNewline2,fdNumber),iterable=iterateForResult({stream,onStreamEnd,lines,encoding,stripFinalNewline:stripFinalNewlineValue,allMixed}),[output]=await Promise.all([getStreamContents2({stream,iterable,fdNumber,encoding,maxBuffer,lines}),logPromise]);return output},logOutputAsync=async({stream,onStreamEnd,fdNumber,encoding,allMixed,verboseInfo,streamInfo:{fileDescriptors}})=>{if(!shouldLogOutput({stdioItems:fileDescriptors[fdNumber]?.stdioItems,encoding,verboseInfo,fdNumber}))return;let linesIterable=iterateForResult({stream,onStreamEnd,lines:!0,encoding,stripFinalNewline:!0,allMixed});await logLines(linesIterable,stream,fdNumber,verboseInfo);},resumeStream=async stream=>{await promises$1.setImmediate(),stream.readableFlowing===null&&stream.resume();},getStreamContents2=async({stream,stream:{readableObjectMode},iterable,fdNumber,encoding,maxBuffer,lines})=>{try{return readableObjectMode||lines?await getStreamAsArray(iterable,{maxBuffer}):encoding==="buffer"?new Uint8Array(await getStreamAsArrayBuffer(iterable,{maxBuffer})):await getStreamAsString(iterable,{maxBuffer})}catch(error){return handleBufferedData(handleMaxBuffer({error,stream,readableObjectMode,lines,encoding,fdNumber}))}},getBufferedData=async streamPromise=>{try{return await streamPromise}catch(error){return handleBufferedData(error)}},handleBufferedData=({bufferedData})=>isArrayBuffer(bufferedData)?new Uint8Array(bufferedData):bufferedData;var waitForStream=async(stream,fdNumber,streamInfo,{isSameDirection,stopOnExit=!1}={})=>{let state=handleStdinDestroy(stream,streamInfo),abortController=new AbortController;try{await Promise.race([...stopOnExit?[streamInfo.exitPromise]:[],promises.finished(stream,{cleanup:!0,signal:abortController.signal})]);}catch(error){state.stdinCleanedUp||handleStreamError(error,fdNumber,streamInfo,isSameDirection);}finally{abortController.abort();}},handleStdinDestroy=(stream,{originalStreams:[originalStdin],subprocess})=>{let state={stdinCleanedUp:!1};return stream===originalStdin&&spyOnStdinDestroy(stream,subprocess,state),state},spyOnStdinDestroy=(subprocessStdin,subprocess,state)=>{let{_destroy}=subprocessStdin;subprocessStdin._destroy=(...destroyArguments)=>{setStdinCleanedUp(subprocess,state),_destroy.call(subprocessStdin,...destroyArguments);};},setStdinCleanedUp=({exitCode,signalCode},state)=>{(exitCode!==null||signalCode!==null)&&(state.stdinCleanedUp=!0);},handleStreamError=(error,fdNumber,streamInfo,isSameDirection)=>{if(!shouldIgnoreStreamError(error,fdNumber,streamInfo,isSameDirection))throw error},shouldIgnoreStreamError=(error,fdNumber,streamInfo,isSameDirection=!0)=>streamInfo.propagating?isStreamEpipe(error)||isStreamAbort(error):(streamInfo.propagating=!0,isInputFileDescriptor(streamInfo,fdNumber)===isSameDirection?isStreamEpipe(error):isStreamAbort(error)),isInputFileDescriptor=({fileDescriptors},fdNumber)=>fdNumber!=="all"&&fileDescriptors[fdNumber].direction==="input",isStreamAbort=error=>error?.code==="ERR_STREAM_PREMATURE_CLOSE",isStreamEpipe=error=>error?.code==="EPIPE";var waitForStdioStreams=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>subprocess.stdio.map((stream,fdNumber)=>waitForSubprocessStream({stream,fdNumber,encoding,buffer:buffer[fdNumber],maxBuffer:maxBuffer[fdNumber],lines:lines[fdNumber],allMixed:!1,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})),waitForSubprocessStream=async({stream,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>{if(!stream)return;let onStreamEnd=waitForStream(stream,fdNumber,streamInfo);if(isInputFileDescriptor(streamInfo,fdNumber)){await onStreamEnd;return}let[output]=await Promise.all([getStreamOutput({stream,onStreamEnd,fdNumber,encoding,buffer,maxBuffer,lines,allMixed,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),onStreamEnd]);return output};var makeAllStream=({stdout,stderr},{all})=>all&&(stdout||stderr)?mergeStreams([stdout,stderr].filter(Boolean)):void 0,waitForAllStream=({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo})=>waitForSubprocessStream({...getAllStream(subprocess,buffer),fdNumber:"all",encoding,maxBuffer:maxBuffer[1]+maxBuffer[2],lines:lines[1]||lines[2],allMixed:getAllMixed(subprocess),stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),getAllStream=({stdout,stderr,all},[,bufferStdout,bufferStderr])=>{let buffer=bufferStdout||bufferStderr;return buffer?bufferStdout?bufferStderr?{stream:all,buffer}:{stream:stdout,buffer}:{stream:stderr,buffer}:{stream:all,buffer}},getAllMixed=({all,stdout,stderr})=>all&&stdout&&stderr&&stdout.readableObjectMode!==stderr.readableObjectMode;var shouldLogIpc=verboseInfo=>isFullVerbose(verboseInfo,"ipc"),logIpcOutput=(message,verboseInfo)=>{let verboseMessage=serializeVerboseMessage(message);verboseLog({type:"ipc",verboseMessage,fdNumber:"ipc",verboseInfo});};var waitForIpcOutput=async({subprocess,buffer:bufferArray,maxBuffer:maxBufferArray,ipc,ipcOutput,verboseInfo})=>{if(!ipc)return ipcOutput;let isVerbose2=shouldLogIpc(verboseInfo),buffer=getFdSpecificValue(bufferArray,"ipc"),maxBuffer=getFdSpecificValue(maxBufferArray,"ipc");for await(let message of loopOnMessages({anyProcess:subprocess,channel:subprocess.channel,isSubprocess:!1,ipc,shouldAwait:!1,reference:!0}))buffer&&(checkIpcMaxBuffer(subprocess,ipcOutput,maxBuffer),ipcOutput.push(message)),isVerbose2&&logIpcOutput(message,verboseInfo);return ipcOutput},getBufferedIpcOutput=async(ipcOutputPromise,ipcOutput)=>(await Promise.allSettled([ipcOutputPromise]),ipcOutput);var waitForSubprocessResult=async({subprocess,options:{encoding,buffer,maxBuffer,lines,timeoutDuration:timeout,cancelSignal,gracefulCancel,forceKillAfterDelay,stripFinalNewline:stripFinalNewline2,ipc,ipcInput},context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller})=>{let exitPromise=waitForExit(subprocess,context),streamInfo={originalStreams,fileDescriptors,subprocess,exitPromise,propagating:!1},stdioPromises=waitForStdioStreams({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),allPromise=waitForAllStream({subprocess,encoding,buffer,maxBuffer,lines,stripFinalNewline:stripFinalNewline2,verboseInfo,streamInfo}),ipcOutput=[],ipcOutputPromise=waitForIpcOutput({subprocess,buffer,maxBuffer,ipc,ipcOutput,verboseInfo}),originalPromises=waitForOriginalStreams(originalStreams,subprocess,streamInfo),customStreamsEndPromises=waitForCustomStreamsEnd(fileDescriptors,streamInfo);try{return await Promise.race([Promise.all([{},waitForSuccessfulExit(exitPromise),Promise.all(stdioPromises),allPromise,ipcOutputPromise,sendIpcInput(subprocess,ipcInput),...originalPromises,...customStreamsEndPromises]),onInternalError,throwOnSubprocessError(subprocess,controller),...throwOnTimeout(subprocess,timeout,context,controller),...throwOnCancel({subprocess,cancelSignal,gracefulCancel,context,controller}),...throwOnGracefulCancel({subprocess,cancelSignal,gracefulCancel,forceKillAfterDelay,context,controller})])}catch(error){return context.terminationReason??="other",Promise.all([{error},exitPromise,Promise.all(stdioPromises.map(stdioPromise=>getBufferedData(stdioPromise))),getBufferedData(allPromise),getBufferedIpcOutput(ipcOutputPromise,ipcOutput),Promise.allSettled(originalPromises),Promise.allSettled(customStreamsEndPromises)])}},waitForOriginalStreams=(originalStreams,subprocess,streamInfo)=>originalStreams.map((stream,fdNumber)=>stream===subprocess.stdio[fdNumber]?void 0:waitForStream(stream,fdNumber,streamInfo)),waitForCustomStreamsEnd=(fileDescriptors,streamInfo)=>fileDescriptors.flatMap(({stdioItems},fdNumber)=>stdioItems.filter(({value,stream=value})=>isStream(stream,{checkOpen:!1})&&!isStandardStream(stream)).map(({type,value,stream=value})=>waitForStream(stream,fdNumber,streamInfo,{isSameDirection:TRANSFORM_TYPES.has(type),stopOnExit:type==="native"}))),throwOnSubprocessError=async(subprocess,{signal})=>{let[error]=await events.once(subprocess,"error",{signal});throw error};var initializeConcurrentStreams=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),addConcurrentStream=(concurrentStreams,stream,waitName)=>{let weakMap=concurrentStreams[waitName];weakMap.has(stream)||weakMap.set(stream,[]);let promises=weakMap.get(stream),promise=createDeferred();return promises.push(promise),{resolve:promise.resolve.bind(promise),promises}},waitForConcurrentStreams=async({resolve,promises},subprocess)=>{resolve();let[isSubprocessExit]=await Promise.race([Promise.allSettled([!0,subprocess]),Promise.all([!1,...promises])]);return !isSubprocessExit};var safeWaitForSubprocessStdin=async subprocessStdin=>{if(subprocessStdin!==void 0)try{await waitForSubprocessStdin(subprocessStdin);}catch{}},safeWaitForSubprocessStdout=async subprocessStdout=>{if(subprocessStdout!==void 0)try{await waitForSubprocessStdout(subprocessStdout);}catch{}},waitForSubprocessStdin=async subprocessStdin=>{await promises.finished(subprocessStdin,{cleanup:!0,readable:!1,writable:!0});},waitForSubprocessStdout=async subprocessStdout=>{await promises.finished(subprocessStdout,{cleanup:!0,readable:!0,writable:!1});},waitForSubprocess=async(subprocess,error)=>{if(await subprocess,error)throw error},destroyOtherStream=(stream,isOpen,error)=>{error&&!isStreamAbort(error)?stream.destroy(error):isOpen&&stream.destroy();};var createReadable=({subprocess,concurrentStreams,encoding},{from,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),readable2=new stream.Readable({read,destroy:util.callbackify(onReadableDestroy.bind(void 0,{subprocessStdout,subprocess,waitReadableDestroy})),highWaterMark:readableHighWaterMark,objectMode:readableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess}),readable2},getSubprocessStdout=(subprocess,from,concurrentStreams)=>{let subprocessStdout=getFromStream(subprocess,from),waitReadableDestroy=addConcurrentStream(concurrentStreams,subprocessStdout,"readableDestroy");return {subprocessStdout,waitReadableDestroy}},getReadableOptions=({readableEncoding,readableObjectMode,readableHighWaterMark},binary)=>binary?{readableEncoding,readableObjectMode,readableHighWaterMark}:{readableEncoding,readableObjectMode:!0,readableHighWaterMark:DEFAULT_OBJECT_HIGH_WATER_MARK},getReadableMethods=({subprocessStdout,subprocess,binary,encoding,preserveNewlines})=>{let onStdoutDataDone=createDeferred(),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!binary,encoding,preserveNewlines});return {read(){onRead(this,onStdoutData,onStdoutDataDone);},onStdoutDataDone}},onRead=async(readable2,onStdoutData,onStdoutDataDone)=>{try{let{value,done}=await onStdoutData.next();done?onStdoutDataDone.resolve():readable2.push(value);}catch{}},onStdoutFinished=async({subprocessStdout,onStdoutDataDone,readable:readable2,subprocess,subprocessStdin})=>{try{await waitForSubprocessStdout(subprocessStdout),await subprocess,await safeWaitForSubprocessStdin(subprocessStdin),await onStdoutDataDone,readable2.readable&&readable2.push(null);}catch(error){await safeWaitForSubprocessStdin(subprocessStdin),destroyOtherReadable(readable2,error);}},onReadableDestroy=async({subprocessStdout,subprocess,waitReadableDestroy},error)=>{await waitForConcurrentStreams(waitReadableDestroy,subprocess)&&(destroyOtherReadable(subprocessStdout,error),await waitForSubprocess(subprocess,error));},destroyOtherReadable=(stream,error)=>{destroyOtherStream(stream,stream.readable,error);};var createWritable=({subprocess,concurrentStreams},{to}={})=>{let{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),writable2=new stream.Writable({...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onWritableDestroy.bind(void 0,{subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy})),highWaterMark:subprocessStdin.writableHighWaterMark,objectMode:subprocessStdin.writableObjectMode});return onStdinFinished(subprocessStdin,writable2),writable2},getSubprocessStdin=(subprocess,to,concurrentStreams)=>{let subprocessStdin=getToStream(subprocess,to),waitWritableFinal=addConcurrentStream(concurrentStreams,subprocessStdin,"writableFinal"),waitWritableDestroy=addConcurrentStream(concurrentStreams,subprocessStdin,"writableDestroy");return {subprocessStdin,waitWritableFinal,waitWritableDestroy}},getWritableMethods=(subprocessStdin,subprocess,waitWritableFinal)=>({write:onWrite.bind(void 0,subprocessStdin),final:util.callbackify(onWritableFinal.bind(void 0,subprocessStdin,subprocess,waitWritableFinal))}),onWrite=(subprocessStdin,chunk,encoding,done)=>{subprocessStdin.write(chunk,encoding)?done():subprocessStdin.once("drain",done);},onWritableFinal=async(subprocessStdin,subprocess,waitWritableFinal)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess)&&(subprocessStdin.writable&&subprocessStdin.end(),await subprocess);},onStdinFinished=async(subprocessStdin,writable2,subprocessStdout)=>{try{await waitForSubprocessStdin(subprocessStdin),writable2.writable&&writable2.end();}catch(error){await safeWaitForSubprocessStdout(subprocessStdout),destroyOtherWritable(writable2,error);}},onWritableDestroy=async({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)=>{await waitForConcurrentStreams(waitWritableFinal,subprocess),await waitForConcurrentStreams(waitWritableDestroy,subprocess)&&(destroyOtherWritable(subprocessStdin,error),await waitForSubprocess(subprocess,error));},destroyOtherWritable=(stream,error)=>{destroyOtherStream(stream,stream.writable,error);};var createDuplex=({subprocess,concurrentStreams,encoding},{from,to,binary:binaryOption=!0,preserveNewlines=!0}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),{subprocessStdout,waitReadableDestroy}=getSubprocessStdout(subprocess,from,concurrentStreams),{subprocessStdin,waitWritableFinal,waitWritableDestroy}=getSubprocessStdin(subprocess,to,concurrentStreams),{readableEncoding,readableObjectMode,readableHighWaterMark}=getReadableOptions(subprocessStdout,binary),{read,onStdoutDataDone}=getReadableMethods({subprocessStdout,subprocess,binary,encoding,preserveNewlines}),duplex2=new stream.Duplex({read,...getWritableMethods(subprocessStdin,subprocess,waitWritableFinal),destroy:util.callbackify(onDuplexDestroy.bind(void 0,{subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy})),readableHighWaterMark,writableHighWaterMark:subprocessStdin.writableHighWaterMark,readableObjectMode,writableObjectMode:subprocessStdin.writableObjectMode,encoding:readableEncoding});return onStdoutFinished({subprocessStdout,onStdoutDataDone,readable:duplex2,subprocess,subprocessStdin}),onStdinFinished(subprocessStdin,duplex2,subprocessStdout),duplex2},onDuplexDestroy=async({subprocessStdout,subprocessStdin,subprocess,waitReadableDestroy,waitWritableFinal,waitWritableDestroy},error)=>{await Promise.all([onReadableDestroy({subprocessStdout,subprocess,waitReadableDestroy},error),onWritableDestroy({subprocessStdin,subprocess,waitWritableFinal,waitWritableDestroy},error)]);};var createIterable=(subprocess,encoding,{from,binary:binaryOption=!1,preserveNewlines=!1}={})=>{let binary=binaryOption||BINARY_ENCODINGS.has(encoding),subprocessStdout=getFromStream(subprocess,from),onStdoutData=iterateOnSubprocessStream({subprocessStdout,subprocess,binary,shouldEncode:!0,encoding,preserveNewlines});return iterateOnStdoutData(onStdoutData,subprocessStdout,subprocess)},iterateOnStdoutData=async function*(onStdoutData,subprocessStdout,subprocess){try{yield*onStdoutData;}finally{subprocessStdout.readable&&subprocessStdout.destroy(),await subprocess;}};var addConvertedStreams=(subprocess,{encoding})=>{let concurrentStreams=initializeConcurrentStreams();subprocess.readable=createReadable.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.writable=createWritable.bind(void 0,{subprocess,concurrentStreams}),subprocess.duplex=createDuplex.bind(void 0,{subprocess,concurrentStreams,encoding}),subprocess.iterable=createIterable.bind(void 0,subprocess,encoding),subprocess[Symbol.asyncIterator]=createIterable.bind(void 0,subprocess,encoding,{});};var mergePromise=(subprocess,promise)=>{for(let[property,descriptor]of descriptors){let value=descriptor.value.bind(promise);Reflect.defineProperty(subprocess,property,{...descriptor,value});}},nativePromisePrototype=(async()=>{})().constructor.prototype,descriptors=["then","catch","finally"].map(property=>[property,Reflect.getOwnPropertyDescriptor(nativePromisePrototype,property)]);var execaCoreAsync=(rawFile,rawArguments,rawOptions,createNested)=>{let{file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}=handleAsyncArguments(rawFile,rawArguments,rawOptions),{subprocess,promise}=spawnSubprocessAsync({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors});return subprocess.pipe=pipeToSubprocess.bind(void 0,{source:subprocess,sourcePromise:promise,boundOptions:{},createNested}),mergePromise(subprocess,promise),SUBPROCESS_OPTIONS.set(subprocess,{options,fileDescriptors}),subprocess},handleAsyncArguments=(rawFile,rawArguments,rawOptions)=>{let{command,escapedCommand,startTime,verboseInfo}=handleCommand(rawFile,rawArguments,rawOptions),{file,commandArguments,options:normalizedOptions}=normalizeOptions(rawFile,rawArguments,rawOptions),options=handleAsyncOptions(normalizedOptions),fileDescriptors=handleStdioAsync(options,verboseInfo);return {file,commandArguments,command,escapedCommand,startTime,verboseInfo,options,fileDescriptors}},handleAsyncOptions=({timeout,signal,...options})=>{if(signal!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return {...options,timeoutDuration:timeout}},spawnSubprocessAsync=({file,commandArguments,options,startTime,verboseInfo,command,escapedCommand,fileDescriptors})=>{let subprocess;try{subprocess=child_process.spawn(...concatenateShell(file,commandArguments,options));}catch(error){return handleEarlyError({error,command,escapedCommand,fileDescriptors,options,startTime,verboseInfo})}let controller=new AbortController;events.setMaxListeners(Number.POSITIVE_INFINITY,controller.signal);let originalStreams=[...subprocess.stdio];pipeOutputAsync(subprocess,fileDescriptors,controller),cleanupOnExit(subprocess,options,controller);let context={},onInternalError=createDeferred();subprocess.kill=subprocessKill.bind(void 0,{kill:subprocess.kill.bind(subprocess),options,onInternalError,context,controller}),subprocess.all=makeAllStream(subprocess,options),addConvertedStreams(subprocess,options),addIpcMethods(subprocess,options);let promise=handlePromise({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller});return {subprocess,promise}},handlePromise=async({subprocess,options,startTime,verboseInfo,fileDescriptors,originalStreams,command,escapedCommand,context,onInternalError,controller})=>{let[errorInfo,[exitCode,signal],stdioResults,allResult,ipcOutput]=await waitForSubprocessResult({subprocess,options,context,verboseInfo,fileDescriptors,originalStreams,onInternalError,controller});controller.abort(),onInternalError.resolve();let stdio=stdioResults.map((stdioResult,fdNumber)=>stripNewline(stdioResult,options,fdNumber)),all=stripNewline(allResult,options,"all"),result=getAsyncResult({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime});return handleResult(result,verboseInfo,options)},getAsyncResult=({errorInfo,exitCode,signal,stdio,all,ipcOutput,context,options,command,escapedCommand,startTime})=>"error"in errorInfo?makeError({error:errorInfo.error,command,escapedCommand,timedOut:context.terminationReason==="timeout",isCanceled:context.terminationReason==="cancel"||context.terminationReason==="gracefulCancel",isGracefullyCanceled:context.terminationReason==="gracefulCancel",isMaxBuffer:errorInfo.error instanceof MaxBufferError,isForcefullyTerminated:context.isForcefullyTerminated,exitCode,signal,stdio,all,ipcOutput,options,startTime,isSync:!1}):makeSuccessResult({command,escapedCommand,stdio,all,ipcOutput,options,startTime});var mergeOptions=(boundOptions,options)=>{let newOptions=Object.fromEntries(Object.entries(options).map(([optionName,optionValue])=>[optionName,mergeOption(optionName,boundOptions[optionName],optionValue)]));return {...boundOptions,...newOptions}},mergeOption=(optionName,boundOptionValue,optionValue)=>DEEP_OPTIONS.has(optionName)&&isPlainObject(boundOptionValue)&&isPlainObject(optionValue)?{...boundOptionValue,...optionValue}:optionValue,DEEP_OPTIONS=new Set(["env",...FD_SPECIFIC_OPTIONS]);var createExeca=(mapArguments,boundOptions,deepOptions,setBoundExeca)=>{let createNested=(mapArguments2,boundOptions2,setBoundExeca2)=>createExeca(mapArguments2,boundOptions2,deepOptions,setBoundExeca2),boundExeca=(...execaArguments)=>callBoundExeca({mapArguments,deepOptions,boundOptions,setBoundExeca,createNested},...execaArguments);return setBoundExeca!==void 0&&setBoundExeca(boundExeca,createNested,boundOptions),boundExeca},callBoundExeca=({mapArguments,deepOptions={},boundOptions={},setBoundExeca,createNested},firstArgument,...nextArguments)=>{if(isPlainObject(firstArgument))return createNested(mapArguments,mergeOptions(boundOptions,firstArgument),setBoundExeca);let{file,commandArguments,options,isSync}=parseArguments({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions});return isSync?execaCoreSync(file,commandArguments,options):execaCoreAsync(file,commandArguments,options,createNested)},parseArguments=({mapArguments,firstArgument,nextArguments,deepOptions,boundOptions})=>{let callArguments=isTemplateString(firstArgument)?parseTemplates(firstArgument,nextArguments):[firstArgument,...nextArguments],[initialFile,initialArguments,initialOptions]=normalizeParameters(...callArguments),mergedOptions=mergeOptions(mergeOptions(deepOptions,boundOptions),initialOptions),{file=initialFile,commandArguments=initialArguments,options=mergedOptions,isSync=!1}=mapArguments({file:initialFile,commandArguments:initialArguments,options:mergedOptions});return {file,commandArguments,options,isSync}};var mapCommandAsync=({file,commandArguments})=>parseCommand(file,commandArguments),mapCommandSync=({file,commandArguments})=>({...parseCommand(file,commandArguments),isSync:!0}),parseCommand=(command,unusedArguments)=>{if(unusedArguments.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${command} ${unusedArguments}.`);let[file,...commandArguments]=parseCommandString(command);return {file,commandArguments}},parseCommandString=command=>{if(typeof command!="string")throw new TypeError(`The command must be a string: ${String(command)}.`);let trimmedCommand=command.trim();if(trimmedCommand==="")return [];let tokens=[];for(let token of trimmedCommand.split(SPACES_REGEXP)){let previousToken=tokens.at(-1);previousToken&&previousToken.endsWith("\\")?tokens[tokens.length-1]=`${previousToken.slice(0,-1)} ${token}`:tokens.push(token);}return tokens},SPACES_REGEXP=/ +/g;var setScriptSync=(boundExeca,createNested,boundOptions)=>{boundExeca.sync=createNested(mapScriptSync,boundOptions),boundExeca.s=boundExeca.sync;},mapScriptAsync=({options})=>getScriptOptions(options),mapScriptSync=({options})=>({...getScriptOptions(options),isSync:!0}),getScriptOptions=options=>({options:{...getScriptStdinOption(options),...options}}),getScriptStdinOption=({input,inputFile,stdio})=>input===void 0&&inputFile===void 0&&stdio===void 0?{stdin:"inherit"}:{},deepScriptOptions={preferLocal:!0};var execa=createExeca(()=>({}));createExeca(()=>({isSync:!0}));createExeca(mapCommandAsync);createExeca(mapCommandSync);createExeca(mapNode);createExeca(mapScriptAsync,{},deepScriptOptions,setScriptSync);getIpcExport();var $2=execa({preferLocal:!0,stdio:"inherit",reject:!1});async function postinstall(options){let command=["storybook","automigrate","addon-a11y-addon-test"];command.push("--loglevel","silent"),command.push("--skip-doctor"),options.yes&&command.push("--yes"),options.packageManager&&command.push("--package-manager",options.packageManager),options.configDir&&command.push("--config-dir",options.configDir),await $2`${command.join(" ")}`;}
68
68
 
69
69
  module.exports = postinstall;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-a11y",
3
- "version": "9.1.0-alpha.5",
3
+ "version": "9.1.0-alpha.7",
4
4
  "description": "Test component compliance with web accessibility standards",
5
5
  "keywords": [
6
6
  "a11y",
@@ -81,7 +81,7 @@
81
81
  "vitest-axe": "^0.1.0"
82
82
  },
83
83
  "peerDependencies": {
84
- "storybook": "^9.1.0-alpha.5"
84
+ "storybook": "^9.1.0-alpha.7"
85
85
  },
86
86
  "publishConfig": {
87
87
  "access": "public"