react-animated-select 0.6.6 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,16 +1,16 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const t=require("react"),Me=require("react-transition-group"),ct=require("react-dom");var De={exports:{}},Ie={};var Ke;function ut(){if(Ke)return Ie;Ke=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(c,l,x){var b=null;if(x!==void 0&&(b=""+x),l.key!==void 0&&(b=""+l.key),"key"in l){x={};for(var g in l)g!=="key"&&(x[g]=l[g])}else x=l;return l=x.ref,{$$typeof:e,type:c,key:b,ref:l!==void 0?l:null,props:x}}return Ie.Fragment=n,Ie.jsx=s,Ie.jsxs=s,Ie}var He={};var Ze;function dt(){return Ze||(Ze=1,process.env.NODE_ENV!=="production"&&(function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===le?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case C:return"Fragment";case L:return"Profiler";case O:return"StrictMode";case Q:return"Suspense";case G:return"SuspenseList";case D:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case _:return"Portal";case H:return r.displayName||"Context";case I:return(r._context.displayName||"Context")+".Consumer";case Z:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case U:return o=r.displayName||null,o!==null?o:e(r.type)||"Memo";case u:o=r._payload,r=r._init;try{return e(r(o))}catch{}}return null}function n(r){return""+r}function s(r){try{n(r);var o=!1}catch{o=!0}if(o){o=console;var m=o.error,S=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return m.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",S),n(r)}}function c(r){if(r===C)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===u)return"<...>";try{var o=e(r);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function l(){var r=F.A;return r===null?null:r.getOwner()}function x(){return Error("react-stack-top-frame")}function b(r){if(q.call(r,"key")){var o=Object.getOwnPropertyDescriptor(r,"key").get;if(o&&o.isReactWarning)return!1}return r.key!==void 0}function g(r,o){function m(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",o))}m.isReactWarning=!0,Object.defineProperty(r,"key",{get:m,configurable:!0})}function j(){var r=e(this.type);return P[r]||(P[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function i(r,o,m,S,ce,a){var y=m.ref;return r={$$typeof:N,type:r,key:o,props:m,_owner:S},(y!==void 0?y:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:j}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ce}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function v(r,o,m,S,ce,a){var y=o.children;if(y!==void 0)if(S)if(fe(y)){for(S=0;S<y.length;S++)k(y[S]);Object.freeze&&Object.freeze(y)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else k(y);if(q.call(o,"key")){y=e(r);var p=Object.keys(o).filter(function(T){return T!=="key"});S=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",W[y+S]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const n=require("react"),he=require("react-transition-group"),Me=require("react-dom");var Ee={exports:{}},me={};var Ce;function Fe(){if(Ce)return me;Ce=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(a,i,h){var u=null;if(h!==void 0&&(u=""+h),i.key!==void 0&&(u=""+i.key),"key"in i){h={};for(var S in i)S!=="key"&&(h[S]=i[S])}else h=i;return i=h.ref,{$$typeof:e,type:a,key:u,ref:i!==void 0?i:null,props:h}}return me.Fragment=t,me.jsx=s,me.jsxs=s,me}var ye={};var Ie;function We(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&(function(){function e(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===K?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case D:return"Fragment";case J:return"Profiler";case X:return"StrictMode";case q:return"Suspense";case c:return"SuspenseList";case I:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case C:return"Portal";case Z:return r.displayName||"Context";case W:return(r._context.displayName||"Context")+".Consumer";case y:var v=r.render;return r=r.displayName,r||(r=v.displayName||v.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case w:return v=r.displayName||null,v!==null?v:e(r.type)||"Memo";case z:v=r._payload,r=r._init;try{return e(r(v))}catch{}}return null}function t(r){return""+r}function s(r){try{t(r);var v=!1}catch{v=!0}if(v){v=console;var _=v.error,Y=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return _.call(v,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Y),t(r)}}function a(r){if(r===D)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===z)return"<...>";try{var v=e(r);return v?"<"+v+">":"<...>"}catch{return"<...>"}}function i(){var r=L.A;return r===null?null:r.getOwner()}function h(){return Error("react-stack-top-frame")}function u(r){if(B.call(r,"key")){var v=Object.getOwnPropertyDescriptor(r,"key").get;if(v&&v.isReactWarning)return!1}return r.key!==void 0}function S(r,v){function _(){P||(P=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",v))}_.isReactWarning=!0,Object.defineProperty(r,"key",{get:_,configurable:!0})}function j(){var r=e(this.type);return G[r]||(G[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function E(r,v,_,Y,Q,o){var p=_.ref;return r={$$typeof:k,type:r,key:v,props:_,_owner:Y},(p!==void 0?p:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:j}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Q}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function l(r,v,_,Y,Q,o){var p=v.children;if(p!==void 0)if(Y)if(V(p)){for(Y=0;Y<p.length;Y++)R(p[Y]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else R(p);if(B.call(v,"key")){p=e(r);var b=Object.keys(v).filter(function(A){return A!=="key"});Y=0<b.length?"{key: someKey, "+b.join(": ..., ")+": ...}":"{key: someKey}",O[p+Y]||(b=0<b.length?"{"+b.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,S,y,p,y),W[y+S]=!0)}if(y=null,m!==void 0&&(s(m),y=""+m),b(o)&&(s(o.key),y=""+o.key),"key"in o){m={};for(var $ in o)$!=="key"&&(m[$]=o[$])}else m=o;return y&&g(m,typeof r=="function"?r.displayName||r.name||"Unknown":r),i(r,y,m,l(),ce,a)}function k(r){d(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===u&&(r._payload.status==="fulfilled"?d(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function d(r){return typeof r=="object"&&r!==null&&r.$$typeof===N}var R=t,N=Symbol.for("react.transitional.element"),_=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),L=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),H=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),F=R.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,fe=Array.isArray,V=console.createTask?console.createTask:function(){return null};R={react_stack_bottom_frame:function(r){return r()}};var re,P={},ie=R.react_stack_bottom_frame.bind(R,x)(),E=V(c(x)),W={};He.Fragment=C,He.jsx=function(r,o,m){var S=1e4>F.recentlyCreatedOwnerStacks++;return v(r,o,m,!1,S?Error("react-stack-top-frame"):ie,S?V(c(r)):E)},He.jsxs=function(r,o,m){var S=1e4>F.recentlyCreatedOwnerStacks++;return v(r,o,m,!0,S?Error("react-stack-top-frame"):ie,S?V(c(r)):E)}})()),He}var Qe;function ft(){return Qe||(Qe=1,process.env.NODE_ENV==="production"?De.exports=ut():De.exports=dt()),De.exports}var h=ft();const et=({className:e="",...n})=>h.jsx("svg",{className:e,role:"button","aria-label":"Clear selection",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:"1em",height:"1em",fill:"currentColor",...n,children:h.jsx("path",{d:"M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z"})}),gt=({className:e="",...n})=>h.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor",...n,children:h.jsx("path",{d:"M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z"})}),pt=({className:e="",...n})=>h.jsx("svg",{className:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"currentColor",...n,children:h.jsx("path",{d:"M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z"})}),Ve=t.createContext(null),Ae=t.forwardRef(({className:e="",visibility:n=void 0,setLeaving:s,setEntering:c,setSpacer:l,children:x,duration:b=300,unmount:g,style:j,exit:i=!0,...v},k)=>{const d=t.useRef(null),R=n!==void 0?n:v.in;t.useImperativeHandle(k,()=>d.current),t.useEffect(()=>{!R&&d.current&&(d.current.style.width="0px")},[]);const N=t.useCallback(()=>{if(!d.current)return{left:"0px",right:"0px"};const _=window.getComputedStyle(d.current);return{left:_.marginLeft,right:_.marginRight}},[]);return h.jsx(Me.CSSTransition,{onEnter:()=>{d.current.style.transition="none",d.current.style.marginRight="0px",d.current.style.marginLeft="0px",d.current.style.width="0px",c?.(!0)},onEntering:()=>{const{left:_,right:C}=N();requestAnimationFrame(()=>{requestAnimationFrame(()=>{d.current&&(d.current.style.transition=`width ${b}ms, color ${b}ms, background-color ${b}ms, margin ${b}ms ease`,d.current.style.width=d.current.scrollWidth+"px",d.current.style.marginRight=C,d.current.style.marginLeft=_)})})},onEntered:()=>{d.current.style.width="auto",l?.(!1),c?.(!1)},onExit:()=>{const{left:_,right:C}=N();d.current.style.width=d.current.scrollWidth+"px",d.current.style.marginRight=C,d.current.style.marginLeft=_,d.current.offsetHeight,s?.(!0)},onExiting:()=>{d.current.style.marginRight="0px",d.current.style.marginLeft="0px",d.current.style.width="0px"},onExited:()=>{g?.(),s?.(!1),l?.(!1)},classNames:"rac-slide-left",unmountOnExit:i,timeout:b,nodeRef:d,in:R,...v,children:h.jsx("div",{className:e,ref:d,style:{transition:`width ${b}ms, color ${b}ms, background-color ${b}ms, margin ${b}ms ease`,willChange:"width",overflow:"hidden",...j},children:x})})}),ht=t.memo(({element:e,index:n,setEntering:s,leaving:c,setLeaving:l,setSpacer:x,selectRef:b,spacer:g,delSpacer:j,setVisibility:i,setActiveHoverId:v,activeHoverId:k,swipedId:d,deleteInline:R,remove:N,renderIcon:_,DelIcon:C,normalizedOptions:O,swiped:L,onSwipe:I,deleting:H,setDeleting:Z,onRender:Q,duration:G,showDelete:U})=>{const u=t.useRef(null),D=t.useRef(!1),le=t.useRef(!1),F=t.useRef(0),q=t.useRef(null),fe=t.useCallback(o=>{F.current=o.touches[0].clientX,D.current=!1,u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{Z(!0),D.current=!0,b.current?.focus(),i(!1),window.navigator.vibrate&&window.navigator.vibrate(50)},600),o.preventDefault()},[]),V=t.useCallback(o=>{u.current&&clearTimeout(u.current);const m=o.touches[0].clientX,S=F.current-m;Math.abs(S)>10&&(le.current=!0,S>30&&!L?(v(null),I(e.id)):S<-30&&L&&I(null))},[e.id,L,I]),re=t.useCallback(o=>{u.current&&clearTimeout(u.current),D.current&&o.preventDefault()},[]);let P=null;if(e?.jsx)P=e.jsx;else if(e?.name)P=e.name;else if(e?.raw!==void 0){const o=O.find(m=>m.raw===e.raw||m.original===e.raw||m.userId===e.raw);o&&(P=o.jsx??o.name)}P==null&&(P=typeof e=="object"?e.label??e.name??e.value??"Selected item":String(e));const ie=t.useCallback(o=>{o.stopPropagation(),o.preventDefault()},[]),E=t.useCallback(o=>{ie(o),N(e.id),I(null)},[e.id,N,I]),W=t.useCallback(o=>{if(ie(o),D.current){D.current=!1;return}if(H){E(o);return}},[H,E]);t.useLayoutEffect(()=>{if(q.current&&Q){const o=q.current.offsetWidth;Q(o)}},[Q,P]);const r=U?!0:k===e.id||d===e.id||H;return h.jsxs(t.Fragment,{children:[h.jsxs("div",{className:`rac-multiple-selected-option ${H?"--deleting-shake":""}`,onMouseEnter:()=>{v(e.id),I(null)},onMouseLeave:()=>v(null),onTouchStart:fe,onTouchMove:V,onTouchEnd:re,onClick:W,ref:q,children:[P,h.jsx(Ae,{style:{backgroundColor:H||R?"transparent":"--rac-multiple-del-bg",position:H||R?"relative":"absolute"},className:"rac-multiple-del",visibility:r,setEntering:s,setLeaving:l,setSpacer:x,duration:G,children:_(C,{onClick:E,onMouseDown:ie})})]}),h.jsx(Ae,{visibility:!c&&!g?.state&&!k&&!d&&!H&&R&&j,className:"rac-multiple-option",style:{visibility:"hidden"},children:h.jsx("div",{style:{padding:0,marginRight:0,marginLeft:0},className:"rac-multiple-selected-option",children:_(C)})})]})}),st=({children:e,setLeaving:n,duration:s,setSpacer:c,id:l=null,widthMode:x=!1,...b})=>{const g=t.useRef(null),j=t.useCallback(()=>{if(!g.current)return{t:0,b:0,l:0,r:0};const i=window.getComputedStyle(g.current);return{t:i.marginTop,b:i.marginBottom,l:i.marginLeft,r:i.marginRight}},[]);return h.jsx(Me.CSSTransition,{classNames:"rac-slide-left",timeout:s,nodeRef:g,unmountOnExit:!0,...b,onEnter:()=>{const i=g.current;i&&(x?(i.style.width="0px",i.style.marginLeft="0px",i.style.marginRight="0px"):(i.style.height="0px",i.style.marginTop="0px",i.style.marginBottom="0px",i.style.transform="translateY(-10px)"),i.style.opacity="0")},onEntering:()=>{const i=g.current,v=j();i.offsetHeight,x?(i.style.width=i.scrollWidth+"px",i.style.marginRight=v.r,i.style.marginLeft=v.l):(i.style.height=i.scrollHeight+"px",i.style.transform="translateY(0)",i.style.marginBottom=v.b,i.style.marginTop=v.t),i.style.opacity="1"},onEntered:()=>{const i=g.current;i.style.width=x?"auto":"",i.style.height=x?"":"100%",i.style.opacity="1",i.style.transform="",c?.(!1)},onExit:()=>{const i=g.current,v=j();x?(i.style.width=i.offsetWidth+"px",i.style.marginRight=v.r,i.style.marginLeft=v.l):(i.style.height=i.offsetHeight+"px",i.style.position="absolute",i.style.marginBottom=v.b,i.style.marginTop=v.t),i.style.opacity="1",n?.(!0)},onExiting:()=>{const i=g.current;x?(i.style.marginRight="0px",i.style.marginLeft="0px",i.style.width="0px"):(i.style.transform="translateY(10px)",i.style.marginBottom="0px",i.style.marginTop="0px",i.style.height="0px"),i.style.opacity="0"},onExited:()=>{c?.(!1),n?.(!1)},children:h.jsx("div",{ref:g,id:l,style:{transition:`all ${s}ms ease`,alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",display:"flex",left:0,top:0},children:e})})},mt=t.memo(({element:e,index:n,setEntering:s,leaving:c,setLeaving:l,selectRef:x,setVisibility:b,setActiveHoverId:g,delSpacer:j,swiped:i,swipedId:v,onSwipe:k,activeHoverId:d,deleteInline:R,spacer:N,duration:_,normalizedOptions:C,setDeleting:O,renderIcon:L,deleting:I,DelIcon:H,remove:Z,registerItemWidth:Q,setSpacer:G,showDelete:U,...u})=>h.jsxs(t.Fragment,{children:[h.jsx(st,{className:"rac-multiple-option",onEnter:u.onEnter,setLeaving:l,setSpacer:G,onExit:u.onExit,duration:_,id:e.id,in:u.in,widthMode:!0,children:h.jsx(ht,{onRender:D=>Q(e.id,D),normalizedOptions:C,setActiveHoverId:g,activeHoverId:d,setVisibility:b,deleteInline:R,setDeleting:O,setEntering:s,setLeaving:l,renderIcon:L,showDelete:U,setSpacer:G,selectRef:x,delSpacer:j,duration:_,deleting:I,swipedId:v,onSwipe:k,element:e,DelIcon:H,leaving:c,swiped:i,remove:Z,spacer:N,index:n},e.id??n)}),N.state&&N.id===e.id&&h.jsx("div",{style:{width:N.width-2},className:"rac-spacer"})]}));function yt({visibility:e,children:n,selectRef:s,onAnimationDone:c,unmount:l=!0,duration:x,easing:b,offset:g,animateOpacity:j,style:i,className:v,setBottomDirection:k=()=>{}}){const d=t.useRef(null),[R,N]=t.useState({top:0,left:0,width:0}),_=t.useRef(R);t.useLayoutEffect(()=>{_.current=R},[R]);const C=t.useCallback(()=>{if(s?.current){const u=s.current.getBoundingClientRect(),D=window.innerHeight,le=d.current?.scrollHeight||250,F=D-u.bottom,q=F<le&&u.top>F;k(q),N({top:u.top,bottom:u.bottom,left:u.left,width:u.width,isUpward:q})}},[s]);t.useLayoutEffect(()=>{if(e)return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[e,C]);const O=`height var(--rac-duration) ${b}${j?`, opacity var(--rac-duration) ${b}`:""}`;t.useLayoutEffect(()=>{if(!s?.current)return;const u=new ResizeObserver(D=>{for(let le of D)if(e&&d.current&&s.current){const F=s.current.getBoundingClientRect(),{isUpward:q}=_.current;d.current.style.width=`${F.width}px`,d.current.style.left=`${F.left}px`,q?d.current.style.bottom=`${window.innerHeight-F.top+g}px`:d.current.style.top=`${F.bottom+g}px`}});return u.observe(s.current),()=>u.disconnect()},[s,e,g]);const L={position:"fixed","--rac-duration":`${x}ms`,"--rac-easing":b,left:`${R.left}px`,width:`${R.width}px`,overflow:"hidden",zIndex:"2147483647",height:e?"auto":"0px",opacity:j?e?1:0:1,pointerEvents:e?"all":"none",boxSizing:"border-box",transformOrigin:R.isUpward?"bottom":"top",...R.isUpward?{bottom:`${window.innerHeight-R.top+g}px`,top:"auto"}:{top:`${R.bottom+g}px`,bottom:"auto"},...Object.fromEntries(Object.entries(i||{}).map(([u,D])=>[u.startsWith("--")?u:`--rac-${u.replace(/([A-Z])/g,"-$1").toLowerCase()}`,D]))},I=t.useCallback(()=>{const u=d.current;u&&(u.style.height="0px",j&&(u.style.opacity="0"),u.style.transition="")},[j]),H=t.useCallback(()=>{const u=d.current;u&&(u.style.transition=O,u.style.height=`${u.scrollHeight}px`,j&&(u.style.opacity="1"))},[O,j]),Z=t.useCallback(()=>{const u=d.current;u&&(u.style.height="auto",u.style.transition="",c&&c())},[c]),Q=t.useCallback(()=>{const u=d.current;u&&(u.style.height=`${u.scrollHeight}px`,j&&(u.style.opacity="1"),u.offsetHeight,u.style.transition=O)},[O,j]),G=t.useCallback(()=>{const u=d.current;u&&(u.style.height="0px",j&&(u.style.opacity="0"))},[j]),U=t.useCallback(()=>{const u=d.current;u&&(u.style.transition="")},[]);return ct.createPortal(h.jsx(Me.CSSTransition,{in:e,timeout:x,classNames:"rac-options",unmountOnExit:l,nodeRef:d,onEnter:I,onEntering:H,onEntered:Z,onExit:Q,onExiting:G,onExited:U,children:h.jsx("div",{ref:d,className:`rac-options ${v||""}`,style:{...L,"--rac-duration":`${x}ms`,"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-base":"var(--rac-duration)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)"},onMouseDown:u=>u.preventDefault(),children:n})}),document.body)}const bt=t.memo(yt,(e,n)=>e.visibility===n.visibility&&e.duration===n.duration&&e.easing===n.easing&&e.offset===n.offset&&e.animateOpacity===n.animateOpacity&&e.selectRef===n.selectRef&&e.children===n.children&&JSON.stringify(e.style)===JSON.stringify(n.style)),tt=e=>{const n=window.getComputedStyle(e);return parseFloat(n.marginLeft)+parseFloat(n.marginRight)},rt=e=>e.reduce((n,s)=>{const c=s.offsetTop,l=s.getBoundingClientRect().width;return n[c]=(n[c]||0)+l,n},{}),xt=t.memo(({deleteInline:e,selectRef:n,setVisibility:s,selectId:c,removeOption:l,renderOptions:x,selected:b,selectedIDs:g,setSelectedIds:j,normalizedOptions:i,title:v,visibility:k,active:d,hasOptions:R,hasActualValue:N,optionsClassName:_,selectedText:C,disabled:O,loading:L,error:I,registerOption:H,unregisterOption:Z,handleBlur:Q,handleFocus:G,toggleVisibility:U,handleKeyDown:u,handleListScroll:D,setAnimationFinished:le,clear:F,children:q,placeholder:fe,className:V,style:re,duration:P,easing:ie,offset:E,animateOpacity:W,unmount:r,OpenIcon:o,ClearIcon:m,DelIcon:S,renderIcon:ce,hasMore:a,loadButton:y,deleting:p,setDeleting:$,showDelete:T})=>{const[Y,ue]=t.useState(!1),[oe,xe]=t.useState(null),[ee,f]=t.useState(!1),[A,ne]=t.useState({}),[he,z]=t.useState(null),[ke,X]=t.useState(null),[be,ve]=t.useState(!1),[te,Re]=t.useState(!1),$e=t.useRef(!0),Se=t.useRef(null),We=t.useCallback(J=>{l?l(J):j(B=>B.filter(ae=>ae.id!==J))},[l,j]),Ye=t.useCallback(J=>{if(p){J.stopPropagation(),J.preventDefault(),$(!1);return}U(J)},[p,U]),Ge=t.useCallback((J,B)=>{ne(ae=>ae[J]===B?ae:{...ae,[J]:B})},[]);t.useLayoutEffect(()=>{const J=Se.current;if(!J)return;const B=new ResizeObserver(ae=>{window.requestAnimationFrame(()=>{if(!Array.isArray(ae)||!ae.length)return;const Oe=ae[0].contentRect.height;xe(Oe)})});return B.observe(J),()=>B.disconnect()},[]),t.useEffect(()=>{$e.current=!1,n&&(typeof n=="function"?n(n.current):n.current=n.current)},[n]),t.useEffect(()=>{p&&k&&U()&&U?.()(p&&g?.length===0)&&$(!1),X(null)},[g?.length,p]),t.useLayoutEffect(()=>{const J=Se.current;if(!J||!g?.length||p){g?.length||f({state:!1,id:null,width:0});return}const B=Array.from(J.children).filter(ye=>ye.classList.contains("rac-multiple-option")),ae=J.clientWidth;if(B.length>g.length){const ye=new Set(g.map(me=>me.id)),Ee=B.findIndex(me=>!ye.has(me.id));if(Ee===-1)return;const de=B[Ee],ge=B[Ee-1];if(!(ge&&de.offsetTop!==ge.offsetTop)){f({state:!1,id:null,width:0});return}const Le=rt(B),Pe=Object.keys(Le).map(Number).sort((me,je)=>me-je),M=Pe.indexOf(de.offsetTop);if(M<=0){f({state:!1,id:null,width:0});return}const K=Pe[M-1],se=Le[K],pe=ae-se;Oe(ge?.id||null,!0,pe)}else if(B.length===g.length){const ye=B[B.length-1],Ee=g[g.length-1]?.id,de=A[Ee];if(!de)return;const ge=ye?.firstElementChild||ye,Ne=tt(ge),Le=tt(ye),Pe=B.slice(0,-1),M=rt(Pe),K=Object.keys(M).map(Number).sort((je,w)=>je-w);let se=ae;if(K.length>0){const je=Math.max(...K);se=ae-(M[je]||0)}const pe=de+Ne+Le>se,me=g[g.length-2]?.id;Oe(me,pe,se)}function Oe(ye,Ee,de){f(ge=>ge.id===ye&&ge.state===Ee&&ge.width===de?ge:{state:Ee,id:ye,width:de})}},[g,A,p]);const Ce=m&&N&&R&&!O&&!L&&!I&&!p,Te=o&&d&&!p,Ue=g?.map((J,B)=>{const ae=B===g.length-1;return h.jsx(mt,{normalizedOptions:i,registerItemWidth:Ge,setActiveHoverId:X,swiped:he===J.id,activeHoverId:ke,setVisibility:s,deleteInline:e,setDeleting:$,setEntering:Re,setLeaving:ve,renderIcon:ce,showDelete:T,selectRef:n,setSpacer:f,onSwipe:z,delSpacer:ae,duration:P,deleting:p,swipedId:he,leaving:be,element:J,DelIcon:S,spacer:ee,remove:We,index:B},J.id??B)});return h.jsxs(Ve.Provider,{value:{registerOption:H,unregisterOption:Z},children:[q,h.jsxs("div",{ref:n,style:{"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)","--rac-duration-base":"var(--rac-duration)","--rac-duration":`${P}ms`,...re},className:`
7
- ${!R||O?"rac-disabled-style":""}
6
+ <%s key={someKey} {...props} />`,Y,p,b,p),O[p+Y]=!0)}if(p=null,_!==void 0&&(s(_),p=""+_),u(v)&&(s(v.key),p=""+v.key),"key"in v){_={};for(var T in v)T!=="key"&&(_[T]=v[T])}else _=v;return p&&S(_,typeof r=="function"?r.displayName||r.name||"Unknown":r),E(r,p,_,i(),Q,o)}function R(r){g(r)?r._store&&(r._store.validated=1):typeof r=="object"&&r!==null&&r.$$typeof===z&&(r._payload.status==="fulfilled"?g(r._payload.value)&&r._payload.value._store&&(r._payload.value._store.validated=1):r._store&&(r._store.validated=1))}function g(r){return typeof r=="object"&&r!==null&&r.$$typeof===k}var N=n,k=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),X=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),W=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),q=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),L=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,B=Object.prototype.hasOwnProperty,V=Array.isArray,x=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(r){return r()}};var P,G={},F=N.react_stack_bottom_frame.bind(N,h)(),d=x(a(h)),O={};ye.Fragment=D,ye.jsx=function(r,v,_){var Y=1e4>L.recentlyCreatedOwnerStacks++;return l(r,v,_,!1,Y?Error("react-stack-top-frame"):F,Y?x(a(r)):d)},ye.jsxs=function(r,v,_){var Y=1e4>L.recentlyCreatedOwnerStacks++;return l(r,v,_,!0,Y?Error("react-stack-top-frame"):F,Y?x(a(r)):d)}})()),ye}var $e;function ze(){return $e||($e=1,process.env.NODE_ENV==="production"?Ee.exports=Fe():Ee.exports=We()),Ee.exports}var f=ze();const Ne=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://w3.org/2000/svg","aria-label":"Clear selection",className:e,viewBox:"0 0 320 512",fill:"currentColor",role:"button",height:"1em",width:"1em",...t,children:f.jsx("path",{d:"M310.6 361.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L160 301.3 54.6 406.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L114.7 256 9.4 150.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 210.7 265.4 105.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3L205.3 256l105.3 105.4z"})}),Be=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://w3.org/2000/svg",className:e,viewBox:"0 0 448 512",fill:"currentColor",height:"1em",width:"1em",...t,children:f.jsx("path",{d:"M34.9 289.5l175.9-175.8c9.4-9.4 24.6-9.4 33.9 0L420.1 289.5c15.1 15.1 4.4 41-17 41H51.9c-21.4 0-32.1-25.9-17-41z"})}),Ge=({className:e="",...t})=>f.jsx("svg",{xmlns:"http://w3.org/2000/svg",className:e,viewBox:"0 0 24 24",fill:"currentColor",height:"1em",width:"1em",...t,children:f.jsx("path",{d:"M20.285 6.708a1 1 0 0 0-1.414-1.416l-9.192 9.192-4.243-4.244a1 1 0 1 0-1.414 1.416l5 5a1 1 0 0 0 1.414 0l9.849-9.948z"})}),Ye=e=>({loadingTitle:e.loadButton?e.loadButtonText:e.loadMoreText,internalVisibility:!1,animationFinished:!1,deleting:!1,jsxOptions:[]}),Ve=(e,t)=>{if(t.type==="SET"){const s=t.payload;return{...e,...typeof s=="function"?s(e):s}}return e},fe=(e,t)=>{if(!e)return null;const s=(a={})=>({...t,...a,style:{...t?.style,...a?.style}});if(typeof e=="string")return f.jsx("img",{src:e,...s(),alt:""});if(n.isValidElement(e))return n.cloneElement(e,s(e.props));if(typeof e=="function"||typeof e=="object"&&e.$$typeof){const a=e;return f.jsx(a,{...s()})}return null},Je=(e,t,s,a,i,h,u,S)=>{const j=S?.some(E=>E.id===e.id);return e.groupHeader?"rac-select-option rac-group-option":["rac-select-option",e.className,(j||a===e.id)&&"rac-selected",t===s&&"rac-highlighted",(e.disabled||e.loading)&&"rac-disabled-option",(e.invalid||e.name===u)&&"rac-invalid-option",e.loadMore&&i===h&&"rac-loading-option",typeof e.raw=="boolean"&&(e.raw?"rac-true-option":"rac-false-option")].filter(Boolean).join(" ")},Se=n.createContext(null),Te=e=>{const t=window.getComputedStyle(e);return parseFloat(t.marginLeft)+parseFloat(t.marginRight)},Oe=e=>e.reduce((t,s)=>{const a=s.getBoundingClientRect(),i=a.top,h=a.width;return t[i]=(t[i]||0)+h,t},{}),qe={bottomDirection:!1,selectHeight:null,spacer:{state:!1,id:null,width:0},activeHoverId:null,hoverRowTop:null,spacerWidths:{},entering:!1,swipedId:null,leaving:!1,rowEndIds:[],delWidth:0};function Ue(e,t){switch(t.type){case"SET":return{...e,...t.payload};case"SET_SPACER_WIDTH":return{...e,spacerWidths:{...e.spacerWidths,[t.id]:t.width}};default:return e}}const Xe=e=>{const{selectedIDs:t,deleting:s,setDeleting:a,toggleVisibility:i,visibility:h,removeOption:u,setselectedIDs:S,selectRef:j,deleteInline:E}=e,[l,R]=n.useReducer(Ue,qe),{spacerWidths:g,spacer:N,delWidth:k}=l,C=n.useCallback(c=>R({type:"SET",payload:c}),[]),D=n.useRef(t?.length||0),X=n.useRef(!0),J=n.useRef(null),W=n.useRef(null),Z=n.useCallback(c=>{u?u(c):S(w=>w.filter(z=>z.id!==c))},[u,S]),y=n.useCallback(c=>{if(s){c.stopPropagation(),c.preventDefault(),a(!1);return}i(c)},[s,i]),q=n.useCallback((c,w)=>{g[c]!==w&&R({type:"SET_SPACER_WIDTH",id:c,width:w})},[g]);return n.useLayoutEffect(()=>{const c=J.current;if(!c)return;const w=()=>{C({selectHeight:c.offsetHeight});const I=Array.from(c.children).filter(B=>B.classList.contains("rac-multiple-option"));if(!I.length){C({rowEndIds:[]});return}const K=new Set(t.map(B=>B.id)),L={};I.forEach(B=>{K.has(B.id)&&(L[B.offsetTop]=B.id)}),C({rowEndIds:Object.values(L)})};w();const z=new ResizeObserver(()=>w());return z.observe(c),()=>z.disconnect()},[t]),n.useEffect(()=>{X.current=!1,j&&(typeof j=="function"?j(j.current):j.current=j.current)},[j]),n.useEffect(()=>{s&&h&&i()&&i?.()(s&&t?.length===0)&&a(!1),C({activeHoverId:null})},[t?.length,s]),n.useLayoutEffect(()=>{const c=J.current,w=t?.length||0,z=t[w-1]?.id;if(!c||!t?.length||s){t?.length||C({spacer:{state:!1,id:null,width:0},entering:null});return}const I=Array.from(c.children).filter(V=>V.classList.contains("rac-multiple-option")),K=w!==D.current||I.length!==w||z&&g[z]&&!D.currentWidths?.[z];if(!c||!w||s||!K){!w&&K&&C({spacer:{state:!1,id:null,width:0},entering:null}),D.current=w,D.currentWidths=g;return}D.current=w,D.currentWidths=g;const L=c.getBoundingClientRect().width;if(I.length>t.length){const V=new Set(t.map(Q=>Q.id)),x=I.findIndex(Q=>!V.has(Q.id));if(x===-1)return;const P=I[x],G=I[x-1];if(!(G&&P.getBoundingClientRect().top!==G.getBoundingClientRect().top)){C({spacer:{state:!1,id:null,width:0},entering:null});return}const d=Oe(I),O=Object.keys(d).map(Number).sort((Q,o)=>Q-o),r=O.indexOf(P.getBoundingClientRect().top);if(r<=0){C({spacer:{state:!1,id:null,width:0},entering:null});return}const v=O[r-1],_=d[v],Y=L-_;B(G?.id||null,!0,Y)}else if(I.length===t.length){const V=I[I.length-1],x=t[t.length-1]?.id,P=g[x];if(!P)return;const G=V?.firstElementChild||V,F=Te(G),d=Te(V),O=I.slice(0,-1),r=Oe(O),v=Object.keys(r).map(Number).sort((o,p)=>o-p);let _=L;if(v.length>0){const o=Math.max(...v);_=L-(r[o]||0)}const Y=P+F+d>_-k+.1,Q=t[t.length-2]?.id;B(Q,Y,_)}function B(V,x,P){N.id===V&&N.state===x&&N.width===P||C({spacer:{state:x,id:V,width:P},entering:x?V:null})}},[t,g,s]),n.useLayoutEffect(()=>{if(W.current){const c=W.current.getBoundingClientRect(),w=Te(W.current.firstElementChild||W.current);C({delWidth:c.width+w})}},[W]),{state:l,setState:C,optionRef:J,firstMount:X,remove:Z,safeToggle:y,registerItemWidth:q,delIcon:W,delWidth:k}},pe=n.forwardRef(({className:e="",visibility:t=void 0,setLeaving:s,setEntering:a,setSpacer:i,children:h,duration:u=300,unmount:S,style:j,exit:E=!0,...l},R)=>{const g=n.useRef(null),N=t!==void 0?t:l.in;n.useImperativeHandle(R,()=>g.current),n.useEffect(()=>{!N&&g.current&&(g.current.style.width="0px")},[]);const k=n.useCallback(()=>{if(!g.current)return{left:"0px",right:"0px"};const C=window.getComputedStyle(g.current);return{left:C.marginLeft,right:C.marginRight}},[]);return f.jsx(he.CSSTransition,{onEnter:()=>{g.current.style.transition="none",g.current.style.marginRight="0px",g.current.style.marginLeft="0px",g.current.style.width="0px",a?.(!0)},onEntering:()=>{const{left:C,right:D}=k();requestAnimationFrame(()=>{requestAnimationFrame(()=>{g.current&&(g.current.style.transition=`width ${u}ms, color ${u}ms, background-color ${u}ms, margin ${u}ms ease`,g.current.style.width=g.current.scrollWidth+"px",g.current.style.marginRight=D,g.current.style.marginLeft=C)})})},onEntered:()=>{g.current.style.width="auto",i?.(!1),a?.(!1)},onExit:()=>{const{left:C,right:D}=k();g.current.style.width=g.current.scrollWidth+"px",g.current.style.marginRight=D,g.current.style.marginLeft=C,g.current.offsetHeight,s?.(!0)},onExiting:()=>{g.current.style.marginRight="0px",g.current.style.marginLeft="0px",g.current.style.width="0px"},onExited:()=>{S?.(),s?.(!1),i?.(!1)},classNames:"rac-slide-left",unmountOnExit:E,timeout:u,nodeRef:g,in:N,...l,children:f.jsx("div",{className:e,ref:g,style:{transition:`width ${u}ms, color ${u}ms, background-color ${u}ms, margin ${u}ms ease`,willChange:"width",overflow:"hidden",...j},children:h})})}),Ke=n.memo(({element:e,setState:t,spacer:s,delWidth:a,selectRef:i,setVisibility:h,activeHoverId:u,hoverRowTop:S,swipedId:j,deleteInline:E,remove:l,DelIcon:R,normalizedOptions:g,swiped:N,deleting:k,entering:C,setDeleting:D,onRender:X,duration:J,rowEnd:W,showDelete:Z})=>{const y=n.useRef({longPressTimer:null,hoverTimer:null,longPress:!1,swiping:!1,touchStart:0}),q=n.useRef(null),c=n.useCallback(d=>{y.current.touchStart=d.touches[0].clientX,y.current.longPress=!1,y.current.longPressTimer&&clearTimeout(y.current.longPressTimer),y.current.longPressTimer=setTimeout(()=>{D(!0),y.current.longPress=!0,i.current?.focus(),h(!1),window.navigator.vibrate&&window.navigator.vibrate(50)},600),d.preventDefault()},[]),w=n.useCallback(d=>{y.current.longPressTimer&&clearTimeout(y.current.longPressTimer);const O=d.touches[0].clientX,r=y.current.touchStart-O;Math.abs(r)>10&&(y.current.swiping=!0,r>30&&!N?t({activeHoverId:null,swipedId:e.id}):r<-30&&N&&t({swipedId:null}))},[e.id,N]),z=n.useCallback(d=>{y.current.longPressTimer&&clearTimeout(y.current.longPressTimer),y.current.longPress&&d.preventDefault()},[]),I=n.useCallback(()=>{s?.state||(y.current.hoverTimer&&clearTimeout(y.current.hoverTimer),y.current.hoverTimer=setTimeout(()=>{t({hoverRowTop:q.current?.getBoundingClientRect().top,activeHoverId:e.id,swipedId:null})},100))},[e.id,s?.state]),K=n.useCallback(()=>{y.current.hoverTimer&&clearTimeout(y.current.hoverTimer),y.current.hoverTimer=setTimeout(()=>t({activeHoverId:null,hoverRowTop:null}),100)},[]);n.useEffect(()=>{!s?.state&&q.current&&q.current.matches(":hover")&&I()},[s?.state,I]),n.useEffect(()=>()=>{y.current.hoverTimer&&clearTimeout(y.current.hoverTimer),y.current.longPressTimer&&clearTimeout(y.current.longPressTimer)},[]);let L=null;if(e?.jsx)L=e.jsx;else if(e?.name)L=e.name;else if(e?.raw!==void 0){const d=g.find(O=>O.raw===e.raw||O.original===e.raw||O.userId===e.raw);d&&(L=d.jsx??d.name)}L==null&&(L=typeof e=="object"?e.label??e.name??e.value??"Selected item":String(e));const B=n.useCallback(d=>{d.stopPropagation(),d.preventDefault()},[]),V=n.useCallback(d=>{t({swipedId:null}),l(e.id),B(d)},[e.id,l]),x=n.useCallback(d=>{B(d),y.current.longPress?y.current.longPress=!1:k&&V(d)},[k,V]);n.useLayoutEffect(()=>{if(q.current&&X){const{width:d}=q.current.getBoundingClientRect();X(d)}},[X,L]);const P=Z?!0:u===e.id||j===e.id||k,G=S===q.current?.getBoundingClientRect().top,F=(u||j)&&G;return f.jsxs(n.Fragment,{children:[f.jsxs("div",{className:`rac-multiple-selected-option ${k?"--deleting-shake":""}`,onTouchStart:c,onTouchMove:w,onTouchEnd:z,onMouseEnter:I,onMouseLeave:K,onClick:x,ref:q,children:[L,f.jsx(pe,{style:{backgroundColor:k||E?"transparent":"--rac-multiple-del-bg",position:k||E?"relative":"absolute"},setEntering:d=>t({entering:d}),setLeaving:d=>t({leaving:d}),setSpacer:d=>t({spacer:d}),className:"rac-multiple-del",visibility:P,duration:J,children:fe(R,{onClick:V,onMouseDown:B})})]}),!Z&&!k&&E&&W&&C!==e.id&&f.jsx("div",{style:{minWidth:F?"0px":`${a}px`,transition:`min-width ${J}ms ease`,"--del-width":`${a}px`,flexBasis:"0px",height:"1px",flexShrink:1},className:"rac-del-spacer"})]})}),Ae=({children:e,setLeaving:t,duration:s,setSpacer:a,setEntering:i,id:h=null,widthMode:u=!1,...S})=>{const j=n.useRef(null),E=n.useCallback(()=>{if(!j.current)return{t:0,b:0,l:0,r:0};const l=window.getComputedStyle(j.current);return{t:l.marginTop,b:l.marginBottom,l:l.marginLeft,r:l.marginRight}},[]);return f.jsx(he.CSSTransition,{classNames:"rac-slide-left",timeout:s,nodeRef:j,unmountOnExit:!0,...S,onEnter:()=>{const l=j.current;l&&(u?(l.style.width="0px",l.style.marginLeft="0px",l.style.marginRight="0px"):(l.style.height="0px",l.style.marginTop="0px",l.style.marginBottom="0px",l.style.transform="translateY(-10px)"),l.style.opacity="0")},onEntering:()=>{const l=j.current,R=E();l.offsetHeight,u?(l.style.width=l.scrollWidth+"px",l.style.marginRight=R.r,l.style.marginLeft=R.l):(l.style.height=l.scrollHeight+"px",l.style.transform="translateY(0)",l.style.marginBottom=R.b,l.style.marginTop=R.t),l.style.opacity="1"},onEntered:()=>{const l=j.current;l.style.width=u?"auto":"",l.style.height=u?"":"100%",l.style.opacity="1",l.style.transform="",i?.(!1),a?.(!1)},onExit:()=>{const l=j.current,R=E();u?(l.style.width=l.offsetWidth+"px",l.style.marginRight=R.r,l.style.marginLeft=R.l):(l.style.height=l.offsetHeight+"px",l.style.position="absolute",l.style.marginBottom=R.b,l.style.marginTop=R.t),l.style.opacity="1",t?.(!0)},onExiting:()=>{const l=j.current;u?(l.style.marginRight="0px",l.style.marginLeft="0px",l.style.width="0px"):(l.style.transform="translateY(10px)",l.style.marginBottom="0px",l.style.marginTop="0px",l.style.height="0px"),l.style.opacity="0"},onExited:()=>{a?.(!1),t?.(!1)},children:f.jsx("div",{ref:j,id:h,style:{transition:`all ${s}ms ease`,alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",display:"flex",left:0,top:0},children:e})})},Ze=n.memo(({element:e,index:t,spacer:s,duration:a,setState:i,...h})=>f.jsxs(n.Fragment,{children:[f.jsx(Ae,{setEntering:u=>i({entering:u}),setLeaving:u=>i({leaving:u}),setSpacer:u=>i({spacer:u}),className:"rac-multiple-option",onEnter:h.onEnter,onExit:h.onExit,duration:a,id:e.id,in:h.in,widthMode:!0,children:f.jsx(Ke,{onRender:u=>h.registerItemWidth(e.id,u),setState:i,duration:a,element:e,spacer:s,index:t,...h})}),s.state&&s.id===e.id&&f.jsx("div",{style:{width:s.width},className:"rac-spacer"})]}));function Qe({visibility:e,selectRef:t,setBottomDirection:s}){const a=n.useRef(250);n.useLayoutEffect(()=>{if(!t.current)return;const i=document.createElement("div");i.className="rac-select-list",i.style.visibility="hidden",i.style.position="absolute",document.body.appendChild(i);const h=parseInt(window.getComputedStyle(i).maxHeight);h&&(a.current=h),document.body.removeChild(i);const u=new ResizeObserver(j=>{for(let E of j){const l=E.borderBoxSize?.[0]?.blockSize||E.contentRect.height;l>0&&(a.current=l)}}),S=new IntersectionObserver(j=>{e||j.forEach(E=>{const l=E.boundingClientRect,R=window.innerHeight-l.bottom;s(R<a.current)})},{threshold:[0,1]});return S.observe(t.current),()=>{S.disconnect(),u.disconnect()}},[t,e,s])}function et({visibility:e,bottomDirection:t,children:s,selectRef:a,onAnimationDone:i,unmount:h=!0,duration:u,easing:S,offset:j,animateOpacity:E,style:l,className:R,setBottomDirection:g=()=>{}}){const N=n.useRef(null),k=n.useCallback(()=>{if(!a?.current||!N.current)return;const c=a.current.getBoundingClientRect(),w=N.current,z=w.scrollHeight||250,I=window.innerHeight-c.bottom,K=I<z&&c.top>I;K!==t&&g(K),w.style.width=`${c.width}px`,w.style.left=`${c.left}px`,K?(w.style.top="auto",w.style.bottom=`${window.innerHeight-c.top+j}px`,w.style.transformOrigin="bottom"):(w.style.bottom="auto",w.style.top=`${c.bottom+j}px`,w.style.transformOrigin="top")},[a,t,j,g]);n.useLayoutEffect(()=>{if(e){k(),window.addEventListener("scroll",k,{capture:!0,passive:!0}),window.addEventListener("resize",k);const c=new ResizeObserver(k);return a.current&&c.observe(a.current),()=>{window.removeEventListener("scroll",k,{capture:!0,passive:!0}),window.removeEventListener("resize",k),c.disconnect()}}},[e,k,a]);const C=`height var(--rac-duration) ${S}${E?`, opacity var(--rac-duration) ${S}`:""}`,D={opacity:E?e?1:0:1,transformOrigin:t?"bottom":"top",pointerEvents:e?"all":"none",height:e?"auto":"0px","--rac-duration":`${u}ms`,boxSizing:"border-box","--rac-easing":S,zIndex:"2147483647",overflow:"hidden",position:"fixed",...Object.fromEntries(Object.entries(l||{}).map(([c,w])=>[c.startsWith("--")?c:`--rac-${c.replace(/([A-Z])/g,"-$1").toLowerCase()}`,w]))},X=n.useCallback(()=>{const c=N.current;c&&(c.style.height="0px",E&&(c.style.opacity="0"),c.style.transition="")},[E]),J=n.useCallback(()=>{const c=N.current;c&&(c.style.transition=C,c.style.height=`${c.scrollHeight}px`,E&&(c.style.opacity="1"))},[C,E]),W=n.useCallback(()=>{const c=N.current;c&&(c.style.height="auto",c.style.transition="",i&&i())},[i]),Z=n.useCallback(()=>{const c=N.current;c&&(c.style.height=`${c.scrollHeight}px`,E&&(c.style.opacity="1"),c.offsetHeight,c.style.transition=C)},[C,E]),y=n.useCallback(()=>{const c=N.current;c&&(c.style.height="0px",E&&(c.style.opacity="0"))},[E]),q=n.useCallback(()=>{const c=N.current;c&&(c.style.transition="")},[]);return Me.createPortal(f.jsx(he.CSSTransition,{classNames:"rac-options",unmountOnExit:h,onEntering:J,onExiting:y,onEntered:W,onExited:q,timeout:u,nodeRef:N,onEnter:X,in:e,onExit:Z,children:f.jsx("div",{style:{...D,"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)","--rac-duration-base":"var(--rac-duration)","--rac-duration":`${u}ms`},className:`rac-options ${R||""}`,onMouseDown:c=>c.preventDefault(),ref:N,children:s})}),document.body)}const tt=n.memo(et,(e,t)=>e.visibility===t.visibility&&e.duration===t.duration&&e.easing===t.easing&&e.offset===t.offset&&e.animateOpacity===t.animateOpacity&&e.selectRef===t.selectRef&&e.children===t.children&&JSON.stringify(e.style)===JSON.stringify(t.style)),rt=n.memo(e=>{const{state:t,setState:s,optionRef:a,firstMount:i,remove:h,safeToggle:u,registerItemWidth:S,delIcon:j}=Xe(e),{bottomDirection:E,selectHeight:l,swipedId:R,rowEndIds:g,delWidth:N}=t,{selectRef:k,selectId:C,renderOptions:D,selected:X,selectedIDs:J,normalizedOptions:W,title:Z,visibility:y,active:q,hasOptions:c,hasActualValue:w,optionsClassName:z,selectedText:I,disabled:K,loading:L,error:B,registerOption:V,unregisterOption:x,handleBlur:P,handleFocus:G,handleKeyDown:F,handleListScroll:d,setAnimationFinished:O,clear:r,children:v,placeholder:_,className:Y,style:Q,duration:o,easing:p,offset:b,animateOpacity:T,unmount:A,OpenIcon:H,ClearIcon:ee,DelIcon:re,hasMore:le,loadButton:se,deleting:m}=e;Qe({visibility:y,selectRef:k,setBottomDirection:M=>s({bottomDirection:M})});const U=ee&&w&&c&&!K&&!L&&!B&&!m,te=H&&q&&!m,ie=J?.map((M,ue)=>f.jsx(Ze,{rowEnd:g.includes(M.id),registerItemWidth:S,swiped:R===M.id,setState:s,element:M,remove:h,index:ue,...e,...t},M.id));return f.jsxs(Se.Provider,{value:{registerOption:V,unregisterOption:x},children:[v,f.jsxs("div",{ref:k,style:{"--rac-duration-fast":"calc(var(--rac-duration) * 0.5)","--rac-duration-slow":"calc(var(--rac-duration) * 1.3)","--rac-duration-base":"var(--rac-duration)","--rac-duration":`${o}ms`,...Q},className:`
7
+ ${!c||K?"rac-disabled-style":""}
8
8
  ${L?"rac-loading-style":""}
