@g4rcez/components 2.2.7 → 2.2.9

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.umd.js CHANGED
@@ -18,7 +18,7 @@ Valid keys: `+JSON.stringify(Object.keys(L),null," "));var R=pe(te,Z,H,ee,ie+".
18
18
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qB(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function UB(e){if(Array.isArray(e))return xh(e)}function CT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function IT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?CT(Object(n),!0).forEach(function(r){AT(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function AT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ys(e,t){return KB(e)||YB(e,t)||PT(e,t)||GB()}function GB(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
19
19
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PT(e,t){if(e){if(typeof e=="string")return xh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xh(e,t)}}function xh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function YB(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,a=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function KB(e){if(Array.isArray(e))return e}var ZB=typeof bh=="function"?bh:bh.default,XB="file-invalid-type",QB="file-too-large",JB="file-too-small",e4="too-many-files",t4=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:XB,message:"File type must be ".concat(r)}},OT=function(t){return{code:QB,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},_T=function(t){return{code:JB,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},n4={code:e4,message:"Too many files"};function r4(e){return e.type===""&&typeof e.getAsFile=="function"}function MT(e,t){var n=e.type==="application/x-moz-file"||ZB(e,t)||r4(e);return[n,n?null:t4(t)]}function DT(e,t,n){if(Io(e.size))if(Io(t)&&Io(n)){if(e.size>n)return[!1,OT(n)];if(e.size<t)return[!1,_T(t)]}else{if(Io(t)&&e.size<t)return[!1,_T(t)];if(Io(n)&&e.size>n)return[!1,OT(n)]}return[!0,null]}function Io(e){return e!=null}function o4(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,i=e.multiple,s=e.maxFiles,a=e.validator;return!i&&t.length>1||i&&s>=1&&t.length>s?!1:t.every(function(l){var c=MT(l,n),u=Ys(c,1),d=u[0],f=DT(l,r,o),p=Ys(f,1),h=p[0],y=a?a(l):null;return d&&h&&!y})}function fc(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Ks(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function NT(e){e.preventDefault()}function i4(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function s4(e){return e.indexOf("Edge/")!==-1}function a4(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return i4(e)||s4(e)}function ar(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return!fc(r)&&a&&a.apply(void 0,[r].concat(i)),fc(r)})}}function l4(){return"showOpenFilePicker"in window}function c4(e){if(Io(e)){var t=Object.entries(e).filter(function(n){var r=Ys(n,2),o=r[0],i=r[1],s=!0;return FT(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),s=!1),(!Array.isArray(i)||!i.every(LT))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),s=!1),s}).reduce(function(n,r){var o=Ys(r,2),i=o[0],s=o[1];return IT(IT({},n),{},AT({},i,s))},{});return[{description:"Files",accept:t}]}return e}function u4(e){if(Io(e))return Object.entries(e).reduce(function(t,n){var r=Ys(n,2),o=r[0],i=r[1];return[].concat(kT(t),[o],kT(i))},[]).filter(function(t){return FT(t)||LT(t)}).join(",")}function d4(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function f4(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function FT(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function LT(e){return/^.*\.[\w]+$/.test(e)}var p4=["children"],h4=["open"],m4=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],g4=["refKey","onChange","onClick"];function VT(e){return b4(e)||v4(e)||$T(e)||y4()}function y4(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
20
20
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v4(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function b4(e){if(Array.isArray(e))return Sh(e)}function wh(e,t){return S4(e)||w4(e,t)||$T(e,t)||x4()}function x4(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
21
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $T(e,t){if(e){if(typeof e=="string")return Sh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sh(e,t)}}function Sh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w4(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,a=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function S4(e){if(Array.isArray(e))return e}function zT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zT(Object(n),!0).forEach(function(r){Th(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Th(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pc(e,t){if(e==null)return{};var n=T4(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T4(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var Eh=S.forwardRef(function(e,t){var n=e.children,r=pc(e,p4),o=RT(r),i=o.open,s=pc(o,h4);return S.useImperativeHandle(t,function(){return{open:i}},[i]),S.createElement(S.Fragment,null,n(St(St({},s),{},{open:i})))});Eh.displayName="Dropzone";var jT={disabled:!1,getFilesFromEvent:DB,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Eh.defaultProps=jT,Eh.propTypes={children:yt.func,accept:yt.objectOf(yt.arrayOf(yt.string)),multiple:yt.bool,preventDropOnDocument:yt.bool,noClick:yt.bool,noKeyboard:yt.bool,noDrag:yt.bool,noDragEventsBubbling:yt.bool,minSize:yt.number,maxSize:yt.number,maxFiles:yt.number,disabled:yt.bool,getFilesFromEvent:yt.func,onFileDialogCancel:yt.func,onFileDialogOpen:yt.func,useFsAccessApi:yt.bool,autoFocus:yt.bool,onDragEnter:yt.func,onDragLeave:yt.func,onDragOver:yt.func,onDrop:yt.func,onDropAccepted:yt.func,onDropRejected:yt.func,onError:yt.func,validator:yt.func};var kh={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function RT(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=St(St({},jT),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,i=t.maxSize,s=t.minSize,a=t.multiple,l=t.maxFiles,c=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,h=t.onDropRejected,y=t.onFileDialogCancel,m=t.onFileDialogOpen,v=t.useFsAccessApi,b=t.autoFocus,x=t.preventDropOnDocument,T=t.noClick,E=t.noKeyboard,I=t.noDrag,w=t.noDragEventsBubbling,k=t.onError,A=t.validator,O=S.useMemo(function(){return u4(n)},[n]),N=S.useMemo(function(){return c4(n)},[n]),M=S.useMemo(function(){return typeof m=="function"?m:BT},[m]),$=S.useMemo(function(){return typeof y=="function"?y:BT},[y]),_=S.useRef(null),F=S.useRef(null),z=S.useReducer(E4,kh),D=wh(z,2),C=D[0],V=D[1],L=C.isFocused,B=C.isFileDialogActive,U=S.useRef(typeof window<"u"&&window.isSecureContext&&v&&l4()),G=function(){!U.current&&B&&setTimeout(function(){if(F.current){var X=F.current.files;X.length||(V({type:"closeDialog"}),$())}},300)};S.useEffect(function(){return window.addEventListener("focus",G,!1),function(){window.removeEventListener("focus",G,!1)}},[F,B,$,U]);var H=S.useRef([]),ee=S.useRef([]),ie=function(X){_.current&&_.current.contains(X.target)||(X.preventDefault(),H.current=[])};S.useEffect(function(){return x&&(document.addEventListener("dragover",NT,!1),document.addEventListener("drop",ie,!1)),function(){x&&(document.removeEventListener("dragover",NT),document.removeEventListener("drop",ie))}},[_,x]),S.useEffect(function(){var j=function(De){ee.current=[].concat(VT(ee.current),[De.target]),Ks(De)&&V({isDragGlobal:!0,type:"setDragGlobal"})},X=function(De){ee.current=ee.current.filter(function(Ne){return Ne!==De.target&&Ne!==null}),!(ee.current.length>0)&&V({isDragGlobal:!1,type:"setDragGlobal"})},me=function(){ee.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})},ve=function(){ee.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",j,!1),document.addEventListener("dragleave",X,!1),document.addEventListener("dragend",me,!1),document.addEventListener("drop",ve,!1),function(){document.removeEventListener("dragenter",j),document.removeEventListener("dragleave",X),document.removeEventListener("dragend",me),document.removeEventListener("drop",ve)}},[_]),S.useEffect(function(){return!r&&b&&_.current&&_.current.focus(),function(){}},[_,b,r]);var te=S.useCallback(function(j){k?k(j):console.error(j)},[k]),q=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j),H.current=[].concat(VT(H.current),[j.target]),Ks(j)&&Promise.resolve(o(j)).then(function(X){if(!(fc(j)&&!w)){var me=X.length,ve=me>0&&o4({files:X,accept:O,minSize:s,maxSize:i,multiple:a,maxFiles:l,validator:A}),ke=me>0&&!ve;V({isDragAccept:ve,isDragReject:ke,isDragActive:!0,type:"setDraggedFiles"}),c&&c(j)}}).catch(function(X){return te(X)})},[o,c,te,w,O,s,i,a,l,A]),Y=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j);var X=Ks(j);if(X&&j.dataTransfer)try{j.dataTransfer.dropEffect="copy"}catch{}return X&&d&&d(j),!1},[d,w]),Z=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j);var X=H.current.filter(function(ve){return _.current&&_.current.contains(ve)}),me=X.indexOf(j.target);me!==-1&&X.splice(me,1),H.current=X,!(X.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Ks(j)&&u&&u(j))},[_,u,w]),pe=S.useCallback(function(j,X){var me=[],ve=[];j.forEach(function(ke){var De=MT(ke,O),Ne=wh(De,2),ct=Ne[0],Nt=Ne[1],Qt=DT(ke,s,i),Re=wh(Qt,2),W=Re[0],K=Re[1],Oe=A?A(ke):null;if(ct&&W&&!Oe)me.push(ke);else{var Ue=[Nt,K];Oe&&(Ue=Ue.concat(Oe)),ve.push({file:ke,errors:Ue.filter(function(Ye){return Ye})})}}),(!a&&me.length>1||a&&l>=1&&me.length>l)&&(me.forEach(function(ke){ve.push({file:ke,errors:[n4]})}),me.splice(0)),V({acceptedFiles:me,fileRejections:ve,type:"setFiles"}),f&&f(me,ve,X),ve.length>0&&h&&h(ve,X),me.length>0&&p&&p(me,X)},[V,a,O,s,i,l,f,p,h,A]),R=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j),H.current=[],Ks(j)&&Promise.resolve(o(j)).then(function(X){fc(j)&&!w||pe(X,j)}).catch(function(X){return te(X)}),V({type:"reset"})},[o,pe,te,w]),ae=S.useCallback(function(){if(U.current){V({type:"openDialog"}),M();var j={multiple:a,types:N};window.showOpenFilePicker(j).then(function(X){return o(X)}).then(function(X){pe(X,null),V({type:"closeDialog"})}).catch(function(X){d4(X)?($(X),V({type:"closeDialog"})):f4(X)?(U.current=!1,F.current?(F.current.value=null,F.current.click()):te(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):te(X)});return}F.current&&(V({type:"openDialog"}),M(),F.current.value=null,F.current.click())},[V,M,$,v,pe,te,N,a]),ce=S.useCallback(function(j){!_.current||!_.current.isEqualNode(j.target)||(j.key===" "||j.key==="Enter"||j.keyCode===32||j.keyCode===13)&&(j.preventDefault(),ae())},[_,ae]),Q=S.useCallback(function(){V({type:"focus"})},[]),ue=S.useCallback(function(){V({type:"blur"})},[]),re=S.useCallback(function(){T||(a4()?setTimeout(ae,0):ae())},[T,ae]),he=function(X){return r?null:X},oe=function(X){return E?null:he(X)},le=function(X){return I?null:he(X)},be=function(X){w&&X.stopPropagation()},de=S.useMemo(function(){return function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=j.refKey,me=X===void 0?"ref":X,ve=j.role,ke=j.onKeyDown,De=j.onFocus,Ne=j.onBlur,ct=j.onClick,Nt=j.onDragEnter,Qt=j.onDragOver,Re=j.onDragLeave,W=j.onDrop,K=pc(j,m4);return St(St(Th({onKeyDown:oe(ar(ke,ce)),onFocus:oe(ar(De,Q)),onBlur:oe(ar(Ne,ue)),onClick:he(ar(ct,re)),onDragEnter:le(ar(Nt,q)),onDragOver:le(ar(Qt,Y)),onDragLeave:le(ar(Re,Z)),onDrop:le(ar(W,R)),role:typeof ve=="string"&&ve!==""?ve:"presentation"},me,_),!r&&!E?{tabIndex:0}:{}),K)}},[_,ce,Q,ue,re,q,Y,Z,R,E,I,r]),ne=S.useCallback(function(j){j.stopPropagation()},[]),J=S.useMemo(function(){return function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=j.refKey,me=X===void 0?"ref":X,ve=j.onChange,ke=j.onClick,De=pc(j,g4),Ne=Th({accept:O,multiple:a,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:he(ar(ve,R)),onClick:he(ar(ke,ne)),tabIndex:-1},me,F);return St(St({},Ne),De)}},[F,n,a,R,r]);return St(St({},C),{},{isFocused:L&&!r,getRootProps:de,getInputProps:J,rootRef:_,inputRef:F,open:he(ae)})}function E4(e,t){switch(t.type){case"focus":return St(St({},e),{},{isFocused:!0});case"blur":return St(St({},e),{},{isFocused:!1});case"openDialog":return St(St({},kh),{},{isFileDialogActive:!0});case"closeDialog":return St(St({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return St(St({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return St(St({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return St(St({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return St({},kh);default:return e}}function BT(){}const HT=S.createContext([null,()=>{}]),k4=()=>S.useContext(HT),C4=e=>e.type.startsWith("image/")?"img":e.type.startsWith("audio/")?"audio":e.type.startsWith("video/")?"video":e.type,I4={csv:Mu,xls:Mu,mov:jg,mp4:jg,xlsx:Mu,pdf:zg,txt:zg,json:fI,mp3:aI},A4=e=>{const[,t]=k4(),[n,r]=S.useState({url:"",type:"",size:""});S.useEffect(()=>{const l=e.file,c=URL.createObjectURL(l);return r({url:c,type:C4(l),size:wB(l.size)}),()=>URL.revokeObjectURL(c)},[e.file]);const o=l=>{l.stopPropagation(),l.preventDefault(),t({...n,file:e.file})},i=l=>{l.preventDefault(),l.stopPropagation(),e.onDeleteFile?.(e.file)},s=I4[e.file.name.split(".").at(-1)]??Rg,a=n.type==="img"?g.jsx("img",{src:n.url,className:"object-contain w-full",alt:e.file.name}):g.jsx(s,{strokeWidth:2,absoluteStrokeWidth:!0,size:48});return g.jsxs("li",{className:"flex flex-row gap-4 justify-between w-full border-b border-card-border last:border-b-transparent",children:[g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-row gap-4 items-center",children:[g.jsx("button",{type:"button",onClick:o,className:"flex overflow-hidden justify-center items-center max-w-16 m-2 size-16",children:a}),g.jsxs("div",{className:"flex flex-col justify-start items-start text-left",children:[g.jsx("span",{children:e.file.name}),g.jsx("span",{className:"text-sm italic",children:n.size})]})]}),e.File?g.jsx("div",{className:"flex-1 min-w-full",children:g.jsx(e.File,{file:e.file})}):null]}),g.jsx("div",{className:"flex justify-start py-4 transition-colors duration-300 ease-linear align-start hover:text-danger-hover",children:g.jsx("button",{onClick:i,type:"button",className:"flex justify-center items-center size-6",children:g.jsx(Lo,{size:16})})})]})},P4=e=>g.jsx("ul",{className:"space-y-8 w-full",children:e.files.map(t=>g.jsx(A4,{File:e.File,onDeleteFile:e.onDeleteFile,file:t},t.name))}),WT=e=>{const t=At(),n=e.dragging?pI:hI;return g.jsxs("div",{className:"flex flex-col justify-center items-center",children:[g.jsx("div",{className:"flex flex-col gap-2 justify-center items-center",children:g.jsx(n,{className:"text-primary",size:80})}),g.jsxs("div",{className:"flex flex-col gap-1 items-center my-4",children:[g.jsx("p",{children:t.uploadIdle}),g.jsx("button",{className:"underline text-primary",type:"button",children:t.uploadIdleButton})]})]})},O4=e=>e.isDragActive?g.jsx(WT,{files:e.files,dragging:!0}):e.files.length>0?g.jsx(P4,{File:e.File,onDeleteFile:e.onDeleteFile,files:e.files}):g.jsx(S.Fragment,{children:e.idle}),_4=g.jsx(WT,{dragging:!1}),M4=e=>{const t=e.item.file,n=e.item.type;return g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx("p",{className:"text-lg font-medium",children:e.item.file.name}),g.jsx("p",{className:"text-base",children:e.item.size}),n==="img"?g.jsx("img",{className:"container inline-block w-full max-w-96",src:e.item.url,alt:t.name}):n==="video"?g.jsx("video",{className:"container block w-full max-w-96",src:e.item.url,controls:!0,muted:!0}):n==="audio"?g.jsx("figure",{children:g.jsx("audio",{controls:!0,src:e.item.url})}):null]})},D4=({idle:e=_4,onDeleteFile:t,File:n,onDrop:r,...o})=>{const i=At(),s=S.useState(null),[a,l]=S.useState([]),c=o.files??a,u=()=>s[1](null),d=y=>{r?.(y),l(m=>m.concat(y))},{getRootProps:f,getInputProps:p,isDragActive:h}=RT({onDrop:d});return g.jsxs(HT.Provider,{value:s,children:[g.jsx(Ws,{overlayClickClose:!0,title:i.uploadDialogTitle,ariaTitle:i.uploadDialogTitle,open:s[0]!==null,onChange:u,children:s[0]?g.jsx(M4,{item:s[0]}):null}),g.jsxs("div",{...f(),"data-active":c?c.length>0:!1,className:"flex flex-col items-center justify-center rounded-lg border border-card-border p-6 text-foreground data-[active=true]:border-solid data-[active=false]:border-dashed data-[active=true]:border-transparent data-[active=true]:bg-card-background",children:[g.jsx("input",{...p(o),name:o.name,id:o.name}),g.jsx(O4,{File:n,onDeleteFile:t,isDragActive:h,idle:e,files:c})]})]})},qT=()=>window.matchMedia("@media (pointer: coarse)"),N4=()=>{const e=S.useRef(Dr()?null:qT()),[t,n]=S.useState(Dr()?!1:e.current?.matches??!1);return S.useEffect(()=>{(e.current===null?qT():e.current).addEventListener("change",o=>n(o.matches))},[]),t},UT=(e,t="overflow-hidden")=>{const n=S.useRef(null),r=N4(),o=S.useRef(Dr()?"":document.documentElement.style.overflowY);return S.useEffect(()=>{if(!(n.current===null&&!e)&&t!=="block-only"&&t==="overflow-hidden")if(e){if(o.current=document.documentElement.style.overflowY,document.documentElement.style.overflowY="hidden",r||vv())return;document.documentElement.style.padding=Sg(document.documentElement)?"0 15px 0 0":""}else document.documentElement.style.padding="",document.documentElement.style.overflowY=o.current},[e,r,t]),S.useEffect(()=>{if(!e)return;const i=new AbortController,s=document.documentElement,a=l=>{const c=n.current;if(c&&c.contains(l.target)){const u=c.getBoundingClientRect(),d=c.style.height?Number(Hk(c.style.height)):null,f=Be.number(d)?d:u.height,p=c.scrollHeight<=f;return f===c.scrollHeight?e?l.preventDefault():void 0:p?void 0:e?l.preventDefault():void 0}return l.currentTarget===document.documentElement,e?l.preventDefault():void 0};return s.addEventListener("wheel",a,{signal:i.signal,passive:!1}),s.addEventListener("scroll",a,{signal:i.signal,passive:!1}),()=>{i.abort()}},[e]),n},F4=(e,t)=>{e=String(e).toLocaleLowerCase(),t=String(t).toLocaleLowerCase();const n=t[0],r=e.split("").map((s,a)=>s===n?a:!1).filter(s=>s!==!1);if(r.length===0)return null;const o=[];if(r.forEach(s=>{let a=s+1;const l=[s];for(let c=1;c<t.length;c++){const u=t[c];if(a=e.indexOf(u,a),a===-1)return;l.push(a),a++}o.push(l)}),o.length===0)return null;const i=o.sort((s,a)=>{if(s.length===1)return s[0]-a[0];const l=s[s.length-1]-s[0],c=a[a.length-1]-a[0];return l-c})[0];return e===t?1:i.length>1?2+(i[i.length-1]-i[0]):2+i[0]},GT=(e,t,n)=>{const r=e.split(t).filter(Boolean);let o=n;for(const i of r){if(o==null)return o;o=o[i]}return o},YT={basic:/[,[\]]+?/,extend:/[,[\].]+?/},KT=(e,t)=>{const n=GT(t,YT.basic,e);return n!==void 0&&n!==e?n:GT(t,YT.extend,e)},ZT=e=>e.replace(/[^0-9]/g,""),hc=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),XT=(e,t,n,r="FUZZY")=>r==="CONTAINS"?e.includes(t):r==="EQUAL"?e===t:r==="CONTAINS_NUMBERS"?ZT(e).includes(ZT(t)):r==="STARTS_WITH"?e.startsWith(t):r==="ENDS_WITH"?e.endsWith(t):r==="FUZZY"?F4(e,t)!==null:!1,L4=(e,t,n,r="FUZZY")=>Array.isArray(t)?t.some(o=>XT(e,o,n,r)):XT(e,t,n,r),Ch=(e,t,n)=>{if(n.length===0)return e;const r=new Map,o=n.map(i=>({...i,value:Be.array(i.value)?i.value.map(hc):hc(`${i.value}`)}));return e.forEach(i=>{const s=KT(i,t);o.forEach(a=>{const l=KT(i,a.key);if(!l)return;const c=hc(`${a.value}`.toLocaleLowerCase()).trim(),u=hc(`${l}`.toLocaleLowerCase()).trim();if(L4(u,c,a.score,a.match))return void r.set(s,i);Be.function(a.ifNotMatch)&&a.ifNotMatch(c,u)&&r.set(s,i)})}),Array.from(r.values())},V4=e=>g.jsx(S.Fragment,{children:e.children}),$4={duration:200,open:{transform:"scaleY(1)",opacity:1},close:{transform:"scaleY(0)",opacity:0},initial:{transform:"scaleY(0)",opacity:.2}},z4=[],j4=S.forwardRef(function(t,n){return g.jsx(He.ul,{...t,ref:n,className:"overscroll-contain w-full max-h-96 rounded-lg",children:g.jsx(mn,{children:t.children})})}),R4=S.forwardRef(function({item:t,context:n,...r},o){return g.jsx(He.li,{...r,ref:o,className:"first:rounded-t-lg last:rounded-t-lg"})}),B4={List:j4,Item:R4},Pi=40,H4=S.forwardRef(({left:e,error:t,right:n,loading:r,options:o,container:i,rightLabel:s,interactive:a,emptyMessage:l,optionalText:c,labelClassName:u,feedback:d=null,hideLeft:f=!1,required:p=!1,dynamicOption:h=!1,...y},m)=>{const v=S.useRef(null),b=S.useRef(null),x=S.useRef(null),T=y.value??y.defaultValue??"",E=At(),[I,w]=S.useState(()=>Math.min(320,Pi*o.length)),[k,A]=S.useState(!1),[O,N]=S.useState(""),[M,$]=S.useState(T),[_,F]=S.useState(()=>o.find(j=>j.value===T)?.label??T),[z,D]=S.useState(null),C=S.useRef(z4),V=UT(k,"block-only"),L=h&&O!==""?[{value:O,label:O,"data-dynamic":"true"},...o]:o,B=()=>Ri.flushSync(()=>A(!0)),U=O?Ch(L,"value",[{key:"value",value:O},{key:"label",value:O}]):L,G=()=>{A(!1),w(0)},H=U.filter(j=>j.hidden!==!0),ee=h?void 0:`^(${o.map(j=>`${pd(j.value)}${j.label?"|"+pd(j.label):""}`).join("|")})$`,{x:ie,y:te,strategy:q,refs:Y,context:Z,placement:pe}=Gn({open:k,transform:!0,onOpenChange:A,placement:"bottom-start",whileElementsMounted:io,middleware:[Ho(4),My({allowedPlacements:["top-start","bottom-start"],alignment:"start"}),_y({padding:10,elementContext:"reference",apply(j){const me=j.elements.floating.querySelector("ul")?.getBoundingClientRect().height||0,ve=Wi(Y.reference.current,window.innerHeight),ke=Math.min(me<Pi?ve:me,ve,j.availableHeight),De=H.length===0?Pi:Math.min(ke,ve,me),Ne=`${b.current.getBoundingClientRect().width}px`;Object.assign(j.elements.floating.style,{width:Ne,maxWidth:Ne,height:De})}})]}),R=uv(Z,$4),{getReferenceProps:ae,getFloatingProps:ce,getItemProps:Q}=Yn([gr(Z,{role:"listbox"}),Mr(Z),Ya(Z,{cols:0,listRef:C,loop:!0,virtual:!0,allowEscape:!0,activeIndex:z,selectedIndex:z,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,scrollItemIntoView:!0})]);S.useEffect(()=>{if(y.value){const j=o.find(X=>X.value===y.value);j&&(F(j.label??j.value),$(y.value))}},[y.value,o.length]),S.useEffect(()=>{if(!k)return w(0);const j=Y.reference;if(j.current===null)return;const X=Wi(j.current,window.innerHeight);setTimeout(()=>w(Math.min(X,H.length*Pi)),100)},[O,k,Y.reference,H.length]),S.useEffect(()=>{const j=Y.reference.current;if(j)return Hi(j)},[]);const ue=(j,X)=>{$(j.value);const me=Y.reference.current;if(!me)return;me?.setAttribute("data-value",j.value),me.value=j.value;const ve=new Event("change",{bubbles:!1,cancelable:!0});me.dispatchEvent(ve),y.onChange&&y.onChange(ve),F(j.label??""),G(),N(""),D(X)},re=j=>{const X=j.target.value;return N(X),!k&&X===""?A(!0):(j.target.name=y.name||"",X?A(!0):y.onChange?.(j))},he=()=>{B(),N(""),Y.reference.current?.focus()},oe=()=>{D(j=>j===null?0:j),B(),N("")},le=()=>{Y.reference.current?.setAttribute("data-value",""),N(""),$(""),F(""),wg(Y.reference.current),G()},be=y.id||y.name,de=`${be}-shadow`,ne=H.length===0,J=pe==="top"||pe==="top-start";return g.jsxs(rs,{...y,left:e,error:t,ref:b,form:y.form,loading:r,name:y.name,feedback:k&&J?y.title:d,hideLeft:f,required:p,title:y.title,container:i,rightLabel:s,interactive:a,id:de,optionalText:c,componentName:"autocomplete",labelClassName:u,placeholder:y.placeholder,right:g.jsxs("span",{className:"flex gap-0.5 items-center",children:[n,g.jsxs("button",{type:"button",className:"p-2 transition-colors md:p-1 link:text-primary",onClick:he,children:[g.jsx(Iu,{size:20}),g.jsx("span",{className:"sr-only",children:E.inputCaretDown})]}),M?g.jsx("button",{type:"button",onClick:le,className:"p-2 transition-colors md:p-1 link:text-danger",children:g.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}):null]}),children:[g.jsx("input",{"data-shadow":"true",...ae({...y,onFocus:oe,pattern:ee,onChange:re,id:de,name:de,ref:Y.setReference,onClick:j=>j.currentTarget.focus(),onKeyDown(j){if(j.key==="Escape")return j.currentTarget.blur(),G();if(k){if(j.key==="ArrowDown"){let X=Be.number(z)?z+1:0;return X>H.length-1&&(X=0),x.current?.scrollIntoView({index:X}),D(X)}if(j.key==="ArrowUp"){let X=Be.number(z)?z-1:H.length-1;return X<0&&(X=H.length-1),x.current?.scrollIntoView({index:X}),D(X)}if(j.key==="Enter"){if(z!==null&&H[z])return j.preventDefault(),ue(H[z],z);if(H.length===1)return j.preventDefault(),ue(H[0],0)}}}}),"data-value":M,"data-error":!!t,"data-name":be,"data-target":be,required:p,value:k?O:o.length===0?"":_||M,"aria-autocomplete":"list",autoComplete:"off",className:Pe("input placeholder-input-mask group h-input-height w-full flex-1","rounded-md bg-transparent px-input-x py-input-y text-foreground","outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary","group-error:text-danger group-error:placeholder-input-mask-error","text-base group-focus-within:border-primary group-hover:border-primary",y.className)}),g.jsx("input",{id:be,name:be,type:"hidden","data-origin":be,ref:m,required:p,defaultValue:y.value||M||void 0}),g.jsx(mr,{preserveTabOrder:!0,children:k?g.jsx(lo,{modal:!0,guards:!0,returnFocus:!1,context:Z,initialFocus:-1,visuallyHiddenDismiss:!0,children:g.jsxs(He.div,{...ce({ref:dr(V,Y.setFloating),style:{...R.styles,left:ie,top:te??0,position:q,height:"auto"}}),initial:!1,"data-floating":"true",animate:{height:ne?"auto":I},className:Pe("overscroll-contain p-0 m-0 max-h-80 list-none rounded-t-lg rounded-b-lg border ease-in-out isolate z-floating origin-[top_center] border-floating-border bg-floating-background text-foreground shadow-floating",J?"origin-[bottom_center]":"origin-[top_center]"),onAnimationComplete:()=>{if(!k)return w(0);const X=Y.floating.current.querySelectorAll("li").item(0),me=(X?X.getBoundingClientRect().height:Pi)*H.length;return Ri.flushSync(()=>w(me+2))},children:[ne?g.jsx("div",{role:"option",className:"w-full border-b border-tooltip-border",children:g.jsx("span",{className:"flex justify-between p-2 w-full text-left text-disabled",children:l||E.autocompleteEmpty})}):null,g.jsx(Lp,{overscan:40,ref:x,hidden:ne,data:H,style:{height:I},defaultItemHeight:Pi,components:B4,scrollerRef:j=>{v.current=j},className:"overscroll-contain p-0 max-h-full rounded-lg border-floating bg-floating-background text-foreground",itemContent:(j,X)=>{const me=X.Render??V4,ve=M===X.value||M===X.label,ke=z===j,De=X.label??X.value;return g.jsx("button",{"data-value":X.value,...Q({ref:Ne=>{C.current[j]=Ne},role:"option",type:"button","aria-checked":ve,"aria-current":ve,"aria-selected":ve,"aria-busy":X.disabled,onClick:()=>ue(X,j),className:`cursor-pointer min-h-10 hover:bg-floating-hover w-full p-2 text-left ${ve?"bg-primary-hover text-primary-foreground":""} ${ke?"bg-floating-hover text-floating-foreground":""}`}),children:g.jsx(me,{...y,label:X.label,value:X.value,children:De})})}})]})}):null})]})});class zn extends Map{list=[];constructor(t){super(t),this.list=[],Array.isArray(t)&&(this.list=t),t instanceof zn&&(this.list=Array.from(t.entries()))}set(t,n){return super.set(t,n),this.list=(this.list??[]).concat([[t,n]]),this}remove(t){return super.delete(t),this.list=Array.from(this.entries())??[],this}map(t){return this.list.map((n,r)=>t(n[1],r))}clone(t){const n=new zn(this);return t?t(n):n}static from(t,n){return new zn(t.map(r=>[n(r),r]))}static unique(t,n){return Array.from(zn.from(t,n).values())}toArray(){return Array.from(this.values())}}const QT=40,W4=e=>g.jsx(S.Fragment,{children:e.children}),q4={duration:300,initial:{transform:"scaleY(0)",opacity:.2},open:{transform:"scaleY(1)",opacity:1},close:{transform:"scaleY(0)",opacity:0}},JT=[],U4=S.forwardRef(function(t,n){return g.jsx(He.ul,{...t,role:"listbox",ref:n,className:"w-full rounded-b-lg border-b last:border-transparent border-tooltip-border",children:g.jsx(mn,{children:t.children})})}),G4=S.forwardRef(function({item:t,context:n,...r},o){return g.jsx(He.li,{...r,ref:o,className:"last:rounded-t-lg"})}),Y4={List:U4,Item:G4},K4=e=>{const t=At(),n=S.useRef(null),r=S.Children.count(e.children),[o,i]=S.useState(!1);return S.useEffect(()=>{if(n.current===null)return;const s=n.current.parentElement.getBoundingClientRect(),l=Array.from(n.current.querySelectorAll("[data-component='tag']")).reduce((u,d)=>u+d.getBoundingClientRect().width,0);if(n.current.querySelectorAll("[data-multicounter]").length&&r<=3)return i(!1);if(l>s.width)return i(!0)},[r]),g.jsx("span",{ref:n,className:"flex flex-nowrap gap-x-2",children:o?g.jsxs(la,{size:"small","data-multicounter":"true",children:[r," ",t.multiSelectSelectedLabel]}):e.children})},Z4=S.forwardRef(({left:e,error:t,right:n,options:r,container:o,rightLabel:i,interactive:s,emptyMessage:a,optionalText:l,selectedLabel:c,labelClassName:u,feedback:d=null,hideLeft:f=!1,required:p=!1,dynamicOption:h=!1,onChangeOptions:y,...m},v)=>{const b=S.useMemo(()=>new zn(r.map(ne=>[ne.value,ne])),[r]),x=S.useRef(null),T=S.useRef(null),E=m.value??m.defaultValue??JT,I=At(),[w,k]=S.useState(0),[A,O]=S.useState(!1),[N,M]=S.useState(""),[$,_]=S.useState(()=>{const ne=new zn;return E.forEach(J=>{const j=b.get(J);return j?ne.set(J,j):void 0}),ne}),F=S.useMemo(()=>Array.from($.keys()),[$]),[z,D]=S.useState(()=>{const ne=new Set(E);return r.reduce((J,j)=>ne.has(j.value)?[...J,j.label??j.value]:J,[])??E}),[C,V]=S.useState(null),L=S.useRef(JT),B=h&&N!==""?[{value:N,label:N,"data-dynamic":"true"},...r]:r,U=N.length===0?B:Ch(B,"value",[{key:"value",value:N},{key:"label",value:N}]),G=UT(A,"block-only"),H=U.filter(ne=>ne.hidden!==!0),ee=H.length===0,{x:ie,y:te,strategy:q,refs:Y,context:Z}=Gn({open:A,transform:!0,placement:"bottom-start",strategy:"absolute",onOpenChange:O,whileElementsMounted:io,middleware:[Ho(4),_y({padding:10,elementContext:"reference",apply(ne){const j=ne.elements.floating.querySelector("ul")?.getBoundingClientRect().height||0,X=Wi(Y.reference.current,window.innerHeight),me=Math.min(j<QT?X:j,X,ne.availableHeight),ve=H.length===0?QT:Math.min(me,X,j),ke=`${x.current.getBoundingClientRect().width}px`;Object.assign(ne.elements.floating.style,{width:ke,maxWidth:ke,height:ve})}})]}),pe=uv(Z,q4),{getReferenceProps:R,getFloatingProps:ae,getItemProps:ce}=Yn([gr(Z,{role:"listbox"}),Mr(Z),Ya(Z,{cols:0,listRef:L,loop:!0,virtual:!0,allowEscape:!0,activeIndex:C,selectedIndex:C,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,scrollItemIntoView:!0,onNavigate:ne=>V(J=>ne??J)})]);S.useEffect(()=>{if(!A)return k(0);const ne=Y.reference;if(ne.current===null)return;const J=Wi(ne.current,window.innerHeight);setTimeout(()=>k(Math.min(J,H.length*40)),100)},[N,A,Y.reference]),S.useEffect(()=>{m.value&&_(new zn(m.value.map(ne=>[ne,b.get(ne)])))},[m.value,b]),S.useEffect(()=>{const ne=Y.reference.current;if(ne)return Hi(ne)},[]);const Q=(ne,J)=>{const j=$.clone(ve=>ve.has(ne.value)?ve.remove(ne.value):ve.set(ne.value,ne));_(j);const X=Y.reference.current;if(!X)return;const me=j.map(ve=>ve.value);X?.setAttribute("data-value",JSON.stringify(me)),y&&y(me),D(ve=>ve.concat(ne.label??"")),M(""),V(J)},ue=ne=>{const J=ne.target.value;return M(J),!A&&J===""?O(!0):(ne.target.name=m.name||"",J?O(!0):void 0)},re=()=>{O(!0),M(""),Y.reference.current?.focus()},he=()=>{O(!0),M("")},oe=()=>{Y.reference.current?.setAttribute("data-value","[]"),M(""),O(!1),_(new zn),y?.([])},le=m.id||m.name,be=$.map((ne,J)=>g.jsx(la,{size:"small",icon:g.jsx("button",{type:"button",className:"text-current hover:text-danger focus:text-danger",onClick:j=>{j.preventDefault(),j.stopPropagation(),Q(ne,J)},children:g.jsx(Lo,{size:14})}),children:ne.label??ne.value},`MultiSelect-${ne.value}-x`)),de={height:ee?"0":$.size===0?w-49:w-86};return g.jsxs(rs,{...m,left:e,error:t,ref:x,form:m.form,name:m.name,feedback:d,hideLeft:f,required:p,title:m.title,container:o,rightLabel:i,interactive:s,id:m.name||m.id,optionalText:l,componentName:"autocomplete",labelClassName:u,placeholder:m.placeholder,right:g.jsxs("span",{className:"flex gap-0.5 items-center",children:[n,g.jsxs("button",{type:"button",className:"transition-colors link:text-primary",onClick:re,children:[g.jsx(Iu,{size:20}),g.jsx("span",{className:"sr-only",children:I.inputCaretDown})]}),$?g.jsx("button",{type:"button",onClick:oe,className:"transition-colors link:text-danger",children:g.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}):null]}),children:[g.jsxs("ul",{...R({...m,onFocus:he,id:`${le}-shadow`,name:`${le}-shadow`,ref:Y.setReference}),tabIndex:0,role:"button","data-name":le,"data-target":le,"data-shadow":"true","data-error":!!t,"aria-autocomplete":"list","data-value":F.join(","),className:Pe("input text-base placeholder-input-mask group h-input-height w-full","rounded-md bg-transparent px-input-x py-input-y text-foreground","outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary","group-error:text-danger group-error:placeholder-input-mask-error","group-focus-within:border-primary group-hover:border-primary","flex flex-row items-center gap-2 whitespace-nowrap text-left","max-w-full overflow-x-auto truncate overflow-ellipsis",m.className),children:[F.length>0?null:g.jsx("li",{className:"text-input-placeholder",children:m.placeholder}),g.jsx(K4,{label:c,children:be})]}),g.jsx("input",{id:le,name:le,type:"hidden","data-origin":le,ref:v,required:p,defaultValue:m.value||F||void 0}),g.jsx(mr,{preserveTabOrder:!0,children:A?g.jsx(ld,{lockScroll:!0,children:g.jsx(lo,{modal:!0,guards:!0,returnFocus:!1,context:Z,initialFocus:-1,visuallyHiddenDismiss:!0,children:g.jsxs("div",{...ae({ref:Y.setFloating,style:{...pe.styles,top:te??0,position:q,left:ie,height:w-(F.length===0?65:30)}}),"data-floating":"true",className:"overscroll-contain p-0 m-0 w-full max-h-96 list-none rounded-t-lg rounded-b-lg border shadow-floating isolate z-floating origin-[top_center] border-floating-border bg-floating-background text-foreground",children:[g.jsx("input",{autoFocus:!0,value:N,onChange:ue,title:m.title,placeholder:I.multiSelectInnerPlaceholder,className:"flex-1 mb-1 w-full h-10 bg-transparent rounded border-b transition-colors outline-none focus:ring-2 focus:ring-inset input placeholder-input-mask group border-input-border px-input-x py-input-y focus:ring-primary",onKeyDown:ne=>{if(ne.key==="ArrowDown"){let J=C+1;return J>H.length-1&&(J=0),T.current?.scrollIntoView({index:J}),V(J)}if(ne.key==="ArrowUp"){let J=C-1;return J<0&&(J=H.length-1),T.current?.scrollIntoView({index:J}),V(J)}if(ne.key==="Escape")return ne.currentTarget.blur(),O(!1);if(ne.key==="Enter"){if(C!==null&&H[C])return ne.preventDefault(),Q(H[C],C);if(H.length===1)return ne.preventDefault(),Q(H[0],0)}}}),ee?g.jsx("li",{role:"option",className:"w-full border-b last:border-transparent border-tooltip-border",children:g.jsx("span",{className:"flex justify-between p-2 w-full text-left text-disabled",children:a||I.autocompleteEmpty})}):null,ee?null:g.jsx(He.div,{initial:!1,"data-floating":"true",ref:G,animate:{height:ee?"auto":w},style:de,className:"overscroll-contain w-full max-h-72",onAnimationComplete:()=>{if(!A)return k(0);const J=Y.floating.current.querySelectorAll("li").item(0),j=(J?J.getBoundingClientRect().height:40)*H.length;return Ri.flushSync(()=>k(j+2))},children:g.jsx(Lp,{ref:T,hidden:ee,data:H,components:Y4,style:de,className:"p-0 max-h-72 border-floating-border bg-floating-background text-foreground",itemContent:(ne,J)=>{const j=J.Render??W4,X=$.has(J.value)||$.has(J.label??""),me=C===ne,ve=J.label??J.value;return g.jsxs("button",{"data-value":J.value,...ce({ref:ke=>{L.current[ne]=ke},role:"option",type:"button","aria-checked":X,"aria-current":X,"aria-selected":X,"aria-busy":J.disabled,onClick:()=>Q(J,ne)}),className:`flex w-full max-w-full cursor-pointer items-center justify-start p-2 text-left hover:bg-floating-hover focus:bg-floating-hover ${X||me?"bg-floating-hover text-floating-foreground":""}`,children:[g.jsx(Xp,{onChange:Yo,checked:X,"aria-checked":X,onClick:ke=>{ke.stopPropagation(),Q(J,ne)}}),g.jsx(j,{...m,label:J.label,value:J.value,children:ve})]})}})}),g.jsx("div",{className:"flex overflow-x-auto sticky bottom-0 flex-nowrap gap-2 items-center p-2 w-full rounded-b-lg bg-floating-background",children:$.size===0?g.jsx(la,{theme:"muted",size:"small",children:I.autocompleteEmpty}):be})]})})}):null})]})}),X4=e=>{const[t,n]=S.useState(0);return S.useEffect(()=>{const r=e.current;if(!r)return;const o=r.parentElement;if(!o)return;const i=()=>{n(o.clientHeight)};return o.addEventListener("resize",i),i(),()=>{o.removeEventListener("resize",i)}},[]),t},Q4={Item:S.forwardRef(function(t,n){return g.jsx("li",{...t,ref:n,className:"flex items-center gap-1 justify-between"})}),List:S.forwardRef(function(t,n){return g.jsx("ul",{...t,ref:n,className:"space-y-3"})})},J4=e=>{const t=S.useRef(null),n=X4(t);return g.jsxs("div",{className:"flex flex-row gap-4",ref:t,children:[g.jsxs("div",{className:"py-8 space-y-4 min-w-64 w-fit flex flex-col whitespace-nowrap rounded-lg border border-card-border",children:[g.jsx("header",{className:"border-b border-card-border pb-2"}),g.jsxs("div",{className:"px-8 space-y-2",children:[g.jsx(Ko,{rightLabel:"",title:"Search",placeholder:"Looking for..."}),g.jsx(Lp,{height:n,useWindowScroll:!0,data:e.source,components:Q4,itemContent:(r,o)=>g.jsx(S.Fragment,{children:g.jsx(Xp,{children:g.jsx(e.Item,{data:o})})})})]})]}),g.jsx("div",{children:g.jsx(yr,{children:g.jsx(Au,{})})}),g.jsx("div",{})]})};function e3(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}const t3=({children:e,...t})=>{const n=Fr(t.onIntersection),r=S.useRef(null),[o,i]=S.useState(()=>r.current===null?!1:e3(r.current));return S.useLayoutEffect(()=>{const s=r.current;if(s===null)return;const a=new IntersectionObserver(l=>{const c=l[0];return c.isIntersecting&&n.current?.(),i(u=>c.isIntersecting?!0:u)});return a.observe(s),()=>a.disconnect()},[]),g.jsx("div",{...t,ref:r,children:o?e:null})},mc=P.createContext(void 0);process.env.NODE_ENV!=="production"&&(mc.displayName="ToastContext");function Ih(){const e=P.useContext(mc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":On(73));return e}var n3=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(i){({stack:o}=i)}console.warn(`The result function returned its own inputs without modification. e.g
21
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $T(e,t){if(e){if(typeof e=="string")return Sh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sh(e,t)}}function Sh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function w4(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,i=!1,s,a;try{for(n=n.call(e);!(o=(s=n.next()).done)&&(r.push(s.value),!(t&&r.length===t));o=!0);}catch(l){i=!0,a=l}finally{try{!o&&n.return!=null&&n.return()}finally{if(i)throw a}}return r}}function S4(e){if(Array.isArray(e))return e}function zT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zT(Object(n),!0).forEach(function(r){Th(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Th(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pc(e,t){if(e==null)return{};var n=T4(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T4(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var Eh=S.forwardRef(function(e,t){var n=e.children,r=pc(e,p4),o=RT(r),i=o.open,s=pc(o,h4);return S.useImperativeHandle(t,function(){return{open:i}},[i]),S.createElement(S.Fragment,null,n(St(St({},s),{},{open:i})))});Eh.displayName="Dropzone";var jT={disabled:!1,getFilesFromEvent:DB,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};Eh.defaultProps=jT,Eh.propTypes={children:yt.func,accept:yt.objectOf(yt.arrayOf(yt.string)),multiple:yt.bool,preventDropOnDocument:yt.bool,noClick:yt.bool,noKeyboard:yt.bool,noDrag:yt.bool,noDragEventsBubbling:yt.bool,minSize:yt.number,maxSize:yt.number,maxFiles:yt.number,disabled:yt.bool,getFilesFromEvent:yt.func,onFileDialogCancel:yt.func,onFileDialogOpen:yt.func,useFsAccessApi:yt.bool,autoFocus:yt.bool,onDragEnter:yt.func,onDragLeave:yt.func,onDragOver:yt.func,onDrop:yt.func,onDropAccepted:yt.func,onDropRejected:yt.func,onError:yt.func,validator:yt.func};var kh={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function RT(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=St(St({},jT),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,i=t.maxSize,s=t.minSize,a=t.multiple,l=t.maxFiles,c=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,h=t.onDropRejected,y=t.onFileDialogCancel,m=t.onFileDialogOpen,v=t.useFsAccessApi,b=t.autoFocus,x=t.preventDropOnDocument,T=t.noClick,E=t.noKeyboard,I=t.noDrag,w=t.noDragEventsBubbling,k=t.onError,A=t.validator,O=S.useMemo(function(){return u4(n)},[n]),N=S.useMemo(function(){return c4(n)},[n]),M=S.useMemo(function(){return typeof m=="function"?m:BT},[m]),$=S.useMemo(function(){return typeof y=="function"?y:BT},[y]),_=S.useRef(null),F=S.useRef(null),z=S.useReducer(E4,kh),D=wh(z,2),C=D[0],V=D[1],L=C.isFocused,B=C.isFileDialogActive,U=S.useRef(typeof window<"u"&&window.isSecureContext&&v&&l4()),G=function(){!U.current&&B&&setTimeout(function(){if(F.current){var X=F.current.files;X.length||(V({type:"closeDialog"}),$())}},300)};S.useEffect(function(){return window.addEventListener("focus",G,!1),function(){window.removeEventListener("focus",G,!1)}},[F,B,$,U]);var H=S.useRef([]),ee=S.useRef([]),ie=function(X){_.current&&_.current.contains(X.target)||(X.preventDefault(),H.current=[])};S.useEffect(function(){return x&&(document.addEventListener("dragover",NT,!1),document.addEventListener("drop",ie,!1)),function(){x&&(document.removeEventListener("dragover",NT),document.removeEventListener("drop",ie))}},[_,x]),S.useEffect(function(){var j=function(De){ee.current=[].concat(VT(ee.current),[De.target]),Ks(De)&&V({isDragGlobal:!0,type:"setDragGlobal"})},X=function(De){ee.current=ee.current.filter(function(Ne){return Ne!==De.target&&Ne!==null}),!(ee.current.length>0)&&V({isDragGlobal:!1,type:"setDragGlobal"})},me=function(){ee.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})},ve=function(){ee.current=[],V({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",j,!1),document.addEventListener("dragleave",X,!1),document.addEventListener("dragend",me,!1),document.addEventListener("drop",ve,!1),function(){document.removeEventListener("dragenter",j),document.removeEventListener("dragleave",X),document.removeEventListener("dragend",me),document.removeEventListener("drop",ve)}},[_]),S.useEffect(function(){return!r&&b&&_.current&&_.current.focus(),function(){}},[_,b,r]);var te=S.useCallback(function(j){k?k(j):console.error(j)},[k]),q=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j),H.current=[].concat(VT(H.current),[j.target]),Ks(j)&&Promise.resolve(o(j)).then(function(X){if(!(fc(j)&&!w)){var me=X.length,ve=me>0&&o4({files:X,accept:O,minSize:s,maxSize:i,multiple:a,maxFiles:l,validator:A}),ke=me>0&&!ve;V({isDragAccept:ve,isDragReject:ke,isDragActive:!0,type:"setDraggedFiles"}),c&&c(j)}}).catch(function(X){return te(X)})},[o,c,te,w,O,s,i,a,l,A]),Y=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j);var X=Ks(j);if(X&&j.dataTransfer)try{j.dataTransfer.dropEffect="copy"}catch{}return X&&d&&d(j),!1},[d,w]),Z=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j);var X=H.current.filter(function(ve){return _.current&&_.current.contains(ve)}),me=X.indexOf(j.target);me!==-1&&X.splice(me,1),H.current=X,!(X.length>0)&&(V({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Ks(j)&&u&&u(j))},[_,u,w]),pe=S.useCallback(function(j,X){var me=[],ve=[];j.forEach(function(ke){var De=MT(ke,O),Ne=wh(De,2),ct=Ne[0],Nt=Ne[1],Qt=DT(ke,s,i),Re=wh(Qt,2),W=Re[0],K=Re[1],Oe=A?A(ke):null;if(ct&&W&&!Oe)me.push(ke);else{var Ue=[Nt,K];Oe&&(Ue=Ue.concat(Oe)),ve.push({file:ke,errors:Ue.filter(function(Ye){return Ye})})}}),(!a&&me.length>1||a&&l>=1&&me.length>l)&&(me.forEach(function(ke){ve.push({file:ke,errors:[n4]})}),me.splice(0)),V({acceptedFiles:me,fileRejections:ve,type:"setFiles"}),f&&f(me,ve,X),ve.length>0&&h&&h(ve,X),me.length>0&&p&&p(me,X)},[V,a,O,s,i,l,f,p,h,A]),R=S.useCallback(function(j){j.preventDefault(),j.persist(),be(j),H.current=[],Ks(j)&&Promise.resolve(o(j)).then(function(X){fc(j)&&!w||pe(X,j)}).catch(function(X){return te(X)}),V({type:"reset"})},[o,pe,te,w]),ae=S.useCallback(function(){if(U.current){V({type:"openDialog"}),M();var j={multiple:a,types:N};window.showOpenFilePicker(j).then(function(X){return o(X)}).then(function(X){pe(X,null),V({type:"closeDialog"})}).catch(function(X){d4(X)?($(X),V({type:"closeDialog"})):f4(X)?(U.current=!1,F.current?(F.current.value=null,F.current.click()):te(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):te(X)});return}F.current&&(V({type:"openDialog"}),M(),F.current.value=null,F.current.click())},[V,M,$,v,pe,te,N,a]),ce=S.useCallback(function(j){!_.current||!_.current.isEqualNode(j.target)||(j.key===" "||j.key==="Enter"||j.keyCode===32||j.keyCode===13)&&(j.preventDefault(),ae())},[_,ae]),Q=S.useCallback(function(){V({type:"focus"})},[]),ue=S.useCallback(function(){V({type:"blur"})},[]),re=S.useCallback(function(){T||(a4()?setTimeout(ae,0):ae())},[T,ae]),he=function(X){return r?null:X},oe=function(X){return E?null:he(X)},le=function(X){return I?null:he(X)},be=function(X){w&&X.stopPropagation()},de=S.useMemo(function(){return function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=j.refKey,me=X===void 0?"ref":X,ve=j.role,ke=j.onKeyDown,De=j.onFocus,Ne=j.onBlur,ct=j.onClick,Nt=j.onDragEnter,Qt=j.onDragOver,Re=j.onDragLeave,W=j.onDrop,K=pc(j,m4);return St(St(Th({onKeyDown:oe(ar(ke,ce)),onFocus:oe(ar(De,Q)),onBlur:oe(ar(Ne,ue)),onClick:he(ar(ct,re)),onDragEnter:le(ar(Nt,q)),onDragOver:le(ar(Qt,Y)),onDragLeave:le(ar(Re,Z)),onDrop:le(ar(W,R)),role:typeof ve=="string"&&ve!==""?ve:"presentation"},me,_),!r&&!E?{tabIndex:0}:{}),K)}},[_,ce,Q,ue,re,q,Y,Z,R,E,I,r]),ne=S.useCallback(function(j){j.stopPropagation()},[]),J=S.useMemo(function(){return function(){var j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},X=j.refKey,me=X===void 0?"ref":X,ve=j.onChange,ke=j.onClick,De=pc(j,g4),Ne=Th({accept:O,multiple:a,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:he(ar(ve,R)),onClick:he(ar(ke,ne)),tabIndex:-1},me,F);return St(St({},Ne),De)}},[F,n,a,R,r]);return St(St({},C),{},{isFocused:L&&!r,getRootProps:de,getInputProps:J,rootRef:_,inputRef:F,open:he(ae)})}function E4(e,t){switch(t.type){case"focus":return St(St({},e),{},{isFocused:!0});case"blur":return St(St({},e),{},{isFocused:!1});case"openDialog":return St(St({},kh),{},{isFileDialogActive:!0});case"closeDialog":return St(St({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return St(St({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return St(St({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case"setDragGlobal":return St(St({},e),{},{isDragGlobal:t.isDragGlobal});case"reset":return St({},kh);default:return e}}function BT(){}const HT=S.createContext([null,()=>{}]),k4=()=>S.useContext(HT),C4=e=>e.type.startsWith("image/")?"img":e.type.startsWith("audio/")?"audio":e.type.startsWith("video/")?"video":e.type,I4={csv:Mu,xls:Mu,mov:jg,mp4:jg,xlsx:Mu,pdf:zg,txt:zg,json:fI,mp3:aI},A4=e=>{const[,t]=k4(),[n,r]=S.useState({url:"",type:"",size:""});S.useEffect(()=>{const l=e.file,c=URL.createObjectURL(l);return r({url:c,type:C4(l),size:wB(l.size)}),()=>URL.revokeObjectURL(c)},[e.file]);const o=l=>{l.stopPropagation(),l.preventDefault(),t({...n,file:e.file})},i=l=>{l.preventDefault(),l.stopPropagation(),e.onDeleteFile?.(e.file)},s=I4[e.file.name.split(".").at(-1)]??Rg,a=n.type==="img"?g.jsx("img",{src:n.url,className:"object-contain w-full",alt:e.file.name}):g.jsx(s,{strokeWidth:2,absoluteStrokeWidth:!0,size:48});return g.jsxs("li",{className:"flex flex-row gap-4 justify-between w-full border-b border-card-border last:border-b-transparent",children:[g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-row gap-4 items-center",children:[g.jsx("button",{type:"button",onClick:o,className:"flex overflow-hidden justify-center items-center max-w-16 m-2 size-16",children:a}),g.jsxs("div",{className:"flex flex-col justify-start items-start text-left",children:[g.jsx("span",{children:e.file.name}),g.jsx("span",{className:"text-sm italic",children:n.size})]})]}),e.File?g.jsx("div",{className:"flex-1 min-w-full",children:g.jsx(e.File,{file:e.file})}):null]}),g.jsx("div",{className:"flex justify-start py-4 transition-colors duration-300 ease-linear align-start hover:text-danger-hover",children:g.jsx("button",{onClick:i,type:"button",className:"flex justify-center items-center size-6",children:g.jsx(Lo,{size:16})})})]})},P4=e=>g.jsx("ul",{className:"space-y-8 w-full",children:e.files.map(t=>g.jsx(A4,{File:e.File,onDeleteFile:e.onDeleteFile,file:t},t.name))}),WT=e=>{const t=At(),n=e.dragging?pI:hI;return g.jsxs("div",{className:"flex flex-col justify-center items-center",children:[g.jsx("div",{className:"flex flex-col gap-2 justify-center items-center",children:g.jsx(n,{className:"text-primary",size:80})}),g.jsxs("div",{className:"flex flex-col gap-1 items-center my-4",children:[g.jsx("p",{children:t.uploadIdle}),g.jsx("button",{className:"underline text-primary",type:"button",children:t.uploadIdleButton})]})]})},O4=e=>e.isDragActive?g.jsx(WT,{files:e.files,dragging:!0}):e.files.length>0?g.jsx(P4,{File:e.File,onDeleteFile:e.onDeleteFile,files:e.files}):g.jsx(S.Fragment,{children:e.idle}),_4=g.jsx(WT,{dragging:!1}),M4=e=>{const t=e.item.file,n=e.item.type;return g.jsxs("div",{className:"flex flex-col gap-4",children:[g.jsx("p",{className:"text-lg font-medium",children:e.item.file.name}),g.jsx("p",{className:"text-base",children:e.item.size}),n==="img"?g.jsx("img",{className:"container inline-block w-full max-w-96",src:e.item.url,alt:t.name}):n==="video"?g.jsx("video",{className:"container block w-full max-w-96",src:e.item.url,controls:!0,muted:!0}):n==="audio"?g.jsx("figure",{children:g.jsx("audio",{controls:!0,src:e.item.url})}):null]})},D4=({idle:e=_4,onDeleteFile:t,File:n,onDrop:r,...o})=>{const i=At(),s=S.useState(null),[a,l]=S.useState([]),c=o.files??a,u=()=>s[1](null),d=y=>{r?.(y),l(m=>m.concat(y))},{getRootProps:f,getInputProps:p,isDragActive:h}=RT({onDrop:d});return g.jsxs(HT.Provider,{value:s,children:[g.jsx(Ws,{overlayClickClose:!0,title:i.uploadDialogTitle,ariaTitle:i.uploadDialogTitle,open:s[0]!==null,onChange:u,children:s[0]?g.jsx(M4,{item:s[0]}):null}),g.jsxs("div",{...f(),"data-active":c?c.length>0:!1,className:"flex flex-col items-center justify-center rounded-lg border border-card-border p-6 text-foreground data-[active=true]:border-solid data-[active=false]:border-dashed data-[active=true]:border-transparent data-[active=true]:bg-card-background",children:[g.jsx("input",{...p(o),name:o.name,id:o.name}),g.jsx(O4,{File:n,onDeleteFile:t,isDragActive:h,idle:e,files:c})]})]})},qT=()=>window.matchMedia("@media (pointer: coarse)"),N4=()=>{const e=S.useRef(Dr()?null:qT()),[t,n]=S.useState(Dr()?!1:e.current?.matches??!1);return S.useEffect(()=>{(e.current===null?qT():e.current).addEventListener("change",o=>n(o.matches))},[]),t},UT=(e,t="overflow-hidden")=>{const n=S.useRef(null),r=N4(),o=S.useRef(Dr()?"":document.documentElement.style.overflowY);return S.useEffect(()=>{if(!(n.current===null&&!e)&&t!=="block-only"&&t==="overflow-hidden")if(e){if(o.current=document.documentElement.style.overflowY,document.documentElement.style.overflowY="hidden",r||vv())return;document.documentElement.style.padding=Sg(document.documentElement)?"0 15px 0 0":""}else document.documentElement.style.padding="",document.documentElement.style.overflowY=o.current},[e,r,t]),S.useEffect(()=>{if(!e)return;const i=new AbortController,s=document.documentElement,a=l=>{const c=n.current;if(c&&c.contains(l.target)){const u=c.getBoundingClientRect(),d=c.style.height?Number(Hk(c.style.height)):null,f=Be.number(d)?d:u.height,p=c.scrollHeight<=f;return f===c.scrollHeight?e?l.preventDefault():void 0:p?void 0:e?l.preventDefault():void 0}return l.currentTarget===document.documentElement,e?l.preventDefault():void 0};return s.addEventListener("wheel",a,{signal:i.signal,passive:!1}),s.addEventListener("scroll",a,{signal:i.signal,passive:!1}),()=>{i.abort()}},[e]),n},F4=(e,t)=>{e=String(e).toLocaleLowerCase(),t=String(t).toLocaleLowerCase();const n=t[0],r=e.split("").map((s,a)=>s===n?a:!1).filter(s=>s!==!1);if(r.length===0)return null;const o=[];if(r.forEach(s=>{let a=s+1;const l=[s];for(let c=1;c<t.length;c++){const u=t[c];if(a=e.indexOf(u,a),a===-1)return;l.push(a),a++}o.push(l)}),o.length===0)return null;const i=o.sort((s,a)=>{if(s.length===1)return s[0]-a[0];const l=s[s.length-1]-s[0],c=a[a.length-1]-a[0];return l-c})[0];return e===t?1:i.length>1?2+(i[i.length-1]-i[0]):2+i[0]},GT=(e,t,n)=>{const r=e.split(t).filter(Boolean);let o=n;for(const i of r){if(o==null)return o;o=o[i]}return o},YT={basic:/[,[\]]+?/,extend:/[,[\].]+?/},KT=(e,t)=>{const n=GT(t,YT.basic,e);return n!==void 0&&n!==e?n:GT(t,YT.extend,e)},ZT=e=>e.replace(/[^0-9]/g,""),hc=e=>e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),XT=(e,t,n,r="FUZZY")=>r==="CONTAINS"?e.includes(t):r==="EQUAL"?e===t:r==="CONTAINS_NUMBERS"?ZT(e).includes(ZT(t)):r==="STARTS_WITH"?e.startsWith(t):r==="ENDS_WITH"?e.endsWith(t):r==="FUZZY"?F4(e,t)!==null:!1,L4=(e,t,n,r="FUZZY")=>Array.isArray(t)?t.some(o=>XT(e,o,n,r)):XT(e,t,n,r),Ch=(e,t,n)=>{if(n.length===0)return e;const r=new Map,o=n.map(i=>({...i,value:Be.array(i.value)?i.value.map(hc):hc(`${i.value}`)}));return e.forEach(i=>{const s=KT(i,t);o.forEach(a=>{const l=KT(i,a.key);if(!l)return;const c=hc(`${a.value}`.toLocaleLowerCase()).trim(),u=hc(`${l}`.toLocaleLowerCase()).trim();if(L4(u,c,a.score,a.match))return void r.set(s,i);Be.function(a.ifNotMatch)&&a.ifNotMatch(c,u)&&r.set(s,i)})}),Array.from(r.values())},V4=e=>g.jsx(S.Fragment,{children:e.children}),$4={duration:200,open:{transform:"scaleY(1)",opacity:1},close:{transform:"scaleY(0)",opacity:0},initial:{transform:"scaleY(0)",opacity:.2}},z4=[],j4=S.forwardRef(function(t,n){return g.jsx(He.ul,{...t,ref:n,className:"overscroll-contain w-full max-h-96 rounded-lg",children:g.jsx(mn,{children:t.children})})}),R4=S.forwardRef(function({item:t,context:n,...r},o){return g.jsx(He.li,{...r,ref:o,className:"first:rounded-t-lg last:rounded-t-lg"})}),B4={List:j4,Item:R4},Pi=40,H4=S.forwardRef(({left:e,error:t,right:n,loading:r,options:o,container:i,rightLabel:s,interactive:a,emptyMessage:l,optionalText:c,labelClassName:u,feedback:d=null,hideLeft:f=!1,required:p=!1,dynamicOption:h=!1,...y},m)=>{const v=S.useRef(null),b=S.useRef(null),x=S.useRef(null),T=y.value??y.defaultValue??"",E=At(),[I,w]=S.useState(()=>Math.min(320,Pi*o.length)),[k,A]=S.useState(!1),[O,N]=S.useState(""),[M,$]=S.useState(T),[_,F]=S.useState(()=>o.find(j=>j.value===T)?.label??T),[z,D]=S.useState(null),C=S.useRef(z4),V=UT(k,"block-only"),L=h&&O!==""?[{value:O,label:O,"data-dynamic":"true"},...o]:o,B=()=>Ri.flushSync(()=>A(!0)),U=O?Ch(L,"value",[{key:"value",value:O},{key:"label",value:O}]):L,G=()=>{A(!1),w(0)},H=U.filter(j=>j.hidden!==!0),ee=h?void 0:`^(${o.map(j=>`${pd(j.value)}${j.label?"|"+pd(j.label):""}`).join("|")})$`,{x:ie,y:te,strategy:q,refs:Y,context:Z,placement:pe}=Gn({open:k,transform:!0,onOpenChange:A,placement:"bottom-start",whileElementsMounted:io,middleware:[Ho(4),My({allowedPlacements:["top-start","bottom-start"],alignment:"start"}),_y({padding:10,elementContext:"reference",apply(j){const me=j.elements.floating.querySelector("ul")?.getBoundingClientRect().height||0,ve=Wi(Y.reference.current,window.innerHeight),ke=Math.min(me<Pi?ve:me,ve,j.availableHeight),De=H.length===0?Pi:Math.min(ke,ve,me),Ne=`${b.current?.getBoundingClientRect().width||ve}px`;Object.assign(j.elements.floating.style,{width:Ne,maxWidth:Ne,height:De})}})]}),R=uv(Z,$4),{getReferenceProps:ae,getFloatingProps:ce,getItemProps:Q}=Yn([gr(Z,{role:"listbox"}),Mr(Z),Ya(Z,{cols:0,listRef:C,loop:!0,virtual:!0,allowEscape:!0,activeIndex:z,selectedIndex:z,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,scrollItemIntoView:!0})]);S.useEffect(()=>{if(y.value){const j=o.find(X=>X.value===y.value);j&&(F(j.label??j.value),$(y.value))}},[y.value,o.length]),S.useEffect(()=>{if(!k)return w(0);const j=Y.reference;if(j.current===null)return;const X=Wi(j.current,window.innerHeight);setTimeout(()=>w(Math.min(X,H.length*Pi)),100)},[O,k,Y.reference,H.length]),S.useEffect(()=>{const j=Y.reference.current;if(j)return Hi(j)},[]);const ue=(j,X)=>{$(j.value);const me=Y.reference.current;if(!me)return;me?.setAttribute("data-value",j.value),me.value=j.value;const ve=new Event("change",{bubbles:!1,cancelable:!0});me.dispatchEvent(ve),y.onChange&&y.onChange(ve),F(j.label??""),G(),N(""),D(X)},re=j=>{const X=j.target.value;return N(X),!k&&X===""?A(!0):(j.target.name=y.name||"",X?A(!0):y.onChange?.(j))},he=()=>{B(),N(""),Y.reference.current?.focus()},oe=()=>{D(j=>j===null?0:j),B(),N("")},le=()=>{Y.reference.current?.setAttribute("data-value",""),N(""),$(""),F(""),wg(Y.reference.current),G()},be=y.id||y.name,de=`${be}-shadow`,ne=H.length===0,J=pe==="top"||pe==="top-start";return g.jsxs(rs,{...y,left:e,error:t,ref:b,form:y.form,loading:r,name:y.name,feedback:k&&J?y.title:d,hideLeft:f,required:p,title:y.title,container:i,rightLabel:s,interactive:a,id:de,optionalText:c,componentName:"autocomplete",labelClassName:u,placeholder:y.placeholder,right:g.jsxs("span",{className:"flex gap-0.5 items-center",children:[n,g.jsxs("button",{type:"button",className:"p-2 transition-colors md:p-1 link:text-primary",onClick:he,children:[g.jsx(Iu,{size:20}),g.jsx("span",{className:"sr-only",children:E.inputCaretDown})]}),M?g.jsx("button",{type:"button",onClick:le,className:"p-2 transition-colors md:p-1 link:text-danger",children:g.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}):null]}),children:[g.jsx("input",{"data-shadow":"true",...ae({...y,onFocus:oe,pattern:ee,onChange:re,id:de,name:de,ref:Y.setReference,onClick:j=>j.currentTarget.focus(),onKeyDown(j){if(j.key==="Escape")return j.currentTarget.blur(),G();if(k){if(j.key==="ArrowDown"){let X=Be.number(z)?z+1:0;return X>H.length-1&&(X=0),x.current?.scrollIntoView({index:X}),D(X)}if(j.key==="ArrowUp"){let X=Be.number(z)?z-1:H.length-1;return X<0&&(X=H.length-1),x.current?.scrollIntoView({index:X}),D(X)}if(j.key==="Enter"){if(z!==null&&H[z])return j.preventDefault(),ue(H[z],z);if(H.length===1)return j.preventDefault(),ue(H[0],0)}}}}),"data-value":M,"data-error":!!t,"data-name":be,"data-target":be,required:p,value:k?O:o.length===0?"":_||M,"aria-autocomplete":"list",autoComplete:"off",className:Pe("input placeholder-input-mask group h-input-height w-full flex-1","rounded-md bg-transparent px-input-x py-input-y text-foreground","outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary","group-error:text-danger group-error:placeholder-input-mask-error","text-base group-focus-within:border-primary group-hover:border-primary",y.className)}),g.jsx("input",{id:be,name:be,type:"hidden","data-origin":be,ref:m,required:p,defaultValue:y.value||M||void 0}),g.jsx(mr,{preserveTabOrder:!0,children:k?g.jsx(lo,{modal:!0,guards:!0,returnFocus:!1,context:Z,initialFocus:-1,visuallyHiddenDismiss:!0,children:g.jsxs(He.div,{...ce({ref:dr(V,Y.setFloating),style:{...R.styles,left:ie,top:te??0,position:q,height:"auto"}}),initial:!1,"data-floating":"true",animate:{height:ne?"auto":I},className:Pe("overscroll-contain p-0 m-0 max-h-80 list-none rounded-t-lg rounded-b-lg border ease-in-out isolate z-floating origin-[top_center] border-floating-border bg-floating-background text-foreground shadow-floating",J?"origin-[bottom_center]":"origin-[top_center]"),onAnimationComplete:()=>{if(!k)return w(0);const X=Y.floating.current.querySelectorAll("li").item(0),me=(X?X.getBoundingClientRect().height:Pi)*H.length;return Ri.flushSync(()=>w(me+2))},children:[ne?g.jsx("div",{role:"option",className:"w-full border-b border-tooltip-border",children:g.jsx("span",{className:"flex justify-between p-2 w-full text-left text-disabled",children:l||E.autocompleteEmpty})}):null,g.jsx(Lp,{overscan:40,ref:x,hidden:ne,data:H,style:{height:I},defaultItemHeight:Pi,components:B4,scrollerRef:j=>{v.current=j},className:"overscroll-contain p-0 max-h-full rounded-lg border-floating bg-floating-background text-foreground",itemContent:(j,X)=>{const me=X.Render??V4,ve=M===X.value||M===X.label,ke=z===j,De=X.label??X.value;return g.jsx("button",{"data-value":X.value,...Q({ref:Ne=>{C.current[j]=Ne},role:"option",type:"button","aria-checked":ve,"aria-current":ve,"aria-selected":ve,"aria-busy":X.disabled,onClick:()=>ue(X,j),className:`cursor-pointer min-h-10 hover:bg-floating-hover w-full p-2 text-left ${ve?"bg-primary-hover text-primary-foreground":""} ${ke?"bg-floating-hover text-floating-foreground":""}`}),children:g.jsx(me,{...y,label:X.label,value:X.value,children:De})})}})]})}):null})]})});class zn extends Map{list=[];constructor(t){super(t),this.list=[],Array.isArray(t)&&(this.list=t),t instanceof zn&&(this.list=Array.from(t.entries()))}set(t,n){return super.set(t,n),this.list=(this.list??[]).concat([[t,n]]),this}remove(t){return super.delete(t),this.list=Array.from(this.entries())??[],this}map(t){return this.list.map((n,r)=>t(n[1],r))}clone(t){const n=new zn(this);return t?t(n):n}static from(t,n){return new zn(t.map(r=>[n(r),r]))}static unique(t,n){return Array.from(zn.from(t,n).values())}toArray(){return Array.from(this.values())}}const QT=40,W4=e=>g.jsx(S.Fragment,{children:e.children}),q4={duration:300,initial:{transform:"scaleY(0)",opacity:.2},open:{transform:"scaleY(1)",opacity:1},close:{transform:"scaleY(0)",opacity:0}},JT=[],U4=S.forwardRef(function(t,n){return g.jsx(He.ul,{...t,role:"listbox",ref:n,className:"w-full rounded-b-lg border-b last:border-transparent border-tooltip-border",children:g.jsx(mn,{children:t.children})})}),G4=S.forwardRef(function({item:t,context:n,...r},o){return g.jsx(He.li,{...r,ref:o,className:"last:rounded-t-lg"})}),Y4={List:U4,Item:G4},K4=e=>{const t=At(),n=S.useRef(null),r=S.Children.count(e.children),[o,i]=S.useState(!1);return S.useEffect(()=>{if(n.current===null)return;const s=n.current.parentElement.getBoundingClientRect(),l=Array.from(n.current.querySelectorAll("[data-component='tag']")).reduce((u,d)=>u+d.getBoundingClientRect().width,0);if(n.current.querySelectorAll("[data-multicounter]").length&&r<=3)return i(!1);if(l>s.width)return i(!0)},[r]),g.jsx("span",{ref:n,className:"flex flex-nowrap gap-x-2",children:o?g.jsxs(la,{size:"small","data-multicounter":"true",children:[r," ",t.multiSelectSelectedLabel]}):e.children})},Z4=S.forwardRef(({left:e,error:t,right:n,options:r,container:o,rightLabel:i,interactive:s,emptyMessage:a,optionalText:l,selectedLabel:c,labelClassName:u,feedback:d=null,hideLeft:f=!1,required:p=!1,dynamicOption:h=!1,onChangeOptions:y,...m},v)=>{const b=S.useMemo(()=>new zn(r.map(ne=>[ne.value,ne])),[r]),x=S.useRef(null),T=S.useRef(null),E=m.value??m.defaultValue??JT,I=At(),[w,k]=S.useState(0),[A,O]=S.useState(!1),[N,M]=S.useState(""),[$,_]=S.useState(()=>{const ne=new zn;return E.forEach(J=>{const j=b.get(J);return j?ne.set(J,j):void 0}),ne}),F=S.useMemo(()=>Array.from($.keys()),[$]),[z,D]=S.useState(()=>{const ne=new Set(E);return r.reduce((J,j)=>ne.has(j.value)?[...J,j.label??j.value]:J,[])??E}),[C,V]=S.useState(null),L=S.useRef(JT),B=h&&N!==""?[{value:N,label:N,"data-dynamic":"true"},...r]:r,U=N.length===0?B:Ch(B,"value",[{key:"value",value:N},{key:"label",value:N}]),G=UT(A,"block-only"),H=U.filter(ne=>ne.hidden!==!0),ee=H.length===0,{x:ie,y:te,strategy:q,refs:Y,context:Z}=Gn({open:A,transform:!0,placement:"bottom-start",strategy:"absolute",onOpenChange:O,whileElementsMounted:io,middleware:[Ho(4),_y({padding:10,elementContext:"reference",apply(ne){const j=ne.elements.floating.querySelector("ul")?.getBoundingClientRect().height||0,X=Wi(Y.reference.current,window.innerHeight),me=Math.min(j<QT?X:j,X,ne.availableHeight),ve=H.length===0?QT:Math.min(me,X,j),ke=`${x.current.getBoundingClientRect().width}px`;Object.assign(ne.elements.floating.style,{width:ke,maxWidth:ke,height:ve})}})]}),pe=uv(Z,q4),{getReferenceProps:R,getFloatingProps:ae,getItemProps:ce}=Yn([gr(Z,{role:"listbox"}),Mr(Z),Ya(Z,{cols:0,listRef:L,loop:!0,virtual:!0,allowEscape:!0,activeIndex:C,selectedIndex:C,focusItemOnOpen:"auto",openOnArrowKeyDown:!0,scrollItemIntoView:!0,onNavigate:ne=>V(J=>ne??J)})]);S.useEffect(()=>{if(!A)return k(0);const ne=Y.reference;if(ne.current===null)return;const J=Wi(ne.current,window.innerHeight);setTimeout(()=>k(Math.min(J,H.length*40)),100)},[N,A,Y.reference]),S.useEffect(()=>{m.value&&_(new zn(m.value.map(ne=>[ne,b.get(ne)])))},[m.value,b]),S.useEffect(()=>{const ne=Y.reference.current;if(ne)return Hi(ne)},[]);const Q=(ne,J)=>{const j=$.clone(ve=>ve.has(ne.value)?ve.remove(ne.value):ve.set(ne.value,ne));_(j);const X=Y.reference.current;if(!X)return;const me=j.map(ve=>ve.value);X?.setAttribute("data-value",JSON.stringify(me)),y&&y(me),D(ve=>ve.concat(ne.label??"")),M(""),V(J)},ue=ne=>{const J=ne.target.value;return M(J),!A&&J===""?O(!0):(ne.target.name=m.name||"",J?O(!0):void 0)},re=()=>{O(!0),M(""),Y.reference.current?.focus()},he=()=>{O(!0),M("")},oe=()=>{Y.reference.current?.setAttribute("data-value","[]"),M(""),O(!1),_(new zn),y?.([])},le=m.id||m.name,be=$.map((ne,J)=>g.jsx(la,{size:"small",icon:g.jsx("button",{type:"button",className:"text-current hover:text-danger focus:text-danger",onClick:j=>{j.preventDefault(),j.stopPropagation(),Q(ne,J)},children:g.jsx(Lo,{size:14})}),children:ne.label??ne.value},`MultiSelect-${ne.value}-x`)),de={height:ee?"0":$.size===0?w-49:w-86};return g.jsxs(rs,{...m,left:e,error:t,ref:x,form:m.form,name:m.name,feedback:d,hideLeft:f,required:p,title:m.title,container:o,rightLabel:i,interactive:s,id:m.name||m.id,optionalText:l,componentName:"autocomplete",labelClassName:u,placeholder:m.placeholder,right:g.jsxs("span",{className:"flex gap-0.5 items-center",children:[n,g.jsxs("button",{type:"button",className:"transition-colors link:text-primary",onClick:re,children:[g.jsx(Iu,{size:20}),g.jsx("span",{className:"sr-only",children:I.inputCaretDown})]}),$?g.jsx("button",{type:"button",onClick:oe,className:"transition-colors link:text-danger",children:g.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}):null]}),children:[g.jsxs("ul",{...R({...m,onFocus:he,id:`${le}-shadow`,name:`${le}-shadow`,ref:Y.setReference}),tabIndex:0,role:"button","data-name":le,"data-target":le,"data-shadow":"true","data-error":!!t,"aria-autocomplete":"list","data-value":F.join(","),className:Pe("input text-base placeholder-input-mask group h-input-height w-full","rounded-md bg-transparent px-input-x py-input-y text-foreground","outline-none transition-colors focus:ring-2 focus:ring-inset focus:ring-primary","group-error:text-danger group-error:placeholder-input-mask-error","group-focus-within:border-primary group-hover:border-primary","flex flex-row items-center gap-2 whitespace-nowrap text-left","max-w-full overflow-x-auto truncate overflow-ellipsis",m.className),children:[F.length>0?null:g.jsx("li",{className:"text-input-placeholder",children:m.placeholder}),g.jsx(K4,{label:c,children:be})]}),g.jsx("input",{id:le,name:le,type:"hidden","data-origin":le,ref:v,required:p,defaultValue:m.value||F||void 0}),g.jsx(mr,{preserveTabOrder:!0,children:A?g.jsx(ld,{lockScroll:!0,children:g.jsx(lo,{modal:!0,guards:!0,returnFocus:!1,context:Z,initialFocus:-1,visuallyHiddenDismiss:!0,children:g.jsxs("div",{...ae({ref:Y.setFloating,style:{...pe.styles,top:te??0,position:q,left:ie,height:w-(F.length===0?65:30)}}),"data-floating":"true",className:"overscroll-contain p-0 m-0 w-full max-h-96 list-none rounded-t-lg rounded-b-lg border shadow-floating isolate z-floating origin-[top_center] border-floating-border bg-floating-background text-foreground",children:[g.jsx("input",{autoFocus:!0,value:N,onChange:ue,title:m.title,placeholder:I.multiSelectInnerPlaceholder,className:"flex-1 mb-1 w-full h-10 bg-transparent rounded border-b transition-colors outline-none focus:ring-2 focus:ring-inset input placeholder-input-mask group border-input-border px-input-x py-input-y focus:ring-primary",onKeyDown:ne=>{if(ne.key==="ArrowDown"){let J=C+1;return J>H.length-1&&(J=0),T.current?.scrollIntoView({index:J}),V(J)}if(ne.key==="ArrowUp"){let J=C-1;return J<0&&(J=H.length-1),T.current?.scrollIntoView({index:J}),V(J)}if(ne.key==="Escape")return ne.currentTarget.blur(),O(!1);if(ne.key==="Enter"){if(C!==null&&H[C])return ne.preventDefault(),Q(H[C],C);if(H.length===1)return ne.preventDefault(),Q(H[0],0)}}}),ee?g.jsx("li",{role:"option",className:"w-full border-b last:border-transparent border-tooltip-border",children:g.jsx("span",{className:"flex justify-between p-2 w-full text-left text-disabled",children:a||I.autocompleteEmpty})}):null,ee?null:g.jsx(He.div,{initial:!1,"data-floating":"true",ref:G,animate:{height:ee?"auto":w},style:de,className:"overscroll-contain w-full max-h-72",onAnimationComplete:()=>{if(!A)return k(0);const J=Y.floating.current.querySelectorAll("li").item(0),j=(J?J.getBoundingClientRect().height:40)*H.length;return Ri.flushSync(()=>k(j+2))},children:g.jsx(Lp,{ref:T,hidden:ee,data:H,components:Y4,style:de,className:"p-0 max-h-72 border-floating-border bg-floating-background text-foreground",itemContent:(ne,J)=>{const j=J.Render??W4,X=$.has(J.value)||$.has(J.label??""),me=C===ne,ve=J.label??J.value;return g.jsxs("button",{"data-value":J.value,...ce({ref:ke=>{L.current[ne]=ke},role:"option",type:"button","aria-checked":X,"aria-current":X,"aria-selected":X,"aria-busy":J.disabled,onClick:()=>Q(J,ne)}),className:`flex w-full max-w-full cursor-pointer items-center justify-start p-2 text-left hover:bg-floating-hover focus:bg-floating-hover ${X||me?"bg-floating-hover text-floating-foreground":""}`,children:[g.jsx(Xp,{onChange:Yo,checked:X,"aria-checked":X,onClick:ke=>{ke.stopPropagation(),Q(J,ne)}}),g.jsx(j,{...m,label:J.label,value:J.value,children:ve})]})}})}),g.jsx("div",{className:"flex overflow-x-auto sticky bottom-0 flex-nowrap gap-2 items-center p-2 w-full rounded-b-lg bg-floating-background",children:$.size===0?g.jsx(la,{theme:"muted",size:"small",children:I.autocompleteEmpty}):be})]})})}):null})]})}),X4=e=>{const[t,n]=S.useState(0);return S.useEffect(()=>{const r=e.current;if(!r)return;const o=r.parentElement;if(!o)return;const i=()=>{n(o.clientHeight)};return o.addEventListener("resize",i),i(),()=>{o.removeEventListener("resize",i)}},[]),t},Q4={Item:S.forwardRef(function(t,n){return g.jsx("li",{...t,ref:n,className:"flex items-center gap-1 justify-between"})}),List:S.forwardRef(function(t,n){return g.jsx("ul",{...t,ref:n,className:"space-y-3"})})},J4=e=>{const t=S.useRef(null),n=X4(t);return g.jsxs("div",{className:"flex flex-row gap-4",ref:t,children:[g.jsxs("div",{className:"py-8 space-y-4 min-w-64 w-fit flex flex-col whitespace-nowrap rounded-lg border border-card-border",children:[g.jsx("header",{className:"border-b border-card-border pb-2"}),g.jsxs("div",{className:"px-8 space-y-2",children:[g.jsx(Ko,{rightLabel:"",title:"Search",placeholder:"Looking for..."}),g.jsx(Lp,{height:n,useWindowScroll:!0,data:e.source,components:Q4,itemContent:(r,o)=>g.jsx(S.Fragment,{children:g.jsx(Xp,{children:g.jsx(e.Item,{data:o})})})})]})]}),g.jsx("div",{children:g.jsx(yr,{children:g.jsx(Au,{})})}),g.jsx("div",{})]})};function e3(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}const t3=({children:e,...t})=>{const n=Fr(t.onIntersection),r=S.useRef(null),[o,i]=S.useState(()=>r.current===null?!1:e3(r.current));return S.useLayoutEffect(()=>{const s=r.current;if(s===null)return;const a=new IntersectionObserver(l=>{const c=l[0];return c.isIntersecting&&n.current?.(),i(u=>c.isIntersecting?!0:u)});return a.observe(s),()=>a.disconnect()},[]),g.jsx("div",{...t,ref:r,children:o?e:null})},mc=P.createContext(void 0);process.env.NODE_ENV!=="production"&&(mc.displayName="ToastContext");function Ih(){const e=P.useContext(mc);if(!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: useToastManager must be used within <Toast.Provider>.":On(73));return e}var n3=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(i){({stack:o}=i)}console.warn(`The result function returned its own inputs without modification. e.g
22
22
  \`createSelector([state => state.todos], todos => todos)\`
23
23
  This could lead to inefficient memoization and unnecessary re-renders.
24
24
  Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:o})}}},r3=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:i,inputSelectorResultsCopy:s}=e,a=r(()=>({}),...o);if(!(a.apply(null,i)===a.apply(null,s))){let c;try{throw new Error}catch(u){({stack:c}=u)}console.warn(`An input selector returned a different result when passed same arguments.