"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["vendors-node_modules_primer_react_lib-esm_TreeView_TreeView_js"],{81455:(e,t,r)=>{r.d(t,{L:()=>F});var n=r(85529),l=r(86010),i=r(67294),o=r(15388),a=r(37904),c=r(74121),s=r(97011),u=r(53670),d=r(42379),m=r(14543),f=r(70697),g=r(69889),p=r(15173);function v(e){var t,r,n;let l=e.getAttribute("aria-label"),i=e.getAttribute("aria-labelledby");return l||(i?null!==(t=null===(r=document.getElementById(i))||void 0===r?void 0:r.textContent)&&void 0!==t?t:"":null!==(n=e.textContent)&&void 0!==n?n:"")}var h=r(17840),E=r(87691),w=r(48542);function T(e,t){let r=e.closest("[role=tree]");if(!r)return;let n=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,e=>e instanceof HTMLElement&&"treeitem"===e.getAttribute("role")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP),l=n.firstChild();for(;l!==e;)l=n.nextNode();let i="next"===t?n.nextNode():n.previousNode();for(;i instanceof HTMLElement&&null!==(o=i.parentElement)&&void 0!==o&&o.closest("[role=treeitem][aria-expanded=false]");){var o;i="next"===t?n.nextNode():n.previousNode()}return i instanceof HTMLElement?i:void 0}function y(e){let t=e.querySelector("[role=treeitem]");return t instanceof HTMLElement?t:void 0}function V(e){let t=e.closest("[role=group]"),r=null==t?void 0:t.closest("[role=treeitem]");return r instanceof HTMLElement?r:void 0}let b={height:32};function A(e,t){var r,n;let l=(0,E.J)(e),{height:i}=null!==(r=null==t?void 0:t.getBoundingClientRect())&&void 0!==r?r:b,o=null!==(n=null==l?void 0:l.clientHeight)&&void 0!==n?n:window.innerHeight;return Math.floor(o/i)}let x=i.createContext({announceUpdate:()=>{},expandedStateCache:{current:new Map}}),I=i.createContext({itemId:"",level:1,isSubTreeEmpty:!1,setIsSubTreeEmpty:()=>{},isExpanded:!1,setIsExpanded:()=>{},leadingVisualId:"",trailingVisualId:""}),R=o.ZP.ul.withConfig({displayName:"TreeView__UlBox",componentId:"sc-4ex6b6-0"})(["list-style:none;padding:0;margin:0;.PRIVATE_TreeView-item{outline:none;&:focus-visible > div,&.focus-visible > div{box-shadow:inset 0 0 0 2px ",";@media (forced-colors:active){outline:2px solid HighlightText;outline-offset:-2;}}}.PRIVATE_TreeView-item-container{--level:1;--toggle-width:1rem;position:relative;display:grid;grid-template-columns:calc(calc(var(--level) - 1) * (var(--toggle-width) / 2)) var(--toggle-width) 1fr;grid-template-areas:'spacer toggle content';width:100%;min-height:2rem;font-size:",";color:",";border-radius:",";cursor:pointer;&:hover{background-color:",";@media (forced-colors:active){outline:2px solid transparent;outline-offset:-2px;}}@media (pointer:coarse){--toggle-width:1.5rem;min-height:2.75rem;}&:has(.PRIVATE_TreeView-item-skeleton):hover{background-color:transparent;cursor:default;@media (forced-colors:active){outline:none;}}}&[data-omit-spacer='true'] .PRIVATE_TreeView-item-container{grid-template-columns:0 0 1fr;}.PRIVATE_TreeView-item[aria-current='true'] > .PRIVATE_TreeView-item-container{background-color:",";&::after{content:'';position:absolute;top:calc(50% - 0.75rem);left:-",";width:0.25rem;height:1.5rem;background-color:",";border-radius:",";@media (forced-colors:active){background-color:HighlightText;}}}.PRIVATE_TreeView-item-toggle{grid-area:toggle;display:flex;align-items:center;justify-content:center;height:100%;color:",";}.PRIVATE_TreeView-item-toggle--hover:hover{background-color:",";}.PRIVATE_TreeView-item-toggle--end{border-top-left-radius:",";border-bottom-left-radius:",";}.PRIVATE_TreeView-item-content{grid-area:content;display:flex;align-items:center;height:100%;padding:0 ",";gap:",";}.PRIVATE_TreeView-item-content-text{flex:1 1 auto;width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;}.PRIVATE_TreeView-item-visual{display:flex;color:",";}.PRIVATE_TreeView-item-level-line{width:100%;height:100%;border-right:1px solid;border-color:",";}@media (hover:hover){.PRIVATE_TreeView-item-level-line{border-color:transparent;}&:hover .PRIVATE_TreeView-item-level-line,&:focus-within .PRIVATE_TreeView-item-level-line{border-color:",";}}.PRIVATE_TreeView-directory-icon{display:grid;color:",";}.PRIVATE_VisuallyHidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;}",""],(0,d.U2)("colors.accent.fg"),(0,d.U2)("fontSizes.1"),(0,d.U2)("colors.fg.default"),(0,d.U2)("radii.2"),(0,d.U2)("colors.actionListItem.default.hoverBg"),(0,d.U2)("colors.actionListItem.default.selectedBg"),(0,d.U2)("space.2"),(0,d.U2)("colors.accent.fg"),(0,d.U2)("radii.2"),(0,d.U2)("colors.fg.muted"),(0,d.U2)("colors.treeViewItem.chevron.hoverBg"),(0,d.U2)("radii.2"),(0,d.U2)("radii.2"),(0,d.U2)("space.2"),(0,d.U2)("space.2"),(0,d.U2)("colors.fg.muted"),(0,d.U2)("colors.border.subtle"),(0,d.U2)("colors.border.subtle"),(0,d.U2)("colors.treeViewItem.directory.fill"),p.Z),P=({"aria-label":e,"aria-labelledby":t,children:r,flat:n})=>{let l=i.useRef(null),o=i.useRef(!1),[a,c]=i.useState(""),s=i.useCallback(e=>{c(e)},[]),d=(0,i.useCallback)(()=>{o.current=!0},[]);(0,i.useEffect)(()=>{function e(){o.current=!1}return document.addEventListener("mouseup",e),()=>{document.removeEventListener("mouseup",e)}},[]),function({containerRef:e,mouseDownRef:t}){(0,h.v)({containerRef:e,bindKeys:w.Qw.ArrowVertical|w.Qw.ArrowHorizontal|w.Qw.HomeAndEnd|w.Qw.Backspace|w.Qw.PageUpDown,preventScroll:!0,getNextFocusable:(e,t,r)=>{var n;if(t instanceof HTMLElement){try{if(t.closest("dialog:modal"))return}catch{}return null!==(n=function(e,t){let r=function(e){if("treeitem"!==e.getAttribute("role"))throw Error("Element is not a treeitem");switch(e.getAttribute("aria-expanded")){case"true":return"open";case"false":return"closed";default:return"end"}}(e);switch(`${r} ${t.key}`){case"open ArrowRight":return y(e);case"open ArrowLeft":case"closed ArrowRight":case"end ArrowRight":return;case"closed ArrowLeft":case"end ArrowLeft":return V(e)}switch(t.key){case"ArrowUp":return T(e,"previous");case"ArrowDown":return T(e,"next");case"Backspace":return V(e);case"Home":return function(e){let t=e.closest("[role=tree]"),r=null==t?void 0:t.querySelector("[role=treeitem]");return r instanceof HTMLElement?r:void 0}(e);case"End":return function(e){let t=e.closest("[role=tree]"),r=Array.from((null==t?void 0:t.querySelectorAll("[role=treeitem]"))||[]);if(0===r.length)return;let n=r.length-1,l=r[n];for(;n>0&&l instanceof HTMLElement&&null!==(i=l.parentElement)&&void 0!==i&&i.closest("[role=treeitem][aria-expanded=false]");){var i;n-=1,l=r[n]}return l instanceof HTMLElement?l:void 0}(e);case"PageUp":return function(e){let t=e.closest('[role="tree"]');if(!t)return;let r=Array.from(t.querySelectorAll('[role="treeitem"]'));if(0===r.length)return;let n=r[0].firstElementChild,l=A(t,n),i=Math.floor(r.indexOf(e)/l),o=r.indexOf(e)-l*i;return r[Math.max(0,(i-1)*l+o)]}(e);case"PageDown":return function(e){let t=e.closest('[role="tree"]');if(!t)return;let r=Array.from(t.querySelectorAll('[role="treeitem"]'));if(0===r.length)return;let n=r[0].firstElementChild,l=A(t,n),i=Math.floor(r.indexOf(e)/l),o=r.indexOf(e)-l*i;return r[Math.min(r.length-1,(i+1)*l+o)]}(e)}}(t,r))&&void 0!==n?n:t}},focusInStrategy:()=>{var r,n,l;if(t.current)return;let i=null===(r=e.current)||void 0===r?void 0:r.querySelector("[aria-current]"),o=null===(n=e.current)||void 0===n?void 0:n.querySelector('[role="treeitem"]');return i instanceof HTMLElement?i:document.activeElement instanceof HTMLElement&&null!==(l=e.current)&&void 0!==l&&l.contains(document.activeElement)?document.activeElement:o instanceof HTMLElement?o:void 0}})}({containerRef:l,mouseDownRef:o}),function({containerRef:e,onFocusChange:t}){let r=i.useRef(""),n=i.useRef(0),l=i.useRef(t),{safeSetTimeout:o,safeClearTimeout:a}=(0,f.Z)();i.useEffect(()=>{l.current=t},[t]);let c=i.useCallback(t=>{if(!t||!e.current)return;let r=e.current,n=Array.from(r.querySelectorAll('[role="treeitem"]')),i=n.findIndex(e=>e===document.activeElement),o=n.map((e,t)=>n[(i+t)%n.length]);1===t.length&&(o=o.slice(1));let a=o.find(e=>{let r=v(e).toLowerCase();return r.startsWith(t.toLowerCase())});a&&l.current(a)},[e]);i.useEffect(()=>{if(!e.current)return;let t=e.current;function l(e){e.key&&!(e.key.length>1)&&(e.ctrlKey||e.altKey||e.metaKey||(r.current+=e.key,c(r.current),a(n.current),n.current=o(()=>r.current="",300),e.preventDefault(),e.stopPropagation()))}return t.addEventListener("keydown",l),()=>t.removeEventListener("keydown",l)},[e,c,a,o])}({containerRef:l,onFocusChange:e=>{e instanceof HTMLElement&&e.focus()}});let m=i.useRef(null);return null===m.current&&(m.current=new Map),i.createElement(x.Provider,{value:{announceUpdate:s,expandedStateCache:m}},i.createElement(i.Fragment,null,i.createElement(u.Z,{role:"status","aria-live":"polite","aria-atomic":"true"},a),i.createElement(R,{ref:l,role:"tree","aria-label":e,"aria-labelledby":t,"data-omit-spacer":n,onMouseDown:d},r)))};P.displayName="Root",P.displayName="TreeView";let k=i.forwardRef(({id:e,containIntrinsicSize:t,current:r=!1,defaultExpanded:o,expanded:a,onExpandedChange:c,onSelect:s,children:u},d)=>{let[f,p]=(0,g.R)(u,{leadingVisual:M,trailingVisual:S}),{expandedStateCache:v}=i.useContext(x),h=(0,m.M)(),E=(0,m.M)(),w=(0,m.M)(),[T,y]=function({name:e="custom",defaultValue:t,value:r,onChange:n}){let[l,o]=i.useState(null!=r?r:t),a=i.useRef(null),c=i.useRef(n);i.useEffect(()=>{c.current=n}),null===a.current&&(a.current=void 0!==r);let s=i.useCallback(e=>{var t;let r="function"==typeof e?e(l):e;!1===a.current&&o(r),null===(t=c.current)||void 0===t||t.call(c,r)},[l]);return(i.useEffect(()=>{a.current,a.current},[e,r]),!0===a.current)?[r,s]:[l,s]}({name:e,defaultValue:()=>{var t,n,l;return null!==(t=null!==(n=null===(l=v.current)||void 0===l?void 0:l.get(e))&&void 0!==n?n:o)&&void 0!==t?t:r},value:a,onChange:c}),{level:V}=i.useContext(I),{hasSubTree:b,subTree:A,childrenWithoutSubTree:R}=function(e){return i.useMemo(()=>{let t=i.Children.toArray(e).find(e=>i.isValidElement(e)&&e.type===C),r=i.Children.toArray(e).filter(e=>!(i.isValidElement(e)&&e.type===C));return{subTree:t,childrenWithoutSubTree:r,hasSubTree:!!t}},[e])}(p),[P,k]=i.useState(!b),[L,N]=i.useState(!1),U=i.useCallback(t=>{var r;y(t),null===(r=v.current)||void 0===r||r.set(e,t)},[e,y,v]),H=i.useCallback(e=>{U(!T),null==e||e.stopPropagation()},[T,U]),D=i.useCallback(e=>{switch(e.key){case"Enter":s?s(e):H(e),e.stopPropagation();break;case"ArrowRight":if(e.altKey||e.metaKey)return;e.preventDefault(),e.stopPropagation(),U(!0);break;case"ArrowLeft":if(e.altKey||e.metaKey)return;e.preventDefault(),e.stopPropagation(),U(!1)}},[s,U,H]);return i.createElement(I.Provider,{value:{itemId:e,level:V+1,isSubTreeEmpty:P,setIsSubTreeEmpty:k,isExpanded:T,setIsExpanded:U,leadingVisualId:E,trailingVisualId:w}},i.createElement("li",{className:"PRIVATE_TreeView-item",ref:d,tabIndex:0,id:e,role:"treeitem","aria-labelledby":h,"aria-describedby":`${E} ${w}`,"aria-level":V,"aria-expanded":P?void 0:T,"aria-current":r?"true":void 0,"aria-selected":L?"true":"false",onKeyDown:D,onFocus:e=>{var t;null===(t=e.currentTarget.firstElementChild)||void 0===t||t.scrollIntoView({block:"nearest",inline:"nearest"}),N(!0),e.stopPropagation()},onBlur:()=>N(!1),onClick:e=>{s?s(e):H(e),e.stopPropagation()},onAuxClick:e=>{s&&1===e.button&&s(e),e.stopPropagation()}},i.createElement("div",{className:"PRIVATE_TreeView-item-container",style:{"--level":V,contentVisibility:t?"auto":void 0,containIntrinsicSize:t}},i.createElement("div",{style:{gridArea:"spacer",display:"flex"}},i.createElement(_,{level:V})),b?i.createElement("div",{className:(0,l.Z)("PRIVATE_TreeView-item-toggle",s&&"PRIVATE_TreeView-item-toggle--hover",1===V&&"PRIVATE_TreeView-item-toggle--end"),onClick:e=>{s&&H(e)}},T?i.createElement(n.ChevronDownIcon,{size:12}):i.createElement(n.ChevronRightIcon,{size:12})):null,i.createElement("div",{id:h,className:"PRIVATE_TreeView-item-content"},f.leadingVisual,i.createElement("span",{className:"PRIVATE_TreeView-item-content-text"},R),f.trailingVisual)),A))}),_=({level:e})=>i.createElement("div",{style:{width:"100%",display:"flex"}},Array.from({length:e-1}).map((e,t)=>i.createElement("div",{key:t,className:"PRIVATE_TreeView-item-level-line"})));_.displayName="LevelIndicatorLines",k.displayName="TreeView.Item";let C=({count:e,state:t,children:r})=>{let{announceUpdate:n}=i.useContext(x),{itemId:l,isExpanded:o,isSubTreeEmpty:a,setIsSubTreeEmpty:c}=i.useContext(I),s=i.useRef(null),u=i.useRef(null),[d,m]=i.useState(!1),g=function(e){let t=i.useRef(e);return i.useEffect(()=>{t.current=e},[e]),t.current}(t),{safeSetTimeout:p}=(0,f.Z)();return(i.useEffect(()=>{(void 0===t||"done"===t)&&(a||r?a&&r&&c(!1):c(!0))},[t,a,c,r]),i.useEffect(()=>{if("loading"===g&&"done"===t){var e;let t=document.getElementById(l);if(!t)return;let r=v(t);if(null!==(e=u.current)&&void 0!==e&&e.childElementCount?n(`${r} content loaded`):n(`${r} is empty`),d){let e=y(t);e?p(()=>{e.focus()}):p(()=>{t.focus()}),m(!1)}}},[d,g,t,l,n,u,p]),i.useEffect(()=>{function e(){m(!0)}function t(e){e.relatedTarget&&m(!1)}let r=s.current;if(r)return r.addEventListener("focus",e),r.addEventListener("blur",t),()=>{r.removeEventListener("focus",e),r.removeEventListener("blur",t)}},[s,t]),o)?i.createElement("ul",{role:"group",style:{listStyle:"none",padding:0,margin:0},ref:u},"loading"===t?i.createElement(U,{ref:s,count:e}):r):null};C.displayName="SubTree",C.displayName="TreeView.SubTree";let L=(0,o.F4)(["from{mask-position:200%;}to{mask-position:0%;}"]),N=o.ZP.span.attrs({className:"PRIVATE_TreeView-item-skeleton"}).withConfig({displayName:"TreeView__SkeletonItem",componentId:"sc-4ex6b6-1"})(["display:flex;align-items:center;column-gap:0.5rem;height:2rem;@media (pointer:coarse){height:2.75rem;}@media (prefers-reduced-motion:no-preference){mask-image:linear-gradient(75deg,#000 30%,rgba(0,0,0,0.65) 80%);mask-size:200%;animation:",";animation-duration:1s;animation-iteration-count:infinite;}&::before{content:'';display:block;width:1rem;height:1rem;background-color:",";border-radius:3px;@media (forced-colors:active){outline:1px solid transparent;outline-offset:-1px;}}&::after{content:'';display:block;width:var(--tree-item-loading-width,67%);height:1rem;background-color:",";border-radius:3px;@media (forced-colors:active){outline:1px solid transparent;outline-offset:-1px;}}&:nth-of-type(5n + 1){--tree-item-loading-width:67%;}&:nth-of-type(5n + 2){--tree-item-loading-width:47%;}&:nth-of-type(5n + 3){--tree-item-loading-width:73%;}&:nth-of-type(5n + 4){--tree-item-loading-width:64%;}&:nth-of-type(5n + 5){--tree-item-loading-width:50%;}"],L,(0,d.U2)("colors.neutral.subtle"),(0,d.U2)("colors.neutral.subtle")),U=i.forwardRef(({count:e},t)=>{let r=(0,m.M)();return e?i.createElement(k,{id:r,ref:t},Array.from({length:e}).map((e,t)=>i.createElement(N,{"aria-hidden":!0,key:t})),i.createElement("div",{className:"PRIVATE_VisuallyHidden"},"Loading ",e," items")):i.createElement(k,{id:r,ref:t},i.createElement(M,null,i.createElement(c.Z,{size:"small"})),i.createElement(s.Z,{sx:{color:"fg.muted"}},"Loading..."))}),M=e=>{let{isExpanded:t,leadingVisualId:r}=i.useContext(I),n="function"==typeof e.children?e.children({isExpanded:t}):e.children;return i.createElement(i.Fragment,null,i.createElement("div",{className:"PRIVATE_VisuallyHidden","aria-hidden":!0,id:r},e.label),i.createElement("div",{className:"PRIVATE_TreeView-item-visual","aria-hidden":!0},n))};M.displayName="TreeView.LeadingVisual";let S=e=>{let{isExpanded:t,trailingVisualId:r}=i.useContext(I),n="function"==typeof e.children?e.children({isExpanded:t}):e.children;return i.createElement(i.Fragment,null,i.createElement("div",{className:"PRIVATE_VisuallyHidden","aria-hidden":!0,id:r},e.label),i.createElement("div",{className:"PRIVATE_TreeView-item-visual","aria-hidden":!0},n))};S.displayName="TreeView.TrailingVisual";let H=()=>{let{isExpanded:e}=i.useContext(I),t=e?n.FileDirectoryOpenFillIcon:n.FileDirectoryFillIcon;return i.createElement("div",{className:"PRIVATE_TreeView-directory-icon"},i.createElement(t,null))};H.displayName="DirectoryIcon";let D=({title:e="Error",children:t,onRetry:r,onDismiss:n})=>{let{itemId:l,setIsExpanded:o}=i.useContext(I);return i.createElement("div",{onKeyDown:e=>{["Backspace","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"].includes(e.key)&&e.stopPropagation()}},i.createElement(a.U,{title:e,onClose:e=>{setTimeout(()=>{let e=document.getElementById(l);null==e||e.focus()}),"confirm"===e?null==r||r():(o(!1),null==n||n())},confirmButtonContent:"Retry",cancelButtonContent:"Dismiss"},t))};D.displayName="ErrorDialog",D.displayName="TreeView.ErrorDialog";let F=Object.assign(P,{Item:k,SubTree:C,LeadingVisual:M,TrailingVisual:S,DirectoryIcon:H,ErrorDialog:D})}}]); //# sourceMappingURL=vendors-node_modules_primer_react_lib-esm_TreeView_TreeView_js-5941e78db72c.js.map