@sps-woodland/tabs 8.7.3 → 8.7.5
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/lib/index.cjs.js +3 -3
- package/lib/index.es.js +827 -722
- package/lib/style.css +1 -1
- package/package.json +5 -6
- /package/{vite.config.js → vite.config.mjs} +0 -0
package/lib/index.cjs.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("react"),Z=require("@react-stately/collections"),Ot=require("react-dom"),R=require("@sps-woodland/core"),Re=require("@spscommerce/utils"),Ft=t=>t&&typeof t=="object"&&"default"in t?t:{default:t};function zt(t){if(t&&t.__esModule)return t;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const B=Ft(b),N=zt(b);function ot(t,e,r){let[n,i]=b.useState(t||e),o=b.useRef(t!==void 0),s=t!==void 0;b.useEffect(()=>{let v=o.current;v!==s&&console.warn(`WARN: A component changed from ${v?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}.`),o.current=s},[s]);let u=s?t:n,f=b.useCallback((v,...g)=>{let w=($,...h)=>{r&&(Object.is(u,$)||r($,...h)),s||(u=$)};typeof v=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),i((h,...M)=>{let E=v(s?u:h,...M);return w(E,...g),s?h:E})):(s||i(v),w(v,...g))},[s,u,r]);return[u,f]}class z extends Set{constructor(e,r,n){super(e),e instanceof z?(this.anchorKey=r||e.anchorKey,this.currentKey=n||e.currentKey):(this.anchorKey=r,this.currentKey=n)}}function Nt(t,e){if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;return!0}function Rt(t){let{selectionMode:e="none",disallowEmptySelection:r,allowDuplicateSelectionEvents:n,selectionBehavior:i="toggle",disabledBehavior:o="all"}=t,s=b.useRef(!1),[,u]=b.useState(!1),f=b.useRef(null),v=b.useRef(null),[,g]=b.useState(null),w=b.useMemo(()=>Be(t.selectedKeys),[t.selectedKeys]),$=b.useMemo(()=>Be(t.defaultSelectedKeys,new z),[t.defaultSelectedKeys]),[h,M]=ot(w,$,t.onSelectionChange),E=b.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),[K,L]=b.useState(i);i==="replace"&&K==="toggle"&&typeof h=="object"&&h.size===0&&L("replace");let k=b.useRef(i);return b.useEffect(()=>{i!==k.current&&(L(i),k.current=i)},[i]),{selectionMode:e,disallowEmptySelection:r,selectionBehavior:K,setSelectionBehavior:L,get isFocused(){return s.current},setFocused(x){s.current=x,u(x)},get focusedKey(){return f.current},get childFocusStrategy(){return v.current},setFocusedKey(x,C="first"){f.current=x,v.current=C,g(x)},selectedKeys:h,setSelectedKeys(x){(n||!Nt(x,h))&&M(x)},disabledKeys:E,disabledBehavior:o}}function Be(t,e){return t?t==="all"?"all":new z(t):e}class Bt{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,r){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,r)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){return this.state.selectionMode==="none"?!1:(e=this.getKey(e),this.state.selectedKeys==="all"?this.canSelectItem(e):this.state.selectedKeys.has(e))}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),r=this.state.selectedKeys;return this._isSelectAll=e.every(n=>r.has(n)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&Z.compareNodeOrder(this.collection,n,e)<0)&&(e=n)}return e==null?void 0:e.key}get lastSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&Z.compareNodeOrder(this.collection,n,e)>0)&&(e=n)}return e==null?void 0:e.key}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}e=this.getKey(e);let r;if(this.state.selectedKeys==="all")r=new z([e],e,e);else{let n=this.state.selectedKeys,i=n.anchorKey||e;r=new z(n,i,e);for(let o of this.getKeyRange(i,n.currentKey||e))r.delete(o);for(let o of this.getKeyRange(e,i))this.canSelectItem(o)&&r.add(o)}this.state.setSelectedKeys(r)}getKeyRange(e,r){let n=this.collection.getItem(e),i=this.collection.getItem(r);return n&&i?Z.compareNodeOrder(this.collection,n,i)<=0?this.getKeyRangeInternal(e,r):this.getKeyRangeInternal(r,e):[]}getKeyRangeInternal(e,r){let n=[],i=e;for(;i;){let o=this.collection.getItem(i);if((o&&o.type==="item"||o.type==="cell"&&this.allowsCellSelection)&&n.push(i),i===r)return n;i=this.collection.getKeyAfter(i)}return[]}getKey(e){let r=this.collection.getItem(e);if(!r||r.type==="cell"&&this.allowsCellSelection)return e;for(;r.type!=="item"&&r.parentKey!=null;)r=this.collection.getItem(r.parentKey);return!r||r.type!=="item"?null:r.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}if(e=this.getKey(e),e==null)return;let r=new z(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);r.has(e)?r.delete(e):this.canSelectItem(e)&&(r.add(e),r.anchorKey=e,r.currentKey=e),!(this.disallowEmptySelection&&r.size===0)&&this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode==="none"||(e=this.getKey(e),e==null))return;let r=this.canSelectItem(e)?new z([e],e,e):new z;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode==="none")return;let r=new z;for(let n of e)if(n=this.getKey(n),n!=null&&(r.add(n),this.selectionMode==="single"))break;this.state.setSelectedKeys(r)}getSelectAllKeys(){let e=[],r=n=>{for(;n;){if(this.canSelectItem(n)){let i=this.collection.getItem(n);i.type==="item"&&e.push(n),i.hasChildNodes&&(this.allowsCellSelection||i.type!=="item")&&r(Z.getFirstItem(Z.getChildNodes(i,this.collection)).key)}n=this.collection.getKeyAfter(n)}};return r(this.collection.getFirstKey()),e}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new z)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,r){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||r&&(r.pointerType==="touch"||r.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let r=this.selectedKeys;if(e.size!==r.size)return!1;for(let n of e)if(!r.has(n))return!1;for(let n of r)if(!e.has(n))return!1;return!0}canSelectItem(e){if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let r=this.collection.getItem(e);return!(!r||r.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){return this.state.disabledKeys.has(e)&&this.state.disabledBehavior==="all"}isLink(e){var r,n;return!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.href)}constructor(e,r,n){this.collection=e,this.state=r;var i;this.allowsCellSelection=(i=n==null?void 0:n.allowsCellSelection)!==null&&i!==void 0?i:!1,this._isSelectAll=null}}class je{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let r=this.keyMap.get(e);return r?r.prevKey:null}getKeyAfter(e){let r=this.keyMap.get(e);return r?r.nextKey:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const r=[...this.getKeys()];return this.getItem(r[e])}getChildren(e){let r=this.keyMap.get(e);return(r==null?void 0:r.childNodes)||[]}constructor(e){this.keyMap=new Map,this.iterable=e;let r=o=>{if(this.keyMap.set(o.key,o),o.childNodes&&o.type==="section")for(let s of o.childNodes)r(s)};for(let o of e)r(o);let n,i=0;for(let[o,s]of this.keyMap)n?(n.nextKey=o,s.prevKey=n.key):(this.firstKey=o,s.prevKey=void 0),s.type==="item"&&(s.index=i++),n=s,n.nextKey=void 0;this.lastKey=n==null?void 0:n.key}}function jt(t){let{filter:e}=t,r=Rt(t),n=b.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),i=b.useCallback(v=>e?new je(e(v)):new je(v),[e]),o=b.useMemo(()=>({suppressTextValueWarning:t.suppressTextValueWarning}),[t.suppressTextValueWarning]),s=Z.useCollection(t,i,o),u=b.useMemo(()=>new Bt(s,r),[s,r]);const f=b.useRef(null);return b.useEffect(()=>{if(r.focusedKey!=null&&!s.getItem(r.focusedKey)){const v=f.current.getItem(r.focusedKey),g=[...f.current.getKeys()].map(E=>{const K=f.current.getItem(E);return K.type==="item"?K:null}).filter(E=>E!==null),w=[...s.getKeys()].map(E=>{const K=s.getItem(E);return K.type==="item"?K:null}).filter(E=>E!==null),$=g.length-w.length;let h=Math.min($>1?Math.max(v.index-$+1,0):v.index,w.length-1),M;for(;h>=0;){if(!u.isDisabled(w[h].key)){M=w[h];break}h<w.length-1?h++:(h>v.index&&(h=v.index),h--)}r.setFocusedKey(M?M.key:null)}f.current=s},[s,u,r,r.focusedKey]),{collection:s,disabledKeys:n,selectionManager:u}}function Ut(t){var e;let[r,n]=ot(t.selectedKey,(e=t.defaultSelectedKey)!==null&&e!==void 0?e:null,t.onSelectionChange),i=b.useMemo(()=>r!=null?[r]:[],[r]),{collection:o,disabledKeys:s,selectionManager:u}=jt({...t,selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:v=>{var g;let w=(g=v.values().next().value)!==null&&g!==void 0?g:null;w===r&&t.onSelectionChange&&t.onSelectionChange(w),n(w)}}),f=r!=null?o.getItem(r):null;return{collection:o,disabledKeys:s,selectionManager:u,selectedKey:r,setSelectedKey:n,selectedItem:f}}function Wt(t){var e;let r=Ut({...t,suppressTextValueWarning:!0,defaultSelectedKey:(e=t.defaultSelectedKey)!==null&&e!==void 0?e:Ue(t.collection,t.disabledKeys?new Set(t.disabledKeys):new Set)}),{selectionManager:n,collection:i,selectedKey:o}=r,s=b.useRef(o);return b.useEffect(()=>{let u=o;(n.isEmpty||!i.getItem(u))&&(u=Ue(i,r.disabledKeys),u!=null&&n.setSelectedKeys([u])),(u!=null&&n.focusedKey==null||!n.isFocused&&u!==s.current)&&n.setFocusedKey(u),s.current=u}),{...r,isDisabled:t.isDisabled||!1}}function Ue(t,e){let r=null;if(t){for(r=t.getFirstKey();e.has(r)&&r!==t.getLastKey();)r=t.getKeyAfter(r);e.has(r)&&r===t.getLastKey()&&(r=t.getFirstKey())}return r}const fe={prefix:String(Math.round(Math.random()*1e10)),current:0},st=B.default.createContext(fe),Ht=B.default.createContext(!1);let Vt=Boolean(typeof window<"u"&&window.document&&window.document.createElement),$e=new WeakMap;function Gt(t=!1){let e=b.useContext(st),r=b.useRef(null);if(r.current===null&&!t){var n,i;let o=(i=B.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||i===void 0||(n=i.ReactCurrentOwner)===null||n===void 0?void 0:n.current;if(o){let s=$e.get(o);s==null?$e.set(o,{id:e.current,state:o.memoizedState}):o.memoizedState!==s.state&&(e.current=s.id,$e.delete(o))}r.current=++e.current}return r.current}function qt(t){let e=b.useContext(st);e===fe&&!Vt&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let r=Gt(!!t),n=e===fe&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${e.prefix}`;return t||`${n}-${r}`}function Xt(t){let e=B.default.useId(),[r]=b.useState(at()),n=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${fe.prefix}`;return t||`${n}-${e}`}const Yt=typeof B.default.useId=="function"?Xt:qt;function Jt(){return!1}function _t(){return!0}function Zt(t){return()=>{}}function at(){return typeof B.default.useSyncExternalStore=="function"?B.default.useSyncExternalStore(Zt,Jt,_t):b.useContext(Ht)}function ct(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=ct(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Qt(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=ct(t))&&(n&&(n+=" "),n+=e);return n}const le=typeof document<"u"?B.default.useLayoutEffect:()=>{};function Q(t){const e=b.useRef(null);return le(()=>{e.current=t},[t]),b.useCallback((...r)=>{const n=e.current;return n==null?void 0:n(...r)},[])}let er=Boolean(typeof window<"u"&&window.document&&window.document.createElement),pe=new Map;function ut(t){let[e,r]=b.useState(t),n=b.useRef(null),i=Yt(e),o=b.useCallback(s=>{n.current=s},[]);return er&&pe.set(i,o),le(()=>{let s=i;return()=>{pe.delete(s)}},[i]),b.useEffect(()=>{let s=n.current;s&&(n.current=null,r(s))}),i}function tr(t,e){if(t===e)return t;let r=pe.get(t);if(r)return r(e),e;let n=pe.get(e);return n?(n(t),t):e}function dt(...t){return(...e)=>{for(let r of t)typeof r=="function"&&r(...e)}}const D=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},G=t=>t&&"window"in t&&t.window===t?t:D(t).defaultView||window;function H(...t){let e={...t[0]};for(let r=1;r<t.length;r++){let n=t[r];for(let i in n){let o=e[i],s=n[i];typeof o=="function"&&typeof s=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=dt(o,s):(i==="className"||i==="UNSAFE_className")&&typeof o=="string"&&typeof s=="string"?e[i]=Qt(o,s):i==="id"&&o&&s?e.id=tr(o,s):e[i]=s!==void 0?s:o}}return e}const rr=new Set(["id"]),nr=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),ir=new Set(["href","target","rel","download","ping","referrerPolicy"]),lr=/^(data-.*)$/;function or(t,e={}){let{labelable:r,isLink:n,propNames:i}=e,o={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(rr.has(s)||r&&nr.has(s)||n&&ir.has(s)||(i==null?void 0:i.has(s))||lr.test(s))&&(o[s]=t[s]);return o}function W(t){if(sr())t.focus({preventScroll:!0});else{let e=ar(t);t.focus(),cr(e)}}let se=null;function sr(){if(se==null){se=!1;try{document.createElement("div").focus({get preventScroll(){return se=!0,!0}})}catch{}}return se}function ar(t){let e=t.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==n;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&r.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function cr(t){for(let{element:e,scrollTop:r,scrollLeft:n}of t)e.scrollTop=r,e.scrollLeft=n}function ve(t){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(r=>t.test(r.brand)))||t.test(window.navigator.userAgent)}function Ce(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function q(){return Ce(/^Mac/i)}function ur(){return Ce(/^iPhone/i)}function ft(){return Ce(/^iPad/i)||q()&&navigator.maxTouchPoints>1}function Ie(){return ur()||ft()}function dr(){return q()||Ie()}function fr(){return ve(/AppleWebKit/i)&&!pr()}function pr(){return ve(/Chrome/i)}function pt(){return ve(/Android/i)}function br(){return ve(/Firefox/i)}const yr=b.createContext({isNative:!0,open:gr});function bt(){return b.useContext(yr)}function X(t,e,r=!0){var n,i;let{metaKey:o,ctrlKey:s,altKey:u,shiftKey:f}=e;br()&&((i=window.event)===null||i===void 0||(n=i.type)===null||n===void 0?void 0:n.startsWith("key"))&&t.target==="_blank"&&(q()?o=!0:s=!0);let v=fr()&&q()&&!ft()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:s,altKey:u,shiftKey:f}):new MouseEvent("click",{metaKey:o,ctrlKey:s,altKey:u,shiftKey:f,bubbles:!0,cancelable:!0});X.isOpening=r,W(t),t.dispatchEvent(v),X.isOpening=!1}X.isOpening=!1;function vr(t,e){if(t instanceof HTMLAnchorElement)e(t);else if(t.hasAttribute("data-href")){let r=document.createElement("a");r.href=t.getAttribute("data-href"),t.hasAttribute("data-target")&&(r.target=t.getAttribute("data-target")),t.hasAttribute("data-rel")&&(r.rel=t.getAttribute("data-rel")),t.hasAttribute("data-download")&&(r.download=t.getAttribute("data-download")),t.hasAttribute("data-ping")&&(r.ping=t.getAttribute("data-ping")),t.hasAttribute("data-referrer-policy")&&(r.referrerPolicy=t.getAttribute("data-referrer-policy")),t.appendChild(r),e(r),t.removeChild(r)}}function gr(t,e){vr(t,r=>X(r,e))}let ee=new Map,Te=new Set;function We(){if(typeof window>"u")return;function t(n){return"propertyName"in n}let e=n=>{if(!t(n)||!n.target)return;let i=ee.get(n.target);i||(i=new Set,ee.set(n.target,i),n.target.addEventListener("transitioncancel",r,{once:!0})),i.add(n.propertyName)},r=n=>{if(!t(n)||!n.target)return;let i=ee.get(n.target);if(!!i&&(i.delete(n.propertyName),i.size===0&&(n.target.removeEventListener("transitioncancel",r),ee.delete(n.target)),ee.size===0)){for(let o of Te)o();Te.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?We():document.addEventListener("DOMContentLoaded",We));function yt(t){requestAnimationFrame(()=>{ee.size===0?t():Te.add(t)})}function vt(){let t=b.useRef(new Map),e=b.useCallback((i,o,s,u)=>{let f=u!=null&&u.once?(...v)=>{t.current.delete(s),s(...v)}:s;t.current.set(s,{type:o,eventTarget:i,fn:f,options:u}),i.addEventListener(o,s,u)},[]),r=b.useCallback((i,o,s,u)=>{var f;let v=((f=t.current.get(s))===null||f===void 0?void 0:f.fn)||s;i.removeEventListener(o,v,u),t.current.delete(s)},[]),n=b.useCallback(()=>{t.current.forEach((i,o)=>{r(i.eventTarget,i.type,o,i.options)})},[r]);return b.useEffect(()=>n,[n]),{addGlobalListener:e,removeGlobalListener:r,removeAllGlobalListeners:n}}function gt(t,e){let{id:r,"aria-label":n,"aria-labelledby":i}=t;return r=ut(r),i&&n?i=[...new Set([r,...i.trim().split(/\s+/)])].join(" "):i&&(i=i.trim().split(/\s+/).join(" ")),!n&&!i&&e&&(n=e),{id:r,"aria-label":n,"aria-labelledby":i}}function hr(t,e){le(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function He(t,e){let r=t;for(Ve(r,e)&&(r=r.parentElement);r&&!Ve(r,e);)r=r.parentElement;return r||document.scrollingElement||document.documentElement}function Ve(t,e){let r=window.getComputedStyle(t),n=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return n&&e&&(n=t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth),n}let $r=0;const me=new Map;function mr(t){let[e,r]=b.useState();return le(()=>{if(!t)return;let n=me.get(t);if(n)r(n.element.id);else{let i=`react-aria-description-${$r++}`;r(i);let o=document.createElement("div");o.id=i,o.style.display="none",o.textContent=t,document.body.appendChild(o),n={refCount:0,element:o},me.set(t,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),me.delete(t))}},[t]),{"aria-describedby":t?e:void 0}}function Sr(t,e,r,n){let i=Q(r),o=r==null;b.useEffect(()=>{if(o||!t.current)return;let s=t.current;return s.addEventListener(e,i,n),()=>{s.removeEventListener(e,i,n)}},[t,e,n,o,i])}function ht(t,e){let r=Ge(t,e,"left"),n=Ge(t,e,"top"),i=e.offsetWidth,o=e.offsetHeight,s=t.scrollLeft,u=t.scrollTop,{borderTopWidth:f,borderLeftWidth:v}=getComputedStyle(t),g=t.scrollLeft+parseInt(v,10),w=t.scrollTop+parseInt(f,10),$=g+t.clientWidth,h=w+t.clientHeight;r<=s?s=r-parseInt(v,10):r+i>$&&(s+=r+i-$),n<=w?u=n-parseInt(f,10):n+o>h&&(u+=n+o-h),t.scrollLeft=s,t.scrollTop=u}function Ge(t,e,r){const n=r==="left"?"offsetLeft":"offsetTop";let i=0;for(;e.offsetParent&&(i+=e[n],e.offsetParent!==t);){if(e.offsetParent.contains(t)){i-=t[n];break}e=e.offsetParent}return i}function qe(t,e){if(document.contains(t)){let s=document.scrollingElement||document.documentElement;if(window.getComputedStyle(s).overflow==="hidden"){let f=He(t);for(;t&&f&&t!==s&&f!==s;)ht(f,t),t=f,f=He(t)}else{var r;let{left:f,top:v}=t.getBoundingClientRect();t==null||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{block:"nearest"});let{left:g,top:w}=t.getBoundingClientRect();if(Math.abs(f-g)>1||Math.abs(v-w)>1){var n,i,o;e==null||(i=e.containingElement)===null||i===void 0||(n=i.scrollIntoView)===null||n===void 0||n.call(i,{block:"center",inline:"center"}),(o=t.scrollIntoView)===null||o===void 0||o.call(t,{block:"nearest"})}}}}function we(t){return t.mozInputSource===0&&t.isTrusted?!0:pt()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Kr(t){return!pt()&&t.width===0&&t.height===0||t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"}function Tr(t,e){return e.get?e.get.call(t):e.value}function $t(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function wr(t,e){var r=$t(t,e,"get");return Tr(t,r)}function Pr(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Er(t,e,r){Pr(t,e),e.set(t,r)}function xr(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function Xe(t,e,r){var n=$t(t,e,"set");return xr(t,n,r),r}let re="default",Pe="",de=new WeakMap;function Ye(t){if(Ie()){if(re==="default"){const e=D(t);Pe=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}re="disabled"}else(t instanceof HTMLElement||t instanceof SVGElement)&&(de.set(t,t.style.userSelect),t.style.userSelect="none")}function ae(t){if(Ie()){if(re!=="disabled")return;re="restoring",setTimeout(()=>{yt(()=>{if(re==="restoring"){const e=D(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=Pe||""),Pe="",re="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&de.has(t)){let e=de.get(t);t.style.userSelect==="none"&&(t.style.userSelect=e),t.getAttribute("style")===""&&t.removeAttribute("style"),de.delete(t)}}const mt=B.default.createContext({register:()=>{}});mt.displayName="PressResponderContext";function kr(t){let e=b.useContext(mt);if(e){let{register:r,...n}=e;t=H(n,t),r()}return hr(e,t.ref),t}var ce=new WeakMap;class ue{continuePropagation(){Xe(this,ce,!1)}get shouldStopPropagation(){return wr(this,ce)}constructor(e,r,n){Er(this,ce,{writable:!0,value:void 0}),Xe(this,ce,!0),this.type=e,this.pointerType=r,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey}}const Je=Symbol("linkClicked");function St(t){let{onPress:e,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:u,preventFocusOnPress:f,shouldCancelOnPointerExit:v,allowTextSelectionOnPress:g,ref:w,...$}=kr(t),[h,M]=b.useState(!1),E=b.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:K,removeAllGlobalListeners:L}=vt(),k=Q((l,m)=>{let p=E.current;if(s||p.didFirePressStart)return!1;let d=!0;if(p.isTriggeringEvent=!0,n){let T=new ue("pressstart",m,l);n(T),d=T.shouldStopPropagation}return r&&r(!0),p.isTriggeringEvent=!1,p.didFirePressStart=!0,M(!0),d}),x=Q((l,m,p=!0)=>{let d=E.current;if(!d.didFirePressStart)return!1;d.ignoreClickAfterPress=!0,d.didFirePressStart=!1,d.isTriggeringEvent=!0;let T=!0;if(i){let a=new ue("pressend",m,l);i(a),T=a.shouldStopPropagation}if(r&&r(!1),M(!1),e&&p&&!s){let a=new ue("press",m,l);e(a),T&&(T=a.shouldStopPropagation)}return d.isTriggeringEvent=!1,T}),C=Q((l,m)=>{let p=E.current;if(s)return!1;if(o){p.isTriggeringEvent=!0;let d=new ue("pressup",m,l);return o(d),p.isTriggeringEvent=!1,d.shouldStopPropagation}return!0}),I=Q(l=>{let m=E.current;m.isPressed&&m.target&&(m.isOverTarget&&m.pointerType!=null&&x(U(m.target,l),m.pointerType,!1),m.isPressed=!1,m.isOverTarget=!1,m.activePointerId=null,m.pointerType=null,L(),g||ae(m.target))}),A=Q(l=>{v&&I(l)}),j=b.useMemo(()=>{let l=E.current,m={onKeyDown(d){if(Se(d.nativeEvent,d.currentTarget)&&d.currentTarget.contains(d.target)){var T;Ze(d.target,d.key)&&d.preventDefault();let a=!0;if(!l.isPressed&&!d.repeat){l.target=d.currentTarget,l.isPressed=!0,a=k(d,"keyboard");let c=d.currentTarget,P=O=>{Se(O,c)&&!O.repeat&&c.contains(O.target)&&l.target&&C(U(l.target,O),"keyboard")};K(D(d.currentTarget),"keyup",dt(P,p),!0)}a&&d.stopPropagation(),d.metaKey&&q()&&((T=l.metaKeyEvents)===null||T===void 0||T.set(d.key,d.nativeEvent))}else d.key==="Meta"&&(l.metaKeyEvents=new Map)},onClick(d){if(!(d&&!d.currentTarget.contains(d.target))&&d&&d.button===0&&!l.isTriggeringEvent&&!X.isOpening){let T=!0;if(s&&d.preventDefault(),!l.ignoreClickAfterPress&&!l.ignoreEmulatedMouseEvents&&!l.isPressed&&(l.pointerType==="virtual"||we(d.nativeEvent))){!s&&!f&&W(d.currentTarget);let a=k(d,"virtual"),c=C(d,"virtual"),P=x(d,"virtual");T=a&&c&&P}l.ignoreEmulatedMouseEvents=!1,l.ignoreClickAfterPress=!1,T&&d.stopPropagation()}}},p=d=>{var T;if(l.isPressed&&l.target&&Se(d,l.target)){var a;Ze(d.target,d.key)&&d.preventDefault();let P=d.target;x(U(l.target,d),"keyboard",l.target.contains(P)),L(),d.key!=="Enter"&&De(l.target)&&l.target.contains(P)&&!d[Je]&&(d[Je]=!0,X(l.target,d,!1)),l.isPressed=!1,(a=l.metaKeyEvents)===null||a===void 0||a.delete(d.key)}else if(d.key==="Meta"&&((T=l.metaKeyEvents)===null||T===void 0?void 0:T.size)){var c;let P=l.metaKeyEvents;l.metaKeyEvents=void 0;for(let O of P.values())(c=l.target)===null||c===void 0||c.dispatchEvent(new KeyboardEvent("keyup",O))}};if(typeof PointerEvent<"u"){m.onPointerDown=c=>{if(c.button!==0||!c.currentTarget.contains(c.target))return;if(Kr(c.nativeEvent)){l.pointerType="virtual";return}Ke(c.currentTarget)&&c.preventDefault(),l.pointerType=c.pointerType;let P=!0;l.isPressed||(l.isPressed=!0,l.isOverTarget=!0,l.activePointerId=c.pointerId,l.target=c.currentTarget,!s&&!f&&W(c.currentTarget),g||Ye(l.target),P=k(c,l.pointerType),K(D(c.currentTarget),"pointermove",d,!1),K(D(c.currentTarget),"pointerup",T,!1),K(D(c.currentTarget),"pointercancel",a,!1)),P&&c.stopPropagation()},m.onMouseDown=c=>{!c.currentTarget.contains(c.target)||c.button===0&&(Ke(c.currentTarget)&&c.preventDefault(),c.stopPropagation())},m.onPointerUp=c=>{!c.currentTarget.contains(c.target)||l.pointerType==="virtual"||c.button===0&&_(c,c.currentTarget)&&C(c,l.pointerType||c.pointerType)};let d=c=>{c.pointerId===l.activePointerId&&(l.target&&_(c,l.target)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,k(U(l.target,c),l.pointerType)):l.target&&l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,x(U(l.target,c),l.pointerType,!1),A(c)))},T=c=>{c.pointerId===l.activePointerId&&l.isPressed&&c.button===0&&l.target&&(_(c,l.target)&&l.pointerType!=null?x(U(l.target,c),l.pointerType):l.isOverTarget&&l.pointerType!=null&&x(U(l.target,c),l.pointerType,!1),l.isPressed=!1,l.isOverTarget=!1,l.activePointerId=null,l.pointerType=null,L(),g||ae(l.target))},a=c=>{I(c)};m.onDragStart=c=>{!c.currentTarget.contains(c.target)||I(c)}}else{m.onMouseDown=a=>{if(a.button!==0||!a.currentTarget.contains(a.target))return;if(Ke(a.currentTarget)&&a.preventDefault(),l.ignoreEmulatedMouseEvents){a.stopPropagation();return}l.isPressed=!0,l.isOverTarget=!0,l.target=a.currentTarget,l.pointerType=we(a.nativeEvent)?"virtual":"mouse",!s&&!f&&W(a.currentTarget),k(a,l.pointerType)&&a.stopPropagation(),K(D(a.currentTarget),"mouseup",d,!1)},m.onMouseEnter=a=>{if(!a.currentTarget.contains(a.target))return;let c=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!0,c=k(a,l.pointerType)),c&&a.stopPropagation()},m.onMouseLeave=a=>{if(!a.currentTarget.contains(a.target))return;let c=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!1,c=x(a,l.pointerType,!1),A(a)),c&&a.stopPropagation()},m.onMouseUp=a=>{!a.currentTarget.contains(a.target)||!l.ignoreEmulatedMouseEvents&&a.button===0&&C(a,l.pointerType||"mouse")};let d=a=>{if(a.button===0){if(l.isPressed=!1,L(),l.ignoreEmulatedMouseEvents){l.ignoreEmulatedMouseEvents=!1;return}l.target&&_(a,l.target)&&l.pointerType!=null?x(U(l.target,a),l.pointerType):l.target&&l.isOverTarget&&l.pointerType!=null&&x(U(l.target,a),l.pointerType,!1),l.isOverTarget=!1}};m.onTouchStart=a=>{if(!a.currentTarget.contains(a.target))return;let c=Mr(a.nativeEvent);if(!c)return;l.activePointerId=c.identifier,l.ignoreEmulatedMouseEvents=!0,l.isOverTarget=!0,l.isPressed=!0,l.target=a.currentTarget,l.pointerType="touch",!s&&!f&&W(a.currentTarget),g||Ye(l.target),k(a,l.pointerType)&&a.stopPropagation(),K(G(a.currentTarget),"scroll",T,!0)},m.onTouchMove=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=_e(a.nativeEvent,l.activePointerId),P=!0;c&&_(c,a.currentTarget)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,P=k(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,P=x(a,l.pointerType,!1),A(a)),P&&a.stopPropagation()},m.onTouchEnd=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=_e(a.nativeEvent,l.activePointerId),P=!0;c&&_(c,a.currentTarget)&&l.pointerType!=null?(C(a,l.pointerType),P=x(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(P=x(a,l.pointerType,!1)),P&&a.stopPropagation(),l.isPressed=!1,l.activePointerId=null,l.isOverTarget=!1,l.ignoreEmulatedMouseEvents=!0,l.target&&!g&&ae(l.target),L()},m.onTouchCancel=a=>{!a.currentTarget.contains(a.target)||(a.stopPropagation(),l.isPressed&&I(a))};let T=a=>{l.isPressed&&a.target.contains(l.target)&&I({currentTarget:l.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};m.onDragStart=a=>{!a.currentTarget.contains(a.target)||I(a)}}return m},[K,s,f,L,g,I,A,x,k,C]);return b.useEffect(()=>()=>{var l;g||ae((l=E.current.target)!==null&&l!==void 0?l:void 0)},[g]),{isPressed:u||h,pressProps:H($,j)}}function De(t){return t.tagName==="A"&&t.hasAttribute("href")}function Se(t,e){const{key:r,code:n}=t,i=e,o=i.getAttribute("role");return(r==="Enter"||r===" "||r==="Spacebar"||n==="Space")&&!(i instanceof G(i).HTMLInputElement&&!Kt(i,r)||i instanceof G(i).HTMLTextAreaElement||i.isContentEditable)&&!((o==="link"||!o&&De(i))&&r!=="Enter")}function Mr(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function _e(t,e){const r=t.changedTouches;for(let n=0;n<r.length;n++){const i=r[n];if(i.identifier===e)return i}return null}function U(t,e){return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}}function Lr(t){let e=0,r=0;return t.width!==void 0?e=t.width/2:t.radiusX!==void 0&&(e=t.radiusX),t.height!==void 0?r=t.height/2:t.radiusY!==void 0&&(r=t.radiusY),{top:t.clientY-r,right:t.clientX+e,bottom:t.clientY+r,left:t.clientX-e}}function Cr(t,e){return!(t.left>e.right||e.left>t.right||t.top>e.bottom||e.top>t.bottom)}function _(t,e){let r=e.getBoundingClientRect(),n=Lr(t);return Cr(r,n)}function Ke(t){return!(t instanceof HTMLElement)||!t.hasAttribute("draggable")}function Ze(t,e){return t instanceof HTMLInputElement?!Kt(t,e):t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!De(t)}const Ir=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Kt(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":Ir.has(t.type)}let oe=null,Dr=new Set,ie=new Map,Y=!1,Ee=!1;function Ae(t,e){for(let r of Dr)r(t,e)}function Ar(t){return!(t.metaKey||!q()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function be(t){Y=!0,Ar(t)&&(oe="keyboard",Ae("keyboard",t))}function F(t){oe="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(Y=!0,Ae("pointer",t))}function Tt(t){we(t)&&(Y=!0,oe="virtual")}function wt(t){t.target===window||t.target===document||(!Y&&!Ee&&(oe="virtual",Ae("virtual",t)),Y=!1,Ee=!1)}function Pt(){Y=!1,Ee=!0}function Qe(t){if(typeof window>"u"||ie.get(G(t)))return;const e=G(t),r=D(t);let n=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){Y=!0,n.apply(this,arguments)},r.addEventListener("keydown",be,!0),r.addEventListener("keyup",be,!0),r.addEventListener("click",Tt,!0),e.addEventListener("focus",wt,!0),e.addEventListener("blur",Pt,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",F,!0),r.addEventListener("pointermove",F,!0),r.addEventListener("pointerup",F,!0)):(r.addEventListener("mousedown",F,!0),r.addEventListener("mousemove",F,!0),r.addEventListener("mouseup",F,!0)),e.addEventListener("beforeunload",()=>{Et(t)},{once:!0}),ie.set(e,{focus:n})}const Et=(t,e)=>{const r=G(t),n=D(t);e&&n.removeEventListener("DOMContentLoaded",e),ie.has(r)&&(r.HTMLElement.prototype.focus=ie.get(r).focus,n.removeEventListener("keydown",be,!0),n.removeEventListener("keyup",be,!0),n.removeEventListener("click",Tt,!0),r.removeEventListener("focus",wt,!0),r.removeEventListener("blur",Pt,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",F,!0),n.removeEventListener("pointermove",F,!0),n.removeEventListener("pointerup",F,!0)):(n.removeEventListener("mousedown",F,!0),n.removeEventListener("mousemove",F,!0),n.removeEventListener("mouseup",F,!0)),ie.delete(r))};function Or(t){const e=D(t);let r;return e.readyState!=="loading"?Qe(t):(r=()=>{Qe(t)},e.addEventListener("DOMContentLoaded",r)),()=>Et(t,r)}typeof document<"u"&&Or();function xe(){return oe}const Fr=500;function zr(t){let{isDisabled:e,onLongPressStart:r,onLongPressEnd:n,onLongPress:i,threshold:o=Fr,accessibilityDescription:s}=t;const u=b.useRef();let{addGlobalListener:f,removeGlobalListener:v}=vt(),{pressProps:g}=St({isDisabled:e,onPressStart($){if($.continuePropagation(),($.pointerType==="mouse"||$.pointerType==="touch")&&(r&&r({...$,type:"longpressstart"}),u.current=setTimeout(()=>{$.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),i&&i({...$,type:"longpress"}),u.current=void 0},o),$.pointerType==="touch")){let h=M=>{M.preventDefault()};f($.target,"contextmenu",h,{once:!0}),f(window,"pointerup",()=>{setTimeout(()=>{v($.target,"contextmenu",h)},30)},{once:!0})}},onPressEnd($){u.current&&clearTimeout(u.current),n&&($.pointerType==="mouse"||$.pointerType==="touch")&&n({...$,type:"longpressend"})}}),w=mr(i&&!e?s:void 0);return{longPressProps:H(g,w)}}function ke(t){const e=D(t);if(xe()==="virtual"){let r=e.activeElement;yt(()=>{e.activeElement===r&&t.isConnected&&W(t)})}else W(t)}function Nr(t){const e=G(t);if(!(t instanceof e.HTMLElement)&&!(t instanceof e.SVGElement))return!1;let{display:r,visibility:n}=t.style,i=r!=="none"&&n!=="hidden"&&n!=="collapse";if(i){const{getComputedStyle:o}=t.ownerDocument.defaultView;let{display:s,visibility:u}=o(t);i=s!=="none"&&u!=="hidden"&&u!=="collapse"}return i}function Rr(t,e){return!t.hasAttribute("hidden")&&(t.nodeName==="DETAILS"&&e&&e.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}function xt(t,e){return t.nodeName!=="#comment"&&Nr(t)&&Rr(t,e)&&(!t.parentElement||xt(t.parentElement,t))}const Oe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],Br=Oe.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Oe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const jr=Oe.join(':not([hidden]):not([tabindex="-1"]),');function kt(t,e){return!t||!e?!1:e.some(r=>r.contains(t))}function Mt(t,e,r){let n=e!=null&&e.tabbable?jr:Br,i=D(t).createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(o){var s;return!(e==null||(s=e.from)===null||s===void 0)&&s.contains(o)?NodeFilter.FILTER_REJECT:o.matches(n)&&xt(o)&&(!r||kt(o,r))&&(!(e!=null&&e.accept)||e.accept(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return e!=null&&e.from&&(i.currentNode=e.from),i}class Fe{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,r,n){let i=this.fastMap.get(r!=null?r:null);if(!i)return;let o=new et({scopeRef:e});i.addChild(o),o.parent=i,this.fastMap.set(e,o),n&&(o.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let r=this.fastMap.get(e);if(!r)return;let n=r.parent;for(let o of this.traverse())o!==r&&r.nodeToRestore&&o.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&kt(o.nodeToRestore,r.scopeRef.current)&&(o.nodeToRestore=r.nodeToRestore);let i=r.children;n&&(n.removeChild(r),i.size>0&&i.forEach(o=>n&&n.addChild(o))),this.fastMap.delete(r.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let r of e.children)yield*this.traverse(r)}clone(){var e;let r=new Fe;var n;for(let i of this.traverse())r.addTreeNode(i.scopeRef,(n=(e=i.parent)===null||e===void 0?void 0:e.scopeRef)!==null&&n!==void 0?n:null,i.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new et({scopeRef:null}),this.fastMap.set(null,this.root)}}class et{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}new Fe;function Ur(t,e){let r=e==null?void 0:e.isDisabled,[n,i]=b.useState(!1);return le(()=>{if((t==null?void 0:t.current)&&!r){let o=()=>{if(t.current){let u=Mt(t.current,{tabbable:!0});i(!!u.nextNode())}};o();let s=new MutationObserver(o);return s.observe(t.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{s.disconnect()}}}),r?!1:n}const Wr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Hr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Vr(t){if(Intl.Locale){let r=new Intl.Locale(t).maximize(),n=typeof r.getTextInfo=="function"?r.getTextInfo():r.textInfo;if(n)return n.direction==="rtl";if(r.script)return Wr.has(r.script)}let e=t.split("-")[0];return Hr.has(e)}const Gr=Symbol.for("react-aria.i18n.locale");function Lt(){let t=typeof window<"u"&&window[Gr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{t="en-US"}return{locale:t,direction:Vr(t)?"rtl":"ltr"}}let Me=Lt(),ne=new Set;function tt(){Me=Lt();for(let t of ne)t(Me)}function qr(){let t=at(),[e,r]=b.useState(Me);return b.useEffect(()=>(ne.size===0&&window.addEventListener("languagechange",tt),ne.add(r),()=>{ne.delete(r),ne.size===0&&window.removeEventListener("languagechange",tt)}),[]),t?{locale:"en-US",direction:"ltr"}:e}const Xr=B.default.createContext(null);function Ct(){let t=qr();return b.useContext(Xr)||t}function Le(t){return dr()?t.altKey:t.ctrlKey}function te(t){return q()?t.metaKey:t.ctrlKey}const Yr=1e3;function Jr(t){let{keyboardDelegate:e,selectionManager:r,onTypeSelect:n}=t,i=b.useRef({search:"",timeout:null}).current,o=s=>{let u=_r(s.key);if(!u||s.ctrlKey||s.metaKey||!s.currentTarget.contains(s.target))return;u===" "&&i.search.trim().length>0&&(s.preventDefault(),"continuePropagation"in s||s.stopPropagation()),i.search+=u;let f=e.getKeyForSearch(i.search,r.focusedKey);f==null&&(f=e.getKeyForSearch(i.search)),f!=null&&(r.setFocusedKey(f),n&&n(f)),clearTimeout(i.timeout),i.timeout=setTimeout(()=>{i.search=""},Yr)};return{typeSelectProps:{onKeyDownCapture:e.getKeyForSearch?o:null}}}function _r(t){return t.length===1||!/^[A-Z]/i.test(t)?t:""}function Zr(t){let{selectionManager:e,keyboardDelegate:r,ref:n,autoFocus:i=!1,shouldFocusWrap:o=!1,disallowEmptySelection:s=!1,disallowSelectAll:u=!1,selectOnFocus:f=e.selectionBehavior==="replace",disallowTypeAhead:v=!1,shouldUseVirtualFocus:g,allowsTabNavigation:w=!1,isVirtualized:$,scrollRef:h=n,linkBehavior:M="action"}=t,{direction:E}=Ct(),K=bt(),L=p=>{if(p.altKey&&p.key==="Tab"&&p.preventDefault(),!n.current.contains(p.target))return;const d=(S,V)=>{if(S!=null){if(e.isLink(S)&&M==="selection"&&f&&!Le(p)){Ot.flushSync(()=>{e.setFocusedKey(S,V)});let J=h.current.querySelector(`[data-key="${CSS.escape(S.toString())}"]`);K.open(J,p);return}if(e.setFocusedKey(S,V),e.isLink(S)&&M==="override")return;p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):f&&!Le(p)&&e.replaceSelection(S)}};switch(p.key){case"ArrowDown":if(r.getKeyBelow){var T,a;p.preventDefault();let S=e.focusedKey!=null?r.getKeyBelow(e.focusedKey):(T=r.getFirstKey)===null||T===void 0?void 0:T.call(r);S==null&&o&&(S=(a=r.getFirstKey)===null||a===void 0?void 0:a.call(r,e.focusedKey)),d(S)}break;case"ArrowUp":if(r.getKeyAbove){var c,P;p.preventDefault();let S=e.focusedKey!=null?r.getKeyAbove(e.focusedKey):(c=r.getLastKey)===null||c===void 0?void 0:c.call(r);S==null&&o&&(S=(P=r.getLastKey)===null||P===void 0?void 0:P.call(r,e.focusedKey)),d(S)}break;case"ArrowLeft":if(r.getKeyLeftOf){var O,y;p.preventDefault();let S=r.getKeyLeftOf(e.focusedKey);S==null&&o&&(S=E==="rtl"?(O=r.getFirstKey)===null||O===void 0?void 0:O.call(r,e.focusedKey):(y=r.getLastKey)===null||y===void 0?void 0:y.call(r,e.focusedKey)),d(S,E==="rtl"?"first":"last")}break;case"ArrowRight":if(r.getKeyRightOf){var ge,he;p.preventDefault();let S=r.getKeyRightOf(e.focusedKey);S==null&&o&&(S=E==="rtl"?(ge=r.getLastKey)===null||ge===void 0?void 0:ge.call(r,e.focusedKey):(he=r.getFirstKey)===null||he===void 0?void 0:he.call(r,e.focusedKey)),d(S,E==="rtl"?"last":"first")}break;case"Home":if(r.getFirstKey){p.preventDefault();let S=r.getFirstKey(e.focusedKey,te(p));e.setFocusedKey(S),te(p)&&p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):f&&e.replaceSelection(S)}break;case"End":if(r.getLastKey){p.preventDefault();let S=r.getLastKey(e.focusedKey,te(p));e.setFocusedKey(S),te(p)&&p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):f&&e.replaceSelection(S)}break;case"PageDown":if(r.getKeyPageBelow){p.preventDefault();let S=r.getKeyPageBelow(e.focusedKey);d(S)}break;case"PageUp":if(r.getKeyPageAbove){p.preventDefault();let S=r.getKeyPageAbove(e.focusedKey);d(S)}break;case"a":te(p)&&e.selectionMode==="multiple"&&u!==!0&&(p.preventDefault(),e.selectAll());break;case"Escape":p.preventDefault(),s||e.clearSelection();break;case"Tab":if(!w){if(p.shiftKey)n.current.focus();else{let S=Mt(n.current,{tabbable:!0}),V,J;do J=S.lastChild(),J&&(V=J);while(J);V&&!V.contains(document.activeElement)&&W(V)}break}}},k=b.useRef({top:0,left:0});Sr(h,"scroll",$?null:()=>{k.current={top:h.current.scrollTop,left:h.current.scrollLeft}});let x=p=>{if(e.isFocused){p.currentTarget.contains(p.target)||e.setFocused(!1);return}if(!!p.currentTarget.contains(p.target)){if(e.setFocused(!0),e.focusedKey==null){let a=P=>{P!=null&&(e.setFocusedKey(P),f&&e.replaceSelection(P))},c=p.relatedTarget;var d,T;c&&p.currentTarget.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING?a((d=e.lastSelectedKey)!==null&&d!==void 0?d:r.getLastKey()):a((T=e.firstSelectedKey)!==null&&T!==void 0?T:r.getFirstKey())}else $||(h.current.scrollTop=k.current.top,h.current.scrollLeft=k.current.left);if(!$&&e.focusedKey!=null){let a=h.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);a&&(a.contains(document.activeElement)||W(a),xe()==="keyboard"&&qe(a,{containingElement:n.current}))}}},C=p=>{p.currentTarget.contains(p.relatedTarget)||e.setFocused(!1)};const I=b.useRef(i);b.useEffect(()=>{if(I.current){let p=null;i==="first"&&(p=r.getFirstKey()),i==="last"&&(p=r.getLastKey());let d=e.selectedKeys;if(d.size){for(let T of d)if(e.canSelectItem(T)){p=T;break}}e.setFocused(!0),e.setFocusedKey(p),p==null&&!g&&ke(n.current)}},[]);let A=b.useRef(e.focusedKey);b.useEffect(()=>{let p=xe();if(e.isFocused&&e.focusedKey!=null&&(h==null?void 0:h.current)){let d=h.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);d&&(p==="keyboard"||I.current)&&($||ht(h.current,d),p!=="virtual"&&qe(d,{containingElement:n.current}))}e.isFocused&&e.focusedKey==null&&A.current!=null&&ke(n.current),A.current=e.focusedKey,I.current=!1},[$,h,e.focusedKey,e.isFocused,n]);let j={onKeyDown:L,onFocus:x,onBlur:C,onMouseDown(p){h.current===p.target&&p.preventDefault()}},{typeSelectProps:l}=Jr({keyboardDelegate:r,selectionManager:e});v||(j=H(l,j));let m;return g||(m=e.focusedKey==null?0:-1),{collectionProps:{...j,tabIndex:m}}}function Qr(t){let{selectionManager:e,key:r,ref:n,shouldSelectOnPressUp:i,shouldUseVirtualFocus:o,focus:s,isDisabled:u,onAction:f,allowsDifferentPressOrigin:v,linkBehavior:g="action"}=t,w=bt(),$=y=>{if(y.pointerType==="keyboard"&&Le(y))e.toggleSelection(r);else{if(e.selectionMode==="none")return;if(e.isLink(r)){if(g==="selection"){w.open(n.current,y),e.setSelectedKeys(e.selectedKeys);return}else if(g==="override"||g==="none")return}e.selectionMode==="single"?e.isSelected(r)&&!e.disallowEmptySelection?e.toggleSelection(r):e.replaceSelection(r):y&&y.shiftKey?e.extendSelection(r):e.selectionBehavior==="toggle"||y&&(te(y)||y.pointerType==="touch"||y.pointerType==="virtual")?e.toggleSelection(r):e.replaceSelection(r)}};b.useEffect(()=>{r===e.focusedKey&&e.isFocused&&!o&&(s?s():document.activeElement!==n.current&&ke(n.current))},[n,r,e.focusedKey,e.childFocusStrategy,e.isFocused,o]),u=u||e.isDisabled(r);let h={};!o&&!u?h={tabIndex:r===e.focusedKey?0:-1,onFocus(y){y.target===n.current&&e.setFocusedKey(r)}}:u&&(h.onMouseDown=y=>{y.preventDefault()});let M=e.isLink(r)&&g==="override",E=e.isLink(r)&&g!=="selection"&&g!=="none",K=!u&&e.canSelectItem(r)&&!M,L=(f||E)&&!u,k=L&&(e.selectionBehavior==="replace"?!K:!K||e.isEmpty),x=L&&K&&e.selectionBehavior==="replace",C=k||x,I=b.useRef(null),A=C&&K,j=b.useRef(!1),l=b.useRef(!1),m=y=>{f&&f(),E&&w.open(n.current,y)},p={};i?(p.onPressStart=y=>{I.current=y.pointerType,j.current=A,y.pointerType==="keyboard"&&(!C||nt())&&$(y)},v?(p.onPressUp=k?null:y=>{y.pointerType!=="keyboard"&&K&&$(y)},p.onPress=k?m:null):p.onPress=y=>{if(k||x&&y.pointerType!=="mouse"){if(y.pointerType==="keyboard"&&!rt())return;m(y)}else y.pointerType!=="keyboard"&&K&&$(y)}):(p.onPressStart=y=>{I.current=y.pointerType,j.current=A,l.current=k,K&&(y.pointerType==="mouse"&&!k||y.pointerType==="keyboard"&&(!L||nt()))&&$(y)},p.onPress=y=>{(y.pointerType==="touch"||y.pointerType==="pen"||y.pointerType==="virtual"||y.pointerType==="keyboard"&&C&&rt()||y.pointerType==="mouse"&&l.current)&&(C?m(y):K&&$(y))}),h["data-key"]=r,p.preventFocusOnPress=o;let{pressProps:d,isPressed:T}=St(p),a=x?y=>{I.current==="mouse"&&(y.stopPropagation(),y.preventDefault(),m(y))}:void 0,{longPressProps:c}=zr({isDisabled:!A,onLongPress(y){y.pointerType==="touch"&&($(y),e.setSelectionBehavior("toggle"))}}),P=y=>{I.current==="touch"&&j.current&&y.preventDefault()},O=e.isLink(r)?y=>{X.isOpening||y.preventDefault()}:void 0;return{itemProps:H(h,K||k?d:{},A?c:{},{onDoubleClick:a,onDragStartCapture:P,onClick:O}),isPressed:T,isSelected:e.isSelected(r),isFocused:e.isFocused&&e.focusedKey===r,isDisabled:u,allowsSelection:K,hasAction:C}}function rt(){let t=window.event;return(t==null?void 0:t.key)==="Enter"}function nt(){let t=window.event;return(t==null?void 0:t.key)===" "||(t==null?void 0:t.code)==="Space"}const It=new WeakMap;function ye(t,e,r){return typeof e=="string"&&(e=e.replace(/\s+/g,"")),`${It.get(t)}-${r}-${e}`}function en(t,e,r){var n;let{key:i,isDisabled:o,shouldSelectOnPressUp:s}=t,{selectionManager:u,selectedKey:f}=e,v=i===f,g=o||e.isDisabled||e.disabledKeys.has(i),{itemProps:w,isPressed:$}=Qr({selectionManager:u,key:i,ref:r,isDisabled:g,shouldSelectOnPressUp:s,linkBehavior:"selection"}),h=ye(e,i,"tab"),M=ye(e,i,"tabpanel"),{tabIndex:E}=w,K=e.collection.getItem(i),L=or(K==null?void 0:K.props,{isLink:!!(!(K==null||(n=K.props)===null||n===void 0)&&n.href),labelable:!0});return delete L.id,{tabProps:H(L,w,{id:h,"aria-selected":v,"aria-disabled":g||void 0,"aria-controls":v?M:void 0,tabIndex:g?void 0:E,role:"tab"}),isSelected:v,isDisabled:g,isPressed:$}}function tn(t,e,r){let n=Ur(r)?void 0:0;var i;const o=ye(e,(i=t.id)!==null&&i!==void 0?i:e==null?void 0:e.selectedKey,"tabpanel"),s=gt({...t,id:o,"aria-labelledby":ye(e,e==null?void 0:e.selectedKey,"tab")});return{tabPanelProps:H(s,{tabIndex:n,role:"tabpanel","aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"]})}}class rn{getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}getKeyAbove(e){return this.getPreviousKey(e)}getKeyBelow(e){return this.getNextKey(e)}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.disabledKeys.has(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.disabledKeys.has(e)&&(e=this.getPreviousKey(e)),e}getNextKey(e){do e=this.collection.getKeyAfter(e),e==null&&(e=this.collection.getFirstKey());while(this.disabledKeys.has(e));return e}getPreviousKey(e){do e=this.collection.getKeyBefore(e),e==null&&(e=this.collection.getLastKey());while(this.disabledKeys.has(e));return e}constructor(e,r,n,i=new Set){this.collection=e,this.flipDirection=r==="rtl"&&n==="horizontal",this.disabledKeys=i}}function nn(t,e,r){let{orientation:n="horizontal",keyboardActivation:i="automatic"}=t,{collection:o,selectionManager:s,disabledKeys:u}=e,{direction:f}=Ct(),v=b.useMemo(()=>new rn(o,f,n,u),[o,u,n,f]),{collectionProps:g}=Zr({ref:r,selectionManager:s,keyboardDelegate:v,selectOnFocus:i==="automatic",disallowEmptySelection:!0,scrollRef:r,linkBehavior:"selection"}),w=ut();It.set(e,w);let $=gt({...t,id:w});return{tabListProps:{...H(g,$),role:"tablist","aria-orientation":n,tabIndex:void 0}}}function ln(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function it(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function lt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?it(Object(r),!0).forEach(function(n){ln(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):it(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var on=(t,e,r)=>{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},ze=t=>e=>{var r=t.defaultClassName,n=lt(lt({},t.defaultVariants),e);for(var i in n){var o,s=(o=n[i])!==null&&o!==void 0?o:t.defaultVariants[i];if(s!=null){var u=s;typeof u=="boolean"&&(u=u===!0?"true":"false");var f=t.variantClassNames[i][u];f&&(r+=" "+f)}}for(var[v,g]of t.compoundVariants)on(v,n,t.defaultVariants)&&(r+=" "+g);return r},sn=ze({defaultClassName:"kz6kzz0",variantClassNames:{context:{container:"kz6kzz1",navigation:"kz6kzz2"},active:{true:"kz6kzz3",false:"kz6kzz4"},disabled:{true:"kz6kzz5",false:"kz6kzz6"}},defaultVariants:{},compoundVariants:[[{context:"container",active:!0},"kz6kzz7"],[{context:"container",active:!1},"kz6kzz8"],[{context:"container",active:!1,disabled:!1},"kz6kzz9"],[{context:"navigation",active:!0},"kz6kzza"],[{context:"navigation",active:!1},"kz6kzzb"],[{context:"navigation",active:!1,disabled:!1},"kz6kzzc"],[{context:"navigation",active:!1,disabled:!0},"kz6kzzd"]]}),an=ze({defaultClassName:"",variantClassNames:{active:{true:"kz6kzze",false:"kz6kzzf"},disabled:{true:"kz6kzzg",false:"kz6kzzh"},context:{navigation:"kz6kzzi",container:"kz6kzzj"}},defaultVariants:{},compoundVariants:[[{context:"navigation",active:!0},"kz6kzzk"]]});function Dt({context:t,item:e,state:r,...n}){const{key:i}=e,o=N.useRef(null),{tabProps:s}=en({key:i},r,o),u=r.selectedKey===i,f=r.disabledKeys.has(i),v=R.modChildren(e.rendered,g=>g.type.displayName==="SpsTag"||R.Metadata.isWoodlandComponent(g.type)&&R.Metadata.get(g.type).name==="Tag"?[{className:R.cl(g.props.className,an({active:u,disabled:f,context:t}))}]:[{}]);return N.createElement("div",{...s,ref:o,className:sn({active:u,disabled:f,context:t}),...n},v)}R.Metadata.set(Dt,{name:"Tab"});function At({context:t,"data-testid":e,state:r,...n}){const i=N.useRef(null),{tabPanelProps:o}=tn(n,r,i),s=t==="container"?R.Content:"div";return N.createElement(s,{...o,ref:i,"data-testid":e},r.selectedItem?r.selectedItem.props.children:null)}R.Metadata.set(At,{name:"TabPanel"});var cn=ze({defaultClassName:"fy26er0",variantClassNames:{context:{container:"fy26er1",navigation:"fy26er2"}},defaultVariants:{},compoundVariants:[]});function Ne({className:t,context:e="navigation","data-testid":r,...n}){const i=Wt(n),o=N.useRef(null),{tabListProps:s}=nn(n,i,o),u=R.useChildTestIdAttrBuilder({"data-testid":r});return N.createElement(N.Fragment,null,N.createElement("div",{...s,ref:o,className:R.cl(cn({context:e}),t),"data-testid":r},[...i.collection].map(f=>N.createElement(Dt,{key:f.key,item:f,state:i,context:e,...u(`tab-${String(f.key)}`)}))),N.createElement(At,{key:i.selectedItem?i.selectedItem.key:null,state:i,context:e,...u("tab-panel")}))}R.Metadata.set(Ne,{name:"Tabs"});const un={components:[Ne],examples:{basic:{label:"Basic Navigation Tabs",description:Re.code`
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),Z=require("@react-stately/collections"),Dt=require("react-dom"),N=require("@sps-woodland/core"),Be=require("@spscommerce/utils");function At(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const R=At(f);class Ue{*[Symbol.iterator](){yield*this.iterable}get size(){return this.keyMap.size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let r=this.keyMap.get(e);return r?r.prevKey:null}getKeyAfter(e){let r=this.keyMap.get(e);return r?r.nextKey:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)}at(e){const r=[...this.getKeys()];return this.getItem(r[e])}getChildren(e){let r=this.keyMap.get(e);return(r==null?void 0:r.childNodes)||[]}constructor(e){this.keyMap=new Map,this.iterable=e;let r=o=>{if(this.keyMap.set(o.key,o),o.childNodes&&o.type==="section")for(let s of o.childNodes)r(s)};for(let o of e)r(o);let n,i=0;for(let[o,s]of this.keyMap)n?(n.nextKey=o,s.prevKey=n.key):(this.firstKey=o,s.prevKey=void 0),s.type==="item"&&(s.index=i++),n=s,n.nextKey=void 0;this.lastKey=n==null?void 0:n.key}}class z extends Set{constructor(e,r,n){super(e),e instanceof z?(this.anchorKey=r||e.anchorKey,this.currentKey=n||e.currentKey):(this.anchorKey=r,this.currentKey=n)}}function lt(t,e,r){let[n,i]=f.useState(t||e),o=f.useRef(t!==void 0),s=t!==void 0;f.useEffect(()=>{let v=o.current;v!==s&&console.warn(`WARN: A component changed from ${v?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}.`),o.current=s},[s]);let u=s?t:n,b=f.useCallback((v,...h)=>{let w=($,...g)=>{r&&(Object.is(u,$)||r($,...g)),s||(u=$)};typeof v=="function"?(console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"),i((g,...M)=>{let T=v(s?u:g,...M);return w(T,...h),s?g:T})):(s||i(v),w(v,...h))},[s,u,r]);return[u,b]}function Ot(t,e){if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;return!0}function Ft(t){let{selectionMode:e="none",disallowEmptySelection:r,allowDuplicateSelectionEvents:n,selectionBehavior:i="toggle",disabledBehavior:o="all"}=t,s=f.useRef(!1),[,u]=f.useState(!1),b=f.useRef(null),v=f.useRef(null),[,h]=f.useState(null),w=f.useMemo(()=>je(t.selectedKeys),[t.selectedKeys]),$=f.useMemo(()=>je(t.defaultSelectedKeys,new z),[t.defaultSelectedKeys]),[g,M]=lt(w,$,t.onSelectionChange),T=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),[P,L]=f.useState(i);i==="replace"&&P==="toggle"&&typeof g=="object"&&g.size===0&&L("replace");let k=f.useRef(i);return f.useEffect(()=>{i!==k.current&&(L(i),k.current=i)},[i]),{selectionMode:e,disallowEmptySelection:r,selectionBehavior:P,setSelectionBehavior:L,get isFocused(){return s.current},setFocused(x){s.current=x,u(x)},get focusedKey(){return b.current},get childFocusStrategy(){return v.current},setFocusedKey(x,I="first"){b.current=x,v.current=I,h(x)},selectedKeys:g,setSelectedKeys(x){(n||!Ot(x,g))&&M(x)},disabledKeys:T,disabledBehavior:o}}function je(t,e){return t?t==="all"?"all":new z(t):e}class zt{get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,r){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,r)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){return this.state.selectionMode==="none"?!1:(e=this.getKey(e),this.state.selectedKeys==="all"?this.canSelectItem(e):this.state.selectedKeys.has(e))}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),r=this.state.selectedKeys;return this._isSelectAll=e.every(n=>r.has(n)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&Z.compareNodeOrder(this.collection,n,e)<0)&&(e=n)}return e==null?void 0:e.key}get lastSelectedKey(){let e=null;for(let r of this.state.selectedKeys){let n=this.collection.getItem(r);(!e||n&&Z.compareNodeOrder(this.collection,n,e)>0)&&(e=n)}return e==null?void 0:e.key}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}e=this.getKey(e);let r;if(this.state.selectedKeys==="all")r=new z([e],e,e);else{let n=this.state.selectedKeys,i=n.anchorKey||e;r=new z(n,i,e);for(let o of this.getKeyRange(i,n.currentKey||e))r.delete(o);for(let o of this.getKeyRange(e,i))this.canSelectItem(o)&&r.add(o)}this.state.setSelectedKeys(r)}getKeyRange(e,r){let n=this.collection.getItem(e),i=this.collection.getItem(r);return n&&i?Z.compareNodeOrder(this.collection,n,i)<=0?this.getKeyRangeInternal(e,r):this.getKeyRangeInternal(r,e):[]}getKeyRangeInternal(e,r){let n=[],i=e;for(;i;){let o=this.collection.getItem(i);if((o&&o.type==="item"||o.type==="cell"&&this.allowsCellSelection)&&n.push(i),i===r)return n;i=this.collection.getKeyAfter(i)}return[]}getKey(e){let r=this.collection.getItem(e);if(!r||r.type==="cell"&&this.allowsCellSelection)return e;for(;r.type!=="item"&&r.parentKey!=null;)r=this.collection.getItem(r.parentKey);return!r||r.type!=="item"?null:r.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}if(e=this.getKey(e),e==null)return;let r=new z(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);r.has(e)?r.delete(e):this.canSelectItem(e)&&(r.add(e),r.anchorKey=e,r.currentKey=e),!(this.disallowEmptySelection&&r.size===0)&&this.state.setSelectedKeys(r)}replaceSelection(e){if(this.selectionMode==="none"||(e=this.getKey(e),e==null))return;let r=this.canSelectItem(e)?new z([e],e,e):new z;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode==="none")return;let r=new z;for(let n of e)if(n=this.getKey(n),n!=null&&(r.add(n),this.selectionMode==="single"))break;this.state.setSelectedKeys(r)}getSelectAllKeys(){let e=[],r=n=>{for(;n;){if(this.canSelectItem(n)){let i=this.collection.getItem(n);i.type==="item"&&e.push(n),i.hasChildNodes&&(this.allowsCellSelection||i.type!=="item")&&r(Z.getFirstItem(Z.getChildNodes(i,this.collection)).key)}n=this.collection.getKeyAfter(n)}};return r(this.collection.getFirstKey()),e}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new z)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,r){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||r&&(r.pointerType==="touch"||r.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let r=this.selectedKeys;if(e.size!==r.size)return!1;for(let n of e)if(!r.has(n))return!1;for(let n of r)if(!e.has(n))return!1;return!0}canSelectItem(e){var r;if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let n=this.collection.getItem(e);return!(!n||!(n==null||(r=n.props)===null||r===void 0)&&r.isDisabled||n.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){var r,n;return this.state.disabledBehavior==="all"&&(this.state.disabledKeys.has(e)||!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.isDisabled))}isLink(e){var r,n;return!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.href)}getItemProps(e){var r;return(r=this.collection.getItem(e))===null||r===void 0?void 0:r.props}constructor(e,r,n){this.collection=e,this.state=r;var i;this.allowsCellSelection=(i=n==null?void 0:n.allowsCellSelection)!==null&&i!==void 0?i:!1,this._isSelectAll=null}}function Rt(t){let{filter:e}=t,r=Ft(t),n=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),i=f.useCallback(v=>e?new Ue(e(v)):new Ue(v),[e]),o=f.useMemo(()=>({suppressTextValueWarning:t.suppressTextValueWarning}),[t.suppressTextValueWarning]),s=Z.useCollection(t,i,o),u=f.useMemo(()=>new zt(s,r),[s,r]);const b=f.useRef(null);return f.useEffect(()=>{if(r.focusedKey!=null&&!s.getItem(r.focusedKey)){const v=b.current.getItem(r.focusedKey),h=[...b.current.getKeys()].map(T=>{const P=b.current.getItem(T);return P.type==="item"?P:null}).filter(T=>T!==null),w=[...s.getKeys()].map(T=>{const P=s.getItem(T);return P.type==="item"?P:null}).filter(T=>T!==null),$=h.length-w.length;let g=Math.min($>1?Math.max(v.index-$+1,0):v.index,w.length-1),M;for(;g>=0;){if(!u.isDisabled(w[g].key)){M=w[g];break}g<w.length-1?g++:(g>v.index&&(g=v.index),g--)}r.setFocusedKey(M?M.key:null)}b.current=s},[s,u,r,r.focusedKey]),{collection:s,disabledKeys:n,selectionManager:u}}function Nt(t){var e;let[r,n]=lt(t.selectedKey,(e=t.defaultSelectedKey)!==null&&e!==void 0?e:null,t.onSelectionChange),i=f.useMemo(()=>r!=null?[r]:[],[r]),{collection:o,disabledKeys:s,selectionManager:u}=Rt({...t,selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:v=>{var h;let w=(h=v.values().next().value)!==null&&h!==void 0?h:null;w===r&&t.onSelectionChange&&t.onSelectionChange(w),n(w)}}),b=r!=null?o.getItem(r):null;return{collection:o,disabledKeys:s,selectionManager:u,selectedKey:r,setSelectedKey:n,selectedItem:b}}function Bt(t){var e;let r=Nt({...t,suppressTextValueWarning:!0,defaultSelectedKey:(e=t.defaultSelectedKey)!==null&&e!==void 0?e:He(t.collection,t.disabledKeys?new Set(t.disabledKeys):new Set)}),{selectionManager:n,collection:i,selectedKey:o}=r,s=f.useRef(o);return f.useEffect(()=>{let u=o;(n.isEmpty||!i.getItem(u))&&(u=He(i,r.disabledKeys),u!=null&&n.setSelectedKeys([u])),(u!=null&&n.focusedKey==null||!n.isFocused&&u!==s.current)&&n.setFocusedKey(u),s.current=u}),{...r,isDisabled:t.isDisabled||!1}}function He(t,e){let r=null;if(t){for(r=t.getFirstKey();e.has(r)&&r!==t.getLastKey();)r=t.getKeyAfter(r);e.has(r)&&r===t.getLastKey()&&(r=t.getFirstKey())}return r}const ot=new WeakMap;function fe(t,e,r){return typeof e=="string"&&(e=e.replace(/\s+/g,"")),`${ot.get(t)}-${r}-${e}`}const le=typeof document<"u"?f.useLayoutEffect:()=>{};function Q(t){const e=f.useRef(null);return le(()=>{e.current=t},[t]),f.useCallback((...r)=>{const n=e.current;return n==null?void 0:n(...r)},[])}const pe={prefix:String(Math.round(Math.random()*1e10)),current:0},st=f.createContext(pe),Ut=f.createContext(!1);let jt=!!(typeof window<"u"&&window.document&&window.document.createElement),he=new WeakMap;function Ht(t=!1){let e=f.useContext(st),r=f.useRef(null);if(r.current===null&&!t){var n,i;let o=(i=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)===null||i===void 0||(n=i.ReactCurrentOwner)===null||n===void 0?void 0:n.current;if(o){let s=he.get(o);s==null?he.set(o,{id:e.current,state:o.memoizedState}):o.memoizedState!==s.state&&(e.current=s.id,he.delete(o))}r.current=++e.current}return r.current}function Wt(t){let e=f.useContext(st);e===pe&&!jt&&console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");let r=Ht(!!t),n=e===pe&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${e.prefix}`;return t||`${n}-${r}`}function Vt(t){let e=f.useId(),[r]=f.useState(at()),n=r||process.env.NODE_ENV==="test"?"react-aria":`react-aria${pe.prefix}`;return t||`${n}-${e}`}const Gt=typeof f.useId=="function"?Vt:Wt;function qt(){return!1}function Xt(){return!0}function Yt(t){return()=>{}}function at(){return typeof f.useSyncExternalStore=="function"?f.useSyncExternalStore(Yt,qt,Xt):f.useContext(Ut)}let _t=!!(typeof window<"u"&&window.document&&window.document.createElement),be=new Map;function ct(t){let[e,r]=f.useState(t),n=f.useRef(null),i=Gt(e),o=f.useCallback(s=>{n.current=s},[]);return _t&&be.set(i,o),le(()=>{let s=i;return()=>{be.delete(s)}},[i]),f.useEffect(()=>{let s=n.current;s&&(n.current=null,r(s))}),i}function Jt(t,e){if(t===e)return t;let r=be.get(t);if(r)return r(e),e;let n=be.get(e);return n?(n(t),t):e}function ut(...t){return(...e)=>{for(let r of t)typeof r=="function"&&r(...e)}}const D=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},G=t=>t&&"window"in t&&t.window===t?t:D(t).defaultView||window;function dt(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(r=dt(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function Zt(){for(var t,e,r=0,n="",i=arguments.length;r<i;r++)(t=arguments[r])&&(e=dt(t))&&(n&&(n+=" "),n+=e);return n}function W(...t){let e={...t[0]};for(let r=1;r<t.length;r++){let n=t[r];for(let i in n){let o=e[i],s=n[i];typeof o=="function"&&typeof s=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=ut(o,s):(i==="className"||i==="UNSAFE_className")&&typeof o=="string"&&typeof s=="string"?e[i]=Zt(o,s):i==="id"&&o&&s?e.id=Jt(o,s):e[i]=s!==void 0?s:o}}return e}const Qt=new Set(["id"]),er=new Set(["aria-label","aria-labelledby","aria-describedby","aria-details"]),tr=new Set(["href","hrefLang","target","rel","download","ping","referrerPolicy"]),rr=/^(data-.*)$/;function nr(t,e={}){let{labelable:r,isLink:n,propNames:i}=e,o={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(Qt.has(s)||r&&er.has(s)||n&&tr.has(s)||i!=null&&i.has(s)||rr.test(s))&&(o[s]=t[s]);return o}function H(t){if(ir())t.focus({preventScroll:!0});else{let e=lr(t);t.focus(),or(e)}}let se=null;function ir(){if(se==null){se=!1;try{document.createElement("div").focus({get preventScroll(){return se=!0,!0}})}catch{}}return se}function lr(t){let e=t.parentNode,r=[],n=document.scrollingElement||document.documentElement;for(;e instanceof HTMLElement&&e!==n;)(e.offsetHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)&&r.push({element:e,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),e=e.parentNode;return n instanceof HTMLElement&&r.push({element:n,scrollTop:n.scrollTop,scrollLeft:n.scrollLeft}),r}function or(t){for(let{element:e,scrollTop:r,scrollLeft:n}of t)e.scrollTop=r,e.scrollLeft=n}function ve(t){var e;return typeof window>"u"||window.navigator==null?!1:((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.brands.some(r=>t.test(r.brand)))||t.test(window.navigator.userAgent)}function Le(t){var e;return typeof window<"u"&&window.navigator!=null?t.test(((e=window.navigator.userAgentData)===null||e===void 0?void 0:e.platform)||window.navigator.platform):!1}function q(){return Le(/^Mac/i)}function sr(){return Le(/^iPhone/i)}function ft(){return Le(/^iPad/i)||q()&&navigator.maxTouchPoints>1}function Ie(){return sr()||ft()}function ar(){return q()||Ie()}function cr(){return ve(/AppleWebKit/i)&&!ur()}function ur(){return ve(/Chrome/i)}function pt(){return ve(/Android/i)}function dr(){return ve(/Firefox/i)}const fr=f.createContext({isNative:!0,open:br,useHref:t=>t});function Ce(){return f.useContext(fr)}function X(t,e,r=!0){var n,i;let{metaKey:o,ctrlKey:s,altKey:u,shiftKey:b}=e;dr()&&(!((i=window.event)===null||i===void 0||(n=i.type)===null||n===void 0)&&n.startsWith("key"))&&t.target==="_blank"&&(q()?o=!0:s=!0);let v=cr()&&q()&&!ft()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:s,altKey:u,shiftKey:b}):new MouseEvent("click",{metaKey:o,ctrlKey:s,altKey:u,shiftKey:b,bubbles:!0,cancelable:!0});X.isOpening=r,H(t),t.dispatchEvent(v),X.isOpening=!1}X.isOpening=!1;function pr(t,e){if(t instanceof HTMLAnchorElement)e(t);else if(t.hasAttribute("data-href")){let r=document.createElement("a");r.href=t.getAttribute("data-href"),t.hasAttribute("data-target")&&(r.target=t.getAttribute("data-target")),t.hasAttribute("data-rel")&&(r.rel=t.getAttribute("data-rel")),t.hasAttribute("data-download")&&(r.download=t.getAttribute("data-download")),t.hasAttribute("data-ping")&&(r.ping=t.getAttribute("data-ping")),t.hasAttribute("data-referrer-policy")&&(r.referrerPolicy=t.getAttribute("data-referrer-policy")),t.appendChild(r),e(r),t.removeChild(r)}}function br(t,e){pr(t,r=>X(r,e))}function yr(t){let e=Ce();return{href:t!=null&&t.href?e.useHref(t==null?void 0:t.href):void 0,target:t==null?void 0:t.target,rel:t==null?void 0:t.rel,download:t==null?void 0:t.download,ping:t==null?void 0:t.ping,referrerPolicy:t==null?void 0:t.referrerPolicy}}let ee=new Map,Ke=new Set;function We(){if(typeof window>"u")return;function t(n){return"propertyName"in n}let e=n=>{if(!t(n)||!n.target)return;let i=ee.get(n.target);i||(i=new Set,ee.set(n.target,i),n.target.addEventListener("transitioncancel",r,{once:!0})),i.add(n.propertyName)},r=n=>{if(!t(n)||!n.target)return;let i=ee.get(n.target);if(i&&(i.delete(n.propertyName),i.size===0&&(n.target.removeEventListener("transitioncancel",r),ee.delete(n.target)),ee.size===0)){for(let o of Ke)o();Ke.clear()}};document.body.addEventListener("transitionrun",e),document.body.addEventListener("transitionend",r)}typeof document<"u"&&(document.readyState!=="loading"?We():document.addEventListener("DOMContentLoaded",We));function bt(t){requestAnimationFrame(()=>{ee.size===0?t():Ke.add(t)})}function yt(){let t=f.useRef(new Map),e=f.useCallback((i,o,s,u)=>{let b=u!=null&&u.once?(...v)=>{t.current.delete(s),s(...v)}:s;t.current.set(s,{type:o,eventTarget:i,fn:b,options:u}),i.addEventListener(o,s,u)},[]),r=f.useCallback((i,o,s,u)=>{var b;let v=((b=t.current.get(s))===null||b===void 0?void 0:b.fn)||s;i.removeEventListener(o,v,u),t.current.delete(s)},[]),n=f.useCallback(()=>{t.current.forEach((i,o)=>{r(i.eventTarget,i.type,o,i.options)})},[r]);return f.useEffect(()=>n,[n]),{addGlobalListener:e,removeGlobalListener:r,removeAllGlobalListeners:n}}function vt(t,e){let{id:r,"aria-label":n,"aria-labelledby":i}=t;return r=ct(r),i&&n?i=[...new Set([r,...i.trim().split(/\s+/)])].join(" "):i&&(i=i.trim().split(/\s+/).join(" ")),!n&&!i&&e&&(n=e),{id:r,"aria-label":n,"aria-labelledby":i}}function vr(t,e){le(()=>{if(t&&t.ref&&e)return t.ref.current=e.current,()=>{t.ref&&(t.ref.current=null)}})}function gr(t,e){let r=window.getComputedStyle(t),n=/(auto|scroll)/.test(r.overflow+r.overflowX+r.overflowY);return n&&e&&(n=t.scrollHeight!==t.clientHeight||t.scrollWidth!==t.clientWidth),n}function hr(t,e){const r=[];for(;t&&t!==document.documentElement;)gr(t,e)&&r.push(t),t=t.parentElement;return r}let $r=0;const $e=new Map;function mr(t){let[e,r]=f.useState();return le(()=>{if(!t)return;let n=$e.get(t);if(n)r(n.element.id);else{let i=`react-aria-description-${$r++}`;r(i);let o=document.createElement("div");o.id=i,o.style.display="none",o.textContent=t,document.body.appendChild(o),n={refCount:0,element:o},$e.set(t,n)}return n.refCount++,()=>{n&&--n.refCount===0&&(n.element.remove(),$e.delete(t))}},[t]),{"aria-describedby":t?e:void 0}}function Sr(t,e,r,n){let i=Q(r),o=r==null;f.useEffect(()=>{if(o||!t.current)return;let s=t.current;return s.addEventListener(e,i,n),()=>{s.removeEventListener(e,i,n)}},[t,e,n,o,i])}function gt(t,e){let r=Ve(t,e,"left"),n=Ve(t,e,"top"),i=e.offsetWidth,o=e.offsetHeight,s=t.scrollLeft,u=t.scrollTop,{borderTopWidth:b,borderLeftWidth:v}=getComputedStyle(t),h=t.scrollLeft+parseInt(v,10),w=t.scrollTop+parseInt(b,10),$=h+t.clientWidth,g=w+t.clientHeight;r<=s?s=r-parseInt(v,10):r+i>$&&(s+=r+i-$),n<=w?u=n-parseInt(b,10):n+o>g&&(u+=n+o-g),t.scrollLeft=s,t.scrollTop=u}function Ve(t,e,r){const n=r==="left"?"offsetLeft":"offsetTop";let i=0;for(;e.offsetParent&&(i+=e[n],e.offsetParent!==t);){if(e.offsetParent.contains(t)){i-=t[n];break}e=e.offsetParent}return i}function Ge(t,e){if(document.contains(t)){let s=document.scrollingElement||document.documentElement;if(window.getComputedStyle(s).overflow==="hidden"){let b=hr(t);for(let v of b)gt(v,t)}else{var r;let{left:b,top:v}=t.getBoundingClientRect();t==null||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{block:"nearest"});let{left:h,top:w}=t.getBoundingClientRect();if(Math.abs(b-h)>1||Math.abs(v-w)>1){var n,i,o;e==null||(i=e.containingElement)===null||i===void 0||(n=i.scrollIntoView)===null||n===void 0||n.call(i,{block:"center",inline:"center"}),(o=t.scrollIntoView)===null||o===void 0||o.call(t,{block:"nearest"})}}}}function Te(t){return t.mozInputSource===0&&t.isTrusted?!0:pt()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Kr(t){return!pt()&&t.width===0&&t.height===0||t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"}function we(t){return ar()?t.altKey:t.ctrlKey}function te(t){return q()?t.metaKey:t.ctrlKey}const Tr=1e3;function wr(t){let{keyboardDelegate:e,selectionManager:r,onTypeSelect:n}=t,i=f.useRef({search:"",timeout:null}).current,o=s=>{let u=Pr(s.key);if(!u||s.ctrlKey||s.metaKey||!s.currentTarget.contains(s.target))return;u===" "&&i.search.trim().length>0&&(s.preventDefault(),"continuePropagation"in s||s.stopPropagation()),i.search+=u;let b=e.getKeyForSearch(i.search,r.focusedKey);b==null&&(b=e.getKeyForSearch(i.search)),b!=null&&(r.setFocusedKey(b),n&&n(b)),clearTimeout(i.timeout),i.timeout=setTimeout(()=>{i.search=""},Tr)};return{typeSelectProps:{onKeyDownCapture:e.getKeyForSearch?o:null}}}function Pr(t){return t.length===1||!/^[A-Z]/i.test(t)?t:""}let re="default",Pe="",de=new WeakMap;function qe(t){if(Ie()){if(re==="default"){const e=D(t);Pe=e.documentElement.style.webkitUserSelect,e.documentElement.style.webkitUserSelect="none"}re="disabled"}else(t instanceof HTMLElement||t instanceof SVGElement)&&(de.set(t,t.style.userSelect),t.style.userSelect="none")}function ae(t){if(Ie()){if(re!=="disabled")return;re="restoring",setTimeout(()=>{bt(()=>{if(re==="restoring"){const e=D(t);e.documentElement.style.webkitUserSelect==="none"&&(e.documentElement.style.webkitUserSelect=Pe||""),Pe="",re="default"}})},300)}else if((t instanceof HTMLElement||t instanceof SVGElement)&&t&&de.has(t)){let e=de.get(t);t.style.userSelect==="none"&&(t.style.userSelect=e),t.getAttribute("style")===""&&t.removeAttribute("style"),de.delete(t)}}const ht=f.createContext({register:()=>{}});ht.displayName="PressResponderContext";function Er(t,e){return e.get?e.get.call(t):e.value}function $t(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function xr(t,e){var r=$t(t,e,"get");return Er(t,r)}function kr(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Mr(t,e,r){kr(t,e),e.set(t,r)}function Lr(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}function Xe(t,e,r){var n=$t(t,e,"set");return Lr(t,n,r),r}function Ir(t){let e=f.useContext(ht);if(e){let{register:r,...n}=e;t=W(n,t),r()}return vr(e,t.ref),t}var ce=new WeakMap;class ue{continuePropagation(){Xe(this,ce,!1)}get shouldStopPropagation(){return xr(this,ce)}constructor(e,r,n){Mr(this,ce,{writable:!0,value:void 0}),Xe(this,ce,!0),this.type=e,this.pointerType=r,this.target=n.currentTarget,this.shiftKey=n.shiftKey,this.metaKey=n.metaKey,this.ctrlKey=n.ctrlKey,this.altKey=n.altKey}}const Ye=Symbol("linkClicked");function mt(t){let{onPress:e,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:u,preventFocusOnPress:b,shouldCancelOnPointerExit:v,allowTextSelectionOnPress:h,ref:w,...$}=Ir(t),[g,M]=f.useState(!1),T=f.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:P,removeAllGlobalListeners:L}=yt(),k=Q((l,m)=>{let p=T.current;if(s||p.didFirePressStart)return!1;let d=!0;if(p.isTriggeringEvent=!0,n){let K=new ue("pressstart",m,l);n(K),d=K.shouldStopPropagation}return r&&r(!0),p.isTriggeringEvent=!1,p.didFirePressStart=!0,M(!0),d}),x=Q((l,m,p=!0)=>{let d=T.current;if(!d.didFirePressStart)return!1;d.ignoreClickAfterPress=!0,d.didFirePressStart=!1,d.isTriggeringEvent=!0;let K=!0;if(i){let a=new ue("pressend",m,l);i(a),K=a.shouldStopPropagation}if(r&&r(!1),M(!1),e&&p&&!s){let a=new ue("press",m,l);e(a),K&&(K=a.shouldStopPropagation)}return d.isTriggeringEvent=!1,K}),I=Q((l,m)=>{let p=T.current;if(s)return!1;if(o){p.isTriggeringEvent=!0;let d=new ue("pressup",m,l);return o(d),p.isTriggeringEvent=!1,d.shouldStopPropagation}return!0}),C=Q(l=>{let m=T.current;m.isPressed&&m.target&&(m.isOverTarget&&m.pointerType!=null&&x(j(m.target,l),m.pointerType,!1),m.isPressed=!1,m.isOverTarget=!1,m.activePointerId=null,m.pointerType=null,L(),h||ae(m.target))}),A=Q(l=>{v&&C(l)}),B=f.useMemo(()=>{let l=T.current,m={onKeyDown(d){if(me(d.nativeEvent,d.currentTarget)&&d.currentTarget.contains(d.target)){var K;Je(d.target,d.key)&&d.preventDefault();let a=!0;if(!l.isPressed&&!d.repeat){l.target=d.currentTarget,l.isPressed=!0,a=k(d,"keyboard");let c=d.currentTarget,E=O=>{me(O,c)&&!O.repeat&&c.contains(O.target)&&l.target&&I(j(l.target,O),"keyboard")};P(D(d.currentTarget),"keyup",ut(E,p),!0)}a&&d.stopPropagation(),d.metaKey&&q()&&((K=l.metaKeyEvents)===null||K===void 0||K.set(d.key,d.nativeEvent))}else d.key==="Meta"&&(l.metaKeyEvents=new Map)},onClick(d){if(!(d&&!d.currentTarget.contains(d.target))&&d&&d.button===0&&!l.isTriggeringEvent&&!X.isOpening){let K=!0;if(s&&d.preventDefault(),!l.ignoreClickAfterPress&&!l.ignoreEmulatedMouseEvents&&!l.isPressed&&(l.pointerType==="virtual"||Te(d.nativeEvent))){!s&&!b&&H(d.currentTarget);let a=k(d,"virtual"),c=I(d,"virtual"),E=x(d,"virtual");K=a&&c&&E}l.ignoreEmulatedMouseEvents=!1,l.ignoreClickAfterPress=!1,K&&d.stopPropagation()}}},p=d=>{var K;if(l.isPressed&&l.target&&me(d,l.target)){var a;Je(d.target,d.key)&&d.preventDefault();let E=d.target;x(j(l.target,d),"keyboard",l.target.contains(E)),L(),d.key!=="Enter"&&De(l.target)&&l.target.contains(E)&&!d[Ye]&&(d[Ye]=!0,X(l.target,d,!1)),l.isPressed=!1,(a=l.metaKeyEvents)===null||a===void 0||a.delete(d.key)}else if(d.key==="Meta"&&(!((K=l.metaKeyEvents)===null||K===void 0)&&K.size)){var c;let E=l.metaKeyEvents;l.metaKeyEvents=void 0;for(let O of E.values())(c=l.target)===null||c===void 0||c.dispatchEvent(new KeyboardEvent("keyup",O))}};if(typeof PointerEvent<"u"){m.onPointerDown=c=>{if(c.button!==0||!c.currentTarget.contains(c.target))return;if(Kr(c.nativeEvent)){l.pointerType="virtual";return}Se(c.currentTarget)&&c.preventDefault(),l.pointerType=c.pointerType;let E=!0;l.isPressed||(l.isPressed=!0,l.isOverTarget=!0,l.activePointerId=c.pointerId,l.target=c.currentTarget,!s&&!b&&H(c.currentTarget),h||qe(l.target),E=k(c,l.pointerType),P(D(c.currentTarget),"pointermove",d,!1),P(D(c.currentTarget),"pointerup",K,!1),P(D(c.currentTarget),"pointercancel",a,!1)),E&&c.stopPropagation()},m.onMouseDown=c=>{c.currentTarget.contains(c.target)&&c.button===0&&(Se(c.currentTarget)&&c.preventDefault(),c.stopPropagation())},m.onPointerUp=c=>{!c.currentTarget.contains(c.target)||l.pointerType==="virtual"||c.button===0&&J(c,c.currentTarget)&&I(c,l.pointerType||c.pointerType)};let d=c=>{c.pointerId===l.activePointerId&&(l.target&&J(c,l.target)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,k(j(l.target,c),l.pointerType)):l.target&&l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,x(j(l.target,c),l.pointerType,!1),A(c)))},K=c=>{c.pointerId===l.activePointerId&&l.isPressed&&c.button===0&&l.target&&(J(c,l.target)&&l.pointerType!=null?x(j(l.target,c),l.pointerType):l.isOverTarget&&l.pointerType!=null&&x(j(l.target,c),l.pointerType,!1),l.isPressed=!1,l.isOverTarget=!1,l.activePointerId=null,l.pointerType=null,L(),h||ae(l.target))},a=c=>{C(c)};m.onDragStart=c=>{c.currentTarget.contains(c.target)&&C(c)}}else{m.onMouseDown=a=>{if(a.button!==0||!a.currentTarget.contains(a.target))return;if(Se(a.currentTarget)&&a.preventDefault(),l.ignoreEmulatedMouseEvents){a.stopPropagation();return}l.isPressed=!0,l.isOverTarget=!0,l.target=a.currentTarget,l.pointerType=Te(a.nativeEvent)?"virtual":"mouse",!s&&!b&&H(a.currentTarget),k(a,l.pointerType)&&a.stopPropagation(),P(D(a.currentTarget),"mouseup",d,!1)},m.onMouseEnter=a=>{if(!a.currentTarget.contains(a.target))return;let c=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!0,c=k(a,l.pointerType)),c&&a.stopPropagation()},m.onMouseLeave=a=>{if(!a.currentTarget.contains(a.target))return;let c=!0;l.isPressed&&!l.ignoreEmulatedMouseEvents&&l.pointerType!=null&&(l.isOverTarget=!1,c=x(a,l.pointerType,!1),A(a)),c&&a.stopPropagation()},m.onMouseUp=a=>{a.currentTarget.contains(a.target)&&!l.ignoreEmulatedMouseEvents&&a.button===0&&I(a,l.pointerType||"mouse")};let d=a=>{if(a.button===0){if(l.isPressed=!1,L(),l.ignoreEmulatedMouseEvents){l.ignoreEmulatedMouseEvents=!1;return}l.target&&J(a,l.target)&&l.pointerType!=null?x(j(l.target,a),l.pointerType):l.target&&l.isOverTarget&&l.pointerType!=null&&x(j(l.target,a),l.pointerType,!1),l.isOverTarget=!1}};m.onTouchStart=a=>{if(!a.currentTarget.contains(a.target))return;let c=Cr(a.nativeEvent);if(!c)return;l.activePointerId=c.identifier,l.ignoreEmulatedMouseEvents=!0,l.isOverTarget=!0,l.isPressed=!0,l.target=a.currentTarget,l.pointerType="touch",!s&&!b&&H(a.currentTarget),h||qe(l.target),k(a,l.pointerType)&&a.stopPropagation(),P(G(a.currentTarget),"scroll",K,!0)},m.onTouchMove=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=_e(a.nativeEvent,l.activePointerId),E=!0;c&&J(c,a.currentTarget)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,E=k(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,E=x(a,l.pointerType,!1),A(a)),E&&a.stopPropagation()},m.onTouchEnd=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=_e(a.nativeEvent,l.activePointerId),E=!0;c&&J(c,a.currentTarget)&&l.pointerType!=null?(I(a,l.pointerType),E=x(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(E=x(a,l.pointerType,!1)),E&&a.stopPropagation(),l.isPressed=!1,l.activePointerId=null,l.isOverTarget=!1,l.ignoreEmulatedMouseEvents=!0,l.target&&!h&&ae(l.target),L()},m.onTouchCancel=a=>{a.currentTarget.contains(a.target)&&(a.stopPropagation(),l.isPressed&&C(a))};let K=a=>{l.isPressed&&a.target.contains(l.target)&&C({currentTarget:l.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};m.onDragStart=a=>{a.currentTarget.contains(a.target)&&C(a)}}return m},[P,s,b,L,h,C,A,x,k,I]);return f.useEffect(()=>()=>{var l;h||ae((l=T.current.target)!==null&&l!==void 0?l:void 0)},[h]),{isPressed:u||g,pressProps:W($,B)}}function De(t){return t.tagName==="A"&&t.hasAttribute("href")}function me(t,e){const{key:r,code:n}=t,i=e,o=i.getAttribute("role");return(r==="Enter"||r===" "||r==="Spacebar"||n==="Space")&&!(i instanceof G(i).HTMLInputElement&&!St(i,r)||i instanceof G(i).HTMLTextAreaElement||i.isContentEditable)&&!((o==="link"||!o&&De(i))&&r!=="Enter")}function Cr(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function _e(t,e){const r=t.changedTouches;for(let n=0;n<r.length;n++){const i=r[n];if(i.identifier===e)return i}return null}function j(t,e){return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey}}function Dr(t){let e=0,r=0;return t.width!==void 0?e=t.width/2:t.radiusX!==void 0&&(e=t.radiusX),t.height!==void 0?r=t.height/2:t.radiusY!==void 0&&(r=t.radiusY),{top:t.clientY-r,right:t.clientX+e,bottom:t.clientY+r,left:t.clientX-e}}function Ar(t,e){return!(t.left>e.right||e.left>t.right||t.top>e.bottom||e.top>t.bottom)}function J(t,e){let r=e.getBoundingClientRect(),n=Dr(t);return Ar(r,n)}function Se(t){return!(t instanceof HTMLElement)||!t.hasAttribute("draggable")}function Je(t,e){return t instanceof HTMLInputElement?!St(t,e):t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!De(t)}const Or=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function St(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":Or.has(t.type)}let oe=null,Fr=new Set,ie=new Map,Y=!1,Ee=!1;function Ae(t,e){for(let r of Fr)r(t,e)}function zr(t){return!(t.metaKey||!q()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function ye(t){Y=!0,zr(t)&&(oe="keyboard",Ae("keyboard",t))}function F(t){oe="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(Y=!0,Ae("pointer",t))}function Kt(t){Te(t)&&(Y=!0,oe="virtual")}function Tt(t){t.target===window||t.target===document||(!Y&&!Ee&&(oe="virtual",Ae("virtual",t)),Y=!1,Ee=!1)}function wt(){Y=!1,Ee=!0}function Ze(t){if(typeof window>"u"||ie.get(G(t)))return;const e=G(t),r=D(t);let n=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){Y=!0,n.apply(this,arguments)},r.addEventListener("keydown",ye,!0),r.addEventListener("keyup",ye,!0),r.addEventListener("click",Kt,!0),e.addEventListener("focus",Tt,!0),e.addEventListener("blur",wt,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",F,!0),r.addEventListener("pointermove",F,!0),r.addEventListener("pointerup",F,!0)):(r.addEventListener("mousedown",F,!0),r.addEventListener("mousemove",F,!0),r.addEventListener("mouseup",F,!0)),e.addEventListener("beforeunload",()=>{Pt(t)},{once:!0}),ie.set(e,{focus:n})}const Pt=(t,e)=>{const r=G(t),n=D(t);e&&n.removeEventListener("DOMContentLoaded",e),ie.has(r)&&(r.HTMLElement.prototype.focus=ie.get(r).focus,n.removeEventListener("keydown",ye,!0),n.removeEventListener("keyup",ye,!0),n.removeEventListener("click",Kt,!0),r.removeEventListener("focus",Tt,!0),r.removeEventListener("blur",wt,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",F,!0),n.removeEventListener("pointermove",F,!0),n.removeEventListener("pointerup",F,!0)):(n.removeEventListener("mousedown",F,!0),n.removeEventListener("mousemove",F,!0),n.removeEventListener("mouseup",F,!0)),ie.delete(r))};function Rr(t){const e=D(t);let r;return e.readyState!=="loading"?Ze(t):(r=()=>{Ze(t)},e.addEventListener("DOMContentLoaded",r)),()=>Pt(t,r)}typeof document<"u"&&Rr();function xe(){return oe}const Nr=500;function Br(t){let{isDisabled:e,onLongPressStart:r,onLongPressEnd:n,onLongPress:i,threshold:o=Nr,accessibilityDescription:s}=t;const u=f.useRef();let{addGlobalListener:b,removeGlobalListener:v}=yt(),{pressProps:h}=mt({isDisabled:e,onPressStart($){if($.continuePropagation(),($.pointerType==="mouse"||$.pointerType==="touch")&&(r&&r({...$,type:"longpressstart"}),u.current=setTimeout(()=>{$.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),i&&i({...$,type:"longpress"}),u.current=void 0},o),$.pointerType==="touch")){let g=M=>{M.preventDefault()};b($.target,"contextmenu",g,{once:!0}),b(window,"pointerup",()=>{setTimeout(()=>{v($.target,"contextmenu",g)},30)},{once:!0})}},onPressEnd($){u.current&&clearTimeout(u.current),n&&($.pointerType==="mouse"||$.pointerType==="touch")&&n({...$,type:"longpressend"})}}),w=mr(i&&!e?s:void 0);return{longPressProps:W(h,w)}}function ke(t){const e=D(t);if(xe()==="virtual"){let r=e.activeElement;bt(()=>{e.activeElement===r&&t.isConnected&&H(t)})}else H(t)}function Ur(t){const e=G(t);if(!(t instanceof e.HTMLElement)&&!(t instanceof e.SVGElement))return!1;let{display:r,visibility:n}=t.style,i=r!=="none"&&n!=="hidden"&&n!=="collapse";if(i){const{getComputedStyle:o}=t.ownerDocument.defaultView;let{display:s,visibility:u}=o(t);i=s!=="none"&&u!=="hidden"&&u!=="collapse"}return i}function jr(t,e){return!t.hasAttribute("hidden")&&!t.hasAttribute("data-react-aria-prevent-focus")&&(t.nodeName==="DETAILS"&&e&&e.nodeName!=="SUMMARY"?t.hasAttribute("open"):!0)}function Et(t,e){return t.nodeName!=="#comment"&&Ur(t)&&jr(t,e)&&(!t.parentElement||Et(t.parentElement,t))}const Oe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],Hr=Oe.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Oe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Wr=Oe.join(':not([hidden]):not([tabindex="-1"]),');function xt(t,e){return!t||!e?!1:e.some(r=>r.contains(t))}function kt(t,e,r){let n=e!=null&&e.tabbable?Wr:Hr,i=D(t).createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode(o){var s;return!(e==null||(s=e.from)===null||s===void 0)&&s.contains(o)?NodeFilter.FILTER_REJECT:o.matches(n)&&Et(o)&&(!r||xt(o,r))&&(!(e!=null&&e.accept)||e.accept(o))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return e!=null&&e.from&&(i.currentNode=e.from),i}class Fe{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,r,n){let i=this.fastMap.get(r??null);if(!i)return;let o=new Qe({scopeRef:e});i.addChild(o),o.parent=i,this.fastMap.set(e,o),n&&(o.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let r=this.fastMap.get(e);if(!r)return;let n=r.parent;for(let o of this.traverse())o!==r&&r.nodeToRestore&&o.nodeToRestore&&r.scopeRef&&r.scopeRef.current&&xt(o.nodeToRestore,r.scopeRef.current)&&(o.nodeToRestore=r.nodeToRestore);let i=r.children;n&&(n.removeChild(r),i.size>0&&i.forEach(o=>n&&n.addChild(o))),this.fastMap.delete(r.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let r of e.children)yield*this.traverse(r)}clone(){var e;let r=new Fe;var n;for(let i of this.traverse())r.addTreeNode(i.scopeRef,(n=(e=i.parent)===null||e===void 0?void 0:e.scopeRef)!==null&&n!==void 0?n:null,i.nodeToRestore);return r}constructor(){this.fastMap=new Map,this.root=new Qe({scopeRef:null}),this.fastMap.set(null,this.root)}}class Qe{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}}new Fe;function Vr(t,e){let r=e==null?void 0:e.isDisabled,[n,i]=f.useState(!1);return le(()=>{if(t!=null&&t.current&&!r){let o=()=>{if(t.current){let u=kt(t.current,{tabbable:!0});i(!!u.nextNode())}};o();let s=new MutationObserver(o);return s.observe(t.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabIndex","disabled"]}),()=>{s.disconnect()}}}),r?!1:n}const Gr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),qr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function Xr(t){if(Intl.Locale){let r=new Intl.Locale(t).maximize(),n=typeof r.getTextInfo=="function"?r.getTextInfo():r.textInfo;if(n)return n.direction==="rtl";if(r.script)return Gr.has(r.script)}let e=t.split("-")[0];return qr.has(e)}const Yr=Symbol.for("react-aria.i18n.locale");function Mt(){let t=typeof window<"u"&&window[Yr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{t="en-US"}return{locale:t,direction:Xr(t)?"rtl":"ltr"}}let Me=Mt(),ne=new Set;function et(){Me=Mt();for(let t of ne)t(Me)}function _r(){let t=at(),[e,r]=f.useState(Me);return f.useEffect(()=>(ne.size===0&&window.addEventListener("languagechange",et),ne.add(r),()=>{ne.delete(r),ne.size===0&&window.removeEventListener("languagechange",et)}),[]),t?{locale:"en-US",direction:"ltr"}:e}const Jr=f.createContext(null);function Lt(){let t=_r();return f.useContext(Jr)||t}function Zr(t){let{selectionManager:e,keyboardDelegate:r,ref:n,autoFocus:i=!1,shouldFocusWrap:o=!1,disallowEmptySelection:s=!1,disallowSelectAll:u=!1,selectOnFocus:b=e.selectionBehavior==="replace",disallowTypeAhead:v=!1,shouldUseVirtualFocus:h,allowsTabNavigation:w=!1,isVirtualized:$,scrollRef:g=n,linkBehavior:M="action"}=t,{direction:T}=Lt(),P=Ce(),L=p=>{if(p.altKey&&p.key==="Tab"&&p.preventDefault(),!n.current.contains(p.target))return;const d=(S,V)=>{if(S!=null){if(e.isLink(S)&&M==="selection"&&b&&!we(p)){Dt.flushSync(()=>{e.setFocusedKey(S,V)});let _=g.current.querySelector(`[data-key="${CSS.escape(S.toString())}"]`),Ne=e.getItemProps(S);P.open(_,p,Ne.href,Ne.routerOptions);return}if(e.setFocusedKey(S,V),e.isLink(S)&&M==="override")return;p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&!we(p)&&e.replaceSelection(S)}};switch(p.key){case"ArrowDown":if(r.getKeyBelow){var K,a;p.preventDefault();let S=e.focusedKey!=null?r.getKeyBelow(e.focusedKey):(K=r.getFirstKey)===null||K===void 0?void 0:K.call(r);S==null&&o&&(S=(a=r.getFirstKey)===null||a===void 0?void 0:a.call(r,e.focusedKey)),d(S)}break;case"ArrowUp":if(r.getKeyAbove){var c,E;p.preventDefault();let S=e.focusedKey!=null?r.getKeyAbove(e.focusedKey):(c=r.getLastKey)===null||c===void 0?void 0:c.call(r);S==null&&o&&(S=(E=r.getLastKey)===null||E===void 0?void 0:E.call(r,e.focusedKey)),d(S)}break;case"ArrowLeft":if(r.getKeyLeftOf){var O,y;p.preventDefault();let S=r.getKeyLeftOf(e.focusedKey);S==null&&o&&(S=T==="rtl"?(O=r.getFirstKey)===null||O===void 0?void 0:O.call(r,e.focusedKey):(y=r.getLastKey)===null||y===void 0?void 0:y.call(r,e.focusedKey)),d(S,T==="rtl"?"first":"last")}break;case"ArrowRight":if(r.getKeyRightOf){var U,ge;p.preventDefault();let S=r.getKeyRightOf(e.focusedKey);S==null&&o&&(S=T==="rtl"?(U=r.getLastKey)===null||U===void 0?void 0:U.call(r,e.focusedKey):(ge=r.getFirstKey)===null||ge===void 0?void 0:ge.call(r,e.focusedKey)),d(S,T==="rtl"?"last":"first")}break;case"Home":if(r.getFirstKey){p.preventDefault();let S=r.getFirstKey(e.focusedKey,te(p));e.setFocusedKey(S),te(p)&&p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&e.replaceSelection(S)}break;case"End":if(r.getLastKey){p.preventDefault();let S=r.getLastKey(e.focusedKey,te(p));e.setFocusedKey(S),te(p)&&p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&e.replaceSelection(S)}break;case"PageDown":if(r.getKeyPageBelow){p.preventDefault();let S=r.getKeyPageBelow(e.focusedKey);d(S)}break;case"PageUp":if(r.getKeyPageAbove){p.preventDefault();let S=r.getKeyPageAbove(e.focusedKey);d(S)}break;case"a":te(p)&&e.selectionMode==="multiple"&&u!==!0&&(p.preventDefault(),e.selectAll());break;case"Escape":!s&&e.selectedKeys.size!==0&&(p.stopPropagation(),p.preventDefault(),e.clearSelection());break;case"Tab":if(!w){if(p.shiftKey)n.current.focus();else{let S=kt(n.current,{tabbable:!0}),V,_;do _=S.lastChild(),_&&(V=_);while(_);V&&!V.contains(document.activeElement)&&H(V)}break}}},k=f.useRef({top:0,left:0});Sr(g,"scroll",$?null:()=>{k.current={top:g.current.scrollTop,left:g.current.scrollLeft}});let x=p=>{if(e.isFocused){p.currentTarget.contains(p.target)||e.setFocused(!1);return}if(p.currentTarget.contains(p.target)){if(e.setFocused(!0),e.focusedKey==null){let a=E=>{E!=null&&(e.setFocusedKey(E),b&&e.replaceSelection(E))},c=p.relatedTarget;var d,K;c&&p.currentTarget.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING?a((d=e.lastSelectedKey)!==null&&d!==void 0?d:r.getLastKey()):a((K=e.firstSelectedKey)!==null&&K!==void 0?K:r.getFirstKey())}else $||(g.current.scrollTop=k.current.top,g.current.scrollLeft=k.current.left);if(!$&&e.focusedKey!=null){let a=g.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);a&&(a.contains(document.activeElement)||H(a),xe()==="keyboard"&&Ge(a,{containingElement:n.current}))}}},I=p=>{p.currentTarget.contains(p.relatedTarget)||e.setFocused(!1)};const C=f.useRef(i);f.useEffect(()=>{if(C.current){let p=null;i==="first"&&(p=r.getFirstKey()),i==="last"&&(p=r.getLastKey());let d=e.selectedKeys;if(d.size){for(let K of d)if(e.canSelectItem(K)){p=K;break}}e.setFocused(!0),e.setFocusedKey(p),p==null&&!h&&ke(n.current)}},[]);let A=f.useRef(e.focusedKey);f.useEffect(()=>{let p=xe();if(e.isFocused&&e.focusedKey!=null&&(g!=null&&g.current)){let d=g.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);d&&(p==="keyboard"||C.current)&&($||gt(g.current,d),p!=="virtual"&&Ge(d,{containingElement:n.current}))}e.isFocused&&e.focusedKey==null&&A.current!=null&&ke(n.current),A.current=e.focusedKey,C.current=!1},[$,g,e.focusedKey,e.isFocused,n]);let B={onKeyDown:L,onFocus:x,onBlur:I,onMouseDown(p){g.current===p.target&&p.preventDefault()}},{typeSelectProps:l}=wr({keyboardDelegate:r,selectionManager:e});v||(B=W(l,B));let m;return h||(m=e.focusedKey==null?0:-1),{collectionProps:{...B,tabIndex:m}}}function Qr(t){let{selectionManager:e,key:r,ref:n,shouldSelectOnPressUp:i,shouldUseVirtualFocus:o,focus:s,isDisabled:u,onAction:b,allowsDifferentPressOrigin:v,linkBehavior:h="action"}=t,w=Ce(),$=y=>{if(y.pointerType==="keyboard"&&we(y))e.toggleSelection(r);else{if(e.selectionMode==="none")return;if(e.isLink(r)){if(h==="selection"){let U=e.getItemProps(r);w.open(n.current,y,U.href,U.routerOptions),e.setSelectedKeys(e.selectedKeys);return}else if(h==="override"||h==="none")return}e.selectionMode==="single"?e.isSelected(r)&&!e.disallowEmptySelection?e.toggleSelection(r):e.replaceSelection(r):y&&y.shiftKey?e.extendSelection(r):e.selectionBehavior==="toggle"||y&&(te(y)||y.pointerType==="touch"||y.pointerType==="virtual")?e.toggleSelection(r):e.replaceSelection(r)}};f.useEffect(()=>{r===e.focusedKey&&e.isFocused&&!o&&(s?s():document.activeElement!==n.current&&ke(n.current))},[n,r,e.focusedKey,e.childFocusStrategy,e.isFocused,o]),u=u||e.isDisabled(r);let g={};!o&&!u?g={tabIndex:r===e.focusedKey?0:-1,onFocus(y){y.target===n.current&&e.setFocusedKey(r)}}:u&&(g.onMouseDown=y=>{y.preventDefault()});let M=e.isLink(r)&&h==="override",T=e.isLink(r)&&h!=="selection"&&h!=="none",P=!u&&e.canSelectItem(r)&&!M,L=(b||T)&&!u,k=L&&(e.selectionBehavior==="replace"?!P:!P||e.isEmpty),x=L&&P&&e.selectionBehavior==="replace",I=k||x,C=f.useRef(null),A=I&&P,B=f.useRef(!1),l=f.useRef(!1),m=y=>{if(b&&b(),T){let U=e.getItemProps(r);w.open(n.current,y,U.href,U.routerOptions)}},p={};i?(p.onPressStart=y=>{C.current=y.pointerType,B.current=A,y.pointerType==="keyboard"&&(!I||rt())&&$(y)},v?(p.onPressUp=k?null:y=>{y.pointerType!=="keyboard"&&P&&$(y)},p.onPress=k?m:null):p.onPress=y=>{if(k||x&&y.pointerType!=="mouse"){if(y.pointerType==="keyboard"&&!tt())return;m(y)}else y.pointerType!=="keyboard"&&P&&$(y)}):(p.onPressStart=y=>{C.current=y.pointerType,B.current=A,l.current=k,P&&(y.pointerType==="mouse"&&!k||y.pointerType==="keyboard"&&(!L||rt()))&&$(y)},p.onPress=y=>{(y.pointerType==="touch"||y.pointerType==="pen"||y.pointerType==="virtual"||y.pointerType==="keyboard"&&I&&tt()||y.pointerType==="mouse"&&l.current)&&(I?m(y):P&&$(y))}),g["data-key"]=r,p.preventFocusOnPress=o;let{pressProps:d,isPressed:K}=mt(p),a=x?y=>{C.current==="mouse"&&(y.stopPropagation(),y.preventDefault(),m(y))}:void 0,{longPressProps:c}=Br({isDisabled:!A,onLongPress(y){y.pointerType==="touch"&&($(y),e.setSelectionBehavior("toggle"))}}),E=y=>{C.current==="touch"&&B.current&&y.preventDefault()},O=e.isLink(r)?y=>{X.isOpening||y.preventDefault()}:void 0;return{itemProps:W(g,P||k?d:{},A?c:{},{onDoubleClick:a,onDragStartCapture:E,onClick:O}),isPressed:K,isSelected:e.isSelected(r),isFocused:e.isFocused&&e.focusedKey===r,isDisabled:u,allowsSelection:P,hasAction:I}}function tt(){let t=window.event;return(t==null?void 0:t.key)==="Enter"}function rt(){let t=window.event;return(t==null?void 0:t.key)===" "||(t==null?void 0:t.code)==="Space"}function en(t,e,r){let{key:n,isDisabled:i,shouldSelectOnPressUp:o}=t,{selectionManager:s,selectedKey:u}=e,b=n===u,v=i||e.isDisabled||e.selectionManager.isDisabled(n),{itemProps:h,isPressed:w}=Qr({selectionManager:s,key:n,ref:r,isDisabled:v,shouldSelectOnPressUp:o,linkBehavior:"selection"}),$=fe(e,n,"tab"),g=fe(e,n,"tabpanel"),{tabIndex:M}=h,T=e.collection.getItem(n),P=nr(T==null?void 0:T.props,{labelable:!0});delete P.id;let L=yr(T==null?void 0:T.props);return{tabProps:W(P,L,h,{id:$,"aria-selected":b,"aria-disabled":v||void 0,"aria-controls":b?g:void 0,tabIndex:v?void 0:M,role:"tab"}),isSelected:b,isDisabled:v,isPressed:w}}function tn(t,e,r){let n=Vr(r)?void 0:0;var i;const o=fe(e,(i=t.id)!==null&&i!==void 0?i:e==null?void 0:e.selectedKey,"tabpanel"),s=vt({...t,id:o,"aria-labelledby":fe(e,e==null?void 0:e.selectedKey,"tab")});return{tabPanelProps:W(s,{tabIndex:n,role:"tabpanel","aria-describedby":t["aria-describedby"],"aria-details":t["aria-details"]})}}class rn{getKeyLeftOf(e){return this.flipDirection?this.getNextKey(e):this.getPreviousKey(e)}getKeyRightOf(e){return this.flipDirection?this.getPreviousKey(e):this.getNextKey(e)}getKeyAbove(e){return this.getPreviousKey(e)}getKeyBelow(e){return this.getNextKey(e)}isDisabled(e){var r,n;return this.disabledKeys.has(e)||!!(!((n=this.collection.getItem(e))===null||n===void 0||(r=n.props)===null||r===void 0)&&r.isDisabled)}getFirstKey(){let e=this.collection.getFirstKey();return e!=null&&this.isDisabled(e)&&(e=this.getNextKey(e)),e}getLastKey(){let e=this.collection.getLastKey();return e!=null&&this.isDisabled(e)&&(e=this.getPreviousKey(e)),e}getNextKey(e){do e=this.collection.getKeyAfter(e),e==null&&(e=this.collection.getFirstKey());while(this.isDisabled(e));return e}getPreviousKey(e){do e=this.collection.getKeyBefore(e),e==null&&(e=this.collection.getLastKey());while(this.isDisabled(e));return e}constructor(e,r,n,i=new Set){this.collection=e,this.flipDirection=r==="rtl"&&n==="horizontal",this.disabledKeys=i}}function nn(t,e,r){let{orientation:n="horizontal",keyboardActivation:i="automatic"}=t,{collection:o,selectionManager:s,disabledKeys:u}=e,{direction:b}=Lt(),v=f.useMemo(()=>new rn(o,b,n,u),[o,u,n,b]),{collectionProps:h}=Zr({ref:r,selectionManager:s,keyboardDelegate:v,selectOnFocus:i==="automatic",disallowEmptySelection:!0,scrollRef:r,linkBehavior:"selection"}),w=ct();ot.set(e,w);let $=vt({...t,id:w});return{tabListProps:{...W(h,$),role:"tablist","aria-orientation":n,tabIndex:void 0}}}function ln(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function it(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?nt(Object(r),!0).forEach(function(n){ln(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):nt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var on=(t,e,r)=>{for(var n of Object.keys(t)){var i;if(t[n]!==((i=e[n])!==null&&i!==void 0?i:r[n]))return!1}return!0},ze=t=>e=>{var r=t.defaultClassName,n=it(it({},t.defaultVariants),e);for(var i in n){var o,s=(o=n[i])!==null&&o!==void 0?o:t.defaultVariants[i];if(s!=null){var u=s;typeof u=="boolean"&&(u=u===!0?"true":"false");var b=t.variantClassNames[i][u];b&&(r+=" "+b)}}for(var[v,h]of t.compoundVariants)on(v,n,t.defaultVariants)&&(r+=" "+h);return r},sn=ze({defaultClassName:"kz6kzz0",variantClassNames:{context:{container:"kz6kzz1",navigation:"kz6kzz2"},active:{true:"kz6kzz3",false:"kz6kzz4"},disabled:{true:"kz6kzz5",false:"kz6kzz6"}},defaultVariants:{},compoundVariants:[[{context:"container",active:!0},"kz6kzz7"],[{context:"container",active:!1},"kz6kzz8"],[{context:"container",active:!1,disabled:!1},"kz6kzz9"],[{context:"navigation",active:!0},"kz6kzza"],[{context:"navigation",active:!1},"kz6kzzb"],[{context:"navigation",active:!1,disabled:!1},"kz6kzzc"],[{context:"navigation",active:!1,disabled:!0},"kz6kzzd"]]}),an=ze({defaultClassName:"",variantClassNames:{active:{true:"kz6kzze",false:"kz6kzzf"},disabled:{true:"kz6kzzg",false:"kz6kzzh"},context:{navigation:"kz6kzzi",container:"kz6kzzj"}},defaultVariants:{},compoundVariants:[[{context:"navigation",active:!0},"kz6kzzk"]]});function It({context:t,item:e,state:r,...n}){const{key:i}=e,o=R.useRef(null),{tabProps:s}=en({key:i},r,o),u=r.selectedKey===i,b=r.disabledKeys.has(i),v=N.modChildren(e.rendered,h=>h.type.displayName==="SpsTag"||N.Metadata.isWoodlandComponent(h.type)&&N.Metadata.get(h.type).name==="Tag"?[{className:N.cl(h.props.className,an({active:u,disabled:b,context:t}))}]:[{}]);return R.createElement("div",{...s,ref:o,className:sn({active:u,disabled:b,context:t}),...n},v)}N.Metadata.set(It,{name:"Tab"});function Ct({context:t,"data-testid":e,state:r,...n}){const i=R.useRef(null),{tabPanelProps:o}=tn(n,r,i),s=t==="container"?N.Content:"div";return R.createElement(s,{...o,ref:i,"data-testid":e},r.selectedItem?r.selectedItem.props.children:null)}N.Metadata.set(Ct,{name:"TabPanel"});var cn=ze({defaultClassName:"fy26er0",variantClassNames:{context:{container:"fy26er1",navigation:"fy26er2"}},defaultVariants:{},compoundVariants:[]});function Re({className:t,context:e="navigation","data-testid":r,...n}){const i=Bt(n),o=R.useRef(null),{tabListProps:s}=nn(n,i,o),u=N.useChildTestIdAttrBuilder({"data-testid":r});return R.createElement(R.Fragment,null,R.createElement("div",{...s,ref:o,className:N.cl(cn({context:e}),t),"data-testid":r},[...i.collection].map(b=>R.createElement(It,{key:b.key,item:b,state:i,context:e,...u(`tab-${String(b.key)}`)}))),R.createElement(Ct,{key:i.selectedItem?i.selectedItem.key:null,state:i,context:e,...u("tab-panel")}))}N.Metadata.set(Re,{name:"Tabs"});const un={components:[Re],examples:{basic:{label:"Basic Navigation Tabs",description:Be.code`
|
2
2
|
<p>Navigation tabs</p>
|
3
|
-
`,examples:{basic:{react:
|
3
|
+
`,examples:{basic:{react:Be.code`
|
4
4
|
import { Item } from "@react-stately/collections";
|
5
5
|
import { Box, Icon } from "@sps-woodland/core";
|
6
6
|
import { Tabs } from "@sps-woodland/tabs";
|
@@ -61,4 +61,4 @@
|
|
61
61
|
</Tabs>
|
62
62
|
)
|
63
63
|
}
|
64
|
-
`}}}}},dn={"Tabbed Navigation":un};exports.MANIFEST=dn;exports.Tabs=
|
64
|
+
`}}}}},dn={"Tabbed Navigation":un};exports.MANIFEST=dn;exports.Tabs=Re;
|