UNPKG

dgz-ui

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript

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