9
- ${I?"rac-error-style":""}
10
- ${V}
9
+ ${B?"rac-error-style":""}
10
+ ${Y}
11
11
  rac-select
12
- `,...d&&{onKeyDown:u,onFocus:G,onClick:Ye,onBlur:Q},"aria-disabled":O||!R,"aria-controls":`${c}-listbox`,tabIndex:d?0:-1,"aria-expanded":k,"aria-label":fe,"aria-haspopup":"listbox",role:"combobox",children:[h.jsx("div",{className:`rac-select-title-wrapper
13
- ${!I&&!L&&b?.type==="boolean"?b.raw?"rac-true-option":"rac-false-option":""}
14
- `,style:{alignItems:g?.length&&!C?"flex-start":"center",height:oe?`${oe}px`:"auto"},children:h.jsx("div",{style:{alignItems:g?.length&&!C?"flex-start":"center",height:L?"100%":"auto"},className:"rac-select-title",ref:Se,children:h.jsx(Me.TransitionGroup,{enter:!$e.current,component:null,appear:!1,children:g?.length&&!C&&!L?Ue:h.jsxs(st,{className:"rac-title-container",duration:P,widthMode:!0,children:[h.jsx("span",{className:"rac-title-text",children:v}),h.jsx(Ae,{className:"rac-loading-container",visibility:L&&!I,duration:P,children:h.jsxs("span",{className:"rac-loading-dots",children:[h.jsx("i",{}),h.jsx("i",{}),h.jsx("i",{})]})})]},v)})})}),h.jsx(Ae,{visibility:Ce||Te,className:"rac-select-buttons",children:h.jsxs(Me.TransitionGroup,{component:null,children:[Ce&&h.jsx(Ae,{style:{display:"grid"},duration:P,children:ce(m,{className:"rac-select-cancel",onMouseDown:J=>{J.preventDefault(),J.stopPropagation()},onClick:F})},"clear-icon")," ",Te&&h.jsx(Ae,{style:{display:"grid"},duration:P,children:ce(o,{className:`rac-select-arrow ${k?"--open":""} ${Y?"":"--up"}`})},"open-button")]})}),h.jsx(bt,{style:{"--rac-duration":`${P}ms`,...re},visibility:k&&i.length,onAnimationDone:()=>le(!0),setBottomDirection:ue,animateOpacity:W,className:_,selectRef:n,duration:P,unmount:r,easing:ie,offset:E,children:h.jsxs("div",{onScroll:D,className:"rac-select-list","aria-label":"Options",role:"listbox",tabIndex:"-1",children:[x,!y&&a&&h.jsxs("div",{className:"rac-select-option rac-disabled-option rac-loading-option",style:{justifyContent:"initial",alignItems:"end",gap:0},onClick:J=>J.stopPropagation(),children:[h.jsx("span",{className:"rac-loading-option-title",children:"Loading"}),h.jsx("div",{className:"rac-loading-container",children:h.jsxs("span",{style:{paddingBottom:"0.1em"},className:"rac-loading-dots",children:[h.jsx("i",{}),h.jsx("i",{}),h.jsx("i",{})]})})]})]})})]})]})}),Et=["group","disabled","options","items","children"],Je=["name","label","id","value"],nt=[],Fe=(e,n=!1)=>{if(n&&typeof e.group=="string")return e.group;const s=Je.find(l=>e[l]!=null&&e[l]!=="");if(s)return String(e[s]);const c=Object.entries(e).find(([l,x])=>!Et.includes(l)&&x!=null&&x!=="");return c?String(c[1]):null};function wt({options:e=nt,jsxOptions:n=nt,value:s,onChange:c,disabled:l=!1,loading:x=!1,error:b=!1,multiple:g=!1,placeholder:j="Choose option",emptyText:i="No options",disabledText:v="Disabled",loadingText:k="Loading",errorText:d="Failed to load",disabledOption:R="Disabled option",emptyOption:N="Empty option",invalidOption:_="Invalid option",setVisibility:C,hasMore:O,loadButton:L,setLoadingTitle:I,loadingTitle:H,loadMoreText:Z,loadMore:Q,childrenFirst:G=!1,groupsClosed:U=!1}){const u=s!==void 0,[D,le]=t.useState(()=>{const a=new Set;if(U)return a;const y=p=>{Array.isArray(p)&&p.forEach($=>{if($&&typeof $=="object"){if(("options"in $||"group"in $&&!Je.some(Y=>Y in $))&&!$.disabled){const Y=Fe($,!0)||"Empty group";a.add(Y)}$.options&&y($.options)}})};return y(e),a}),F=t.useRef(null),q=t.useCallback(a=>{le(y=>{const p=new Set(y);return p.has(a)?p.delete(a):p.add(a),p})},[]),fe=t.useCallback((a,y,p="n",$=null,T=!1)=>{const Y=`${p}-${y}`;if(a==null||a===""||a===void 0)return{name:N,disabled:!0,type:"normal",groupDisabled:T,userId:null,raw:a,group:$,id:Y};if(typeof a=="function")return{id:Y,userId:null,name:_,raw:a,disabled:!0,invalid:!0,type:"normal",group:$};if(typeof a=="object"&&!Array.isArray(a)){const ue=$||a.group||null,oe=T||a.disabled===!0,xe=a.id??a.value??a.name??a.label,ee=a.value!==void 0?a.value:a.id!==void 0?a.id:a;let f=Fe(a)||(oe?R:N);return{id:Y,userId:xe,name:f,raw:ee,original:a,disabled:oe||f===N&&!oe,type:typeof ee=="boolean"?"boolean":"normal",group:ue,groupDisabled:T}}return{id:Y,userId:a,name:String(a),raw:a,original:a,disabled:T,type:typeof a=="boolean"?"boolean":"normal",group:$}},[N,_,R]),V=t.useMemo(()=>{const a=new Map,y=[],p=n.map((f,A)=>{if(f.isGroupMarker)return{...f,type:"group-marker"};const ne=!f.label&&!f.userId&&!f.value&&(f.value===void 0||f.value===null||f.value==="")&&!f.hasJsx;return{...f,id:`jsx-${f.id}`,index:A,userId:f.userId,raw:f.value,original:f.value,name:ne?N:f.label||f.userId||String(f.value||""),disabled:!!f.disabled||ne,type:typeof f.value=="boolean"?"boolean":"normal",group:f.group||null}});let $=0;const T=(f,A=null,ne=!1,he="0")=>{Array.isArray(f)||(f=[f]),f.forEach((z,ke)=>{const X=`${he}-${ke}`,be=z!=null&&typeof z=="object"&&!Array.isArray(z);if(be&&("options"in z||"group"in z&&!Je.some(te=>te in z))){const te=Fe(z,!0)||"Empty group";a.has(te)||a.set(te,{disabled:!!z.disabled,closedByDefault:!!z.disabled||U,items:[]}),z.options?T(z.options,te,ne||!!z.disabled,X):y.push({id:`empty-${te}-${X}`,name:te,group:te,isPlaceholder:!0,type:"group-marker",index:$++})}else if(be&&!Je.some(te=>te in z)&&!z.group)Object.entries(z).forEach(([te,Re],$e)=>{const Se=fe(Re,`${X}-${$e}`,"default",A,ne);y.push({...Se,index:$++})});else{const te=fe(z,X,"default",A,ne);y.push({...te,index:$++})}})};T(e);const Y=G?[...p,...y]:[...y,...p];if(!F.current)F.current=new Map(Y.map((f,A)=>[f.id,A]));else{let f=!1;if(Y.forEach(A=>{F.current.has(A.id)||(f=!0)}),f){const A=new Map;Y.forEach((ne,he)=>{A.set(ne.id,he)}),F.current=A}}const ue=[...Y].sort((f,A)=>{const ne=F.current.get(f.id)??999999,he=F.current.get(A.id)??999999;return ne-he}),oe=[],xe=new Set;ue.forEach(f=>{if(!f.group)oe.push({type:"item",data:f});else{xe.has(f.group)||(xe.add(f.group),oe.push({type:"group",name:f.group}));const A=a.get(f.group)||{items:[]};a.has(f.group)||a.set(f.group,A),f.isGroupMarker?(A.className=f.className,A.style=f.style,f.disabled&&(A.disabled=!0)):f.isPlaceholder||A.items.push(f)}});const ee=[];return oe.forEach(f=>{if(f.type==="item")ee.push(f.data);else{const A=f.name,ne=a.get(A),he=D.has(A);ee.push({className:ne?.className||"",id:`group-header-${A}`,disabled:!!ne?.disabled,style:ne?.style||{},groupHeader:!0,name:A,type:"group",hidden:!1,expanded:he}),ne?.items.forEach(z=>{const ke=D.size>0?!he:!!U;ee.push({...z,hidden:ke})})}}),O&&L&&ee.push({id:"special-load-more-id",name:H,loadMore:!0,loading:H===Z,type:"special"}),ee},[e,n,fe,G,O,L,H,Z,U,D,N]),re=t.useCallback(()=>{if(s==null||Array.isArray(s)&&s.length===0)return{initialId:null,initialIDs:[]};const a=new Set,y=(p,$)=>{let T=V.find(ue=>ue.original===p&&!a.has(ue.id));if(!T&&typeof p=="object")try{const ue=JSON.stringify(p);T=V.find(oe=>oe.original&&typeof oe.original=="object"&&JSON.stringify(oe.original)===ue&&!a.has(oe.id))}catch{}if(T)return a.add(T.id),T;const Y=typeof p=="object"?p.id||p.value||JSON.stringify(p):String(p);return typeof p=="object"&&p!==null?{id:`virtual-${Y}-${$}`,name:Fe(p)||String(p.id||"Selected Object"),raw:p.value??p.id??p,original:p,userId:p.id??p.value??null,virtual:!0}:{id:`virtual-${Y}-${$}`,name:String(p),raw:p,original:p,userId:p,virtual:!0}};if(g)return{initialId:null,initialIDs:(Array.isArray(s)?s:[s]).map((T,Y)=>y(T,Y))};{const p=Array.isArray(s)?s[0]:s;return{initialId:y(p,0).id,initialIDs:[]}}},[u,s,V,g]),[P,ie]=t.useState(()=>re().initialId),[E,W]=t.useState(()=>re().initialIDs),r=t.useMemo(()=>{const a=V.find(y=>y.id===P);if(a)return a;if(!g&&P?.startsWith("virtual-")){const y=Array.isArray(s)?s[0]:s;if(y)return{id:P,name:typeof y=="object"?Fe(y):String(y),original:y}}return null},[P,V,g,u,s]),o=t.useCallback((a,y)=>{if(a.groupHeader){m(y),a.disabled||q(a.name);return}if(a.disabled||a.loadMore){m(y),a.loadMore&&!a.loading&&(I(Z),Q());return}if(g){if(a.disabled||a.groupHeader||a.loadMore){m(y);return}m(y);const $=E?.some(T=>T.id===a.id)?E.filter(T=>T.id!==a.id):[...E,a];W($),c?.($.map(T=>T.original),$.map(T=>T.userId));return}ie(a.id),c?.(a.original,a.userId),C(!1)},[c,C,Q,Z,I,q,g,E]),m=t.useCallback(a=>{a?.stopPropagation(),a?.preventDefault()},[]),S=t.useCallback(()=>{c?.(null,null),ie(null),W([])},[c]),ce=t.useCallback(a=>{const y=E.filter(p=>p.id!==a);W(y),c?.(y.map(p=>p.original),y.map(p=>p.userId))},[E,c]);return{normalizedOptions:V,selected:r,selectOption:o,clear:S,removeOption:ce,hasOptions:V.length>0,active:!b&&!x&&!l&&V.length>0,selectedValue:s,placeholder:j,emptyText:i,disabledText:v,loadingText:k,errorText:d,disabledOption:R,emptyOption:N,invalidOption:_,disabled:l,loading:x,error:b,expandedGroups:D,toggleGroup:q,selectedIDs:E,multiple:g,setSelectedIds:W}}function vt({disabled:e,open:n,setOpen:s,options:c=[],selectOption:l,setDeleting:x,selected:b,selectedIDs:g,multiple:j,hasMore:i,loadMore:v,loadButton:k,loadButtonText:d,setLoadingTitle:R,loadOffset:N,loadAhead:_,expandedGroups:C,onOpen:O,onClose:L,deleting:I}){const H=t.useRef(!1),Z=t.useRef(0),Q=t.useRef(!1),[G,U]=t.useState(-1);t.useEffect(()=>{Q.current=!1,k&&R(d)},[c.length,i,k,d,R]);const u=t.useCallback(()=>{!i||Q.current||(Q.current=!0,v())},[i,v]),D=t.useCallback(E=>{if(k||!i||Q.current)return;const{scrollTop:W,scrollHeight:r,clientHeight:o}=E.currentTarget(r-W<=o+N)&&u()},[k,i,N,u]);t.useEffect(()=>{!k&&n&&i&&G>=c.length-_&&u()},[G,n,i,c.length,_,k,u]),t.useEffect(()=>{const E=()=>{Z.current=Date.now()};return window.addEventListener("focus",E),()=>window.removeEventListener("focus",E)},[]),t.useEffect(()=>{if(!n){U(-1);return}const E=c[G],W=E&&!E.hidden&&!E.groupHeader;if(G>=0&&G<c.length&&W)return;let r=-1;if(b&&!j){const o=j?b[0]:b;o&&(r=c.findIndex(m=>m.id===o.id&&!m.disabled&&!m.hidden&&!m.groupHeader))}if(j&&g.length){const o=new Set(g.map(m=>m.id));r=c.findIndex(m=>o.has(m.id)&&!m.disabled&&!m.hidden&&!m.groupHeader)}r===-1&&(r=c.findIndex(o=>!o.disabled&&!o.hidden&&!o.groupHeader)),U(r)},[n,c,b]);const le=t.useCallback((E,W)=>{const r=S=>S&&!S?.groupHeader&&(!S?.group||C?.has(S?.group))&&!S?.disabled&&!S?.loading,o=c.length;if(o===0)return-1;let m=E;for(let S=0;S<o;S++){if(m=(m+W+o)%o,!k&&i&&(W>0&&m===0||W<0&&m===o-1))return E;if(r(c[m]))return m}return E},[c,i,k,C]),F=t.useCallback(E=>{const W=E.relatedTarget?.closest(".rac-options");!E.currentTarget.contains(E.relatedTarget)&&!W&&(s(!1),x(!1))},[s]),q=t.useCallback(()=>{e||I||document.hidden||Date.now()-Z.current<100||n||(s(!0),H.current=!0,setTimeout(()=>H.current=!1,200))},[e,n,s,I]),fe=t.useRef(n),V=t.useRef(O),re=t.useRef(L);t.useEffect(()=>{V.current=O,re.current=L},[O,L]),t.useEffect(()=>{fe.current!==n&&(n?V.current?.():re.current?.(),fe.current=n)},[n]);const P=t.useCallback(E=>{e||I||E?.target?.closest(".rac-select-cancel")||H.current||s(!n)},[e,n,s,O,L,I]),ie=t.useCallback(E=>{if(!e)switch(E.key){case"Enter":case" ":E.preventDefault(),n?G!==-1&&c[G]&&l(c[G],E):s(!0);break;case"Escape":E.preventDefault(),s(!1);break;case"ArrowDown":E.preventDefault(),n?U(W=>le(W,1)):s(!0);break;case"ArrowUp":E.preventDefault(),n?U(W=>le(W,-1)):s(!0);break;case"Tab":n&&s(!1);break}},[e,n,s,G,c,l,le]);return t.useMemo(()=>({handleBlur:F,handleFocus:q,toggleVisibility:P,handleKeyDown:ie,highlightedIndex:G,setHighlightedIndex:U,handleListScroll:D}),[F,q,P,ie,G,D])}function St({visibility:e,children:n,duration:s=300,className:c}){const l=t.useRef(null),x=t.useCallback(()=>{if(!l.current)return{top:"0px",bottom:"0px"};const b=window.getComputedStyle(l.current);return{top:b.marginTop,bottom:b.marginBottom}},[]);return h.jsx(Me.CSSTransition,{onEnter:()=>{l.current.style.height="0px",l.current.style.marginTop="0px",l.current.style.marginBottom="0px"},onEntering:()=>{const{top:b,bottom:g}=x();l.current.style.height=l.current.scrollHeight+"px",l.current.style.marginBottom=g,l.current.style.marginTop=b},onEntered:()=>l.current.style.height="auto",onExit:()=>{const{top:b,bottom:g}=x();l.current.style.height=l.current.scrollHeight+"px",l.current.style.marginBottom=g,l.current.style.marginTop=b,l.current.offsetHeight},onExiting:()=>{l.current.style.height="0px",l.current.style.marginTop="0px",l.current.style.marginBottom="0px"},classNames:"rac-slide-down",timeout:s,nodeRef:l,in:e,unmountOnExit:!0,children:h.jsx("div",{style:{transition:`height ${s}ms ease, margin ${s}ms ease`,overflow:"hidden"},className:`${c} rac-slide-down-enter-done`,ref:l,tabIndex:-1,children:n})})}const Be=(e,n="invalid-option",s="")=>{const c=s?s.replace(/:/g,""):"";if(typeof e!="string"||!e.trim())return c?`${n}-${c}`:`${n}-${Math.random().toString(36).slice(2,8)}`;const l=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").replace(/[^\p{L}\p{N}-]+/gu,"").toLowerCase();return l?l||`${n}-${Math.random().toString(36).slice(2,8)}`:c?`${n}-${c}`:`${n}-${Math.random().toString(36).slice(2,8)}`},ze=(e,n)=>{if(!e)return null;const s=(c={})=>({...n,...c,style:{...n?.style,...c?.style}});if(typeof e=="string")return h.jsx("img",{src:e,...s(),alt:""});if(t.isValidElement(e))return t.cloneElement(e,s(e.props));if(typeof e=="function"||typeof e=="object"&&e.$$typeof){const c=e;return h.jsx(c,{...s()})}return null},jt=(e,n,s,c,l,x,b,g)=>{const j=g?.some(i=>i.id===e.id);return e.groupHeader?"rac-select-option rac-group-option":["rac-select-option",e.className,(j||c===e.id)&&"rac-selected",n===s&&"rac-highlighted",(e.disabled||e.loading)&&"rac-disabled-option",(e.invalid||e.name===b)&&"rac-invalid-option",e.loadMore&&l===x&&"rac-loading-option",typeof e.raw=="boolean"&&(e.raw?"rac-true-option":"rac-false-option")].filter(Boolean).join(" ")},kt=t.forwardRef(({unmount:e,children:n,visibility:s,setVisibility:c=()=>{},ownBehavior:l=!1,duration:x=300,easing:b="ease-in",offset:g=1,animateOpacity:j=!0,style:i={},className:v="",OpenIcon:k=gt,ClearIcon:d=et,DelIcon:R=et,Checkmark:N=pt,Checkbox:_=void 0,hasMore:C=!1,loadMore:O=()=>console.warn("loadMore not implemented"),loadButton:L=!1,loadButtonText:I="Load more",loadMoreText:H="Loading",selectedText:Z=void 0,loadOffset:Q=100,loadAhead:G=3,optionsClassName:U="",onOpen:u=()=>{},onClose:D=()=>{},deleteInline:le=!1,showDelete:F=!1,...q},fe)=>{const V=t.useId(),re=t.useMemo(()=>V.replace(/:/g,""),[V]),[P,ie]=t.useState([]),[E,W]=t.useState(!1),[r,o]=t.useState(L?I:H),[m,S]=t.useState(!1),ce=t.useRef(null),[a,y]=t.useState(!1),p=t.useCallback(M=>{ie(K=>{const se=K.findIndex(pe=>pe.id===M.id);if(se!==-1){const pe=K[se];if(pe.label===M.label&&pe.value===M.value&&pe.disabled===M.disabled&&pe.group===M.group)return K;const me=[...K];return me[se]=M,me}return[...K,M]})},[]),$=t.useCallback(M=>{ie(K=>{const se=K.filter(pe=>pe.id!==M);return se.length===K.length?K:se})},[]),T=s!==void 0,Y=t.useMemo(()=>l||T?!!s:E,[l,T,s,E]),ue=t.useCallback(M=>{l||(!T&&W(M),c?.(M))},[l,T,c]),oe=wt({...q,setVisibility:ue,jsxOptions:P,hasMore:C,loadButton:L,loadingTitle:r,loadMore:O,loadMoreText:H,setLoadingTitle:o}),{multiple:xe,normalizedOptions:ee,selected:f,selectOption:A,clear:ne,removeOption:he,hasOptions:z,active:ke,selectedValue:X,disabled:be,loading:ve,error:te,placeholder:Re,invalidOption:$e,emptyText:Se,disabledText:We,loadingText:Ye,errorText:Ge,expandedGroups:Ce,selectedIDs:Te,setSelectedIds:Ue}=oe,J=vt({setDeleting:y,setLoadingTitle:o,loadButton:L,loadButtonText:I,hasMore:C,loadMore:O,disabled:be,multiple:xe,open:Y,setOpen:ue,options:ee,selectOption:A,selected:f,loadOffset:Q,loadAhead:G,expandedGroups:Ce,selectedIDs:Te,onOpen:u,onClose:D,deleting:a}),{handleListScroll:B,handleBlur:ae,handleFocus:Oe,toggleVisibility:ye,handleKeyDown:Ee,highlightedIndex:de,setHighlightedIndex:ge}=J;t.useImperativeHandle(fe,()=>ce.current),t.useEffect(()=>{if(!Y){S(!1);return}Y&&ce.current&&document.activeElement!==ce.current&&ce.current.focus()},[Y]),t.useEffect(()=>{(te||be||ve||!z)&&ue(!1)},[te,be,ve,z,ue]),t.useEffect(()=>{T&&W(!!s)},[s,T]),t.useEffect(()=>{if(Y&&m&&de!==-1){const M=ee[de];M&&document.getElementById(`${re}-${Be(M.id)}`)?.scrollIntoView({block:"nearest"})}},[de,Y,m,ee,re]);const Ne=t.useMemo(()=>X!=null&&!(Array.isArray(X)&&X.length===0)&&!(typeof X=="object"&&Object.keys(X).length===0),[X]),Le=t.useMemo(()=>{if(te)return Ge;if(ve)return Ye;if(be)return We;if(Ne&&Z)return Z;if(f)return f.jsx??f.name;if(Ne){const M=ee.find(K=>K.raw===X);return M?M.name:typeof X=="object"&&X!==null?X.name??X.label??"Selected Object":String(X)}return z?Re:Se},[be,ve,te,z,f,X,Re,Ge,Ye,We,Se,Ne,ee]),Pe=t.useMemo(()=>{const M=[];let K=[],se=null;const pe=ee.reduce((w,we)=>(we.group&&(w[we.group]=(w[we.group]||0)+1),w),{}),me=w=>{w===null||K.length===0||(M.push(h.jsx(St,{visibility:Ce.has(w),className:"rac-group-container",children:K},`slide-${w}`)),K=[])},je=(w,we)=>h.jsxs("div",{className:jt(w,we,de,f?.id,r,H,$e,Te),style:{...w.style,...w.loading?{justifyContent:"initial",alignItems:"end",gap:0}:{}},onMouseEnter:()=>!w.disabled&&!w.loading&&ge(we),onClick:_e=>!w.loading&&A(w,_e),"aria-disabled":w.disabled||w.loading,"aria-selected":f?.id===w.id,id:`${re}-${Be(w.id)}`,role:"option",children:[w.jsx?h.jsx("div",{className:"rac-jsx-option",children:w.jsx}):h.jsx("span",{className:"rac-option-title",children:w.name}),w.loading&&h.jsxs("span",{style:{paddingBottom:"0.1em"},className:"rac-loading-dots",children:[h.jsx("i",{}),h.jsx("i",{}),h.jsx("i",{})]}),xe&&!w.disabled&&h.jsxs("div",{className:`rac-checkbox${_?"":"-default"}`,children:[ze(N,{style:{position:_?"":"relative"},className:`
12
+ `,...q&&{onKeyDown:F,onFocus:G,onClick:u,onBlur:P},"aria-disabled":K||!c,"aria-controls":`${C}-listbox`,tabIndex:q?0:-1,"aria-expanded":y,"aria-label":_,"aria-haspopup":"listbox",role:"combobox",children:[f.jsx("div",{className:`rac-select-title-wrapper
13
+ ${!B&&!L&&X?.type==="boolean"?X.raw?"rac-true-option":"rac-false-option":""}
14
+ `,style:{alignItems:J?.length&&!I?"flex-start":"center",height:l?`${l}px`:"auto"},children:f.jsx("div",{style:{alignItems:J?.length&&!I?"flex-start":"center",height:L?"100%":"auto"},className:"rac-select-title",ref:a,children:f.jsx(he.TransitionGroup,{enter:!i.current,component:null,appear:!1,children:J?.length&&!I&&!L?ie:f.jsxs(Ae,{className:"rac-title-container",duration:o,widthMode:!0,children:[f.jsx("span",{className:"rac-title-text",children:Z}),f.jsx(pe,{className:"rac-loading-container",visibility:L&&!B,duration:o,children:f.jsxs("span",{className:"rac-loading-dots",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]})})]},Z)})})}),f.jsx(pe,{visibility:U||te,className:"rac-select-buttons",children:f.jsxs(he.TransitionGroup,{component:null,children:[U&&f.jsx(pe,{style:{display:"grid"},duration:o,children:fe(ee,{className:"rac-select-cancel",onMouseDown:M=>{M.stopPropagation(),M.preventDefault()},onClick:r})},"clear-icon")," ",te&&f.jsx(pe,{style:{display:"grid"},duration:o,children:fe(H,{className:`rac-select-arrow ${y?"--open":""} ${E?"":"--up"}`})},"open-button")]})}),f.jsx(tt,{setBottomDirection:M=>s({bottomDirection:M}),style:{"--rac-duration":`${o}ms`,...Q},visibility:y&&W.length,onAnimationDone:()=>O(!0),bottomDirection:t.bottomDirection,animateOpacity:T,className:z,selectRef:k,duration:o,unmount:A,easing:p,offset:b,children:f.jsxs("div",{onScroll:d,className:"rac-select-list","aria-label":"Options",role:"listbox",tabIndex:"-1",children:[D,!se&&le&&f.jsxs("div",{className:"rac-select-option rac-disabled-option rac-loading-option",style:{justifyContent:"initial",alignItems:"end",gap:0},onClick:M=>M.stopPropagation(),children:[f.jsx("span",{className:"rac-loading-option-title",children:"Loading"}),f.jsx("div",{className:"rac-loading-container",children:f.jsxs("span",{className:"rac-loading-dots",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]})})]})]})})]}),!N&&f.jsx("div",{style:{position:"absolute",visibility:"hidden",pointerEvents:"none",zIndex:-1},children:f.jsx("div",{ref:j,children:fe(re)})})]})});function nt({disabled:e,open:t,setOpen:s,options:a=[],selectOption:i,setState:h,selected:u,selectedIDs:S,multiple:j,hasMore:E,loadMore:l,loadButton:R,loadButtonText:g,loadOffset:N,loadAhead:k,expandedGroups:C,onOpen:D,onClose:X,deleting:J}){const[W,Z]=n.useState(-1),y=n.useRef({loadingTriggered:!1,lastWindowFocusTime:0,justFocused:!1,focusTimeout:null});n.useEffect(()=>{y.current.loadingTriggered=!1,R&&h({loadingTitle:g})},[a.length,E,R,g]);const q=n.useCallback(()=>{!E||y.current.loadingTriggered||(y.current.loadingTriggered=!0,l())},[E,l]),c=n.useCallback(x=>{if(R||!E||y.current.loadingTriggered)return;const{scrollTop:P,scrollHeight:G,clientHeight:F}=x.currentTarget(G-P<=F+N)&&q()},[R,E,N,q]);n.useEffect(()=>{!R&&t&&E&&W>=a.length-k&&q()},[W,t,E,a.length,k,R,q]),n.useEffect(()=>{const x=()=>y.current.lastWindowFocusTime=Date.now();return window.addEventListener("focus",x),()=>{window.removeEventListener("focus",x),clearTimeout(y.current.focusTimeout)}},[]),n.useEffect(()=>{if(!t){Z(-1);return}const x=a[W],P=x&&!x.hidden&&!x.groupHeader;if(W>=0&&W<a.length&&P)return;let G=-1;if(u&&!j){const F=j?u[0]:u;F&&(G=a.findIndex(d=>d.id===F.id&&!d.disabled&&!d.hidden&&!d.groupHeader))}if(j&&S.length){const F=new Set(S.map(d=>d.id));G=a.findIndex(d=>F.has(d.id)&&!d.disabled&&!d.hidden&&!d.groupHeader)}G===-1&&(G=a.findIndex(F=>!F.disabled&&!F.hidden&&!F.groupHeader)),Z(G)},[t,a,u]);const w=n.useCallback((x,P)=>{const G=O=>O&&!O?.groupHeader&&(!O?.group||C?.has(O?.group))&&!O?.disabled&&!O?.loading,F=a.length;if(F===0)return-1;let d=x;for(let O=0;O<F;O++){if(d=(d+P+F)%F,!R&&E&&(P>0&&d===0||P<0&&d===F-1))return x;if(G(a[d]))return d}return x},[a,E,R,C]),z=n.useCallback(x=>{const P=x.relatedTarget?.closest(".rac-options");!x.currentTarget.contains(x.relatedTarget)&&!P&&(J&&h({deleting:!1}),t&&s(!1))},[J,t,h,s]),I=n.useCallback(()=>{e||J||document.hidden||Date.now()-y.current.lastWindowFocusTime<100||t||(clearTimeout(y.current.focusTimeout),y.current.focusTimeout=setTimeout(()=>y.current.justFocused=!1,200),y.current.justFocused=!0,s(!0))},[e,t,s,J]),K=n.useEffectEvent(()=>D?.()),L=n.useEffectEvent(()=>X?.());n.useEffect(()=>{t?K():L()},[t]);const B=n.useCallback(x=>{e||J||x?.target?.closest(".rac-select-cancel")||y.current.justFocused||s(!t)},[e,t,s,D,X,J]),V=n.useCallback(x=>{if(!e)switch(x.key){case"Enter":case" ":x.preventDefault(),t?W!==-1&&a[W]&&i(a[W],x):s(!0);break;case"Escape":x.preventDefault(),s(!1);break;case"ArrowDown":x.preventDefault(),t?Z(P=>w(P,1)):s(!0);break;case"ArrowUp":x.preventDefault(),t?Z(P=>w(P,-1)):s(!0);break;case"Tab":t&&s(!1);break}},[e,t,s,W,a,i,w]);return n.useMemo(()=>({handleBlur:z,handleFocus:I,toggleVisibility:B,handleKeyDown:V,highlightedIndex:W,setHighlightedIndex:Z,handleListScroll:c}),[z,I,B,V,W,c])}const st=["group","disabled","options","items","children"],we=["name","label","id","value"],_e=[],be=(e,t=!1)=>{if(t&&typeof e.group=="string")return e.group;const s=we.find(i=>e[i]!=null&&e[i]!=="");if(s)return String(e[s]);const a=Object.entries(e).find(([i,h])=>!st.includes(i)&&h!=null&&h!=="");return a?String(a[1]):null};function it({options:e=_e,jsxOptions:t=_e,value:s,onChange:a,disabled:i=!1,loading:h=!1,error:u=!1,multiple:S=!1,placeholder:j="Choose option",emptyText:E="No options",disabledText:l="Disabled",loadingText:R="Loading",errorText:g="Failed to load",disabledOption:N="Disabled option",emptyOption:k="Empty option",invalidOption:C="Invalid option",setVisibility:D,hasMore:X,loadButton:J,setState:W,loadingTitle:Z,loadMoreText:y,loadMore:q,childrenFirst:c=!1,groupsClosed:w=!1}){const z=s!==void 0,[I,K]=n.useState(()=>{const o=new Set;if(w)return o;const p=b=>{Array.isArray(b)&&b.forEach(T=>{if(T&&typeof T=="object"){if(("options"in T||"group"in T&&!we.some(H=>H in T))&&!T.disabled){const H=be(T,!0)||"Empty group";o.add(H)}T.options&&p(T.options)}})};return p(e),o}),L=n.useRef(null),B=n.useCallback(o=>{K(p=>{const b=new Set(p);return b.has(o)?b.delete(o):b.add(o),b})},[]),V=n.useCallback((o,p,b="n",T=null,A=!1)=>{const H=`${b}-${p}`;if(o==null||o===""||o===void 0)return{name:k,disabled:!0,type:"normal",groupDisabled:A,userId:null,raw:o,group:T,id:H};if(typeof o=="function")return{id:H,userId:null,name:C,raw:o,disabled:!0,invalid:!0,type:"normal",group:T};if(typeof o=="object"&&!Array.isArray(o)){const ee=T||o.group||null,re=A||o.disabled===!0,le=o.id??o.value??o.name??o.label,se=o.value!==void 0?o.value:o.id!==void 0?o.id:o;let m=be(o)||(re?N:k);return{id:H,userId:le,name:m,raw:se,original:o,disabled:re||m===k&&!re,type:typeof se=="boolean"?"boolean":"normal",group:ee,groupDisabled:A}}return{id:H,userId:o,name:String(o),raw:o,original:o,disabled:A,type:typeof o=="boolean"?"boolean":"normal",group:T}},[k,C,N]),x=n.useMemo(()=>{const o=new Map,p=[],b=t.map((m,U)=>{if(m.isGroupMarker)return{...m,type:"group-marker"};const te=!m.label&&!m.userId&&!m.value&&(m.value===void 0||m.value===null||m.value==="")&&!m.hasJsx;return{...m,id:`jsx-${m.id}`,index:U,userId:m.userId,raw:m.value,original:m.value,name:te?k:m.label||m.userId||String(m.value||""),disabled:!!m.disabled||te,type:typeof m.value=="boolean"?"boolean":"normal",group:m.group||null}});let T=0;const A=(m,U=null,te=!1,ie="0")=>{Array.isArray(m)||(m=[m]),m.forEach((M,ue)=>{const oe=`${ie}-${ue}`,ae=M!=null&&typeof M=="object"&&!Array.isArray(M);if(ae&&("options"in M||"group"in M&&!we.some(ne=>ne in M))){const ne=be(M,!0)||"Empty group";o.has(ne)||o.set(ne,{disabled:!!M.disabled,closedByDefault:!!M.disabled||w,items:[]}),M.options?A(M.options,ne,te||!!M.disabled,oe):p.push({id:`empty-${ne}-${oe}`,name:ne,group:ne,isPlaceholder:!0,type:"group-marker",index:T++})}else if(ae&&!we.some(ne=>ne in M)&&!M.group)Object.entries(M).forEach(([ne,xe],ve)=>{const $=V(xe,`${oe}-${ve}`,"default",U,te);p.push({...$,index:T++})});else{const ne=V(M,oe,"default",U,te);p.push({...ne,index:T++})}})};A(e);const H=c?[...b,...p]:[...p,...b];if(!L.current)L.current=new Map(H.map((m,U)=>[m.id,U]));else{let m=!1;if(H.forEach(U=>{L.current.has(U.id)||(m=!0)}),m){const U=new Map;H.forEach((te,ie)=>{U.set(te.id,ie)}),L.current=U}}const ee=[...H].sort((m,U)=>{const te=L.current.get(m.id)??999999,ie=L.current.get(U.id)??999999;return te-ie}),re=[],le=new Set;ee.forEach(m=>{if(!m.group)re.push({type:"item",data:m});else{le.has(m.group)||(le.add(m.group),re.push({type:"group",name:m.group}));const U=o.get(m.group)||{items:[]};o.has(m.group)||o.set(m.group,U),m.isGroupMarker?(U.className=m.className,U.style=m.style,m.disabled&&(U.disabled=!0)):m.isPlaceholder||U.items.push(m)}});const se=[];return re.forEach(m=>{if(m.type==="item")se.push(m.data);else{const U=m.name,te=o.get(U),ie=I.has(U);se.push({className:te?.className||"",id:`group-header-${U}`,disabled:!!te?.disabled,style:te?.style||{},groupHeader:!0,name:U,type:"group",hidden:!1,expanded:ie}),te?.items.forEach(M=>{const ue=I.size>0?!ie:!!w;se.push({...M,hidden:ue})})}}),X&&J&&se.push({id:"special-load-more-id",name:Z,loadMore:!0,loading:Z===y,type:"special"}),se},[e,t,V,c,X,J,Z,y,w,I,k]),P=n.useCallback(()=>{if(s==null||Array.isArray(s)&&s.length===0)return{initialId:null,initialIDs:[]};const o=new Set,p=(b,T)=>{let A=x.find(ee=>ee.original===b&&!o.has(ee.id));if(!A&&typeof b=="object")try{const ee=JSON.stringify(b);A=x.find(re=>re.original&&typeof re.original=="object"&&JSON.stringify(re.original)===ee&&!o.has(re.id))}catch{}if(A)return o.add(A.id),A;const H=typeof b=="object"?b.id||b.value||JSON.stringify(b):String(b);return typeof b=="object"&&b!==null?{id:`virtual-${H}-${T}`,name:be(b)||String(b.id||"Selected Object"),raw:b.value??b.id??b,original:b,userId:b.id??b.value??null,virtual:!0}:{id:`virtual-${H}-${T}`,name:String(b),raw:b,original:b,userId:b,virtual:!0}};if(S)return{initialId:null,initialIDs:(Array.isArray(s)?s:[s]).map((A,H)=>p(A,H))};{const b=Array.isArray(s)?s[0]:s;return{initialId:p(b,0).id,initialIDs:[]}}},[z,s,x,S]),[G,F]=n.useState(()=>P().initialId),[d,O]=n.useState(()=>P().initialIDs),r=n.useMemo(()=>{const o=x.find(p=>p.id===G);if(o)return o;if(!S&&G?.startsWith("virtual-")){const p=Array.isArray(s)?s[0]:s;if(p)return{id:G,name:typeof p=="object"?be(p):String(p),original:p}}return null},[G,x,S,z,s]),v=n.useCallback((o,p)=>{if(o.groupHeader){_(p),o.disabled||B(o.name);return}if(o.disabled||o.loadMore){_(p),o.loadMore&&!o.loading&&(W({loadingTitle:y}),q());return}if(S){if(o.disabled||o.groupHeader||o.loadMore){_(p);return}_(p);const T=d?.some(A=>A.id===o.id)?d.filter(A=>A.id!==o.id):[...d,o];O(T),a?.(T.map(A=>A.original),T.map(A=>A.userId));return}a?.(o.original,o.userId),F(o.id),D(!1)},[a,D,q,y,B,S,d]),_=n.useCallback(o=>{o?.stopPropagation(),o?.preventDefault()},[]),Y=n.useCallback(()=>{a?.(null,null),F(null),O([])},[a]),Q=n.useCallback(o=>{const p=d.filter(b=>b.id!==o);O(p),a?.(p.map(b=>b.original),p.map(b=>b.userId))},[d,a]);return{normalizedOptions:x,selected:r,selectOption:v,clear:Y,removeOption:Q,hasOptions:x.length>0,active:!u&&!h&&!i&&x.length>0,selectedValue:s,placeholder:j,emptyText:E,disabledText:l,loadingText:R,errorText:g,disabledOption:N,emptyOption:k,invalidOption:C,disabled:i,loading:h,error:u,expandedGroups:I,toggleGroup:B,selectedIDs:d,multiple:S,setselectedIDs:O}}const Re=(e,t="invalid-option",s="")=>{const a=s?s.replace(/:/g,""):"";if(typeof e!="string"||!e.trim())return a?`${t}-${a}`:`${t}-${Math.random().toString(36).slice(2,8)}`;const i=e.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").replace(/[^\p{L}\p{N}-]+/gu,"").toLowerCase();return i?i||`${t}-${Math.random().toString(36).slice(2,8)}`:a?`${t}-${a}`:`${t}-${Math.random().toString(36).slice(2,8)}`};function ot({setExternalVisibility:e,externalVisibility:t,loadButtonText:s,loadMoreText:a,ownBehavior:i,loadButton:h,loadOffset:u,loadAhead:S,loadMore:j,hasMore:E,onOpen:l,onClose:R,props:g,ref:N}){const k=n.useId(),C=n.useMemo(()=>k.replace(/:/g,""),[k]),D=n.useRef(null);n.useImperativeHandle(N,()=>D.current);const[X,J]=n.useReducer(Ve,{loadButton:h,loadButtonText:s,loadMoreText:a},Ye),{internalVisibility:W,animationFinished:Z,jsxOptions:y,deleting:q,loadingTitle:c}=X,w=n.useCallback(T=>J({type:"SET",payload:T}),[]),z=t!==void 0,I=n.useMemo(()=>i||z?!!t:W,[i,z,t,W]),K=n.useCallback(T=>{i||(!z&&w({internalVisibility:T}),e?.(T))},[i,z,e]),L=n.useCallback(T=>{w(A=>{const H=A.jsxOptions.findIndex(ee=>ee.id===T.id);if(H!==-1){const ee=A[H];if(ee.label===T.label&&ee.value===T.value&&ee.disabled===T.disabled&&ee.group===T.group)return A;const re=[...A];return re[H]=T,{jsxOptions:re}}return{jsxOptions:[...A.jsxOptions,T]}})},[w]),B=n.useCallback(T=>w(A=>({jsxOptions:A.jsxOptions.filter(H=>H.id!==T)})),[]),V=it({...g,setVisibility:K,jsxOptions:y,hasMore:E,loadButton:h,loadingTitle:c,loadMore:j,loadMoreText:a,setState:w}),{multiple:x,normalizedOptions:P,selected:G,selectOption:F,hasOptions:d,selectedValue:O,disabled:r,loading:v,error:_,expandedGroups:Y,selectedIDs:Q}=V,o=nt({setState:w,loadButton:h,loadButtonText:s,hasMore:E,loadMore:j,disabled:r,multiple:x,open:I,setOpen:K,options:P,selectOption:F,selected:G,loadOffset:u,loadAhead:S,expandedGroups:Y,selectedIDs:Q,onOpen:l,onClose:R,deleting:q}),{highlightedIndex:p}=o;n.useEffect(()=>{I&&D.current&&document.activeElement!==D.current&&D.current.focus(),!I&&w({animationFinished:!1})},[I]),n.useEffect(()=>{(_||r||v||!d)&&K(!1)},[_,r,v,d,K]),n.useEffect(()=>{z&&w({internalVisibility:!!t})},[t,z]),n.useEffect(()=>{if(I&&Z&&p!==-1){const T=P[p];T&&document.getElementById(`${C}-${Re(T.id)}`)?.scrollIntoView({block:"nearest"})}},[p,I,Z,P,C]);const b=n.useMemo(()=>O!=null&&!(Array.isArray(O)&&O.length===0)&&!(typeof O=="object"&&Object.keys(O).length===0),[O]);return{selectId:C,selectRef:D,visibility:I,setVisibility:K,animationFinished:Z,setAnimationFinished:T=>w({animationFinished:T}),deleting:q,loadingTitle:c,jsxOptions:y,registerOption:L,unregisterOption:B,logic:V,behavior:o,hasActualValue:b}}function lt({visibility:e,children:t,duration:s=300,className:a}){const i=n.useRef(null),h=n.useCallback(()=>{if(!i.current)return{top:"0px",bottom:"0px"};const u=window.getComputedStyle(i.current);return{top:u.marginTop,bottom:u.marginBottom}},[]);return f.jsx(he.CSSTransition,{onEnter:()=>{i.current.style.height="0px",i.current.style.marginTop="0px",i.current.style.marginBottom="0px"},onEntering:()=>{const{top:u,bottom:S}=h();i.current.style.height=i.current.scrollHeight+"px",i.current.style.marginBottom=S,i.current.style.marginTop=u},onEntered:()=>i.current.style.height="auto",onExit:()=>{const{top:u,bottom:S}=h();i.current.style.height=i.current.scrollHeight+"px",i.current.style.marginBottom=S,i.current.style.marginTop=u,i.current.offsetHeight},onExiting:()=>{i.current.style.height="0px",i.current.style.marginTop="0px",i.current.style.marginBottom="0px"},classNames:"rac-slide-down",timeout:s,nodeRef:i,in:e,unmountOnExit:!0,children:f.jsx("div",{style:{transition:`height ${s}ms ease, margin ${s}ms ease`,overflow:"hidden"},className:`${a} rac-slide-down-enter-done`,ref:i,tabIndex:-1,children:t})})}const at=n.forwardRef(({loadMore:e=()=>console.warn("loadMore not implemented"),setVisibility:t=()=>{},visibility:s,loadButtonText:a="Load more",Checkmark:i=Ge,loadMoreText:h="Loading",selectedText:u=void 0,OpenIcon:S=Be,animateOpacity:j=!0,ClearIcon:E=Ne,optionsClassName:l="",Checkbox:R=void 0,deleteInline:g=!1,ownBehavior:N=!1,DelIcon:k=Ne,onClose:C=()=>{},showDelete:D=!1,easing:X="ease-in",loadButton:J=!1,onOpen:W=()=>{},loadOffset:Z=100,hasMore:y=!1,className:q="",duration:c=300,loadAhead:w=3,offset:z=1,style:I={},children:K,unmount:L,...B},V)=>{const x=ot({externalVisibility:s,setExternalVisibility:t,ownBehavior:N,loadButton:J,loadButtonText:a,loadMoreText:h,loadMore:e,loadOffset:Z,loadAhead:w,hasMore:y,onOpen:W,onClose:C,ref:V,props:B}),{logic:P,behavior:G,selectId:F,hasActualValue:d,loadingTitle:O}=x,{normalizedOptions:r,selected:v,multiple:_,selectedIDs:Y,invalidOption:Q,selectOption:o,hasOptions:p,error:b,loading:T,disabled:A,selectedValue:H,expandedGroups:ee,placeholder:re,emptyText:le,errorText:se,loadingText:m,disabledText:U}=P,{highlightedIndex:te,setHighlightedIndex:ie}=G,M=n.useMemo(()=>{if(b)return se;if(T)return m;if(A)return U;if(d&&u)return u;if(v)return v.jsx??v.name;if(d){const oe=r.find(ae=>ae.raw===H);return oe?oe.name:typeof H=="object"&&H!==null?H.name??H.label??"Selected Object":String(H)}return p?re:le},[A,T,b,p,v,H,re,se,m,U,le,d,r]),ue=n.useMemo(()=>{const oe=[];let ae=[],ge=null;const ne=r.reduce(($,ce)=>(ce.group&&($[ce.group]=($[ce.group]||0)+1),$),{}),xe=$=>{$===null||ae.length===0||(oe.push(f.jsx(lt,{visibility:ee.has($),className:"rac-group-container",duration:c,children:ae},`slide-${$}`)),ae=[])},ve=($,ce)=>f.jsxs("div",{className:Je($,ce,te,v?.id,O,h,Q,Y),style:{...$.style,...$.loading?{justifyContent:"initial",alignItems:"end",gap:0}:{}},onMouseEnter:()=>!$.disabled&&!$.loading&&ie(ce),onClick:de=>!$.loading&&o($,de),"aria-disabled":$.disabled||$.loading,"aria-selected":v?.id===$.id,id:`${F}-${Re($.id)}`,role:"option",children:[$.jsx?f.jsx("div",{className:"rac-jsx-option",children:$.jsx}):f.jsx("span",{className:"rac-option-title",children:$.name}),$.loading&&f.jsxs("span",{style:{paddingBottom:"0.1em"},className:"rac-loading-dots",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]}),_&&!$.disabled&&f.jsxs("div",{className:`rac-checkbox${R?"":"-default"}`,children:[fe(i,{style:{position:R?"":"relative"},className:`
15
15
  rac-checkmark
