dgz-ui-shared
Version:
Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library
2 lines (1 loc) • 27.5 kB
JavaScript
;const Re=require("react"),Pt=require("react-dom"),T=require("./index-DqTIeHVj-C_gsDkBV.cjs");function Ie(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const R=Ie(Re),Dt=Ie(Pt);function Xe(e){const[t,n]=R.useState(void 0);return T.w(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let l,s;if("borderBoxSize"in i){const a=i.borderBoxSize,u=Array.isArray(a)?a[0]:a;l=u.inlineSize,s=u.blockSize}else l=e.offsetWidth,s=e.offsetHeight;n({width:l,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const Ot=["top","right","bottom","left"],J=Math.min,z=Math.max,de=Math.round,fe=Math.floor,V=e=>({x:e,y:e}),Tt={left:"right",right:"left",bottom:"top",top:"bottom"},Lt={start:"end",end:"start"};function Ae(e,t,n){return z(e,J(t,n))}function q(e,t){return typeof e=="function"?e(t):e}function G(e){return e.split("-")[0]}function te(e){return e.split("-")[1]}function De(e){return e==="x"?"y":"x"}function Oe(e){return e==="y"?"height":"width"}function Y(e){return["top","bottom"].includes(G(e))?"y":"x"}function Te(e){return De(Y(e))}function Ct(e,t,n){n===void 0&&(n=!1);const r=te(e),o=Te(e),i=Oe(o);let l=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=pe(l)),[l,pe(l)]}function Et(e){const t=pe(e);return[Se(e),t,Se(t)]}function Se(e){return e.replace(/start|end/g,t=>Lt[t])}function Ht(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}function kt(e,t,n,r){const o=te(e);let i=Ht(G(e),n==="start",r);return o&&(i=i.map(l=>l+"-"+o),t&&(i=i.concat(i.map(Se)))),i}function pe(e){return e.replace(/left|right|bottom|top/g,t=>Tt[t])}function jt(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ye(e){return typeof e!="number"?jt(e):{top:e,right:e,bottom:e,left:e}}function he(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Fe(e,t,n){let{reference:r,floating:o}=e;const i=Y(t),l=Te(t),s=Oe(l),a=G(t),u=i==="y",c=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,h=r[s]/2-o[s]/2;let f;switch(a){case"top":f={x:c,y:r.y-o.height};break;case"bottom":f={x:c,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch(te(t)){case"start":f[l]-=h*(n&&u?-1:1);break;case"end":f[l]+=h*(n&&u?-1:1);break}return f}const Mt=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let u=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:d}=Fe(u,r,a),h=r,f={},p=0;for(let m=0;m<s.length;m++){const{name:g,fn:y}=s[m],{x:w,y:x,data:v,reset:b}=await y({x:c,y:d,initialPlacement:r,placement:h,strategy:o,middlewareData:f,rects:u,platform:l,elements:{reference:e,floating:t}});c=w??c,d=x??d,f={...f,[g]:{...f[g],...v}},b&&p<=50&&(p++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(u=b.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:c,y:d}=Fe(u,h,a)),m=-1)}return{x:c,y:d,placement:h,strategy:o,middlewareData:f}};async function oe(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:l,elements:s,strategy:a}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=q(t,e),p=Ye(f),m=s[h?d==="floating"?"reference":"floating":d],g=he(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:u,rootBoundary:c,strategy:a})),y=d==="floating"?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),x=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},v=he(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:y,offsetParent:w,strategy:a}):y);return{top:(g.top-v.top+p.top)/x.y,bottom:(v.bottom-g.bottom+p.bottom)/x.y,left:(g.left-v.left+p.left)/x.x,right:(v.right-g.right+p.right)/x.x}}const Ft=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:s,middlewareData:a}=t,{element:u,padding:c=0}=q(e,t)||{};if(u==null)return{};const d=Ye(c),h={x:n,y:r},f=Te(o),p=Oe(f),m=await l.getDimensions(u),g=f==="y",y=g?"top":"left",w=g?"bottom":"right",x=g?"clientHeight":"clientWidth",v=i.reference[p]+i.reference[f]-h[f]-i.floating[p],b=h[f]-i.reference[f],S=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u));let P=S?S[x]:0;(!P||!await(l.isElement==null?void 0:l.isElement(S)))&&(P=s.floating[x]||i.floating[p]);const k=v/2-b/2,$=P/2-m[p]/2-1,D=J(d[y],$),W=J(d[w],$),L=D,j=P-m[p]-W,C=P/2-m[p]/2+k,M=Ae(L,C,j),E=!a.arrow&&te(o)!=null&&C!==M&&i.reference[p]/2-(C<L?D:W)-m[p]/2<0,F=E?C<L?C-L:C-j:0;return{[f]:h[f]+F,data:{[f]:M,centerOffset:C-M-F,...E&&{alignmentOffset:F}},reset:E}}}),$t=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:s,platform:a,elements:u}=t,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...g}=q(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=G(o),w=Y(s),x=G(s)===s,v=await(a.isRTL==null?void 0:a.isRTL(u.floating)),b=h||(x||!m?[pe(s)]:Et(s)),S=p!=="none";!h&&S&&b.push(...kt(s,m,p,v));const P=[s,...b],k=await oe(t,g),$=[];let D=((r=i.flip)==null?void 0:r.overflows)||[];if(c&&$.push(k[y]),d){const M=Ct(o,l,v);$.push(k[M[0]],k[M[1]])}if(D=[...D,{placement:o,overflows:$}],!$.every(M=>M<=0)){var W,L;const M=(((W=i.flip)==null?void 0:W.index)||0)+1,E=P[M];if(E){var j;const A=d==="alignment"?w!==Y(E):!1,O=((j=D[0])==null?void 0:j.overflows[0])>0;if(!A||O)return{data:{index:M,overflows:D},reset:{placement:E}}}let F=(L=D.filter(A=>A.overflows[0]<=0).sort((A,O)=>A.overflows[1]-O.overflows[1])[0])==null?void 0:L.placement;if(!F)switch(f){case"bestFit":{var C;const A=(C=D.filter(O=>{if(S){const H=Y(O.placement);return H===w||H==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(H=>H>0).reduce((H,se)=>H+se,0)]).sort((O,H)=>O[1]-H[1])[0])==null?void 0:C[0];A&&(F=A);break}case"initialPlacement":F=s;break}if(o!==F)return{reset:{placement:F}}}return{}}}};function $e(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function We(e){return Ot.some(t=>e[t]>=0)}const Wt=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=q(e,t);switch(r){case"referenceHidden":{const i=await oe(t,{...o,elementContext:"reference"}),l=$e(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:We(l)}}}case"escaped":{const i=await oe(t,{...o,altBoundary:!0}),l=$e(i,n.floating);return{data:{escapedOffsets:l,escaped:We(l)}}}default:return{}}}}};async function zt(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),l=G(n),s=te(n),a=Y(n)==="y",u=["left","top"].includes(l)?-1:1,c=i&&a?-1:1,d=q(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof p=="number"&&(f=s==="end"?p*-1:p),a?{x:f*c,y:h*u}:{x:h*u,y:f*c}}const Bt=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:s}=t,a=await zt(t,e);return l===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:l}}}}},_t=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:s={fn:g=>{let{x:y,y:w}=g;return{x:y,y:w}}},...a}=q(e,t),u={x:n,y:r},c=await oe(t,a),d=Y(G(o)),h=De(d);let f=u[h],p=u[d];if(i){const g=h==="y"?"top":"left",y=h==="y"?"bottom":"right",w=f+c[g],x=f-c[y];f=Ae(w,f,x)}if(l){const g=d==="y"?"top":"left",y=d==="y"?"bottom":"right",w=p+c[g],x=p-c[y];p=Ae(w,p,x)}const m=s.fn({...t,[h]:f,[d]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:i,[d]:l}}}}}},Nt=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:l}=t,{offset:s=0,mainAxis:a=!0,crossAxis:u=!0}=q(e,t),c={x:n,y:r},d=Y(o),h=De(d);let f=c[h],p=c[d];const m=q(s,t),g=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(a){const x=h==="y"?"height":"width",v=i.reference[h]-i.floating[x]+g.mainAxis,b=i.reference[h]+i.reference[x]-g.mainAxis;f<v?f=v:f>b&&(f=b)}if(u){var y,w;const x=h==="y"?"width":"height",v=["top","left"].includes(G(o)),b=i.reference[d]-i.floating[x]+(v&&((y=l.offset)==null?void 0:y[d])||0)+(v?0:g.crossAxis),S=i.reference[d]+i.reference[x]+(v?0:((w=l.offset)==null?void 0:w[d])||0)-(v?g.crossAxis:0);p<b?p=b:p>S&&(p=S)}return{[h]:f,[d]:p}}}},Vt=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:l,elements:s}=t,{apply:a=()=>{},...u}=q(e,t),c=await oe(t,u),d=G(o),h=te(o),f=Y(o)==="y",{width:p,height:m}=i.floating;let g,y;d==="top"||d==="bottom"?(g=d,y=h===(await(l.isRTL==null?void 0:l.isRTL(s.floating))?"start":"end")?"left":"right"):(y=d,g=h==="end"?"top":"bottom");const w=m-c.top-c.bottom,x=p-c.left-c.right,v=J(m-c[g],w),b=J(p-c[y],x),S=!t.middlewareData.shift;let P=v,k=b;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(k=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=w),S&&!h){const D=z(c.left,0),W=z(c.right,0),L=z(c.top,0),j=z(c.bottom,0);f?k=p-2*(D!==0||W!==0?D+W:z(c.left,c.right)):P=m-2*(L!==0||j!==0?L+j:z(c.top,c.bottom))}await a({...t,availableWidth:k,availableHeight:P});const $=await l.getDimensions(s.floating);return p!==$.width||m!==$.height?{reset:{rects:!0}}:{}}}};function ge(){return typeof window<"u"}function ne(e){return qe(e)?(e.nodeName||"").toLowerCase():"#document"}function B(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function X(e){var t;return(t=(qe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qe(e){return ge()?e instanceof Node||e instanceof B(e).Node:!1}function _(e){return ge()?e instanceof Element||e instanceof B(e).Element:!1}function I(e){return ge()?e instanceof HTMLElement||e instanceof B(e).HTMLElement:!1}function ze(e){return!ge()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof B(e).ShadowRoot}function le(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=N(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function It(e){return["table","td","th"].includes(ne(e))}function ye(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Le(e){const t=Ce(),n=_(e)?N(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Xt(e){let t=K(e);for(;I(t)&&!ee(t);){if(Le(t))return t;if(ye(t))return null;t=K(t)}return null}function Ce(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ee(e){return["html","body","#document"].includes(ne(e))}function N(e){return B(e).getComputedStyle(e)}function we(e){return _(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function K(e){if(ne(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ze(e)&&e.host||X(e);return ze(t)?t.host:t}function Ge(e){const t=K(e);return ee(t)?e.ownerDocument?e.ownerDocument.body:e.body:I(t)&&le(t)?t:Ge(t)}function ie(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ge(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),l=B(o);if(i){const s=Pe(l);return t.concat(l,l.visualViewport||[],le(o)?o:[],s&&n?ie(s):[])}return t.concat(o,ie(o,[],n))}function Pe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Je(e){const t=N(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=I(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,s=de(n)!==i||de(r)!==l;return s&&(n=i,r=l),{width:n,height:r,$:s}}function Ee(e){return _(e)?e:e.contextElement}function U(e){const t=Ee(e);if(!I(t))return V(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Je(t);let l=(i?de(n.width):n.width)/r,s=(i?de(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!s||!Number.isFinite(s))&&(s=1),{x:l,y:s}}const Yt=V(0);function Ke(e){const t=B(e);return!Ce()||!t.visualViewport?Yt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==B(e)?!1:t}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ee(e);let l=V(1);t&&(r?_(r)&&(l=U(r)):l=U(e));const s=qt(i,n,r)?Ke(i):V(0);let a=(o.left+s.x)/l.x,u=(o.top+s.y)/l.y,c=o.width/l.x,d=o.height/l.y;if(i){const h=B(i),f=r&&_(r)?B(r):r;let p=h,m=Pe(p);for(;m&&r&&f!==p;){const g=U(m),y=m.getBoundingClientRect(),w=N(m),x=y.left+(m.clientLeft+parseFloat(w.paddingLeft))*g.x,v=y.top+(m.clientTop+parseFloat(w.paddingTop))*g.y;a*=g.x,u*=g.y,c*=g.x,d*=g.y,a+=x,u+=v,p=B(m),m=Pe(p)}}return he({width:c,height:d,x:a,y:u})}function He(e,t){const n=we(e).scrollLeft;return t?t.left+n:Q(X(e)).left+n}function Qe(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:He(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function Gt(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",l=X(r),s=t?ye(t.floating):!1;if(r===l||s&&i)return n;let a={scrollLeft:0,scrollTop:0},u=V(1);const c=V(0),d=I(r);if((d||!d&&!i)&&((ne(r)!=="body"||le(l))&&(a=we(r)),I(r))){const f=Q(r);u=U(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const h=l&&!d&&!i?Qe(l,a,!0):V(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-a.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-a.scrollTop*u.y+c.y+h.y}}function Jt(e){return Array.from(e.getClientRects())}function Kt(e){const t=X(e),n=we(e),r=e.ownerDocument.body,o=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+He(e);const s=-n.scrollTop;return N(r).direction==="rtl"&&(l+=z(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:s}}function Qt(e,t){const n=B(e),r=X(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const u=Ce();(!u||u&&t==="fixed")&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}function Zt(e,t){const n=Q(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=I(e)?U(e):V(1),l=e.clientWidth*i.x,s=e.clientHeight*i.y,a=o*i.x,u=r*i.y;return{width:l,height:s,x:a,y:u}}function Be(e,t,n){let r;if(t==="viewport")r=Qt(e,n);else if(t==="document")r=Kt(X(e));else if(_(t))r=Zt(t,n);else{const o=Ke(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return he(r)}function Ze(e,t){const n=K(e);return n===t||!_(n)||ee(n)?!1:N(n).position==="fixed"||Ze(n,t)}function Ut(e,t){const n=t.get(e);if(n)return n;let r=ie(e,[],!1).filter(s=>_(s)&&ne(s)!=="body"),o=null;const i=N(e).position==="fixed";let l=i?K(e):e;for(;_(l)&&!ee(l);){const s=N(l),a=Le(l);!a&&s.position==="fixed"&&(o=null),(i?!a&&!o:!a&&s.position==="static"&&o&&["absolute","fixed"].includes(o.position)||le(l)&&!a&&Ze(e,l))?r=r.filter(u=>u!==l):o=s,l=K(l)}return t.set(e,r),r}function en(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ye(t)?[]:Ut(t,this._c):[].concat(n),r],l=i[0],s=i.reduce((a,u)=>{const c=Be(t,u,o);return a.top=z(c.top,a.top),a.right=J(c.right,a.right),a.bottom=J(c.bottom,a.bottom),a.left=z(c.left,a.left),a},Be(t,l,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function tn(e){const{width:t,height:n}=Je(e);return{width:t,height:n}}function nn(e,t,n){const r=I(t),o=X(t),i=n==="fixed",l=Q(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const a=V(0);function u(){a.x=He(o)}if(r||!r&&!i)if((ne(t)!=="body"||le(o))&&(s=we(t)),r){const f=Q(t,!0,i,t);a.x=f.x+t.clientLeft,a.y=f.y+t.clientTop}else o&&u();i&&!r&&o&&u();const c=o&&!r&&!i?Qe(o,s):V(0),d=l.left+s.scrollLeft-a.x-c.x,h=l.top+s.scrollTop-a.y-c.y;return{x:d,y:h,width:l.width,height:l.height}}function ve(e){return N(e).position==="static"}function _e(e,t){if(!I(e)||N(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return X(e)===n&&(n=n.ownerDocument.body),n}function Ue(e,t){const n=B(e);if(ye(e))return n;if(!I(e)){let o=K(e);for(;o&&!ee(o);){if(_(o)&&!ve(o))return o;o=K(o)}return n}let r=_e(e,t);for(;r&&It(r)&&ve(r);)r=_e(r,t);return r&&ee(r)&&ve(r)&&!Le(r)?n:r||Xt(e)||n}const rn=async function(e){const t=this.getOffsetParent||Ue,n=this.getDimensions,r=await n(e.floating);return{reference:nn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function on(e){return N(e).direction==="rtl"}const ln={convertOffsetParentRelativeRectToViewportRelativeRect:Gt,getDocumentElement:X,getClippingRect:en,getOffsetParent:Ue,getElementRects:rn,getClientRects:Jt,getDimensions:tn,getScale:U,isElement:_,isRTL:on};function et(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sn(e,t){let n=null,r;const o=X(e);function i(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function l(s,a){s===void 0&&(s=!1),a===void 0&&(a=1),i();const u=e.getBoundingClientRect(),{left:c,top:d,width:h,height:f}=u;if(s||t(),!h||!f)return;const p=fe(d),m=fe(o.clientWidth-(c+h)),g=fe(o.clientHeight-(d+f)),y=fe(c),w={rootMargin:-p+"px "+-m+"px "+-g+"px "+-y+"px",threshold:z(0,J(1,a))||1};let x=!0;function v(b){const S=b[0].intersectionRatio;if(S!==a){if(!x)return l();S?l(!1,S):r=setTimeout(()=>{l(!1,1e-7)},1e3)}S===1&&!et(u,e.getBoundingClientRect())&&l(),x=!1}try{n=new IntersectionObserver(v,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(v,w)}n.observe(e)}return l(!0),i}function tt(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,u=Ee(e),c=o||i?[...u?ie(u):[],...ie(t)]:[];c.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=u&&s?sn(u,n):null;let h=-1,f=null;l&&(f=new ResizeObserver(y=>{let[w]=y;w&&w.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),u&&!a&&f.observe(u),f.observe(t));let p,m=a?Q(e):null;a&&g();function g(){const y=Q(e);m&&!et(m,y)&&n(),m=y,p=requestAnimationFrame(g)}return n(),()=>{var y;c.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,a&&cancelAnimationFrame(p)}}const an=Bt,cn=_t,fn=$t,un=Vt,dn=Wt,Ne=Ft,pn=Nt,hn=(e,t,n)=>{const r=new Map,o={platform:ln,...n},i={...o.platform,_c:r};return Mt(e,t,{...o,platform:i})};var ue=typeof document<"u"?Re.useLayoutEffect:Re.useEffect;function me(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!me(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!me(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function nt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ve(e,t){const n=nt(e);return Math.round(t*n)/n}function be(e){const t=R.useRef(e);return ue(()=>{t.current=e}),t}function mn(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:l}={},transform:s=!0,whileElementsMounted:a,open:u}=e,[c,d]=R.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,f]=R.useState(r);me(h,r)||f(r);const[p,m]=R.useState(null),[g,y]=R.useState(null),w=R.useCallback(A=>{A!==S.current&&(S.current=A,m(A))},[]),x=R.useCallback(A=>{A!==P.current&&(P.current=A,y(A))},[]),v=i||p,b=l||g,S=R.useRef(null),P=R.useRef(null),k=R.useRef(c),$=a!=null,D=be(a),W=be(o),L=be(u),j=R.useCallback(()=>{if(!S.current||!P.current)return;const A={placement:t,strategy:n,middleware:h};W.current&&(A.platform=W.current),hn(S.current,P.current,A).then(O=>{const H={...O,isPositioned:L.current!==!1};C.current&&!me(k.current,H)&&(k.current=H,Dt.flushSync(()=>{d(H)}))})},[h,t,n,W,L]);ue(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,d(A=>({...A,isPositioned:!1})))},[u]);const C=R.useRef(!1);ue(()=>(C.current=!0,()=>{C.current=!1}),[]),ue(()=>{if(v&&(S.current=v),b&&(P.current=b),v&&b){if(D.current)return D.current(v,b,j);j()}},[v,b,j,D,$]);const M=R.useMemo(()=>({reference:S,floating:P,setReference:w,setFloating:x}),[w,x]),E=R.useMemo(()=>({reference:v,floating:b}),[v,b]),F=R.useMemo(()=>{const A={position:n,left:0,top:0};if(!E.floating)return A;const O=Ve(E.floating,c.x),H=Ve(E.floating,c.y);return s?{...A,transform:"translate("+O+"px, "+H+"px)",...nt(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:H}},[n,s,E.floating,c.x,c.y]);return R.useMemo(()=>({...c,update:j,refs:M,elements:E,floatingStyles:F}),[c,j,M,E,F])}const gn=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ne({element:r.current,padding:o}).fn(n):{}:r?Ne({element:r,padding:o}).fn(n):{}}}},yn=(e,t)=>({...an(e),options:[e,t]}),wn=(e,t)=>({...cn(e),options:[e,t]}),xn=(e,t)=>({...pn(e),options:[e,t]}),vn=(e,t)=>({...fn(e),options:[e,t]}),bn=(e,t)=>({...un(e),options:[e,t]}),Rn=(e,t)=>({...dn(e),options:[e,t]}),An=(e,t)=>({...gn(e),options:[e,t]});var Sn="Arrow",rt=R.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return T.ae.jsx(T.h.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:T.ae.jsx("polygon",{points:"0,0 30,0 15,10"})})});rt.displayName=Sn;var Pn=rt,ke="Popper",[ot,Dn]=T.j(ke),[On,it]=ot(ke),lt=e=>{const{__scopePopper:t,children:n}=e,[r,o]=R.useState(null);return T.ae.jsx(On,{scope:t,anchor:r,onAnchorChange:o,children:n})};lt.displayName=ke;var st="PopperAnchor",at=R.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=it(st,n),l=R.useRef(null),s=T.x(t,l);return R.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||l.current)}),r?null:T.ae.jsx(T.h.div,{...o,ref:s})});at.displayName=st;var je="PopperContent",[Tn,Ln]=ot(je),ct=R.forwardRef((e,t)=>{var n,r,o,i,l,s;const{__scopePopper:a,side:u="bottom",sideOffset:c=0,align:d="center",alignOffset:h=0,arrowPadding:f=0,avoidCollisions:p=!0,collisionBoundary:m=[],collisionPadding:g=0,sticky:y="partial",hideWhenDetached:w=!1,updatePositionStrategy:x="optimized",onPlaced:v,...b}=e,S=it(je,a),[P,k]=R.useState(null),$=T.x(t,re=>k(re)),[D,W]=R.useState(null),L=Xe(D),j=(L==null?void 0:L.width)??0,C=(L==null?void 0:L.height)??0,M=u+(d!=="center"?"-"+d:""),E=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},F=Array.isArray(m)?m:[m],A=F.length>0,O={padding:E,boundary:F.filter(En),altBoundary:A},{refs:H,floatingStyles:se,placement:pt,isPositioned:ae,middlewareData:Z}=mn({strategy:"fixed",placement:M,whileElementsMounted:(...re)=>tt(...re,{animationFrame:x==="always"}),elements:{reference:S.anchor},middleware:[yn({mainAxis:c+C,alignmentAxis:h}),p&&wn({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?xn():void 0,...O}),p&&vn({...O}),bn({...O,apply:({elements:re,rects:vt,availableWidth:bt,availableHeight:Rt})=>{const{width:At,height:St}=vt.reference,ce=re.floating.style;ce.setProperty("--radix-popper-available-width",`${bt}px`),ce.setProperty("--radix-popper-available-height",`${Rt}px`),ce.setProperty("--radix-popper-anchor-width",`${At}px`),ce.setProperty("--radix-popper-anchor-height",`${St}px`)}}),D&&An({element:D,padding:f}),Hn({arrowWidth:j,arrowHeight:C}),w&&Rn({strategy:"referenceHidden",...O})]}),[Me,ht]=dt(pt),xe=T.n(v);T.w(()=>{ae&&(xe==null||xe())},[ae,xe]);const mt=(n=Z.arrow)==null?void 0:n.x,gt=(r=Z.arrow)==null?void 0:r.y,yt=((o=Z.arrow)==null?void 0:o.centerOffset)!==0,[wt,xt]=R.useState();return T.w(()=>{P&&xt(window.getComputedStyle(P).zIndex)},[P]),T.ae.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:ae?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:wt,"--radix-popper-transform-origin":[(i=Z.transformOrigin)==null?void 0:i.x,(l=Z.transformOrigin)==null?void 0:l.y].join(" "),...((s=Z.hide)==null?void 0:s.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:T.ae.jsx(Tn,{scope:a,placedSide:Me,onArrowChange:W,arrowX:mt,arrowY:gt,shouldHideArrow:yt,children:T.ae.jsx(T.h.div,{"data-side":Me,"data-align":ht,...b,ref:$,style:{...b.style,animation:ae?void 0:"none"}})})})});ct.displayName=je;var ft="PopperArrow",Cn={top:"bottom",right:"left",bottom:"top",left:"right"},ut=R.forwardRef(function(e,t){const{__scopePopper:n,...r}=e,o=Ln(ft,n),i=Cn[o.placedSide];return T.ae.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:T.ae.jsx(Pn,{...r,ref:t,style:{...r.style,display:"block"}})})});ut.displayName=ft;function En(e){return e!==null}var Hn=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:i,rects:l,middlewareData:s}=t,a=((n=s.arrow)==null?void 0:n.centerOffset)!==0,u=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[d,h]=dt(i),f={start:"0%",center:"50%",end:"100%"}[h],p=(((r=s.arrow)==null?void 0:r.x)??0)+u/2,m=(((o=s.arrow)==null?void 0:o.y)??0)+c/2;let g="",y="";return d==="bottom"?(g=a?f:`${p}px`,y=`${-c}px`):d==="top"?(g=a?f:`${p}px`,y=`${l.floating.height+c}px`):d==="right"?(g=`${-c}px`,y=a?f:`${m}px`):d==="left"&&(g=`${l.floating.width+c}px`,y=a?f:`${m}px`),{data:{x:g,y}}}});function dt(e){const[t,n="center"]=e.split("-");return[t,n]}var kn=lt,jn=at,Mn=ct,Fn=ut;exports.De=Xe;exports.In=jn;exports.Vn=kn;exports.Xn=Fn;exports.Yn=Mn;exports.jn=Dn;exports.un=tt;