@sps-woodland/tabs 8.17.0 → 8.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs.js +3 -3
- package/lib/index.es.js +540 -540
- package/lib/style.css +1 -1
- package/package.json +5 -5
- package/vite.config.mjs +11 -2
package/lib/index.cjs.js
CHANGED
@@ -1,6 +1,6 @@
|
|
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`
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),Z=require("@react-stately/collections"),Ct=require("react-dom"),R=require("@sps-woodland/core"),Ne=require("@spscommerce/utils");function Dt(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 z=Dt(f);class Be{*[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 F extends Set{constructor(e,r,n){super(e),e instanceof F?(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 y=o.current;y!==s&&console.warn(`WARN: A component changed from ${y?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}.`),o.current=s},[s]);let u=s?t:n,b=f.useCallback((y,...h)=>{let T=($,...g)=>{r&&(Object.is(u,$)||r($,...g)),s||(u=$)};typeof y=="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,...k)=>{let w=y(s?u:g,...k);return T(w,...h),s?g:w})):(s||i(y),T(y,...h))},[s,u,r]);return[u,b]}function At(t,e){if(t.size!==e.size)return!1;for(let r of t)if(!e.has(r))return!1;return!0}function Ot(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),y=f.useRef(null),[,h]=f.useState(null),T=f.useMemo(()=>Ue(t.selectedKeys),[t.selectedKeys]),$=f.useMemo(()=>Ue(t.defaultSelectedKeys,new F),[t.defaultSelectedKeys]),[g,k]=lt(T,$,t.onSelectionChange),w=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),[P,M]=f.useState(i);i==="replace"&&P==="toggle"&&typeof g=="object"&&g.size===0&&M("replace");let x=f.useRef(i);return f.useEffect(()=>{i!==x.current&&(M(i),x.current=i)},[i]),{selectionMode:e,disallowEmptySelection:r,selectionBehavior:P,setSelectionBehavior:M,get isFocused(){return s.current},setFocused(E){s.current=E,u(E)},get focusedKey(){return b.current},get childFocusStrategy(){return y.current},setFocusedKey(E,L="first"){b.current=E,y.current=L,h(E)},selectedKeys:g,setSelectedKeys(E){(n||!At(E,g))&&k(E)},disabledKeys:w,disabledBehavior:o}}function Ue(t,e){return t?t==="all"?"all":new F(t):e}class Ft{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 F([e],e,e);else{let n=this.state.selectedKeys,i=n.anchorKey||e;r=new F(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 F(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 F([e],e,e):new F;this.state.setSelectedKeys(r)}setSelectedKeys(e){if(this.selectionMode==="none")return;let r=new F;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 F)}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 zt(t){let{filter:e}=t,r=Ot(t),n=f.useMemo(()=>t.disabledKeys?new Set(t.disabledKeys):new Set,[t.disabledKeys]),i=f.useCallback(y=>e?new Be(e(y)):new Be(y),[e]),o=f.useMemo(()=>({suppressTextValueWarning:t.suppressTextValueWarning}),[t.suppressTextValueWarning]),s=Z.useCollection(t,i,o),u=f.useMemo(()=>new Ft(s,r),[s,r]);const b=f.useRef(null);return f.useEffect(()=>{if(r.focusedKey!=null&&!s.getItem(r.focusedKey)){const y=b.current.getItem(r.focusedKey),h=[...b.current.getKeys()].map(w=>{const P=b.current.getItem(w);return P.type==="item"?P:null}).filter(w=>w!==null),T=[...s.getKeys()].map(w=>{const P=s.getItem(w);return P.type==="item"?P:null}).filter(w=>w!==null),$=h.length-T.length;let g=Math.min($>1?Math.max(y.index-$+1,0):y.index,T.length-1),k;for(;g>=0;){if(!u.isDisabled(T[g].key)){k=T[g];break}g<T.length-1?g++:(g>y.index&&(g=y.index),g--)}r.setFocusedKey(k?k.key:null)}b.current=s},[s,u,r,r.focusedKey]),{collection:s,disabledKeys:n,selectionManager:u}}function Rt(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}=zt({...t,selectionMode:"single",disallowEmptySelection:!0,allowDuplicateSelectionEvents:!0,selectedKeys:i,onSelectionChange:y=>{var h;let T=(h=y.values().next().value)!==null&&h!==void 0?h:null;T===r&&t.onSelectionChange&&t.onSelectionChange(T),n(T)}}),b=r!=null?o.getItem(r):null;return{collection:o,disabledKeys:s,selectionManager:u,selectedKey:r,setSelectedKey:n,selectedItem:b}}function Nt(t){var e;let r=Rt({...t,suppressTextValueWarning:!0,defaultSelectedKey:(e=t.defaultSelectedKey)!==null&&e!==void 0?e:je(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=je(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 je(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),Bt=f.createContext(!1);let Ut=!!(typeof window<"u"&&window.document&&window.document.createElement),he=new WeakMap;function jt(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 Ht(t){let e=f.useContext(st);e===pe&&!Ut&&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=jt(!!t),n=e===pe&&process.env.NODE_ENV==="test"?"react-aria":`react-aria${e.prefix}`;return t||`${n}-${r}`}function Wt(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 Vt=typeof f.useId=="function"?Wt:Ht;function Gt(){return!1}function qt(){return!0}function Xt(t){return()=>{}}function at(){return typeof f.useSyncExternalStore=="function"?f.useSyncExternalStore(Xt,Gt,qt):f.useContext(Bt)}let Yt=!!(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=Vt(e),o=f.useCallback(s=>{n.current=s},[]);return Yt&&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 C=t=>{var e;return(e=t==null?void 0:t.ownerDocument)!==null&&e!==void 0?e:document},V=t=>t&&"window"in t&&t.window===t?t:C(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 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]=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 j(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 ye(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 Me(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 G(){return Me(/^Mac/i)}function sr(){return Me(/^iPhone/i)}function ft(){return Me(/^iPad/i)||G()&&navigator.maxTouchPoints>1}function Le(){return sr()||ft()}function ar(){return G()||Le()}function cr(){return ye(/AppleWebKit/i)&&!ur()}function ur(){return ye(/Chrome/i)}function pt(){return ye(/Android/i)}function dr(){return ye(/Firefox/i)}const fr=f.createContext({isNative:!0,open:br,useHref:t=>t});function Ie(){return f.useContext(fr)}function q(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"&&(G()?o=!0:s=!0);let y=cr()&&G()&&!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});q.isOpening=r,j(t),t.dispatchEvent(y),q.isOpening=!1}q.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=>q(r,e))}function vr(t){let e=Ie();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 He(){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"?He():document.addEventListener("DOMContentLoaded",He));function bt(t){requestAnimationFrame(()=>{ee.size===0?t():Ke.add(t)})}function vt(){let t=f.useRef(new Map),e=f.useCallback((i,o,s,u)=>{let b=u!=null&&u.once?(...y)=>{t.current.delete(s),s(...y)}: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 y=((b=t.current.get(s))===null||b===void 0?void 0:b.fn)||s;i.removeEventListener(o,y,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 yt(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 yr(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=We(t,e,"left"),n=We(t,e,"top"),i=e.offsetWidth,o=e.offsetHeight,s=t.scrollLeft,u=t.scrollTop,{borderTopWidth:b,borderLeftWidth:y}=getComputedStyle(t),h=t.scrollLeft+parseInt(y,10),T=t.scrollTop+parseInt(b,10),$=h+t.clientWidth,g=T+t.clientHeight;r<=s?s=r-parseInt(y,10):r+i>$&&(s+=r+i-$),n<=T?u=n-parseInt(b,10):n+o>g&&(u+=n+o-g),t.scrollLeft=s,t.scrollTop=u}function We(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 Ve(t,e){if(document.contains(t)){let s=document.scrollingElement||document.documentElement;if(window.getComputedStyle(s).overflow==="hidden"){let b=hr(t);for(let y of b)gt(y,t)}else{var r;let{left:b,top:y}=t.getBoundingClientRect();t==null||(r=t.scrollIntoView)===null||r===void 0||r.call(t,{block:"nearest"});let{left:h,top:T}=t.getBoundingClientRect();if(Math.abs(b-h)>1||Math.abs(y-T)>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 Te(t){return ar()?t.altKey:t.ctrlKey}function te(t){return G()?t.metaKey:t.ctrlKey}const wr=1e3;function Tr(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=""},wr)};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 Ge(t){if(Le()){if(re==="default"){const e=C(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(Le()){if(re!=="disabled")return;re="restoring",setTimeout(()=>{bt(()=>{if(re==="restoring"){const e=C(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 _r(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 Er(t,e){var r=$t(t,e,"get");return _r(t,r)}function xr(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function kr(t,e,r){xr(t,e),e.set(t,r)}function Mr(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 qe(t,e,r){var n=$t(t,e,"set");return Mr(t,n,r),r}function Lr(t){let e=f.useContext(ht);if(e){let{register:r,...n}=e;t=H(n,t),r()}return yr(e,t.ref),t}var ce=new WeakMap;class ue{continuePropagation(){qe(this,ce,!1)}get shouldStopPropagation(){return Er(this,ce)}constructor(e,r,n){kr(this,ce,{writable:!0,value:void 0}),qe(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 Xe=Symbol("linkClicked");function mt(t){let{onPress:e,onPressChange:r,onPressStart:n,onPressEnd:i,onPressUp:o,isDisabled:s,isPressed:u,preventFocusOnPress:b,shouldCancelOnPointerExit:y,allowTextSelectionOnPress:h,ref:T,...$}=Lr(t),[g,k]=f.useState(!1),w=f.useRef({isPressed:!1,ignoreEmulatedMouseEvents:!1,ignoreClickAfterPress:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null}),{addGlobalListener:P,removeAllGlobalListeners:M}=vt(),x=Q((l,m)=>{let p=w.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,k(!0),d}),E=Q((l,m,p=!0)=>{let d=w.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),k(!1),e&&p&&!s){let a=new ue("press",m,l);e(a),K&&(K=a.shouldStopPropagation)}return d.isTriggeringEvent=!1,K}),L=Q((l,m)=>{let p=w.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=w.current;m.isPressed&&m.target&&(m.isOverTarget&&m.pointerType!=null&&E(U(m.target,l),m.pointerType,!1),m.isPressed=!1,m.isOverTarget=!1,m.activePointerId=null,m.pointerType=null,M(),h||ae(m.target))}),D=Q(l=>{y&&I(l)}),N=f.useMemo(()=>{let l=w.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=x(d,"keyboard");let c=d.currentTarget,_=A=>{me(A,c)&&!A.repeat&&c.contains(A.target)&&l.target&&L(U(l.target,A),"keyboard")};P(C(d.currentTarget),"keyup",ut(_,p),!0)}a&&d.stopPropagation(),d.metaKey&&G()&&((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&&!q.isOpening){let K=!0;if(s&&d.preventDefault(),!l.ignoreClickAfterPress&&!l.ignoreEmulatedMouseEvents&&!l.isPressed&&(l.pointerType==="virtual"||we(d.nativeEvent))){!s&&!b&&j(d.currentTarget);let a=x(d,"virtual"),c=L(d,"virtual"),_=E(d,"virtual");K=a&&c&&_}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 _=d.target;E(U(l.target,d),"keyboard",l.target.contains(_)),M(),d.key!=="Enter"&&Ce(l.target)&&l.target.contains(_)&&!d[Xe]&&(d[Xe]=!0,q(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 _=l.metaKeyEvents;l.metaKeyEvents=void 0;for(let A of _.values())(c=l.target)===null||c===void 0||c.dispatchEvent(new KeyboardEvent("keyup",A))}};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 _=!0;l.isPressed||(l.isPressed=!0,l.isOverTarget=!0,l.activePointerId=c.pointerId,l.target=c.currentTarget,!s&&!b&&j(c.currentTarget),h||Ge(l.target),_=x(c,l.pointerType),P(C(c.currentTarget),"pointermove",d,!1),P(C(c.currentTarget),"pointerup",K,!1),P(C(c.currentTarget),"pointercancel",a,!1)),_&&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)&&L(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,x(U(l.target,c),l.pointerType)):l.target&&l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,E(U(l.target,c),l.pointerType,!1),D(c)))},K=c=>{c.pointerId===l.activePointerId&&l.isPressed&&c.button===0&&l.target&&(J(c,l.target)&&l.pointerType!=null?E(U(l.target,c),l.pointerType):l.isOverTarget&&l.pointerType!=null&&E(U(l.target,c),l.pointerType,!1),l.isPressed=!1,l.isOverTarget=!1,l.activePointerId=null,l.pointerType=null,M(),h||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(Se(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&&!b&&j(a.currentTarget),x(a,l.pointerType)&&a.stopPropagation(),P(C(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=x(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=E(a,l.pointerType,!1),D(a)),c&&a.stopPropagation()},m.onMouseUp=a=>{a.currentTarget.contains(a.target)&&!l.ignoreEmulatedMouseEvents&&a.button===0&&L(a,l.pointerType||"mouse")};let d=a=>{if(a.button===0){if(l.isPressed=!1,M(),l.ignoreEmulatedMouseEvents){l.ignoreEmulatedMouseEvents=!1;return}l.target&&J(a,l.target)&&l.pointerType!=null?E(U(l.target,a),l.pointerType):l.target&&l.isOverTarget&&l.pointerType!=null&&E(U(l.target,a),l.pointerType,!1),l.isOverTarget=!1}};m.onTouchStart=a=>{if(!a.currentTarget.contains(a.target))return;let c=Ir(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&&j(a.currentTarget),h||Ge(l.target),x(a,l.pointerType)&&a.stopPropagation(),P(V(a.currentTarget),"scroll",K,!0)},m.onTouchMove=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=Ye(a.nativeEvent,l.activePointerId),_=!0;c&&J(c,a.currentTarget)?!l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!0,_=x(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(l.isOverTarget=!1,_=E(a,l.pointerType,!1),D(a)),_&&a.stopPropagation()},m.onTouchEnd=a=>{if(!a.currentTarget.contains(a.target))return;if(!l.isPressed){a.stopPropagation();return}let c=Ye(a.nativeEvent,l.activePointerId),_=!0;c&&J(c,a.currentTarget)&&l.pointerType!=null?(L(a,l.pointerType),_=E(a,l.pointerType)):l.isOverTarget&&l.pointerType!=null&&(_=E(a,l.pointerType,!1)),_&&a.stopPropagation(),l.isPressed=!1,l.activePointerId=null,l.isOverTarget=!1,l.ignoreEmulatedMouseEvents=!0,l.target&&!h&&ae(l.target),M()},m.onTouchCancel=a=>{a.currentTarget.contains(a.target)&&(a.stopPropagation(),l.isPressed&&I(a))};let K=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},[P,s,b,M,h,I,D,E,x,L]);return f.useEffect(()=>()=>{var l;h||ae((l=w.current.target)!==null&&l!==void 0?l:void 0)},[h]),{isPressed:u||g,pressProps:H($,N)}}function Ce(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 V(i).HTMLInputElement&&!St(i,r)||i instanceof V(i).HTMLTextAreaElement||i.isContentEditable)&&!((o==="link"||!o&&Ce(i))&&r!=="Enter")}function Ir(t){const{targetTouches:e}=t;return e.length>0?e[0]:null}function Ye(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 Cr(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 Dr(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=Cr(t);return Dr(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":!Ce(t)}const Ar=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function St(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":Ar.has(t.type)}let oe=null,Or=new Set,ie=new Map,X=!1,_e=!1;function De(t,e){for(let r of Or)r(t,e)}function Fr(t){return!(t.metaKey||!G()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}function ve(t){X=!0,Fr(t)&&(oe="keyboard",De("keyboard",t))}function O(t){oe="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(X=!0,De("pointer",t))}function Kt(t){we(t)&&(X=!0,oe="virtual")}function wt(t){t.target===window||t.target===document||(!X&&!_e&&(oe="virtual",De("virtual",t)),X=!1,_e=!1)}function Tt(){X=!1,_e=!0}function Ze(t){if(typeof window>"u"||ie.get(V(t)))return;const e=V(t),r=C(t);let n=e.HTMLElement.prototype.focus;e.HTMLElement.prototype.focus=function(){X=!0,n.apply(this,arguments)},r.addEventListener("keydown",ve,!0),r.addEventListener("keyup",ve,!0),r.addEventListener("click",Kt,!0),e.addEventListener("focus",wt,!0),e.addEventListener("blur",Tt,!1),typeof PointerEvent<"u"?(r.addEventListener("pointerdown",O,!0),r.addEventListener("pointermove",O,!0),r.addEventListener("pointerup",O,!0)):(r.addEventListener("mousedown",O,!0),r.addEventListener("mousemove",O,!0),r.addEventListener("mouseup",O,!0)),e.addEventListener("beforeunload",()=>{Pt(t)},{once:!0}),ie.set(e,{focus:n})}const Pt=(t,e)=>{const r=V(t),n=C(t);e&&n.removeEventListener("DOMContentLoaded",e),ie.has(r)&&(r.HTMLElement.prototype.focus=ie.get(r).focus,n.removeEventListener("keydown",ve,!0),n.removeEventListener("keyup",ve,!0),n.removeEventListener("click",Kt,!0),r.removeEventListener("focus",wt,!0),r.removeEventListener("blur",Tt,!1),typeof PointerEvent<"u"?(n.removeEventListener("pointerdown",O,!0),n.removeEventListener("pointermove",O,!0),n.removeEventListener("pointerup",O,!0)):(n.removeEventListener("mousedown",O,!0),n.removeEventListener("mousemove",O,!0),n.removeEventListener("mouseup",O,!0)),ie.delete(r))};function zr(t){const e=C(t);let r;return e.readyState!=="loading"?Ze(t):(r=()=>{Ze(t)},e.addEventListener("DOMContentLoaded",r)),()=>Pt(t,r)}typeof document<"u"&&zr();function Ee(){return oe}const Rr=500;function Nr(t){let{isDisabled:e,onLongPressStart:r,onLongPressEnd:n,onLongPress:i,threshold:o=Rr,accessibilityDescription:s}=t;const u=f.useRef();let{addGlobalListener:b,removeGlobalListener:y}=vt(),{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=k=>{k.preventDefault()};b($.target,"contextmenu",g,{once:!0}),b(window,"pointerup",()=>{setTimeout(()=>{y($.target,"contextmenu",g)},30)},{once:!0})}},onPressEnd($){u.current&&clearTimeout(u.current),n&&($.pointerType==="mouse"||$.pointerType==="touch")&&n({...$,type:"longpressend"})}}),T=mr(i&&!e?s:void 0);return{longPressProps:H(h,T)}}function xe(t){const e=C(t);if(Ee()==="virtual"){let r=e.activeElement;bt(()=>{e.activeElement===r&&t.isConnected&&j(t)})}else j(t)}function Br(t){const e=V(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 Ur(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 _t(t,e){return t.nodeName!=="#comment"&&Br(t)&&Ur(t,e)&&(!t.parentElement||_t(t.parentElement,t))}const Ae=["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]"],jr=Ae.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Ae.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const Hr=Ae.join(':not([hidden]):not([tabindex="-1"]),');function Et(t,e){return!t||!e?!1:e.some(r=>r.contains(t))}function xt(t,e,r){let n=e!=null&&e.tabbable?Hr:jr,i=C(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)&&_t(o)&&(!r||Et(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 Oe{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&&Et(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 Oe;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 Oe;function Wr(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=xt(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 Vr=new Set(["Arab","Syrc","Samr","Mand","Thaa","Mend","Nkoo","Adlm","Rohg","Hebr"]),Gr=new Set(["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"]);function qr(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 Vr.has(r.script)}let e=t.split("-")[0];return Gr.has(e)}const Xr=Symbol.for("react-aria.i18n.locale");function kt(){let t=typeof window<"u"&&window[Xr]||typeof navigator<"u"&&(navigator.language||navigator.userLanguage)||"en-US";try{Intl.DateTimeFormat.supportedLocalesOf([t])}catch{t="en-US"}return{locale:t,direction:qr(t)?"rtl":"ltr"}}let ke=kt(),ne=new Set;function et(){ke=kt();for(let t of ne)t(ke)}function Yr(){let t=at(),[e,r]=f.useState(ke);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 Mt(){let t=Yr();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:y=!1,shouldUseVirtualFocus:h,allowsTabNavigation:T=!1,isVirtualized:$,scrollRef:g=n,linkBehavior:k="action"}=t,{direction:w}=Mt(),P=Ie(),M=p=>{if(p.altKey&&p.key==="Tab"&&p.preventDefault(),!n.current.contains(p.target))return;const d=(S,W)=>{if(S!=null){if(e.isLink(S)&&k==="selection"&&b&&!Te(p)){Ct.flushSync(()=>{e.setFocusedKey(S,W)});let Y=g.current.querySelector(`[data-key="${CSS.escape(S.toString())}"]`),Re=e.getItemProps(S);P.open(Y,p,Re.href,Re.routerOptions);return}if(e.setFocusedKey(S,W),e.isLink(S)&&k==="override")return;p.shiftKey&&e.selectionMode==="multiple"?e.extendSelection(S):b&&!Te(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,_;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=(_=r.getLastKey)===null||_===void 0?void 0:_.call(r,e.focusedKey)),d(S)}break;case"ArrowLeft":if(r.getKeyLeftOf){var A,v;p.preventDefault();let S=r.getKeyLeftOf(e.focusedKey);S==null&&o&&(S=w==="rtl"?(A=r.getFirstKey)===null||A===void 0?void 0:A.call(r,e.focusedKey):(v=r.getLastKey)===null||v===void 0?void 0:v.call(r,e.focusedKey)),d(S,w==="rtl"?"first":"last")}break;case"ArrowRight":if(r.getKeyRightOf){var B,ge;p.preventDefault();let S=r.getKeyRightOf(e.focusedKey);S==null&&o&&(S=w==="rtl"?(B=r.getLastKey)===null||B===void 0?void 0:B.call(r,e.focusedKey):(ge=r.getFirstKey)===null||ge===void 0?void 0:ge.call(r,e.focusedKey)),d(S,w==="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(!T){if(p.shiftKey)n.current.focus();else{let S=xt(n.current,{tabbable:!0}),W,Y;do Y=S.lastChild(),Y&&(W=Y);while(Y);W&&!W.contains(document.activeElement)&&j(W)}break}}},x=f.useRef({top:0,left:0});Sr(g,"scroll",$?null:()=>{x.current={top:g.current.scrollTop,left:g.current.scrollLeft}});let E=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=_=>{_!=null&&(e.setFocusedKey(_),b&&e.replaceSelection(_))},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=x.current.top,g.current.scrollLeft=x.current.left);if(!$&&e.focusedKey!=null){let a=g.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);a&&(a.contains(document.activeElement)||j(a),Ee()==="keyboard"&&Ve(a,{containingElement:n.current}))}}},L=p=>{p.currentTarget.contains(p.relatedTarget)||e.setFocused(!1)};const I=f.useRef(i);f.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 K of d)if(e.canSelectItem(K)){p=K;break}}e.setFocused(!0),e.setFocusedKey(p),p==null&&!h&&xe(n.current)}},[]);let D=f.useRef(e.focusedKey);f.useEffect(()=>{let p=Ee();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"||I.current)&&($||gt(g.current,d),p!=="virtual"&&Ve(d,{containingElement:n.current}))}e.isFocused&&e.focusedKey==null&&D.current!=null&&xe(n.current),D.current=e.focusedKey,I.current=!1},[$,g,e.focusedKey,e.isFocused,n]);let N={onKeyDown:M,onFocus:E,onBlur:L,onMouseDown(p){g.current===p.target&&p.preventDefault()}},{typeSelectProps:l}=Tr({keyboardDelegate:r,selectionManager:e});y||(N=H(l,N));let m;return h||(m=e.focusedKey==null?0:-1),{collectionProps:{...N,tabIndex:m}}}function Qr(t){let{selectionManager:e,key:r,ref:n,shouldSelectOnPressUp:i,shouldUseVirtualFocus:o,focus:s,isDisabled:u,onAction:b,allowsDifferentPressOrigin:y,linkBehavior:h="action"}=t,T=Ie(),$=v=>{if(v.pointerType==="keyboard"&&Te(v))e.toggleSelection(r);else{if(e.selectionMode==="none")return;if(e.isLink(r)){if(h==="selection"){let B=e.getItemProps(r);T.open(n.current,v,B.href,B.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):v&&v.shiftKey?e.extendSelection(r):e.selectionBehavior==="toggle"||v&&(te(v)||v.pointerType==="touch"||v.pointerType==="virtual")?e.toggleSelection(r):e.replaceSelection(r)}};f.useEffect(()=>{r===e.focusedKey&&e.isFocused&&!o&&(s?s():document.activeElement!==n.current&&xe(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(v){v.target===n.current&&e.setFocusedKey(r)}}:u&&(g.onMouseDown=v=>{v.preventDefault()});let k=e.isLink(r)&&h==="override",w=e.isLink(r)&&h!=="selection"&&h!=="none",P=!u&&e.canSelectItem(r)&&!k,M=(b||w)&&!u,x=M&&(e.selectionBehavior==="replace"?!P:!P||e.isEmpty),E=M&&P&&e.selectionBehavior==="replace",L=x||E,I=f.useRef(null),D=L&&P,N=f.useRef(!1),l=f.useRef(!1),m=v=>{if(b&&b(),w){let B=e.getItemProps(r);T.open(n.current,v,B.href,B.routerOptions)}},p={};i?(p.onPressStart=v=>{I.current=v.pointerType,N.current=D,v.pointerType==="keyboard"&&(!L||rt())&&$(v)},y?(p.onPressUp=x?null:v=>{v.pointerType!=="keyboard"&&P&&$(v)},p.onPress=x?m:null):p.onPress=v=>{if(x||E&&v.pointerType!=="mouse"){if(v.pointerType==="keyboard"&&!tt())return;m(v)}else v.pointerType!=="keyboard"&&P&&$(v)}):(p.onPressStart=v=>{I.current=v.pointerType,N.current=D,l.current=x,P&&(v.pointerType==="mouse"&&!x||v.pointerType==="keyboard"&&(!M||rt()))&&$(v)},p.onPress=v=>{(v.pointerType==="touch"||v.pointerType==="pen"||v.pointerType==="virtual"||v.pointerType==="keyboard"&&L&&tt()||v.pointerType==="mouse"&&l.current)&&(L?m(v):P&&$(v))}),g["data-key"]=r,p.preventFocusOnPress=o;let{pressProps:d,isPressed:K}=mt(p),a=E?v=>{I.current==="mouse"&&(v.stopPropagation(),v.preventDefault(),m(v))}:void 0,{longPressProps:c}=Nr({isDisabled:!D,onLongPress(v){v.pointerType==="touch"&&($(v),e.setSelectionBehavior("toggle"))}}),_=v=>{I.current==="touch"&&N.current&&v.preventDefault()},A=e.isLink(r)?v=>{q.isOpening||v.preventDefault()}:void 0;return{itemProps:H(g,P||x?d:{},D?c:{},{onDoubleClick:a,onDragStartCapture:_,onClick:A}),isPressed:K,isSelected:e.isSelected(r),isFocused:e.isFocused&&e.focusedKey===r,isDisabled:u,allowsSelection:P,hasAction:L}}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,y=i||e.isDisabled||e.selectionManager.isDisabled(n),{itemProps:h,isPressed:T}=Qr({selectionManager:s,key:n,ref:r,isDisabled:y,shouldSelectOnPressUp:o,linkBehavior:"selection"}),$=fe(e,n,"tab"),g=fe(e,n,"tabpanel"),{tabIndex:k}=h,w=e.collection.getItem(n),P=nr(w==null?void 0:w.props,{labelable:!0});delete P.id;let M=vr(w==null?void 0:w.props);return{tabProps:H(P,M,h,{id:$,"aria-selected":b,"aria-disabled":y||void 0,"aria-controls":b?g:void 0,tabIndex:y?void 0:k,role:"tab"}),isSelected:b,isDisabled:y,isPressed:T}}function tn(t,e,r){let n=Wr(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=yt({...t,id:o,"aria-labelledby":fe(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)}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}=Mt(),y=f.useMemo(()=>new rn(o,b,n,u),[o,u,n,b]),{collectionProps:h}=Zr({ref:r,selectionManager:s,keyboardDelegate:y,selectOnFocus:i==="automatic",disallowEmptySelection:!0,scrollRef:r,linkBehavior:"selection"}),T=ct();ot.set(e,T);let $=yt({...t,id:T});return{tabListProps:{...H(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},Fe=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[y,h]of t.compoundVariants)on(y,n,t.defaultVariants)&&(r+=" "+h);return r},sn=Fe({defaultClassName:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz0",variantClassNames:{context:{container:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz1",navigation:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz2"},active:{true:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz3",false:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz4"},disabled:{true:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz5",false:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz6"}},defaultVariants:{},compoundVariants:[[{context:"container",active:!0},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz7"],[{context:"container",active:!1},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz8"],[{context:"container",active:!1,disabled:!1},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzz9"],[{context:"navigation",active:!0},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzza"],[{context:"navigation",active:!1},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzb"],[{context:"navigation",active:!1,disabled:!1},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzc"],[{context:"navigation",active:!1,disabled:!0},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzd"]]}),an=Fe({defaultClassName:"",variantClassNames:{active:{true:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzze",false:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzf"},disabled:{true:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzg",false:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzh"},context:{navigation:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzi",container:"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzj"}},defaultVariants:{},compoundVariants:[[{context:"navigation",active:!0},"pkg_sps-woodland_tabs__version_8_17_2__hash_kz6kzzk"]]});function Lt({context:t,item:e,state:r,...n}){const{key:i}=e,o=z.useRef(null),{tabProps:s}=en({key:i},r,o),u=r.selectedKey===i,b=r.disabledKeys.has(i),y=R.modChildren(e.rendered,h=>h.type.displayName==="SpsTag"||R.Metadata.isWoodlandComponent(h.type)&&R.Metadata.get(h.type).name==="Tag"?[{className:R.cl(h.props.className,an({active:u,disabled:b,context:t}))}]:[{}]);return z.createElement("div",{...s,ref:o,className:sn({active:u,disabled:b,context:t}),...n},y)}R.Metadata.set(Lt,{name:"Tab"});function It({context:t,"data-testid":e,state:r,...n}){const i=z.useRef(null),{tabPanelProps:o}=tn(n,r,i),s=t==="container"?R.Content:"div";return z.createElement(s,{...o,ref:i,"data-testid":e},r.selectedItem?r.selectedItem.props.children:null)}R.Metadata.set(It,{name:"TabPanel"});var cn=Fe({defaultClassName:"pkg_sps-woodland_tabs__version_8_17_2__hash_fy26er0",variantClassNames:{context:{container:"pkg_sps-woodland_tabs__version_8_17_2__hash_fy26er1",navigation:"pkg_sps-woodland_tabs__version_8_17_2__hash_fy26er2"}},defaultVariants:{},compoundVariants:[]});function ze({className:t,context:e="navigation","data-testid":r,...n}){const i=Nt(n),o=z.useRef(null),{tabListProps:s}=nn(n,i,o),u=R.useChildTestIdAttrBuilder({"data-testid":r});return z.createElement(z.Fragment,null,z.createElement("div",{...s,ref:o,className:R.cl(cn({context:e}),t),"data-testid":r},[...i.collection].map(b=>z.createElement(Lt,{key:b.key,item:b,state:i,context:e,...u(`tab-${String(b.key)}`)}))),z.createElement(It,{key:i.selectedItem?i.selectedItem.key:null,state:i,context:e,...u("tab-panel")}))}R.Metadata.set(ze,{name:"Tabs"});const un={components:[ze],examples:{basic:{label:"Basic Navigation Tabs",description:Ne.code`
|
2
2
|
<p>Navigation tabs</p>
|
3
|
-
`,examples:{basic:{react:
|
3
|
+
`,examples:{basic:{react:Ne.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=ze;
|