16
- ${Te?.some(_e=>_e.id===w.id)?"--checked":""}`}),ze(_,{className:"rac-check-box"})]})]},w.id);return ee.forEach((w,we)=>{const _e=w.groupHeader,Xe=!!w.group;if((_e||!Xe&&se!==null)&&(me(se),_e||(se=null)),_e){se=w.name;const ot=Ce.has(w.name),at=pe[w.name]>0;M.push(h.jsxs("div",{className:["rac-group-header",w.disabled&&"rac-disabled-group",w.className].filter(Boolean).join(" "),onClick:lt=>A(w,lt),style:w.style,id:w.id,children:[h.jsx("span",{className:"rac-group-title-text",children:w.name}),h.jsx(Ae,{visibility:at&&!w.disabled,style:{display:"grid"},duration:x,children:ze(k,{className:`rac-group-arrow ${ot?"--open":""}`})})]},w.id))}else Xe?K.push(je(w,we)):M.push(je(w,we))}),me(se),M},[ee,A,re,f,de,r,H,$e,ge,Ce,k]);return h.jsx(xt,{setDeleting:y,deleting:a,selectedText:Z,selectRef:ce,selectId:re,selectedIDs:Te,setSelectedIds:Ue,multiple:xe,removeOption:he,optionsClassName:U,renderIcon:ze,normalizedOptions:ee,renderOptions:Pe,selected:f,title:Le,visibility:Y,active:ke,hasOptions:z,hasActualValue:Ne,highlightedIndex:de,animationFinished:m,disabled:be,loading:ve,error:te,setVisibility:ue,setHighlightedIndex:ge,setAnimationFinished:S,handleBlur:ae,handleFocus:Oe,toggleVisibility:ye,handleKeyDown:Ee,handleListScroll:B,selectOption:A,clear:ne,registerOption:p,unregisterOption:$,children:n,placeholder:Re,className:v,style:i,duration:x,easing:b,offset:g,animateOpacity:j,unmount:e,OpenIcon:k,ClearIcon:d,DelIcon:R,hasMore:C,loadButton:L,deleteInline:le,showDelete:F})}),it=t.createContext(null);function Rt({children:e,name:n,label:s,value:c,id:l,disabled:x,emptyGroupText:b="Empty group",className:g="",style:j={}}){const i=t.useContext(Ve),v=t.useMemo(()=>{const d=n??s??l??c;return d!=null&&d!==""?String(d):b},[n,s,c,l,b]),k=t.useMemo(()=>`group-marker-${Be(v)}`,[v]);return t.useEffect(()=>{if(!i)return;const d={disabled:!!x,isGroupMarker:!0,group:v,id:k,className:g,style:j};return i.registerOption(d),()=>i.unregisterOption(k)},[i.registerOption,i.unregisterOption,k,v]),h.jsx(it.Provider,{value:v,children:e})}const qe=e=>e?typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(qe).join(" ").replace(/\s+/g," ").trim():t.isValidElement(e)?qe(e.props.children):"":"";function $t({name:e,label:n,id:s,value:c,className:l,style:x,children:b,disabled:g,group:j}){const i=t.useContext(Ve),v=t.useContext(it),k=i?.registerOption,d=i?.unregisterOption,R=t.useId(),N=t.useMemo(()=>s?String(s):R.replace(/:/g,""),[s,R]);return t.useEffect(()=>{if(!k)return;const _=qe(b),C=b!=null;let O="";return n!=null&&n!==""?O=String(n):e!=null&&e!==""?O=String(e):_?O=_:s!=null&&s!==""&&(O=String(s)),k({id:N,value:c!==void 0?c:_,label:O,jsx:b,hasJsx:C,className:l,style:x,disabled:!!g,group:j||v||null}),()=>d(N)},[N,e,n,c,b,l,x,g,j,v,k,d]),null}exports.OptGroup=Rt;exports.Option=$t;exports.Select=kt;
16
+ ${Y?.some(de=>de.id===$.id)?"--checked":""}`}),fe(R,{className:"rac-check-box"})]})]},$.id);return r.forEach(($,ce)=>{const de=$.groupHeader,ke=!!$.group;if((de||!ke&&ge!==null)&&(xe(ge),de||(ge=null)),de){ge=$.name;const Le=ee.has($.name),De=ne[$.name]>0;oe.push(f.jsxs("div",{className:["rac-group-header",$.disabled&&"rac-disabled-group",$.className].filter(Boolean).join(" "),onClick:He=>o($,He),style:$.style,id:$.id,children:[f.jsx("span",{className:"rac-group-title-text",children:$.name}),f.jsx(pe,{visibility:De&&!$.disabled,style:{display:"grid"},duration:c,children:fe(S,{className:`rac-group-arrow ${Le?"--open":""}`})})]},$.id))}else ke?ae.push(ve($,ce)):oe.push(ve($,ce))}),xe(ge),oe},[r,o,F,v,te,O,h,Q,ie,ee,S]);return f.jsx(rt,{optionsClassName:l,animateOpacity:j,renderOptions:ue,deleteInline:g,showDelete:D,className:q,ClearIcon:E,Checkmark:i,OpenIcon:S,Checkbox:R,duration:c,children:K,DelIcon:k,unmount:L,...x,easing:X,offset:z,title:M,style:I,...G,...P})}),Pe=n.createContext(null);function ct({children:e,name:t,label:s,value:a,id:i,disabled:h,emptyGroupText:u="Empty group",className:S="",style:j={}}){const E=n.useContext(Se),l=n.useMemo(()=>{const g=t??s??i??a;return g!=null&&g!==""?String(g):u},[t,s,a,i,u]),R=n.useMemo(()=>`group-marker-${Re(l)}`,[l]);return n.useEffect(()=>{if(!E)return;const g={disabled:!!h,isGroupMarker:!0,group:l,id:R,className:S,style:j};return E.registerOption(g),()=>E.unregisterOption(R)},[E.registerOption,E.unregisterOption,R,l]),f.jsx(Pe.Provider,{value:l,children:e})}const je=e=>e?typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(je).join(" ").replace(/\s+/g," ").trim():n.isValidElement(e)?je(e.props.children):"":"";function ut({name:e,label:t,id:s,value:a,className:i,style:h,children:u,disabled:S,group:j}){const E=n.useContext(Se),l=n.useContext(Pe),R=E?.registerOption,g=E?.unregisterOption,N=n.useId(),k=n.useMemo(()=>s?String(s):N.replace(/:/g,""),[s,N]);return n.useEffect(()=>{if(!R)return;const C=je(u),D=u!=null;let X="";return t!=null&&t!==""?X=String(t):e!=null&&e!==""?X=String(e):C?X=C:s!=null&&s!==""&&(X=String(s)),R({id:k,value:a!==void 0?a:C,label:X,jsx:u,hasJsx:D,className:i,style:h,disabled:!!S,group:j||l||null}),()=>g(k)},[k,e,t,a,u,i,h,S,j,l,R,g]),null}exports.OptGroup=ct;exports.Option=ut;exports.Select=at;
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- @media(prefers-reduced-motion:reduce){.rac-select{--rac-duration: 1ms}}:root{--rac-base-red: #e7000b;--rac-base-green: #4caf50;--rac-base-yellow: #ffc107;--rac-select-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-hover: color-mix(in srgb, Canvas 95%, CanvasText 5%);--rac-select-color: CanvasText;--rac-select-border: 2px solid color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-border-error: 2px solid color-mix(in srgb, var(--rac-base-red), CanvasText 15%);--rac-select-padding: 0em .5em;--rac-select-min-height: 2em;--rac-disabled-opacity: .75;--rac-title-anim-shift: 4px;--rac-title-anim-entry-ease: cubic-bezier(.34, 1.56, .64, 1);--rac-title-font-size: 1em;--rac-dots-color: currentColor;--rac-dots-gap: 3px;--rac-dots-padding-left: .25em;--rac-dots-align: end;--rac-dots-animation-duration: 1.4s;--rac-dots-animation-delay-1: 0s;--rac-dots-animation-delay-2: .2s;--rac-dots-animation-delay-3: .4s;--rac-arrow-height: 1em;--rac-arrow-width: 1em;--rac-arrow-padding: 1px 0 2px;--rac-cancel-height: .9em;--rac-cancel-width: .9em;--rac-scroll-color: color-mix(in srgb, CanvasText 10%, Canvas);--rac-scroll-track: color-mix(in srgb, CanvasText 5%, Canvas);--rac-scroll-padding-top: .5em;--rac-scroll-padding-bottom: .5em;--rac-option-hover: color-mix(in srgb, CanvasText 6%, Canvas);--rac-option-highlight: color-mix(in srgb, CanvasText 10%, Canvas);--rac-option-selected: color-mix(in srgb, CanvasText 14%, Canvas);--rac-list-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-list-color: CanvasText;--rac-list-max-height: 250px;--rac-option-padding: .5em;--rac-option-min-height: 1em;--rac-option-gap: .5em;--rac-disabled-option-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-invalid-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-true-option-color: color-mix(in srgb, var(--rac-base-green), CanvasText 10%);--rac-false-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-warning-option-color: color-mix(in srgb, var(--rac-base-yellow), CanvasText 10%);--rac-group-header-font-size: 1.25em;--rac-group-header-font-weight: bold;--rac-group-header-min-height: 1em;--rac-group-header-padding: .5em;--rac-group-arrow-height: 1em;--rac-group-arrow-width: 1em;--rac-group-arrow-padding: 1px 0 2px;--rac-group-container-padding-left: 1em;--rac-disabled-group-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-multiple-selected-border: .1em solid gray;--rac-multiple-selected-radius: 5px;--rac-checkbox-border: 1px solid gray;--rac-multiple-selected-padding: 0em .25em;--rac-multiple-selected-margin: .25em .5em .25em 0;--rac-multiple-selected-gap: .5em 0;--rac-multiple-deleting-bg: color-mix(in srgb, var(--rac-base-red) 15%, Canvas);--rac-checkbox-margin-right: .2em;--rac-multiple-selected-min-height: 1.5em;--rac-checkbox-size: var(--rac-option-min-height);--rac-multiple-del-bg: color-mix(in srgb, var(--rac-base-red) 30%, Canvas);--rac-multiple-del-hover-color: var(--rac-base-red)}.rac-select{background:var(--rac-select-background);padding:var(--rac-select-padding);border:var(--rac-select-border);color:var(--rac-select-color);min-height:var(--rac-select-min-height);interpolate-size:allow-keywords;transition:background-color var(--rac-duration-base) ease,border-color var(--rac-duration-base) ease,height var(--rac-duration-base) ease;justify-content:space-between;box-sizing:border-box;cursor:pointer;display:flex}.rac-select:hover{background-color:var(--rac-select-hover);border-color:var(--rac-select-hover)}.rac-loading-style,.rac-disabled-style{opacity:var(--rac-disabled-opacity);transition:border-color var(--rac-duration-base),filter var(--rac-duration-base),opacity var(--rac-duration-base);cursor:wait}.rac-disabled-style{cursor:not-allowed}.rac-error-style{border:var(--rac-select-border-error);cursor:help}.rac-select-title-wrapper{transition:height var(--rac-duration-base) cubic-bezier(.4,0,.2,1);display:flex;width:100%}.rac-select-title{min-height:var(--rac-select-min-height);position:relative;flex-wrap:wrap;display:flex;width:100%}.rac-spacer{min-height:var(--rac-select-min-height)}.rac-title-container{height:100%}.rac-title-text{font-size:var(--rac-title-font-size);align-content:center;display:block;height:100%}@keyframes rac-fade-in{0%{opacity:0;transform:translateY(var(--rac-title-anim-shift))}to{opacity:1;transform:translateY(0)}}.rac-loading-container{align-items:end;display:grid;height:100%}.rac-loading-dots{display:inline-flex;--rac-dots-size: calc(var(--rac-title-font-size) / 4);--rac-dots-gap: calc(var(--rac-title-font-size) / 6);--rac-dots-padding-left: calc(var(--rac-title-font-size) / 4);--rac-dots-padding-bottom: .5em;gap:var(--rac-dots-gap);padding-left:var(--rac-dots-padding-left);padding-bottom:var(--rac-dots-padding-bottom)}.rac-loading-dots i{width:var(--rac-dots-size);height:var(--rac-dots-size);background:var(--rac-dots-color, currentColor);border-radius:50%;animation:blink var(--rac-dots-animation-duration) infinite both}.rac-loading-dots i:nth-child(1){animation-delay:var(--rac-dots-animation-delay-1)}.rac-loading-dots i:nth-child(2){animation-delay:var(--rac-dots-animation-delay-2)}.rac-loading-dots i:nth-child(3){animation-delay:var(--rac-dots-animation-delay-3)}@keyframes blink{0%{opacity:.2}20%{opacity:1}to{opacity:.2}}.rac-select-buttons{display:flex;align-items:center}.rac-select-cancel{height:var(--rac-cancel-height);width:var(--rac-cancel-width);transition:opacity var(--rac-duration-fast),border-color var(--rac-duration-fast)}.rac-select-arrow{transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1);transform-origin:50% 50%;transform:rotate(0);will-change:transform;display:block}.rac-select-arrow.--up,.rac-select-arrow.--open{transform:rotate(180deg)}.rac-select-arrow.--up.--open{transform:rotate(0)}.rac-select-arrow,.rac-select-cancel{object-fit:contain}.rac-select-list{background-color:var(--rac-list-background);color:var(--rac-list-color);max-height:var(--rac-list-max-height);overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--rac-scroll-color) var(--rac-scroll-track);scrollbar-width:thin;scrollbar-gutter:stable;scroll-behavior:smooth;scroll-padding-top:var(--rac-scroll-padding-top);scroll-padding-bottom:var(--rac-scroll-padding-bottom);transition:border-color var(--rac-duration-fast),background-color var(--rac-duration-fast),opacity var(--rac-duration-base)}.rac-select-option{transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);min-height:var(--rac-option-min-height);padding:var(--rac-option-padding);justify-content:space-between;gap:var(--rac-option-gap);overflow-wrap:anywhere;word-break:break-all;scrollbar-width:thin;align-items:center;overflow-x:auto;cursor:pointer;display:flex}.rac-select-option:not(.rac-disabled-option):not(.rac-group-option):hover{background-color:var(--rac-option-hover)}.rac-select-option.rac-highlighted{background-color:var(--rac-option-highlight)}.rac-select-option.rac-selected,.rac-select-option.rac-selected.rac-highlighted{background-color:var(--rac-option-selected)}.rac-option-title{text-overflow:ellipsis;overflow-wrap:anywhere;word-break:break-all;text-wrap:wrap}.rac-disabled-option{cursor:not-allowed;color:var(--rac-disabled-option-color)}.rac-invalid-option{color:var(--rac-invalid-option-color)}.rac-true-option{color:var(--rac-true-option-color)}.rac-false-option{color:var(--rac-false-option-color)}.rac-loading-option{cursor:wait}.rac-group-header{cursor:pointer;min-height:var(--rac-group-header-min-height);padding:var(--rac-group-header-padding);transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);display:flex;justify-content:space-between;align-items:center;font-weight:var(--rac-group-header-font-weight);font-size:var(--rac-group-header-font-size)}.rac-group-container{padding-left:var(--rac-group-container-padding-left)}.rac-group-arrow{display:block;will-change:transform;transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1),padding var(--rac-duration-fast);transform-origin:50% 50%;transform:translateZ(0)}.rac-group-arrow.--open{transform:rotate(180deg)}.rac-disabled-group{cursor:not-allowed;color:var(--rac-disabled-group-color)}.rac-select-selected{display:flex;align-items:center}.rac-multiple-selected-option{transition:background-color var(--rac-duration-fast, --rac-duration) cubic-bezier(.4,0,.2,1),transform var(--rac-duration) ease;background-color:color-mix(in srgb,CanvasText 10%,Canvas);min-height:var(--rac-multiple-selected-min-height);position:relative;display:inline-flex;align-items:center;vertical-align:middle;line-height:normal;padding:var(--rac-multiple-selected-padding);margin:var(--rac-multiple-selected-margin);white-space:nowrap;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none}@media(hover:hover){.rac-multiple-selected-option:hover{background-color:color-mix(in srgb,CanvasText 25%,Canvas)}}.rac-multiple-del{background-color:var(--rac-multiple-del-bg);-webkit-tap-highlight-color:transparent;align-items:center;position:absolute;-webkit-user-select:none;user-select:none;display:grid;height:100%;right:0}.rac-multiple-del:hover{color:var(--rac-multiple-del-hover-color)}.rac-multiple-option{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.rac-multiple-selected-option.--deleting-shake{background-color:var(--rac-multiple-deleting-bg);animation:rac-shake .3s infinite}@keyframes rac-shake{0%{transform:rotate(0)}25%{transform:rotate(-1deg)}75%{transform:rotate(1deg)}to{transform:rotate(0)}}.rac-checkbox-default{margin-right:var(--rac-checkbox-margin-right);min-height:var(--rac-option-min-height);min-width:var(--rac-option-min-height);border:var(--rac-checkbox-border);justify-content:center;align-items:center;position:relative;display:flex;height:100%}.rac-checkbox{margin-right:var(--rac-checkbox-margin-right);justify-content:center;align-items:center;position:relative;display:flex}.rac-checkmark{transition:max-height var(--rac-duration-base),max-width var(--rac-duration-base),opacity var(--rac-duration-base);position:absolute;max-height:0;opacity:0}.rac-checkmark.--checked{max-height:var(--rac-option-min-height);opacity:1}
1
+ @media(prefers-reduced-motion:reduce){.rac-select{--rac-duration: 1ms}}:root{--rac-base-red: #e7000b;--rac-base-green: #4caf50;--rac-base-yellow: #ffc107;--rac-select-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-hover: color-mix(in srgb, Canvas 95%, CanvasText 5%);--rac-select-color: CanvasText;--rac-select-border: 2px solid color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-select-border-error: 2px solid color-mix(in srgb, var(--rac-base-red), CanvasText 15%);--rac-select-padding: 0em .5em;--rac-select-min-height: 2em;--rac-arrow-height: 1em;--rac-disabled-opacity: .75;--rac-title-anim-shift: 4px;--rac-title-anim-entry-ease: cubic-bezier(.34, 1.56, .64, 1);--rac-title-font-size: 1em;--rac-dots-color: currentColor;--rac-dots-gap: 3px;--rac-dots-padding-left: .25em;--rac-dots-align: end;--rac-dots-animation-duration: 1.4s;--rac-dots-animation-delay-1: 0s;--rac-dots-animation-delay-2: .2s;--rac-dots-animation-delay-3: .4s;--rac-cancel-height: 1em;--rac-scroll-color: color-mix(in srgb, CanvasText 10%, Canvas);--rac-scroll-track: color-mix(in srgb, CanvasText 5%, Canvas);--rac-scroll-padding-top: .5em;--rac-scroll-padding-bottom: .5em;--rac-option-hover: color-mix(in srgb, CanvasText 6%, Canvas);--rac-option-highlight: color-mix(in srgb, CanvasText 10%, Canvas);--rac-option-selected: color-mix(in srgb, CanvasText 14%, Canvas);--rac-list-background: color-mix(in srgb, Canvas 98%, CanvasText 2%);--rac-list-color: CanvasText;--rac-list-max-height: 250px;--rac-option-padding: .5em;--rac-option-min-height: 1em;--rac-option-gap: .5em;--rac-disabled-option-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-invalid-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-true-option-color: color-mix(in srgb, var(--rac-base-green), CanvasText 10%);--rac-false-option-color: color-mix(in srgb, var(--rac-base-red), CanvasText 10%);--rac-warning-option-color: color-mix(in srgb, var(--rac-base-yellow), CanvasText 10%);--rac-group-header-font-size: 1.25em;--rac-group-header-font-weight: bold;--rac-group-header-min-height: 1em;--rac-group-header-padding: .5em;--rac-group-open-height: 1.5em;--rac-group-arrow-padding: 1px 0 2px;--rac-group-container-padding-left: 1em;--rac-disabled-group-color: color-mix(in srgb, GrayText, CanvasText 20%);--rac-multiple-selected-border: .1em solid gray;--rac-multiple-selected-radius: 5px;--rac-checkbox-border: 1px solid gray;--rac-multiple-selected-padding: 0em .25em;--rac-multiple-selected-margin: .25em .5em .25em 0;--rac-multiple-selected-gap: .5em 0;--rac-multiple-deleting-bg: color-mix(in srgb, var(--rac-base-red) 15%, Canvas);--rac-checkbox-margin-right: .2em;--rac-multiple-selected-min-height: 1.5em;--rac-checkbox-size: var(--rac-option-min-height);--rac-multiple-del-bg: color-mix(in srgb, var(--rac-base-red) 30%, Canvas);--rac-multiple-del-hover-color: var(--rac-base-red)}.rac-select{background:var(--rac-select-background);padding:var(--rac-select-padding);border:var(--rac-select-border);color:var(--rac-select-color);min-height:var(--rac-select-min-height);interpolate-size:allow-keywords;transition:background-color var(--rac-duration-base) ease,border-color var(--rac-duration-base) ease,height var(--rac-duration-base) ease;justify-content:space-between;box-sizing:border-box;cursor:pointer;display:flex}.rac-select:hover{background-color:var(--rac-select-hover);border-color:var(--rac-select-hover)}.rac-loading-style,.rac-disabled-style{opacity:var(--rac-disabled-opacity);transition:border-color var(--rac-duration-base),filter var(--rac-duration-base),opacity var(--rac-duration-base);cursor:wait}.rac-disabled-style{cursor:not-allowed}.rac-error-style{border:var(--rac-select-border-error);cursor:help}.rac-select-title-wrapper{transition:height var(--rac-duration-base) cubic-bezier(.4,0,.2,1);display:flex;width:100%}.rac-select-title{min-height:var(--rac-select-min-height);position:relative;flex-wrap:wrap;display:flex;width:100%}.rac-spacer{min-height:var(--rac-select-min-height)}.rac-title-container{height:100%}.rac-title-text{font-size:var(--rac-title-font-size);align-content:center;display:block;height:100%}@keyframes rac-fade-in{0%{opacity:0;transform:translateY(var(--rac-title-anim-shift))}to{opacity:1;transform:translateY(0)}}.rac-loading-container{align-items:end;display:grid;height:100%}.rac-loading-dots{display:inline-flex;--rac-dots-size: calc(var(--rac-title-font-size) / 4);--rac-dots-gap: calc(var(--rac-title-font-size) / 6);--rac-dots-padding-left: calc(var(--rac-title-font-size) / 4);--rac-dots-padding-bottom: .5em;gap:var(--rac-dots-gap);padding-left:var(--rac-dots-padding-left);padding-bottom:var(--rac-dots-padding-bottom)}.rac-loading-dots i{width:var(--rac-dots-size);height:var(--rac-dots-size);background:var(--rac-dots-color, currentColor);border-radius:50%;animation:blink var(--rac-dots-animation-duration) infinite both}.rac-loading-dots i:nth-child(1){animation-delay:var(--rac-dots-animation-delay-1)}.rac-loading-dots i:nth-child(2){animation-delay:var(--rac-dots-animation-delay-2)}.rac-loading-dots i:nth-child(3){animation-delay:var(--rac-dots-animation-delay-3)}@keyframes blink{0%{opacity:.2}20%{opacity:1}to{opacity:.2}}.rac-select-buttons{display:flex;align-items:center}.rac-select-cancel{height:var(--rac-cancel-height);transition:opacity var(--rac-duration-fast),border-color var(--rac-duration-fast)}.rac-select-arrow{transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1);height:var(--rac-arrow-height);transform-origin:50% 50%;transform:rotate(0);will-change:transform;display:block}.rac-select-arrow.--up,.rac-select-arrow.--open{transform:rotate(180deg)}.rac-select-arrow.--up.--open{transform:rotate(0)}.rac-select-arrow,.rac-select-cancel{object-fit:contain}.rac-select-list{background-color:var(--rac-list-background);color:var(--rac-list-color);max-height:var(--rac-list-max-height);overflow-x:hidden;overflow-y:auto;scrollbar-color:var(--rac-scroll-color) var(--rac-scroll-track);scrollbar-width:thin;scrollbar-gutter:stable;scroll-behavior:smooth;scroll-padding-top:var(--rac-scroll-padding-top);scroll-padding-bottom:var(--rac-scroll-padding-bottom);transition:border-color var(--rac-duration-fast),background-color var(--rac-duration-fast),opacity var(--rac-duration-base)}.rac-select-option{transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);min-height:var(--rac-option-min-height);padding:var(--rac-option-padding);justify-content:space-between;gap:var(--rac-option-gap);overflow-wrap:anywhere;word-break:break-all;scrollbar-width:thin;align-items:center;overflow-x:auto;cursor:pointer;display:flex}.rac-select-option:not(.rac-disabled-option):not(.rac-group-option):hover{background-color:var(--rac-option-hover)}.rac-select-option.rac-highlighted{background-color:var(--rac-option-highlight)}.rac-select-option.rac-selected,.rac-select-option.rac-selected.rac-highlighted{background-color:var(--rac-option-selected)}.rac-option-title{text-overflow:ellipsis;overflow-wrap:anywhere;word-break:break-all;text-wrap:wrap}.rac-disabled-option{cursor:not-allowed;color:var(--rac-disabled-option-color)}.rac-invalid-option{color:var(--rac-invalid-option-color)}.rac-true-option{color:var(--rac-true-option-color)}.rac-false-option{color:var(--rac-false-option-color)}.rac-loading-option{cursor:wait}.rac-group-header{cursor:pointer;min-height:var(--rac-group-header-min-height);padding:var(--rac-group-header-padding);transition:background-color var(--rac-duration-fast) cubic-bezier(.4,0,.2,1);display:flex;justify-content:space-between;align-items:center;font-weight:var(--rac-group-header-font-weight);font-size:var(--rac-group-header-font-size)}.rac-group-container{padding-left:var(--rac-group-container-padding-left)}.rac-group-arrow{display:block;will-change:transform;transition:transform var(--rac-duration-base) cubic-bezier(.4,0,.2,1),padding var(--rac-duration-fast);transform-origin:50% 50%;transform:translateZ(0)}.rac-group-arrow.--open{transform:rotate(180deg)}.rac-disabled-group{cursor:not-allowed;color:var(--rac-disabled-group-color)}.rac-select-selected{display:flex;align-items:center}.rac-multiple-selected-option{transition:background-color var(--rac-duration-fast, --rac-duration) cubic-bezier(.4,0,.2,1),transform var(--rac-duration) ease;background-color:color-mix(in srgb,CanvasText 10%,Canvas);min-height:var(--rac-multiple-selected-min-height);position:relative;display:inline-flex;align-items:center;vertical-align:middle;line-height:normal;padding:var(--rac-multiple-selected-padding);margin:var(--rac-multiple-selected-margin);white-space:nowrap;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none}@media(hover:hover){.rac-multiple-selected-option:hover{background-color:color-mix(in srgb,CanvasText 25%,Canvas)}}.rac-multiple-del{background-color:var(--rac-multiple-del-bg);-webkit-tap-highlight-color:transparent;align-items:center;position:absolute;-webkit-user-select:none;user-select:none;display:grid;height:100%;right:0}.rac-multiple-del:hover{color:var(--rac-multiple-del-hover-color)}.rac-multiple-option{-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none}.rac-multiple-selected-option.--deleting-shake{background-color:var(--rac-multiple-deleting-bg);animation:rac-shake .3s infinite}@keyframes rac-shake{0%{transform:rotate(0)}25%{transform:rotate(-1deg)}75%{transform:rotate(1deg)}to{transform:rotate(0)}}.rac-checkbox-default{margin-right:var(--rac-checkbox-margin-right);min-height:var(--rac-option-min-height);min-width:var(--rac-option-min-height);border:var(--rac-checkbox-border);justify-content:center;align-items:center;position:relative;display:flex;height:100%}.rac-checkbox{margin-right:var(--rac-checkbox-margin-right);justify-content:center;align-items:center;position:relative;display:flex}.rac-checkmark{transition:max-height var(--rac-duration-base),max-width var(--rac-duration-base),opacity var(--rac-duration-base);position:absolute;max-height:0;opacity:0}.rac-checkmark.--checked{max-height:var(--rac-option-min-height);opacity:1}.rac-check-box{height:var(--rac-group-open-height)}@keyframes expandWidth{0%{min-width:0}to{min-width:var(--del-width)}}.rac-del-spacer{animation:expandWidth .3s ease forwards}