@univerjs/design 0.10.14 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -118,7 +118,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
118
118
  hsl(180, 100%, 50%),
119
119
  hsl(240, 100%, 50%),
120
120
  hsl(300, 100%, 50%),
121
- hsl(360, 100%, 50%))`},onPointerDown:y=>{i(!0),l(y.clientX)},children:S.jsx("div",{ref:a,className:"univer-absolute univer-top-1/2 univer-box-border univer-size-2 univer-rounded-full univer-bg-transparent univer-shadow-md univer-ring-2 univer-ring-white univer-transition-transform univer-duration-75 univer-will-change-transform",style:{left:u(),transform:"translateY(-50%)",transition:r?"none":"all 0.1s ease-out"}})})})}const Ag=M.memo(Tg),Lg=M.memo(Ig),jg=M.memo(_g),$g=M.memo(kg);function zg({format:e="hex",value:t="#000000",onChange:n}){if(!Oi)return null;const{locale:r}=M.useContext(pn),[i,o]=M.useState([0,100,100]),[a,s]=M.useState(!1),l=M.useCallback((y,h,g)=>ci(y,h,g),[]);M.useEffect(()=>{try{if(e==="hex"){const[y,h,g]=t?Rs(t):i;o([y,h,g])}}catch(y){console.error("Invalid value:",y)}},[t]);function c(y,h,g){o([y,h,g])}function f(y,h,g){const[w,d,v]=l(y,h,g);if(e==="hex"){const p=Sd(w,d,v);n==null||n(p)}}function u(){const[y,h,g]=i,w=di(y,h,g);n==null||n(w),s(!1)}return S.jsxs("div",{"data-u-comp":"color-picker",className:"univer-cursor-default univer-space-y-2 univer-rounded-lg univer-bg-white dark:!univer-bg-gray-700",onClick:y=>y.stopPropagation(),children:[S.jsx($g,{hsv:i,onChange:(y,h,g)=>{c(y,h,g),f(y,h,g)}}),S.jsx("div",{className:"univer-flex univer-h-7 univer-items-center",children:S.jsx("a",{className:"univer-cursor-pointer univer-gap-2 univer-text-sm univer-text-gray-900 univer-transition-opacity hover:univer-opacity-80 dark:!univer-text-white",onClick:()=>s(!0),children:r==null?void 0:r.ColorPicker.more})}),S.jsx(Ss,{className:"!univer-w-fit !univer-p-2.5",closable:!1,maskClosable:!1,open:a,onOpenChange:s,children:S.jsxs("div",{className:"univer-grid univer-w-64 univer-gap-2",children:[S.jsx(Ag,{hsv:i,onChange:c}),S.jsxs("div",{className:"univer-flex univer-items-center univer-gap-2",children:[S.jsx("div",{className:"univer-size-6 univer-flex-shrink-0 univer-rounded-sm",style:{backgroundColor:di(...i)}}),S.jsx(Lg,{hsv:i,onChange:c})]}),S.jsx(jg,{hsv:i,onChange:c}),S.jsxs("footer",{className:"univer-flex univer-items-center univer-justify-end univer-gap-2",children:[S.jsx(Wn,{onClick:()=>s(!1),children:r==null?void 0:r.ColorPicker.cancel}),S.jsx(Wn,{variant:"primary",onClick:u,children:r==null?void 0:r.ColorPicker.confirm})]})]})})]})}function Fg(e){const{locale:t,cancelText:n,confirmText:r,onClose:i,onConfirm:o}=e;return S.jsxs("footer",{className:"univer-flex univer-items-center univer-justify-end univer-gap-2",children:[S.jsx(Wn,{onClick:i,children:n!=null?n:t==null?void 0:t.Confirm.cancel}),S.jsx(Wn,{variant:"primary",onClick:o,children:r!=null?r:t==null?void 0:t.Confirm.confirm})]})}function Hg(e){const{children:t,visible:n=!1,title:r,cancelText:i,confirmText:o,width:a,onClose:s,onConfirm:l}=e,{locale:c}=M.useContext(pn);return S.jsx(Ss,{open:n,title:r,maskClosable:!1,footer:S.jsx(Fg,{locale:c,cancelText:i,confirmText:o,onClose:s,onConfirm:l}),onClose:s,width:a,children:t})}const Wg=["top","right","bottom","left"],qn=Math.min,Lt=Math.max,fi=Math.round,Bo=Math.floor,cn=e=>({x:e,y:e}),Bg={left:"right",right:"left",bottom:"top",top:"bottom"},Vg={start:"end",end:"start"};function Fa(e,t,n){return Lt(e,qn(t,n))}function Sn(e,t){return typeof e=="function"?e(t):e}function Rn(e){return e.split("-")[0]}function Ir(e){return e.split("-")[1]}function Es(e){return e==="x"?"y":"x"}function Ms(e){return e==="y"?"height":"width"}const qg=new Set(["top","bottom"]);function ln(e){return qg.has(Rn(e))?"y":"x"}function Ps(e){return Es(ln(e))}function Gg(e,t,n){n===void 0&&(n=!1);const r=Ir(e),i=Ps(e),o=Ms(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=vi(a)),[a,vi(a)]}function Ug(e){const t=vi(e);return[Ha(e),t,Ha(t)]}function Ha(e){return e.replace(/start|end/g,t=>Vg[t])}const ku=["left","right"],Tu=["right","left"],Kg=["top","bottom"],Yg=["bottom","top"];function Xg(e,t,n){switch(e){case"top":case"bottom":return n?t?Tu:ku:t?ku:Tu;case"left":case"right":return t?Kg:Yg;default:return[]}}function Zg(e,t,n,r){const i=Ir(e);let o=Xg(Rn(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Ha)))),o}function vi(e){return e.replace(/left|right|bottom|top/g,t=>Bg[t])}function Qg(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ed(e){return typeof e!="number"?Qg(e):{top:e,right:e,bottom:e,left:e}}function pi(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Iu(e,t,n){let{reference:r,floating:i}=e;const o=ln(t),a=Ps(t),s=Ms(a),l=Rn(t),c=o==="y",f=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,y=r[s]/2-i[s]/2;let h;switch(l){case"top":h={x:f,y:r.y-i.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Ir(t)){case"start":h[a]-=y*(n&&c?-1:1);break;case"end":h[a]+=y*(n&&c?-1:1);break}return h}const Jg=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=o.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:u}=Iu(c,r,l),y=r,h={},g=0;for(let w=0;w<s.length;w++){const{name:d,fn:v}=s[w],{x:p,y:b,data:C,reset:x}=await v({x:f,y:u,initialPlacement:r,placement:y,strategy:i,middlewareData:h,rects:c,platform:a,elements:{reference:e,floating:t}});f=p!=null?p:f,u=b!=null?b:u,h={...h,[d]:{...h[d],...C}},x&&g<=50&&(g++,typeof x=="object"&&(x.placement&&(y=x.placement),x.rects&&(c=x.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:f,y:u}=Iu(c,y,l)),w=-1)}return{x:f,y:u,placement:y,strategy:i,middlewareData:h}};async function fo(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:y=!1,padding:h=0}=Sn(t,e),g=Ed(h),d=s[y?u==="floating"?"reference":"floating":u],v=pi(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(d)))==null||n?d:d.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),p=u==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),C=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},x=pi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:p,offsetParent:b,strategy:l}):p);return{top:(v.top-x.top+g.top)/C.y,bottom:(x.bottom-v.bottom+g.bottom)/C.y,left:(v.left-x.left+g.left)/C.x,right:(x.right-v.right+g.right)/C.x}}const e0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:f=0}=Sn(e,t)||{};if(c==null)return{};const u=Ed(f),y={x:n,y:r},h=Ps(i),g=Ms(h),w=await a.getDimensions(c),d=h==="y",v=d?"top":"left",p=d?"bottom":"right",b=d?"clientHeight":"clientWidth",C=o.reference[g]+o.reference[h]-y[h]-o.floating[g],x=y[h]-o.reference[h],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let E=R?R[b]:0;(!E||!await(a.isElement==null?void 0:a.isElement(R)))&&(E=s.floating[b]||o.floating[g]);const P=C/2-x/2,O=E/2-w[g]/2-1,N=qn(u[v],O),T=qn(u[p],O),A=N,H=E-w[g]-T,L=E/2-w[g]/2+P,j=Fa(A,L,H),D=!l.arrow&&Ir(i)!=null&&L!==j&&o.reference[g]/2-(L<A?N:T)-w[g]/2<0,$=D?L<A?L-A:L-H:0;return{[h]:y[h]+$,data:{[h]:j,centerOffset:L-j-$,...D&&{alignmentOffset:$}},reset:D}}}),t0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:y,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...d}=Sn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=Rn(i),p=ln(s),b=Rn(s)===s,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),x=y||(b||!w?[vi(s)]:Ug(s)),R=g!=="none";!y&&R&&x.push(...Zg(s,w,g,C));const E=[s,...x],P=await fo(t,d),O=[];let N=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&O.push(P[v]),u){const L=Gg(i,a,C);O.push(P[L[0]],P[L[1]])}if(N=[...N,{placement:i,overflows:O}],!O.every(L=>L<=0)){var T,A;const L=(((T=o.flip)==null?void 0:T.index)||0)+1,j=E[L];if(j&&(!(u==="alignment"?p!==ln(j):!1)||N.every(I=>ln(I.placement)===p?I.overflows[0]>0:!0)))return{data:{index:L,overflows:N},reset:{placement:j}};let D=(A=N.filter($=>$.overflows[0]<=0).sort(($,I)=>$.overflows[1]-I.overflows[1])[0])==null?void 0:A.placement;if(!D)switch(h){case"bestFit":{var H;const $=(H=N.filter(I=>{if(R){const z=ln(I.placement);return z===p||z==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(z=>z>0).reduce((z,B)=>z+B,0)]).sort((I,z)=>I[1]-z[1])[0])==null?void 0:H[0];$&&(D=$);break}case"initialPlacement":D=s;break}if(i!==D)return{reset:{placement:D}}}return{}}}};function Au(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lu(e){return Wg.some(t=>e[t]>=0)}const n0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Sn(e,t);switch(r){case"referenceHidden":{const o=await fo(t,{...i,elementContext:"reference"}),a=Au(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Lu(a)}}}case"escaped":{const o=await fo(t,{...i,altBoundary:!0}),a=Au(o,n.floating);return{data:{escapedOffsets:a,escaped:Lu(a)}}}default:return{}}}}},Md=new Set(["left","top"]);async function r0(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Rn(n),s=Ir(n),l=ln(n)==="y",c=Md.has(a)?-1:1,f=o&&l?-1:1,u=Sn(t,e);let{mainAxis:y,crossAxis:h,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof g=="number"&&(h=s==="end"?g*-1:g),l?{x:h*f,y:y*c}:{x:y*c,y:h*f}}const o0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:a,middlewareData:s}=t,l=await r0(t,e);return a===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:a}}}}},i0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:d=>{let{x:v,y:p}=d;return{x:v,y:p}}},...l}=Sn(e,t),c={x:n,y:r},f=await fo(t,l),u=ln(Rn(i)),y=Es(u);let h=c[y],g=c[u];if(o){const d=y==="y"?"top":"left",v=y==="y"?"bottom":"right",p=h+f[d],b=h-f[v];h=Fa(p,h,b)}if(a){const d=u==="y"?"top":"left",v=u==="y"?"bottom":"right",p=g+f[d],b=g-f[v];g=Fa(p,g,b)}const w=s.fn({...t,[y]:h,[u]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:o,[u]:a}}}}}},a0=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Sn(e,t),f={x:n,y:r},u=ln(i),y=Es(u);let h=f[y],g=f[u];const w=Sn(s,t),d=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(l){const b=y==="y"?"height":"width",C=o.reference[y]-o.floating[b]+d.mainAxis,x=o.reference[y]+o.reference[b]-d.mainAxis;h<C?h=C:h>x&&(h=x)}if(c){var v,p;const b=y==="y"?"width":"height",C=Md.has(Rn(i)),x=o.reference[u]-o.floating[b]+(C&&((v=a.offset)==null?void 0:v[u])||0)+(C?0:d.crossAxis),R=o.reference[u]+o.reference[b]+(C?0:((p=a.offset)==null?void 0:p[u])||0)-(C?d.crossAxis:0);g<x?g=x:g>R&&(g=R)}return{[y]:h,[u]:g}}}},s0=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:a,elements:s}=t,{apply:l=()=>{},...c}=Sn(e,t),f=await fo(t,c),u=Rn(i),y=Ir(i),h=ln(i)==="y",{width:g,height:w}=o.floating;let d,v;u==="top"||u==="bottom"?(d=u,v=y===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,d=y==="end"?"top":"bottom");const p=w-f.top-f.bottom,b=g-f.left-f.right,C=qn(w-f[d],p),x=qn(g-f[v],b),R=!t.middlewareData.shift;let E=C,P=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=p),R&&!y){const N=Lt(f.left,0),T=Lt(f.right,0),A=Lt(f.top,0),H=Lt(f.bottom,0);h?P=g-2*(N!==0||T!==0?N+T:Lt(f.left,f.right)):E=w-2*(A!==0||H!==0?A+H:Lt(f.top,f.bottom))}await l({...t,availableWidth:P,availableHeight:E});const O=await a.getDimensions(s.floating);return g!==O.width||w!==O.height?{reset:{rects:!0}}:{}}}};function Li(){return typeof window<"u"}function Ar(e){return Pd(e)?(e.nodeName||"").toLowerCase():"#document"}function jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function hn(e){var t;return(t=(Pd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pd(e){return Li()?e instanceof Node||e instanceof jt(e).Node:!1}function Xt(e){return Li()?e instanceof Element||e instanceof jt(e).Element:!1}function fn(e){return Li()?e instanceof HTMLElement||e instanceof jt(e).HTMLElement:!1}function ju(e){return!Li()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jt(e).ShadowRoot}const u0=new Set(["inline","contents"]);function Co(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!u0.has(i)}const l0=new Set(["table","td","th"]);function c0(e){return l0.has(Ar(e))}const d0=[":popover-open",":modal"];function ji(e){return d0.some(t=>{try{return e.matches(t)}catch{return!1}})}const f0=["transform","translate","scale","rotate","perspective"],v0=["transform","translate","scale","rotate","perspective","filter"],p0=["paint","layout","strict","content"];function Ns(e){const t=Ds(),n=Xt(e)?Zt(e):e;return f0.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)||v0.some(r=>(n.willChange||"").includes(r))||p0.some(r=>(n.contain||"").includes(r))}function h0(e){let t=Gn(e);for(;fn(t)&&!Pr(t);){if(Ns(t))return t;if(ji(t))return null;t=Gn(t)}return null}function Ds(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const m0=new Set(["html","body","#document"]);function Pr(e){return m0.has(Ar(e))}function Zt(e){return jt(e).getComputedStyle(e)}function $i(e){return Xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gn(e){if(Ar(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ju(e)&&e.host||hn(e);return ju(t)?t.host:t}function Nd(e){const t=Gn(e);return Pr(t)?e.ownerDocument?e.ownerDocument.body:e.body:fn(t)&&Co(t)?t:Nd(t)}function vo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Nd(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),a=jt(i);if(o){const s=Wa(a);return t.concat(a,a.visualViewport||[],Co(i)?i:[],s&&n?vo(s):[])}return t.concat(i,vo(i,[],n))}function Wa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dd(e){const t=Zt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=fn(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,s=fi(n)!==o||fi(r)!==a;return s&&(n=o,r=a),{width:n,height:r,$:s}}function _s(e){return Xt(e)?e:e.contextElement}function Mr(e){const t=_s(e);if(!fn(t))return cn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Dd(t);let a=(o?fi(n.width):n.width)/r,s=(o?fi(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const g0=cn(0);function _d(e){const t=jt(e);return!Ds()||!t.visualViewport?g0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function y0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jt(e)?!1:t}function ar(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=_s(e);let a=cn(1);t&&(r?Xt(r)&&(a=Mr(r)):a=Mr(e));const s=y0(o,n,r)?_d(o):cn(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,f=i.width/a.x,u=i.height/a.y;if(o){const y=jt(o),h=r&&Xt(r)?jt(r):r;let g=y,w=Wa(g);for(;w&&r&&h!==g;){const d=Mr(w),v=w.getBoundingClientRect(),p=Zt(w),b=v.left+(w.clientLeft+parseFloat(p.paddingLeft))*d.x,C=v.top+(w.clientTop+parseFloat(p.paddingTop))*d.y;l*=d.x,c*=d.y,f*=d.x,u*=d.y,l+=b,c+=C,g=jt(w),w=Wa(g)}}return pi({width:f,height:u,x:l,y:c})}function zi(e,t){const n=$i(e).scrollLeft;return t?t.left+n:ar(hn(e)).left+n}function Od(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-zi(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function b0(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",a=hn(r),s=t?ji(t.floating):!1;if(r===a||s&&o)return n;let l={scrollLeft:0,scrollTop:0},c=cn(1);const f=cn(0),u=fn(r);if((u||!u&&!o)&&((Ar(r)!=="body"||Co(a))&&(l=$i(r)),fn(r))){const h=ar(r);c=Mr(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const y=a&&!u&&!o?Od(a,l):cn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+y.x,y:n.y*c.y-l.scrollTop*c.y+f.y+y.y}}function w0(e){return Array.from(e.getClientRects())}function x0(e){const t=hn(e),n=$i(e),r=e.ownerDocument.body,i=Lt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Lt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+zi(e);const s=-n.scrollTop;return Zt(r).direction==="rtl"&&(a+=Lt(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:s}}const $u=25;function C0(e,t){const n=jt(e),r=hn(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;const f=Ds();(!f||f&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}const c=zi(r);if(c<=0){const f=r.ownerDocument,u=f.body,y=getComputedStyle(u),h=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-h);g<=$u&&(o-=g)}else c<=$u&&(o+=c);return{width:o,height:a,x:s,y:l}}const S0=new Set(["absolute","fixed"]);function R0(e,t){const n=ar(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=fn(e)?Mr(e):cn(1),a=e.clientWidth*o.x,s=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:a,height:s,x:l,y:c}}function zu(e,t,n){let r;if(t==="viewport")r=C0(e,n);else if(t==="document")r=x0(hn(e));else if(Xt(t))r=R0(t,n);else{const i=_d(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return pi(r)}function kd(e,t){const n=Gn(e);return n===t||!Xt(n)||Pr(n)?!1:Zt(n).position==="fixed"||kd(n,t)}function E0(e,t){const n=t.get(e);if(n)return n;let r=vo(e,[],!1).filter(s=>Xt(s)&&Ar(s)!=="body"),i=null;const o=Zt(e).position==="fixed";let a=o?Gn(e):e;for(;Xt(a)&&!Pr(a);){const s=Zt(a),l=Ns(a);!l&&s.position==="fixed"&&(i=null),(o?!l&&!i:!l&&s.position==="static"&&!!i&&S0.has(i.position)||Co(a)&&!l&&kd(e,a))?r=r.filter(f=>f!==a):i=s,a=Gn(a)}return t.set(e,r),r}function M0(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?ji(t)?[]:E0(t,this._c):[].concat(n),r],s=a[0],l=a.reduce((c,f)=>{const u=zu(t,f,i);return c.top=Lt(u.top,c.top),c.right=qn(u.right,c.right),c.bottom=qn(u.bottom,c.bottom),c.left=Lt(u.left,c.left),c},zu(t,s,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function P0(e){const{width:t,height:n}=Dd(e);return{width:t,height:n}}function N0(e,t,n){const r=fn(t),i=hn(t),o=n==="fixed",a=ar(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=cn(0);function c(){l.x=zi(i)}if(r||!r&&!o)if((Ar(t)!=="body"||Co(i))&&(s=$i(t)),r){const h=ar(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&c();o&&!r&&i&&c();const f=i&&!r&&!o?Od(i,s):cn(0),u=a.left+s.scrollLeft-l.x-f.x,y=a.top+s.scrollTop-l.y-f.y;return{x:u,y,width:a.width,height:a.height}}function ba(e){return Zt(e).position==="static"}function Fu(e,t){if(!fn(e)||Zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return hn(e)===n&&(n=n.ownerDocument.body),n}function Td(e,t){const n=jt(e);if(ji(e))return n;if(!fn(e)){let i=Gn(e);for(;i&&!Pr(i);){if(Xt(i)&&!ba(i))return i;i=Gn(i)}return n}let r=Fu(e,t);for(;r&&c0(r)&&ba(r);)r=Fu(r,t);return r&&Pr(r)&&ba(r)&&!Ns(r)?n:r||h0(e)||n}const D0=async function(e){const t=this.getOffsetParent||Td,n=this.getDimensions,r=await n(e.floating);return{reference:N0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _0(e){return Zt(e).direction==="rtl"}const O0={convertOffsetParentRelativeRectToViewportRelativeRect:b0,getDocumentElement:hn,getClippingRect:M0,getOffsetParent:Td,getElementRects:D0,getClientRects:w0,getDimensions:P0,getScale:Mr,isElement:Xt,isRTL:_0};function Id(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function k0(e,t){let n=null,r;const i=hn(e);function o(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function a(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:f,top:u,width:y,height:h}=c;if(s||t(),!y||!h)return;const g=Bo(u),w=Bo(i.clientWidth-(f+y)),d=Bo(i.clientHeight-(u+h)),v=Bo(f),b={rootMargin:-g+"px "+-w+"px "+-d+"px "+-v+"px",threshold:Lt(0,qn(1,l))||1};let C=!0;function x(R){const E=R[0].intersectionRatio;if(E!==l){if(!C)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!Id(c,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(x,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,b)}n.observe(e)}return a(!0),o}function T0(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=_s(e),f=i||o?[...c?vo(c):[],...vo(t)]:[];f.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const u=c&&s?k0(c,n):null;let y=-1,h=null;a&&(h=new ResizeObserver(v=>{let[p]=v;p&&p.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let g,w=l?ar(e):null;l&&d();function d(){const v=ar(e);w&&!Id(w,v)&&n(),w=v,g=requestAnimationFrame(d)}return n(),()=>{var v;f.forEach(p=>{i&&p.removeEventListener("scroll",n),o&&p.removeEventListener("resize",n)}),u==null||u(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const I0=o0,A0=i0,L0=t0,j0=s0,$0=n0,Hu=e0,z0=a0,F0=(e,t,n)=>{const r=new Map,i={platform:O0,...n},o={...i.platform,_c:r};return Jg(e,t,{...i,platform:o})};var H0=typeof document<"u",W0=function(){},ri=H0?M.useLayoutEffect:W0;function hi(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,i;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(!hi(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!hi(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Ad(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wu(e,t){const n=Ad(e);return Math.round(t*n)/n}function wa(e){const t=m.useRef(e);return ri(()=>{t.current=e}),t}function B0(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[f,u]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,h]=m.useState(r);hi(y,r)||h(r);const[g,w]=m.useState(null),[d,v]=m.useState(null),p=m.useCallback(I=>{I!==R.current&&(R.current=I,w(I))},[]),b=m.useCallback(I=>{I!==E.current&&(E.current=I,v(I))},[]),C=o||g,x=a||d,R=m.useRef(null),E=m.useRef(null),P=m.useRef(f),O=l!=null,N=wa(l),T=wa(i),A=wa(c),H=m.useCallback(()=>{if(!R.current||!E.current)return;const I={placement:t,strategy:n,middleware:y};T.current&&(I.platform=T.current),F0(R.current,E.current,I).then(z=>{const B={...z,isPositioned:A.current!==!1};L.current&&!hi(P.current,B)&&(P.current=B,vc.flushSync(()=>{u(B)}))})},[y,t,n,T,A]);ri(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(I=>({...I,isPositioned:!1})))},[c]);const L=m.useRef(!1);ri(()=>(L.current=!0,()=>{L.current=!1}),[]),ri(()=>{if(C&&(R.current=C),x&&(E.current=x),C&&x){if(N.current)return N.current(C,x,H);H()}},[C,x,H,N,O]);const j=m.useMemo(()=>({reference:R,floating:E,setReference:p,setFloating:b}),[p,b]),D=m.useMemo(()=>({reference:C,floating:x}),[C,x]),$=m.useMemo(()=>{const I={position:n,left:0,top:0};if(!D.floating)return I;const z=Wu(D.floating,f.x),B=Wu(D.floating,f.y);return s?{...I,transform:"translate("+z+"px, "+B+"px)",...Ad(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:z,top:B}},[n,s,D.floating,f.x,f.y]);return m.useMemo(()=>({...f,update:H,refs:j,elements:D,floatingStyles:$}),[f,H,j,D,$])}const V0=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Hu({element:r.current,padding:i}).fn(n):{}:r?Hu({element:r,padding:i}).fn(n):{}}}},q0=(e,t)=>({...I0(e),options:[e,t]}),G0=(e,t)=>({...A0(e),options:[e,t]}),U0=(e,t)=>({...z0(e),options:[e,t]}),K0=(e,t)=>({...L0(e),options:[e,t]}),Y0=(e,t)=>({...j0(e),options:[e,t]}),X0=(e,t)=>({...$0(e),options:[e,t]}),Z0=(e,t)=>({...V0(e),options:[e,t]});var Q0="Arrow",Ld=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return S.jsx(Je.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ld.displayName=Q0;var J0=Ld;function ey(e){const[t,n]=m.useState(void 0);return Vn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,s=c.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Os="Popper",[jd,Lr]=Un(Os),[ty,$d]=jd(Os),zd=e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null);return S.jsx(ty,{scope:t,anchor:r,onAnchorChange:i,children:n})};zd.displayName=Os;var Fd="PopperAnchor",Hd=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=$d(Fd,n),a=m.useRef(null),s=dt(t,a),l=m.useRef(null);return m.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||a.current,c!==l.current&&o.onAnchorChange(l.current)}),r?null:S.jsx(Je.div,{...i,ref:s})});Hd.displayName=Fd;var ks="PopperContent",[ny,ry]=jd(ks),Wd=m.forwardRef((e,t)=>{var me,V,G,J,_,k,F,K;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:y=!1,updatePositionStrategy:h="optimized",onPlaced:g,...w}=e,d=$d(ks,n),[v,p]=m.useState(null),b=dt(t,Q=>p(Q)),[C,x]=m.useState(null),R=ey(C),E=(me=R==null?void 0:R.width)!=null?me:0,P=(V=R==null?void 0:R.height)!=null?V:0,O=r+(o!=="center"?"-"+o:""),N=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(c)?c:[c],A=T.length>0,H={padding:N,boundary:T.filter(iy),altBoundary:A},{refs:L,floatingStyles:j,placement:D,isPositioned:$,middlewareData:I}=B0({strategy:"fixed",placement:O,whileElementsMounted:(...Q)=>T0(...Q,{animationFrame:h==="always"}),elements:{reference:d.anchor},middleware:[q0({mainAxis:i+P,alignmentAxis:a}),l&&G0({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?U0():void 0,...H}),l&&K0({...H}),Y0({...H,apply:({elements:Q,rects:X,availableWidth:oe,availableHeight:ee})=>{const{width:ne,height:ge}=X.reference,ye=Q.floating.style;ye.setProperty("--radix-popper-available-width",`${oe}px`),ye.setProperty("--radix-popper-available-height",`${ee}px`),ye.setProperty("--radix-popper-anchor-width",`${ne}px`),ye.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),C&&Z0({element:C,padding:s}),ay({arrowWidth:E,arrowHeight:P}),y&&X0({strategy:"referenceHidden",...H})]}),[z,B]=qd(D),W=dn(g);Vn(()=>{$&&(W==null||W())},[$,W]);const Y=(G=I.arrow)==null?void 0:G.x,U=(J=I.arrow)==null?void 0:J.y,q=((_=I.arrow)==null?void 0:_.centerOffset)!==0,[Z,se]=m.useState();return Vn(()=>{v&&se(window.getComputedStyle(v).zIndex)},[v]),S.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:$?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[(k=I.transformOrigin)==null?void 0:k.x,(F=I.transformOrigin)==null?void 0:F.y].join(" "),...((K=I.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:S.jsx(ny,{scope:n,placedSide:z,onArrowChange:x,arrowX:Y,arrowY:U,shouldHideArrow:q,children:S.jsx(Je.div,{"data-side":z,"data-align":B,...w,ref:b,style:{...w.style,animation:$?void 0:"none"}})})})});Wd.displayName=ks;var Bd="PopperArrow",oy={top:"bottom",right:"left",bottom:"top",left:"right"},Vd=m.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=ry(Bd,r),a=oy[o.placedSide];return S.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]: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:S.jsx(J0,{...i,ref:n,style:{...i.style,display:"block"}})})});Vd.displayName=Bd;function iy(e){return e!==null}var ay=e=>({name:"transformOrigin",options:e,fn(t){var d,v,p,b,C;const{placement:n,rects:r,middlewareData:i}=t,a=((d=i.arrow)==null?void 0:d.centerOffset)!==0,s=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[c,f]=qd(n),u={start:"0%",center:"50%",end:"100%"}[f],y=((p=(v=i.arrow)==null?void 0:v.x)!=null?p:0)+s/2,h=((C=(b=i.arrow)==null?void 0:b.y)!=null?C:0)+l/2;let g="",w="";return c==="bottom"?(g=a?u:`${y}px`,w=`${-l}px`):c==="top"?(g=a?u:`${y}px`,w=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,w=a?u:`${h}px`):c==="left"&&(g=`${r.floating.width+l}px`,w=a?u:`${h}px`),{data:{x:g,y:w}}}});function qd(e){const[t,n="center"]=e.split("-");return[t,n]}var Fi=zd,Hi=Hd,Ts=Wd,Is=Vd,Wi="Popover",[Gd]=Un(Wi,[Lr]),So=Lr(),[sy,Kn]=Gd(Wi),Ud=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:a=!1}=e,s=So(t),l=m.useRef(null),[c,f]=m.useState(!1),[u,y]=Tr({prop:r,defaultProp:i!=null?i:!1,onChange:o,caller:Wi});return S.jsx(Fi,{...s,children:S.jsx(sy,{scope:t,contentId:xn(),triggerRef:l,open:u,onOpenChange:y,onOpenToggle:m.useCallback(()=>y(h=>!h),[y]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>f(!0),[]),onCustomAnchorRemove:m.useCallback(()=>f(!1),[]),modal:a,children:n})})};Ud.displayName=Wi;var Kd="PopoverAnchor",uy=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Kn(Kd,n),o=So(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(a(),()=>s()),[a,s]),S.jsx(Hi,{...o,...r,ref:t})});uy.displayName=Kd;var Yd="PopoverTrigger",Xd=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Kn(Yd,n),o=So(n),a=dt(t,i.triggerRef),s=S.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":tf(i.open),...r,ref:a,onClick:we(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:S.jsx(Hi,{asChild:!0,...o,children:s})});Xd.displayName=Yd;var As="PopoverPortal",[ly,cy]=Gd(As,{forceMount:void 0}),Zd=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Kn(As,t);return S.jsx(ly,{scope:t,forceMount:n,children:S.jsx(Wt,{present:n||o.open,children:S.jsx(xo,{asChild:!0,container:i,children:r})})})};Zd.displayName=As;var Nr="PopoverContent",Qd=m.forwardRef((e,t)=>{const n=cy(Nr,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Kn(Nr,e.__scopePopover);return S.jsx(Wt,{present:r||o.open,children:o.modal?S.jsx(fy,{...i,ref:t}):S.jsx(vy,{...i,ref:t})})});Qd.displayName=Nr;var dy=or("PopoverContent.RemoveScroll"),fy=m.forwardRef((e,t)=>{const n=Kn(Nr,e.__scopePopover),r=m.useRef(null),i=dt(t,r),o=m.useRef(!1);return m.useEffect(()=>{const a=r.current;if(a)return bs(a)},[]),S.jsx(Ii,{as:dy,allowPinchZoom:!0,children:S.jsx(Jd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),o.current||(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,c=s.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:we(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),vy=m.forwardRef((e,t)=>{const n=Kn(Nr,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return S.jsx(Jd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(s=n.triggerRef.current)==null||s.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),Jd=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,...u}=e,y=Kn(Nr,n),h=So(n);return ys(),S.jsx(ki,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:S.jsx(wo,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>y.onOpenChange(!1),children:S.jsx(Ts,{"data-state":tf(y.open),role:"dialog",id:y.contentId,...h,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ef="PopoverClose",py=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Kn(ef,n);return S.jsx(Je.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>i.onOpenChange(!1))})});py.displayName=ef;var hy="PopoverArrow",my=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=So(n);return S.jsx(Is,{...i,...r,ref:t})});my.displayName=hy;function tf(e){return e?"open":"closed"}var gy=Ud,yy=Xd,by=Zd,wy=Qd;function xy({...e}){return S.jsx(gy,{"data-slot":"popover",...e})}function Cy({...e}){return S.jsx(yy,{"data-slot":"popover-trigger",...e})}function Sy({className:e,align:t="center",sideOffset:n=4,...r}){return S.jsx(by,{children:S.jsx(wy,{"data-slot":"popover-content",align:t,sideOffset:n,className:ie(`
121
+ hsl(360, 100%, 50%))`},onPointerDown:y=>{i(!0),l(y.clientX)},children:S.jsx("div",{ref:a,className:"univer-absolute univer-top-1/2 univer-box-border univer-size-2 univer-rounded-full univer-bg-transparent univer-shadow-md univer-ring-2 univer-ring-white univer-transition-transform univer-duration-75 univer-will-change-transform",style:{left:u(),transform:"translateY(-50%)",transition:r?"none":"all 0.1s ease-out"}})})})}const Ag=M.memo(Tg),Lg=M.memo(Ig),jg=M.memo(_g),$g=M.memo(kg);function zg({format:e="hex",value:t="#000000",onChange:n}){if(!Oi)return null;const{locale:r}=M.useContext(pn),[i,o]=M.useState([0,100,100]),[a,s]=M.useState(!1),l=M.useCallback((y,h,g)=>ci(y,h,g),[]);M.useEffect(()=>{try{if(e==="hex"){const[y,h,g]=t?Rs(t):i;o([y,h,g])}}catch(y){console.error("Invalid value:",y)}},[t]);function c(y,h,g){o([y,h,g])}function f(y,h,g){const[w,d,v]=l(y,h,g);if(e==="hex"){const p=Sd(w,d,v);n==null||n(p)}}function u(){const[y,h,g]=i,w=di(y,h,g);n==null||n(w),s(!1)}return S.jsxs("div",{"data-u-comp":"color-picker",className:"univer-cursor-default univer-space-y-2 univer-rounded-lg univer-bg-white dark:!univer-bg-gray-700",onClick:y=>y.stopPropagation(),children:[S.jsx($g,{hsv:i,onChange:(y,h,g)=>{c(y,h,g),f(y,h,g)}}),S.jsx("div",{className:"univer-flex univer-h-7 univer-items-center",children:S.jsx("a",{className:"univer-cursor-pointer univer-gap-2 univer-text-sm univer-text-gray-900 univer-transition-opacity hover:univer-opacity-80 dark:!univer-text-white",onClick:()=>s(!0),children:r==null?void 0:r.ColorPicker.more})}),S.jsx(Ss,{className:"!univer-w-fit !univer-p-2.5",closable:!1,maskClosable:!1,open:a,onOpenChange:s,children:S.jsxs("div",{className:"univer-grid univer-w-64 univer-gap-2",children:[S.jsx(Ag,{hsv:i,onChange:c}),S.jsxs("div",{className:"univer-flex univer-items-center univer-gap-2",children:[S.jsx("div",{className:"univer-size-6 univer-flex-shrink-0 univer-rounded-sm",style:{backgroundColor:di(...i)}}),S.jsx(Lg,{hsv:i,onChange:c})]}),S.jsx(jg,{hsv:i,onChange:c}),S.jsxs("footer",{className:"univer-flex univer-items-center univer-justify-end univer-gap-2",children:[S.jsx(Wn,{onClick:()=>s(!1),children:r==null?void 0:r.ColorPicker.cancel}),S.jsx(Wn,{variant:"primary",onClick:u,children:r==null?void 0:r.ColorPicker.confirm})]})]})})]})}function Fg(e){const{locale:t,cancelText:n,confirmText:r,onClose:i,onConfirm:o,closable:a=!0}=e;return S.jsxs("footer",{className:"univer-flex univer-items-center univer-justify-end univer-gap-2",children:[a&&S.jsx(Wn,{onClick:i,children:n!=null?n:t==null?void 0:t.Confirm.cancel}),S.jsx(Wn,{variant:"primary",onClick:o,children:r!=null?r:t==null?void 0:t.Confirm.confirm})]})}function Hg(e){const{children:t,visible:n=!1,title:r,cancelText:i,confirmText:o,width:a,onClose:s,onConfirm:l,closable:c=!0}=e,{locale:f}=M.useContext(pn);return S.jsx(Ss,{open:n,title:r,maskClosable:!1,footer:S.jsx(Fg,{locale:f,cancelText:i,confirmText:o,onClose:s,onConfirm:l,closable:c}),onClose:s,width:a,closable:c,children:t})}const Wg=["top","right","bottom","left"],qn=Math.min,Lt=Math.max,fi=Math.round,Bo=Math.floor,cn=e=>({x:e,y:e}),Bg={left:"right",right:"left",bottom:"top",top:"bottom"},Vg={start:"end",end:"start"};function Fa(e,t,n){return Lt(e,qn(t,n))}function Sn(e,t){return typeof e=="function"?e(t):e}function Rn(e){return e.split("-")[0]}function Ir(e){return e.split("-")[1]}function Es(e){return e==="x"?"y":"x"}function Ms(e){return e==="y"?"height":"width"}const qg=new Set(["top","bottom"]);function ln(e){return qg.has(Rn(e))?"y":"x"}function Ps(e){return Es(ln(e))}function Gg(e,t,n){n===void 0&&(n=!1);const r=Ir(e),i=Ps(e),o=Ms(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=vi(a)),[a,vi(a)]}function Ug(e){const t=vi(e);return[Ha(e),t,Ha(t)]}function Ha(e){return e.replace(/start|end/g,t=>Vg[t])}const ku=["left","right"],Tu=["right","left"],Kg=["top","bottom"],Yg=["bottom","top"];function Xg(e,t,n){switch(e){case"top":case"bottom":return n?t?Tu:ku:t?ku:Tu;case"left":case"right":return t?Kg:Yg;default:return[]}}function Zg(e,t,n,r){const i=Ir(e);let o=Xg(Rn(e),n==="start",r);return i&&(o=o.map(a=>a+"-"+i),t&&(o=o.concat(o.map(Ha)))),o}function vi(e){return e.replace(/left|right|bottom|top/g,t=>Bg[t])}function Qg(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ed(e){return typeof e!="number"?Qg(e):{top:e,right:e,bottom:e,left:e}}function pi(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Iu(e,t,n){let{reference:r,floating:i}=e;const o=ln(t),a=Ps(t),s=Ms(a),l=Rn(t),c=o==="y",f=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,y=r[s]/2-i[s]/2;let h;switch(l){case"top":h={x:f,y:r.y-i.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-i.width,y:u};break;default:h={x:r.x,y:r.y}}switch(Ir(t)){case"start":h[a]-=y*(n&&c?-1:1);break;case"end":h[a]+=y*(n&&c?-1:1);break}return h}const Jg=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:a}=n,s=o.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:f,y:u}=Iu(c,r,l),y=r,h={},g=0;for(let w=0;w<s.length;w++){const{name:d,fn:v}=s[w],{x:p,y:b,data:C,reset:x}=await v({x:f,y:u,initialPlacement:r,placement:y,strategy:i,middlewareData:h,rects:c,platform:a,elements:{reference:e,floating:t}});f=p!=null?p:f,u=b!=null?b:u,h={...h,[d]:{...h[d],...C}},x&&g<=50&&(g++,typeof x=="object"&&(x.placement&&(y=x.placement),x.rects&&(c=x.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:f,y:u}=Iu(c,y,l)),w=-1)}return{x:f,y:u,placement:y,strategy:i,middlewareData:h}};async function fo(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:a,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:y=!1,padding:h=0}=Sn(t,e),g=Ed(h),d=s[y?u==="floating"?"reference":"floating":u],v=pi(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(d)))==null||n?d:d.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),p=u==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(s.floating)),C=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},x=pi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:p,offsetParent:b,strategy:l}):p);return{top:(v.top-x.top+g.top)/C.y,bottom:(x.bottom-v.bottom+g.bottom)/C.y,left:(v.left-x.left+g.left)/C.x,right:(x.right-v.right+g.right)/C.x}}const e0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:a,elements:s,middlewareData:l}=t,{element:c,padding:f=0}=Sn(e,t)||{};if(c==null)return{};const u=Ed(f),y={x:n,y:r},h=Ps(i),g=Ms(h),w=await a.getDimensions(c),d=h==="y",v=d?"top":"left",p=d?"bottom":"right",b=d?"clientHeight":"clientWidth",C=o.reference[g]+o.reference[h]-y[h]-o.floating[g],x=y[h]-o.reference[h],R=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let E=R?R[b]:0;(!E||!await(a.isElement==null?void 0:a.isElement(R)))&&(E=s.floating[b]||o.floating[g]);const P=C/2-x/2,O=E/2-w[g]/2-1,N=qn(u[v],O),T=qn(u[p],O),A=N,H=E-w[g]-T,L=E/2-w[g]/2+P,j=Fa(A,L,H),D=!l.arrow&&Ir(i)!=null&&L!==j&&o.reference[g]/2-(L<A?N:T)-w[g]/2<0,$=D?L<A?L-A:L-H:0;return{[h]:y[h]+$,data:{[h]:j,centerOffset:L-j-$,...D&&{alignmentOffset:$}},reset:D}}}),t0=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:a,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:y,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:w=!0,...d}=Sn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=Rn(i),p=ln(s),b=Rn(s)===s,C=await(l.isRTL==null?void 0:l.isRTL(c.floating)),x=y||(b||!w?[vi(s)]:Ug(s)),R=g!=="none";!y&&R&&x.push(...Zg(s,w,g,C));const E=[s,...x],P=await fo(t,d),O=[];let N=((r=o.flip)==null?void 0:r.overflows)||[];if(f&&O.push(P[v]),u){const L=Gg(i,a,C);O.push(P[L[0]],P[L[1]])}if(N=[...N,{placement:i,overflows:O}],!O.every(L=>L<=0)){var T,A;const L=(((T=o.flip)==null?void 0:T.index)||0)+1,j=E[L];if(j&&(!(u==="alignment"?p!==ln(j):!1)||N.every(I=>ln(I.placement)===p?I.overflows[0]>0:!0)))return{data:{index:L,overflows:N},reset:{placement:j}};let D=(A=N.filter($=>$.overflows[0]<=0).sort(($,I)=>$.overflows[1]-I.overflows[1])[0])==null?void 0:A.placement;if(!D)switch(h){case"bestFit":{var H;const $=(H=N.filter(I=>{if(R){const z=ln(I.placement);return z===p||z==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(z=>z>0).reduce((z,B)=>z+B,0)]).sort((I,z)=>I[1]-z[1])[0])==null?void 0:H[0];$&&(D=$);break}case"initialPlacement":D=s;break}if(i!==D)return{reset:{placement:D}}}return{}}}};function Au(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Lu(e){return Wg.some(t=>e[t]>=0)}const n0=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=Sn(e,t);switch(r){case"referenceHidden":{const o=await fo(t,{...i,elementContext:"reference"}),a=Au(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Lu(a)}}}case"escaped":{const o=await fo(t,{...i,altBoundary:!0}),a=Au(o,n.floating);return{data:{escapedOffsets:a,escaped:Lu(a)}}}default:return{}}}}},Md=new Set(["left","top"]);async function r0(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=Rn(n),s=Ir(n),l=ln(n)==="y",c=Md.has(a)?-1:1,f=o&&l?-1:1,u=Sn(t,e);let{mainAxis:y,crossAxis:h,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof g=="number"&&(h=s==="end"?g*-1:g),l?{x:h*f,y:y*c}:{x:y*c,y:h*f}}const o0=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:a,middlewareData:s}=t,l=await r0(t,e);return a===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:a}}}}},i0=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:s={fn:d=>{let{x:v,y:p}=d;return{x:v,y:p}}},...l}=Sn(e,t),c={x:n,y:r},f=await fo(t,l),u=ln(Rn(i)),y=Es(u);let h=c[y],g=c[u];if(o){const d=y==="y"?"top":"left",v=y==="y"?"bottom":"right",p=h+f[d],b=h-f[v];h=Fa(p,h,b)}if(a){const d=u==="y"?"top":"left",v=u==="y"?"bottom":"right",p=g+f[d],b=g-f[v];g=Fa(p,g,b)}const w=s.fn({...t,[y]:h,[u]:g});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[y]:o,[u]:a}}}}}},a0=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:o,middlewareData:a}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=Sn(e,t),f={x:n,y:r},u=ln(i),y=Es(u);let h=f[y],g=f[u];const w=Sn(s,t),d=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(l){const b=y==="y"?"height":"width",C=o.reference[y]-o.floating[b]+d.mainAxis,x=o.reference[y]+o.reference[b]-d.mainAxis;h<C?h=C:h>x&&(h=x)}if(c){var v,p;const b=y==="y"?"width":"height",C=Md.has(Rn(i)),x=o.reference[u]-o.floating[b]+(C&&((v=a.offset)==null?void 0:v[u])||0)+(C?0:d.crossAxis),R=o.reference[u]+o.reference[b]+(C?0:((p=a.offset)==null?void 0:p[u])||0)-(C?d.crossAxis:0);g<x?g=x:g>R&&(g=R)}return{[y]:h,[u]:g}}}},s0=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:o,platform:a,elements:s}=t,{apply:l=()=>{},...c}=Sn(e,t),f=await fo(t,c),u=Rn(i),y=Ir(i),h=ln(i)==="y",{width:g,height:w}=o.floating;let d,v;u==="top"||u==="bottom"?(d=u,v=y===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(v=u,d=y==="end"?"top":"bottom");const p=w-f.top-f.bottom,b=g-f.left-f.right,C=qn(w-f[d],p),x=qn(g-f[v],b),R=!t.middlewareData.shift;let E=C,P=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=p),R&&!y){const N=Lt(f.left,0),T=Lt(f.right,0),A=Lt(f.top,0),H=Lt(f.bottom,0);h?P=g-2*(N!==0||T!==0?N+T:Lt(f.left,f.right)):E=w-2*(A!==0||H!==0?A+H:Lt(f.top,f.bottom))}await l({...t,availableWidth:P,availableHeight:E});const O=await a.getDimensions(s.floating);return g!==O.width||w!==O.height?{reset:{rects:!0}}:{}}}};function Li(){return typeof window<"u"}function Ar(e){return Pd(e)?(e.nodeName||"").toLowerCase():"#document"}function jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function hn(e){var t;return(t=(Pd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Pd(e){return Li()?e instanceof Node||e instanceof jt(e).Node:!1}function Xt(e){return Li()?e instanceof Element||e instanceof jt(e).Element:!1}function fn(e){return Li()?e instanceof HTMLElement||e instanceof jt(e).HTMLElement:!1}function ju(e){return!Li()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jt(e).ShadowRoot}const u0=new Set(["inline","contents"]);function Co(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Zt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!u0.has(i)}const l0=new Set(["table","td","th"]);function c0(e){return l0.has(Ar(e))}const d0=[":popover-open",":modal"];function ji(e){return d0.some(t=>{try{return e.matches(t)}catch{return!1}})}const f0=["transform","translate","scale","rotate","perspective"],v0=["transform","translate","scale","rotate","perspective","filter"],p0=["paint","layout","strict","content"];function Ns(e){const t=Ds(),n=Xt(e)?Zt(e):e;return f0.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)||v0.some(r=>(n.willChange||"").includes(r))||p0.some(r=>(n.contain||"").includes(r))}function h0(e){let t=Gn(e);for(;fn(t)&&!Pr(t);){if(Ns(t))return t;if(ji(t))return null;t=Gn(t)}return null}function Ds(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const m0=new Set(["html","body","#document"]);function Pr(e){return m0.has(Ar(e))}function Zt(e){return jt(e).getComputedStyle(e)}function $i(e){return Xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gn(e){if(Ar(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ju(e)&&e.host||hn(e);return ju(t)?t.host:t}function Nd(e){const t=Gn(e);return Pr(t)?e.ownerDocument?e.ownerDocument.body:e.body:fn(t)&&Co(t)?t:Nd(t)}function vo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Nd(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),a=jt(i);if(o){const s=Wa(a);return t.concat(a,a.visualViewport||[],Co(i)?i:[],s&&n?vo(s):[])}return t.concat(i,vo(i,[],n))}function Wa(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Dd(e){const t=Zt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=fn(e),o=i?e.offsetWidth:n,a=i?e.offsetHeight:r,s=fi(n)!==o||fi(r)!==a;return s&&(n=o,r=a),{width:n,height:r,$:s}}function _s(e){return Xt(e)?e:e.contextElement}function Mr(e){const t=_s(e);if(!fn(t))return cn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Dd(t);let a=(o?fi(n.width):n.width)/r,s=(o?fi(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const g0=cn(0);function _d(e){const t=jt(e);return!Ds()||!t.visualViewport?g0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function y0(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jt(e)?!1:t}function ar(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=_s(e);let a=cn(1);t&&(r?Xt(r)&&(a=Mr(r)):a=Mr(e));const s=y0(o,n,r)?_d(o):cn(0);let l=(i.left+s.x)/a.x,c=(i.top+s.y)/a.y,f=i.width/a.x,u=i.height/a.y;if(o){const y=jt(o),h=r&&Xt(r)?jt(r):r;let g=y,w=Wa(g);for(;w&&r&&h!==g;){const d=Mr(w),v=w.getBoundingClientRect(),p=Zt(w),b=v.left+(w.clientLeft+parseFloat(p.paddingLeft))*d.x,C=v.top+(w.clientTop+parseFloat(p.paddingTop))*d.y;l*=d.x,c*=d.y,f*=d.x,u*=d.y,l+=b,c+=C,g=jt(w),w=Wa(g)}}return pi({width:f,height:u,x:l,y:c})}function zi(e,t){const n=$i(e).scrollLeft;return t?t.left+n:ar(hn(e)).left+n}function Od(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-zi(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function b0(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",a=hn(r),s=t?ji(t.floating):!1;if(r===a||s&&o)return n;let l={scrollLeft:0,scrollTop:0},c=cn(1);const f=cn(0),u=fn(r);if((u||!u&&!o)&&((Ar(r)!=="body"||Co(a))&&(l=$i(r)),fn(r))){const h=ar(r);c=Mr(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const y=a&&!u&&!o?Od(a,l):cn(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+y.x,y:n.y*c.y-l.scrollTop*c.y+f.y+y.y}}function w0(e){return Array.from(e.getClientRects())}function x0(e){const t=hn(e),n=$i(e),r=e.ownerDocument.body,i=Lt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Lt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+zi(e);const s=-n.scrollTop;return Zt(r).direction==="rtl"&&(a+=Lt(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:a,y:s}}const $u=25;function C0(e,t){const n=jt(e),r=hn(e),i=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,s=0,l=0;if(i){o=i.width,a=i.height;const f=Ds();(!f||f&&t==="fixed")&&(s=i.offsetLeft,l=i.offsetTop)}const c=zi(r);if(c<=0){const f=r.ownerDocument,u=f.body,y=getComputedStyle(u),h=f.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-h);g<=$u&&(o-=g)}else c<=$u&&(o+=c);return{width:o,height:a,x:s,y:l}}const S0=new Set(["absolute","fixed"]);function R0(e,t){const n=ar(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=fn(e)?Mr(e):cn(1),a=e.clientWidth*o.x,s=e.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:a,height:s,x:l,y:c}}function zu(e,t,n){let r;if(t==="viewport")r=C0(e,n);else if(t==="document")r=x0(hn(e));else if(Xt(t))r=R0(t,n);else{const i=_d(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return pi(r)}function kd(e,t){const n=Gn(e);return n===t||!Xt(n)||Pr(n)?!1:Zt(n).position==="fixed"||kd(n,t)}function E0(e,t){const n=t.get(e);if(n)return n;let r=vo(e,[],!1).filter(s=>Xt(s)&&Ar(s)!=="body"),i=null;const o=Zt(e).position==="fixed";let a=o?Gn(e):e;for(;Xt(a)&&!Pr(a);){const s=Zt(a),l=Ns(a);!l&&s.position==="fixed"&&(i=null),(o?!l&&!i:!l&&s.position==="static"&&!!i&&S0.has(i.position)||Co(a)&&!l&&kd(e,a))?r=r.filter(f=>f!==a):i=s,a=Gn(a)}return t.set(e,r),r}function M0(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const a=[...n==="clippingAncestors"?ji(t)?[]:E0(t,this._c):[].concat(n),r],s=a[0],l=a.reduce((c,f)=>{const u=zu(t,f,i);return c.top=Lt(u.top,c.top),c.right=qn(u.right,c.right),c.bottom=qn(u.bottom,c.bottom),c.left=Lt(u.left,c.left),c},zu(t,s,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function P0(e){const{width:t,height:n}=Dd(e);return{width:t,height:n}}function N0(e,t,n){const r=fn(t),i=hn(t),o=n==="fixed",a=ar(e,!0,o,t);let s={scrollLeft:0,scrollTop:0};const l=cn(0);function c(){l.x=zi(i)}if(r||!r&&!o)if((Ar(t)!=="body"||Co(i))&&(s=$i(t)),r){const h=ar(t,!0,o,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&c();o&&!r&&i&&c();const f=i&&!r&&!o?Od(i,s):cn(0),u=a.left+s.scrollLeft-l.x-f.x,y=a.top+s.scrollTop-l.y-f.y;return{x:u,y,width:a.width,height:a.height}}function ba(e){return Zt(e).position==="static"}function Fu(e,t){if(!fn(e)||Zt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return hn(e)===n&&(n=n.ownerDocument.body),n}function Td(e,t){const n=jt(e);if(ji(e))return n;if(!fn(e)){let i=Gn(e);for(;i&&!Pr(i);){if(Xt(i)&&!ba(i))return i;i=Gn(i)}return n}let r=Fu(e,t);for(;r&&c0(r)&&ba(r);)r=Fu(r,t);return r&&Pr(r)&&ba(r)&&!Ns(r)?n:r||h0(e)||n}const D0=async function(e){const t=this.getOffsetParent||Td,n=this.getDimensions,r=await n(e.floating);return{reference:N0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _0(e){return Zt(e).direction==="rtl"}const O0={convertOffsetParentRelativeRectToViewportRelativeRect:b0,getDocumentElement:hn,getClippingRect:M0,getOffsetParent:Td,getElementRects:D0,getClientRects:w0,getDimensions:P0,getScale:Mr,isElement:Xt,isRTL:_0};function Id(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function k0(e,t){let n=null,r;const i=hn(e);function o(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function a(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),o();const c=e.getBoundingClientRect(),{left:f,top:u,width:y,height:h}=c;if(s||t(),!y||!h)return;const g=Bo(u),w=Bo(i.clientWidth-(f+y)),d=Bo(i.clientHeight-(u+h)),v=Bo(f),b={rootMargin:-g+"px "+-w+"px "+-d+"px "+-v+"px",threshold:Lt(0,qn(1,l))||1};let C=!0;function x(R){const E=R[0].intersectionRatio;if(E!==l){if(!C)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!Id(c,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(x,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,b)}n.observe(e)}return a(!0),o}function T0(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=_s(e),f=i||o?[...c?vo(c):[],...vo(t)]:[];f.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const u=c&&s?k0(c,n):null;let y=-1,h=null;a&&(h=new ResizeObserver(v=>{let[p]=v;p&&p.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let g,w=l?ar(e):null;l&&d();function d(){const v=ar(e);w&&!Id(w,v)&&n(),w=v,g=requestAnimationFrame(d)}return n(),()=>{var v;f.forEach(p=>{i&&p.removeEventListener("scroll",n),o&&p.removeEventListener("resize",n)}),u==null||u(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const I0=o0,A0=i0,L0=t0,j0=s0,$0=n0,Hu=e0,z0=a0,F0=(e,t,n)=>{const r=new Map,i={platform:O0,...n},o={...i.platform,_c:r};return Jg(e,t,{...i,platform:o})};var H0=typeof document<"u",W0=function(){},ri=H0?M.useLayoutEffect:W0;function hi(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,i;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(!hi(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&e.$$typeof)&&!hi(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Ad(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wu(e,t){const n=Ad(e);return Math.round(t*n)/n}function wa(e){const t=m.useRef(e);return ri(()=>{t.current=e}),t}function B0(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:a}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[f,u]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,h]=m.useState(r);hi(y,r)||h(r);const[g,w]=m.useState(null),[d,v]=m.useState(null),p=m.useCallback(I=>{I!==R.current&&(R.current=I,w(I))},[]),b=m.useCallback(I=>{I!==E.current&&(E.current=I,v(I))},[]),C=o||g,x=a||d,R=m.useRef(null),E=m.useRef(null),P=m.useRef(f),O=l!=null,N=wa(l),T=wa(i),A=wa(c),H=m.useCallback(()=>{if(!R.current||!E.current)return;const I={placement:t,strategy:n,middleware:y};T.current&&(I.platform=T.current),F0(R.current,E.current,I).then(z=>{const B={...z,isPositioned:A.current!==!1};L.current&&!hi(P.current,B)&&(P.current=B,vc.flushSync(()=>{u(B)}))})},[y,t,n,T,A]);ri(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(I=>({...I,isPositioned:!1})))},[c]);const L=m.useRef(!1);ri(()=>(L.current=!0,()=>{L.current=!1}),[]),ri(()=>{if(C&&(R.current=C),x&&(E.current=x),C&&x){if(N.current)return N.current(C,x,H);H()}},[C,x,H,N,O]);const j=m.useMemo(()=>({reference:R,floating:E,setReference:p,setFloating:b}),[p,b]),D=m.useMemo(()=>({reference:C,floating:x}),[C,x]),$=m.useMemo(()=>{const I={position:n,left:0,top:0};if(!D.floating)return I;const z=Wu(D.floating,f.x),B=Wu(D.floating,f.y);return s?{...I,transform:"translate("+z+"px, "+B+"px)",...Ad(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:z,top:B}},[n,s,D.floating,f.x,f.y]);return m.useMemo(()=>({...f,update:H,refs:j,elements:D,floatingStyles:$}),[f,H,j,D,$])}const V0=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Hu({element:r.current,padding:i}).fn(n):{}:r?Hu({element:r,padding:i}).fn(n):{}}}},q0=(e,t)=>({...I0(e),options:[e,t]}),G0=(e,t)=>({...A0(e),options:[e,t]}),U0=(e,t)=>({...z0(e),options:[e,t]}),K0=(e,t)=>({...L0(e),options:[e,t]}),Y0=(e,t)=>({...j0(e),options:[e,t]}),X0=(e,t)=>({...$0(e),options:[e,t]}),Z0=(e,t)=>({...V0(e),options:[e,t]});var Q0="Arrow",Ld=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...o}=e;return S.jsx(Je.svg,{...o,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:S.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ld.displayName=Q0;var J0=Ld;function ey(e){const[t,n]=m.useState(void 0);return Vn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let a,s;if("borderBoxSize"in o){const l=o.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,s=c.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Os="Popper",[jd,Lr]=Un(Os),[ty,$d]=jd(Os),zd=e=>{const{__scopePopper:t,children:n}=e,[r,i]=m.useState(null);return S.jsx(ty,{scope:t,anchor:r,onAnchorChange:i,children:n})};zd.displayName=Os;var Fd="PopperAnchor",Hd=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,o=$d(Fd,n),a=m.useRef(null),s=dt(t,a),l=m.useRef(null);return m.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||a.current,c!==l.current&&o.onAnchorChange(l.current)}),r?null:S.jsx(Je.div,{...i,ref:s})});Hd.displayName=Fd;var ks="PopperContent",[ny,ry]=jd(ks),Wd=m.forwardRef((e,t)=>{var me,V,G,J,_,k,F,K;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:y=!1,updatePositionStrategy:h="optimized",onPlaced:g,...w}=e,d=$d(ks,n),[v,p]=m.useState(null),b=dt(t,Q=>p(Q)),[C,x]=m.useState(null),R=ey(C),E=(me=R==null?void 0:R.width)!=null?me:0,P=(V=R==null?void 0:R.height)!=null?V:0,O=r+(o!=="center"?"-"+o:""),N=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},T=Array.isArray(c)?c:[c],A=T.length>0,H={padding:N,boundary:T.filter(iy),altBoundary:A},{refs:L,floatingStyles:j,placement:D,isPositioned:$,middlewareData:I}=B0({strategy:"fixed",placement:O,whileElementsMounted:(...Q)=>T0(...Q,{animationFrame:h==="always"}),elements:{reference:d.anchor},middleware:[q0({mainAxis:i+P,alignmentAxis:a}),l&&G0({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?U0():void 0,...H}),l&&K0({...H}),Y0({...H,apply:({elements:Q,rects:X,availableWidth:oe,availableHeight:ee})=>{const{width:ne,height:ge}=X.reference,ye=Q.floating.style;ye.setProperty("--radix-popper-available-width",`${oe}px`),ye.setProperty("--radix-popper-available-height",`${ee}px`),ye.setProperty("--radix-popper-anchor-width",`${ne}px`),ye.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),C&&Z0({element:C,padding:s}),ay({arrowWidth:E,arrowHeight:P}),y&&X0({strategy:"referenceHidden",...H})]}),[z,B]=qd(D),W=dn(g);Vn(()=>{$&&(W==null||W())},[$,W]);const Y=(G=I.arrow)==null?void 0:G.x,U=(J=I.arrow)==null?void 0:J.y,q=((_=I.arrow)==null?void 0:_.centerOffset)!==0,[Z,se]=m.useState();return Vn(()=>{v&&se(window.getComputedStyle(v).zIndex)},[v]),S.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...j,transform:$?j.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Z,"--radix-popper-transform-origin":[(k=I.transformOrigin)==null?void 0:k.x,(F=I.transformOrigin)==null?void 0:F.y].join(" "),...((K=I.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:S.jsx(ny,{scope:n,placedSide:z,onArrowChange:x,arrowX:Y,arrowY:U,shouldHideArrow:q,children:S.jsx(Je.div,{"data-side":z,"data-align":B,...w,ref:b,style:{...w.style,animation:$?void 0:"none"}})})})});Wd.displayName=ks;var Bd="PopperArrow",oy={top:"bottom",right:"left",bottom:"top",left:"right"},Vd=m.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,o=ry(Bd,r),a=oy[o.placedSide];return S.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]: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:S.jsx(J0,{...i,ref:n,style:{...i.style,display:"block"}})})});Vd.displayName=Bd;function iy(e){return e!==null}var ay=e=>({name:"transformOrigin",options:e,fn(t){var d,v,p,b,C;const{placement:n,rects:r,middlewareData:i}=t,a=((d=i.arrow)==null?void 0:d.centerOffset)!==0,s=a?0:e.arrowWidth,l=a?0:e.arrowHeight,[c,f]=qd(n),u={start:"0%",center:"50%",end:"100%"}[f],y=((p=(v=i.arrow)==null?void 0:v.x)!=null?p:0)+s/2,h=((C=(b=i.arrow)==null?void 0:b.y)!=null?C:0)+l/2;let g="",w="";return c==="bottom"?(g=a?u:`${y}px`,w=`${-l}px`):c==="top"?(g=a?u:`${y}px`,w=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,w=a?u:`${h}px`):c==="left"&&(g=`${r.floating.width+l}px`,w=a?u:`${h}px`),{data:{x:g,y:w}}}});function qd(e){const[t,n="center"]=e.split("-");return[t,n]}var Fi=zd,Hi=Hd,Ts=Wd,Is=Vd,Wi="Popover",[Gd]=Un(Wi,[Lr]),So=Lr(),[sy,Kn]=Gd(Wi),Ud=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:a=!1}=e,s=So(t),l=m.useRef(null),[c,f]=m.useState(!1),[u,y]=Tr({prop:r,defaultProp:i!=null?i:!1,onChange:o,caller:Wi});return S.jsx(Fi,{...s,children:S.jsx(sy,{scope:t,contentId:xn(),triggerRef:l,open:u,onOpenChange:y,onOpenToggle:m.useCallback(()=>y(h=>!h),[y]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>f(!0),[]),onCustomAnchorRemove:m.useCallback(()=>f(!1),[]),modal:a,children:n})})};Ud.displayName=Wi;var Kd="PopoverAnchor",uy=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Kn(Kd,n),o=So(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=i;return m.useEffect(()=>(a(),()=>s()),[a,s]),S.jsx(Hi,{...o,...r,ref:t})});uy.displayName=Kd;var Yd="PopoverTrigger",Xd=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Kn(Yd,n),o=So(n),a=dt(t,i.triggerRef),s=S.jsx(Je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":tf(i.open),...r,ref:a,onClick:we(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:S.jsx(Hi,{asChild:!0,...o,children:s})});Xd.displayName=Yd;var As="PopoverPortal",[ly,cy]=Gd(As,{forceMount:void 0}),Zd=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,o=Kn(As,t);return S.jsx(ly,{scope:t,forceMount:n,children:S.jsx(Wt,{present:n||o.open,children:S.jsx(xo,{asChild:!0,container:i,children:r})})})};Zd.displayName=As;var Nr="PopoverContent",Qd=m.forwardRef((e,t)=>{const n=cy(Nr,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,o=Kn(Nr,e.__scopePopover);return S.jsx(Wt,{present:r||o.open,children:o.modal?S.jsx(fy,{...i,ref:t}):S.jsx(vy,{...i,ref:t})})});Qd.displayName=Nr;var dy=or("PopoverContent.RemoveScroll"),fy=m.forwardRef((e,t)=>{const n=Kn(Nr,e.__scopePopover),r=m.useRef(null),i=dt(t,r),o=m.useRef(!1);return m.useEffect(()=>{const a=r.current;if(a)return bs(a)},[]),S.jsx(Ii,{as:dy,allowPinchZoom:!0,children:S.jsx(Jd,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,a=>{var s;a.preventDefault(),o.current||(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,c=s.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:we(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),vy=m.forwardRef((e,t)=>{const n=Kn(Nr,e.__scopePopover),r=m.useRef(!1),i=m.useRef(!1);return S.jsx(Jd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,s;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(s=n.triggerRef.current)==null||s.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=o.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),Jd=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,...u}=e,y=Kn(Nr,n),h=So(n);return ys(),S.jsx(ki,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:S.jsx(wo,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>y.onOpenChange(!1),children:S.jsx(Ts,{"data-state":tf(y.open),role:"dialog",id:y.contentId,...h,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ef="PopoverClose",py=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Kn(ef,n);return S.jsx(Je.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>i.onOpenChange(!1))})});py.displayName=ef;var hy="PopoverArrow",my=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=So(n);return S.jsx(Is,{...i,...r,ref:t})});my.displayName=hy;function tf(e){return e?"open":"closed"}var gy=Ud,yy=Xd,by=Zd,wy=Qd;function xy({...e}){return S.jsx(gy,{"data-slot":"popover",...e})}function Cy({...e}){return S.jsx(yy,{"data-slot":"popover-trigger",...e})}function Sy({className:e,align:t="center",sideOffset:n=4,...r}){return S.jsx(by,{children:S.jsx(wy,{"data-slot":"popover-content",align:t,sideOffset:n,className:ie(`
122
122
  univer-outline-hidden univer-z-[1080] univer-max-h-[var(--radix-popper-available-height)]
123
123
  univer-overflow-y-auto univer-rounded-md univer-bg-white univer-text-gray-900 univer-shadow-md
124
124
  data-[state=open]:univer-animate-in data-[state=open]:univer-fade-in-0
@@ -229,7 +229,7 @@ html body {
229
229
  placeholder:univer-text-gray-400
230
230
  focus:univer-border-primary-600 focus:univer-outline-none focus:univer-ring-2 focus:univer-ring-primary-50
231
231
  dark:!univer-bg-gray-700 dark:!univer-text-white dark:focus:!univer-ring-primary-900
232
- `,{variants:{size:{mini:"univer-h-7 univer-px-1.5 univer-text-sm",small:"univer-h-8 univer-px-2 univer-text-sm",middle:"univer-h-10 univer-px-3 univer-text-base",large:"univer-h-12 univer-px-4 univer-text-lg"}},defaultVariants:{size:"small"}}),Jv=M.forwardRef(({autoFocus:e=!1,className:t,style:n,type:r="text",placeholder:i,value:o,size:a="small",allowClear:s=!1,disabled:l=!1,onClick:c,onKeyDown:f,onChange:u,onFocus:y,onBlur:h,slot:g,inputClass:w,inputStyle:d,...v},p)=>{const b=O=>{O.stopPropagation(),u==null||u("")},C=O=>{u==null||u(O.target.value)},x=M.useMemo(()=>s&&o&&!l||g,[s,l,g,o]),[R,E]=M.useState(0),P=M.useRef(null);return M.useEffect(()=>{let O=null;return g&&P.current&&(O=new MutationObserver(()=>{P.current&&E(P.current.offsetWidth+8)}),O.observe(P.current,{childList:!0,subtree:!0}),E(P.current.offsetWidth+8)),()=>O==null?void 0:O.disconnect()},[P.current]),S.jsxs("div",{"data-u-comp":"input",className:ie("univer-relative univer-inline-flex univer-w-full univer-items-center univer-rounded-md",l&&"univer-cursor-not-allowed",t),style:n,children:[S.jsx("input",{ref:p,type:r,className:ie(Xx({size:a}),Ct,l&&`
232
+ `,{variants:{size:{mini:"univer-h-7 univer-px-1.5 univer-text-sm",small:"univer-h-8 univer-px-2 univer-text-sm",middle:"univer-h-10 univer-px-3 univer-text-base",large:"univer-h-12 univer-px-4 univer-text-lg"}},defaultVariants:{size:"small"}}),Jv=M.forwardRef(({autoFocus:e=!1,className:t,style:n,type:r="text",placeholder:i,value:o,size:a="small",allowClear:s=!1,disabled:l=!1,onClick:c,onKeyDown:f,onChange:u,onFocus:y,onBlur:h,slot:g,inputClass:w,inputStyle:d,...v},p)=>{const b=O=>{O.stopPropagation(),u==null||u("")},C=O=>{u==null||u(O.target.value)},x=M.useMemo(()=>s&&o&&!l||g,[s,l,g,o]),[R,E]=M.useState(0),P=M.useRef(null);return M.useEffect(()=>{let O=null;return g&&P.current&&(O=new MutationObserver(()=>{P.current&&E(P.current.offsetWidth+8)}),O.observe(P.current,{childList:!0,subtree:!0}),E(P.current.offsetWidth+8)),()=>O==null?void 0:O.disconnect()},[P.current]),M.useEffect(()=>{s&&!(g&&P.current)&&E(26)},[]),S.jsxs("div",{"data-u-comp":"input",className:ie("univer-relative univer-inline-flex univer-w-full univer-items-center univer-rounded-md",l&&"univer-cursor-not-allowed",t),style:n,children:[S.jsx("input",{ref:p,type:r,className:ie(Xx({size:a}),Ct,l&&`
233
233
  univer-cursor-not-allowed univer-bg-gray-50 univer-text-gray-400
234
234
  dark:!univer-text-gray-500
235
235
  `,s&&!g&&"univer-pr-8",w),placeholder:i,value:o,disabled:l,autoFocus:e,onClick:c,onKeyDown:f,onChange:C,onFocus:y,onBlur:h,style:{...d,paddingRight:R},...v}),x&&S.jsxs("div",{className:"univer-absolute univer-right-2 univer-flex univer-items-center univer-gap-1 univer-rounded-full",ref:P,children:[g,s&&o&&!l&&S.jsx("button",{type:"button",onClick:b,className:"univer-flex univer-size-4 univer-cursor-pointer univer-items-center univer-rounded-full univer-border-none univer-bg-transparent univer-p-1 univer-text-gray-400 univer-transition-colors univer-duration-200 hover:univer-text-gray-500 focus:univer-outline-none",children:S.jsx(Di,{className:"univer-size-3"})})]})]})}),Zx=M.forwardRef(({value:e,defaultValue:t,size:n="small",min:r=Number.MIN_SAFE_INTEGER,max:i=Number.MAX_SAFE_INTEGER,step:o=1,precision:a,formatter:s,parser:l,controls:c=!0,className:f,inputClassName:u,controlsClassName:y,disabled:h,onChange:g,onKeyDown:w,onPressEnter:d,onFocus:v,onBlur:p,allowEmpty:b=!1},C)=>{const[x,R]=M.useState(e!==void 0?e:t!==void 0?t:null),E=M.useRef(x),[P,O]=M.useState(L(x)),N=M.useRef(null),T=M.useRef(null),A=M.useRef(null),H=W=>{C&&(typeof C=="function"?C(W):C.current=W),N.current=W};M.useEffect(()=>{e!==void 0&&e!==x&&(R(e),E.current=e,O(L(e)))},[e]),M.useEffect(()=>{x!==null&&(E.current=x)},[x]),M.useEffect(()=>()=>{T.current&&clearTimeout(T.current),A.current&&clearInterval(A.current)},[]);function L(W){if(W==null)return"";let Y=W;return a!==void 0&&(Y=Number(W).toFixed(a)),s?s(Y):String(Y)}function j(W){if(!W)return null;let Y=W;l&&(Y=l(W));try{const q=Y.replace(/[^\d.-]/g,"").split("."),Z=q[0],se=q.length>1?q.slice(1).join(""):"",me=Z+(se?`.${se}`:""),V=Number(me);if(Number.isNaN(V))return null;let G;if(a!==void 0){const J=10**a,_=Math.round(V*J)/J;_.toString().includes("e")?G=Number.parseFloat(_.toFixed(a)):G=_}else V.toString().includes("e")?G=Number.parseFloat(V.toFixed(16).replace(/\.?0+$/,"")):G=V;return i!==void 0&&G>i&&(G=i),r!==void 0&&G<r&&(G=r),G}catch{return null}}function D(W){if(O(W),b&&W===""){R(null),g==null||g(null);return}const Y=j(W);R(Y),g==null||g(Y)}function $(W){if(x===null){if(P===""&&b)g&&g(null);else{const U=E.current;R(U),O(L(U)),g&&g(U)}p==null||p(W);return}let Y=x;i!==void 0&&Y>i&&(Y=i),r!==void 0&&Y<r&&(Y=r),Y!==x?(R(Y),O(L(Y)),g==null||g(Y)):O(L(x)),p==null||p(W)}function I(W){if(h)return;const Y=W?o:-o;let U;x!==null?U=x:E.current!==null?U=E.current:U=r>0?r:0;let q=U+Y;i!==void 0&&q>i&&(q=i),r!==void 0&&q<r&&(q=r),q!==U&&(R(q),E.current=q,O(L(q)),g==null||g(q))}function z(W){h||(w==null||w(W),W.key==="ArrowUp"?(W.preventDefault(),I(!0)):W.key==="ArrowDown"?(W.preventDefault(),I(!1)):W.key==="Enter"&&(d==null||d(W)))}function B(W){var Y;h||(I(W),(Y=N.current)==null||Y.focus())}return S.jsx("div",{className:ie("univer-inline-block",f),children:S.jsxs("div",{className:"univer-relative univer-w-full",children:[S.jsx(Jv,{ref:H,className:ie("univer-box-border",u),size:n,value:P,disabled:h,onChange:D,onFocus:v,onBlur:$,onKeyDown:z}),c&&S.jsxs("div",{className:ie(`