6 lines
29 KiB
JavaScript
6 lines
29 KiB
JavaScript
(()=>{var Vt=Object.create;var qt=Object.defineProperty;var Nt=Object.getOwnPropertyDescriptor;var jt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var It=(g,R)=>()=>(R||g((R={exports:{}}).exports,R),R.exports);var _t=(g,R,at,lt)=>{if(R&&typeof R=="object"||typeof R=="function")for(let Q of jt(R))!Yt.call(g,Q)&&Q!==at&&qt(g,Q,{get:()=>R[Q],enumerable:!(lt=Nt(R,Q))||lt.enumerable});return g};var Wt=(g,R,at)=>(at=g!=null?Vt(Xt(g)):{},_t(R||!g||!g.__esModule?qt(at,"default",{value:g,enumerable:!0}):at,g));var Et=It((Tt,zt)=>{(function(g,R){typeof Tt=="object"&&typeof zt<"u"?R(Tt):typeof define=="function"&&define.amd?define(["exports"],R):R((g=typeof globalThis<"u"?globalThis:g||self).FloatingUICore={})})(Tt,function(g){"use strict";let R=["top","right","bottom","left"],at=["start","end"],lt=R.reduce((n,i)=>n.concat(i,i+"-"+at[0],i+"-"+at[1]),[]),Q=Math.min,G=Math.max,st={left:"right",right:"left",bottom:"top",top:"bottom"},gt={start:"end",end:"start"};function mt(n,i,h){return G(n,Q(i,h))}function V(n,i){return typeof n=="function"?n(i):n}function N(n){return n.split("-")[0]}function it(n){return n.split("-")[1]}function l(n){return n==="x"?"y":"x"}function c(n){return n==="y"?"height":"width"}function A(n){return["top","bottom"].includes(N(n))?"y":"x"}function D(n){return l(A(n))}function I(n,i,h){h===void 0&&(h=!1);let s=it(n),y=D(n),u=c(y),w=y==="x"?s===(h?"end":"start")?"right":"left":s==="start"?"bottom":"top";return i.reference[u]>i.floating[u]&&(w=_(w)),[w,_(w)]}function j(n){return n.replace(/start|end/g,i=>gt[i])}function _(n){return n.replace(/left|right|bottom|top/g,i=>st[i])}function nt(n){return typeof n!="number"?(function(i){return{top:0,right:0,bottom:0,left:0,...i}})(n):{top:n,right:n,bottom:n,left:n}}function dt(n){let{x:i,y:h,width:s,height:y}=n;return{width:s,height:y,top:h,left:i,right:i+s,bottom:h+y,x:i,y:h}}function rt(n,i,h){let{reference:s,floating:y}=n,u=A(i),w=D(i),k=c(w),W=N(i),M=u==="y",L=s.x+s.width/2-y.width/2,p=s.y+s.height/2-y.height/2,E=s[k]/2-y[k]/2,m;switch(W){case"top":m={x:L,y:s.y-y.height};break;case"bottom":m={x:L,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:p};break;case"left":m={x:s.x-y.width,y:p};break;default:m={x:s.x,y:s.y}}switch(it(i)){case"start":m[w]-=E*(h&&M?-1:1);break;case"end":m[w]+=E*(h&&M?-1:1)}return m}async function ct(n,i){var h;i===void 0&&(i={});let{x:s,y,platform:u,rects:w,elements:k,strategy:W}=n,{boundary:M="clippingAncestors",rootBoundary:L="viewport",elementContext:p="floating",altBoundary:E=!1,padding:m=0}=V(i,n),T=nt(m),P=k[E?p==="floating"?"reference":"floating":p],O=dt(await u.getClippingRect({element:(h=await(u.isElement==null?void 0:u.isElement(P)))==null||h?P:P.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(k.floating)),boundary:M,rootBoundary:L,strategy:W})),H=p==="floating"?{x:s,y,width:w.floating.width,height:w.floating.height}:w.reference,B=await(u.getOffsetParent==null?void 0:u.getOffsetParent(k.floating)),C=await(u.isElement==null?void 0:u.isElement(B))&&await(u.getScale==null?void 0:u.getScale(B))||{x:1,y:1},S=dt(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:k,rect:H,offsetParent:B,strategy:W}):H);return{top:(O.top-S.top+T.top)/C.y,bottom:(S.bottom-O.bottom+T.bottom)/C.y,left:(O.left-S.left+T.left)/C.x,right:(S.right-O.right+T.right)/C.x}}function ut(n,i){return{top:n.top-i.height,right:n.right-i.width,bottom:n.bottom-i.height,left:n.left-i.width}}function ht(n){return R.some(i=>n[i]>=0)}function pt(n){let i=Q(...n.map(s=>s.left)),h=Q(...n.map(s=>s.top));return{x:i,y:h,width:G(...n.map(s=>s.right))-i,height:G(...n.map(s=>s.bottom))-h}}g.arrow=n=>({name:"arrow",options:n,async fn(i){let{x:h,y:s,placement:y,rects:u,platform:w,elements:k,middlewareData:W}=i,{element:M,padding:L=0}=V(n,i)||{};if(M==null)return{};let p=nt(L),E={x:h,y:s},m=D(y),T=c(m),P=await w.getDimensions(M),O=m==="y",H=O?"top":"left",B=O?"bottom":"right",C=O?"clientHeight":"clientWidth",S=u.reference[T]+u.reference[m]-E[m]-u.floating[T],F=E[m]-u.reference[m],J=await(w.getOffsetParent==null?void 0:w.getOffsetParent(M)),K=J?J[C]:0;K&&await(w.isElement==null?void 0:w.isElement(J))||(K=k.floating[C]||u.floating[T]);let ot=S/2-F/2,z=K/2-P[T]/2-1,X=Q(p[H],z),t=Q(p[B],z),e=X,o=K-P[T]-t,r=K/2-P[T]/2+ot,a=mt(e,r,o),f=!W.arrow&&it(y)!=null&&r!==a&&u.reference[T]/2-(r<e?X:t)-P[T]/2<0,b=f?r<e?r-e:r-o:0;return{[m]:E[m]+b,data:{[m]:a,centerOffset:r-a-b,...f&&{alignmentOffset:b}},reset:f}}}),g.autoPlacement=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(i){var h,s,y;let{rects:u,middlewareData:w,placement:k,platform:W,elements:M}=i,{crossAxis:L=!1,alignment:p,allowedPlacements:E=lt,autoAlignment:m=!0,...T}=V(n,i),P=p!==void 0||E===lt?(function(z,X,t){return(z?[...t.filter(e=>it(e)===z),...t.filter(e=>it(e)!==z)]:t.filter(e=>N(e)===e)).filter(e=>!z||it(e)===z||!!X&&j(e)!==e)})(p||null,m,E):E,O=await ct(i,T),H=((h=w.autoPlacement)==null?void 0:h.index)||0,B=P[H];if(B==null)return{};let C=I(B,u,await(W.isRTL==null?void 0:W.isRTL(M.floating)));if(k!==B)return{reset:{placement:P[0]}};let S=[O[N(B)],O[C[0]],O[C[1]]],F=[...((s=w.autoPlacement)==null?void 0:s.overflows)||[],{placement:B,overflows:S}],J=P[H+1];if(J)return{data:{index:H+1,overflows:F},reset:{placement:J}};let K=F.map(z=>{let X=it(z.placement);return[z.placement,X&&L?z.overflows.slice(0,2).reduce((t,e)=>t+e,0):z.overflows[0],z.overflows]}).sort((z,X)=>z[1]-X[1]),ot=((y=K.filter(z=>z[2].slice(0,it(z[0])?2:3).every(X=>X<=0))[0])==null?void 0:y[0])||K[0][0];return ot!==k?{data:{index:H+1,overflows:F},reset:{placement:ot}}:{}}}},g.computePosition=async(n,i,h)=>{let{placement:s="bottom",strategy:y="absolute",middleware:u=[],platform:w}=h,k=u.filter(Boolean),W=await(w.isRTL==null?void 0:w.isRTL(i)),M=await w.getElementRects({reference:n,floating:i,strategy:y}),{x:L,y:p}=rt(M,s,W),E=s,m={},T=0;for(let P=0;P<k.length;P++){let{name:O,fn:H}=k[P],{x:B,y:C,data:S,reset:F}=await H({x:L,y:p,initialPlacement:s,placement:E,strategy:y,middlewareData:m,rects:M,platform:w,elements:{reference:n,floating:i}});L=B??L,p=C??p,m={...m,[O]:{...m[O],...S}},F&&T<=50&&(T++,typeof F=="object"&&(F.placement&&(E=F.placement),F.rects&&(M=F.rects===!0?await w.getElementRects({reference:n,floating:i,strategy:y}):F.rects),{x:L,y:p}=rt(M,E,W)),P=-1)}return{x:L,y:p,placement:E,strategy:y,middlewareData:m}},g.detectOverflow=ct,g.flip=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(i){var h,s;let{placement:y,middlewareData:u,rects:w,initialPlacement:k,platform:W,elements:M}=i,{mainAxis:L=!0,crossAxis:p=!0,fallbackPlacements:E,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:T="none",flipAlignment:P=!0,...O}=V(n,i);if((h=u.arrow)!=null&&h.alignmentOffset)return{};let H=N(y),B=A(k),C=N(k)===k,S=await(W.isRTL==null?void 0:W.isRTL(M.floating)),F=E||(C||!P?[_(k)]:(function(a){let f=_(a);return[j(a),f,j(f)]})(k)),J=T!=="none";!E&&J&&F.push(...(function(a,f,b,x){let d=it(a),v=(function(q,Y,et){let Z=["left","right"],$=["right","left"],tt=["top","bottom"],U=["bottom","top"];switch(q){case"top":case"bottom":return et?Y?$:Z:Y?Z:$;case"left":case"right":return Y?tt:U;default:return[]}})(N(a),b==="start",x);return d&&(v=v.map(q=>q+"-"+d),f&&(v=v.concat(v.map(j)))),v})(k,P,T,S));let K=[k,...F],ot=await ct(i,O),z=[],X=((s=u.flip)==null?void 0:s.overflows)||[];if(L&&z.push(ot[H]),p){let a=I(y,w,S);z.push(ot[a[0]],ot[a[1]])}if(X=[...X,{placement:y,overflows:z}],!z.every(a=>a<=0)){var t,e;let a=(((t=u.flip)==null?void 0:t.index)||0)+1,f=K[a];if(f){var o;let x=p==="alignment"&&B!==A(f),d=((o=X[0])==null?void 0:o.overflows[0])>0;if(!x||d)return{data:{index:a,overflows:X},reset:{placement:f}}}let b=(e=X.filter(x=>x.overflows[0]<=0).sort((x,d)=>x.overflows[1]-d.overflows[1])[0])==null?void 0:e.placement;if(!b)switch(m){case"bestFit":{var r;let x=(r=X.filter(d=>{if(J){let v=A(d.placement);return v===B||v==="y"}return!0}).map(d=>[d.placement,d.overflows.filter(v=>v>0).reduce((v,q)=>v+q,0)]).sort((d,v)=>d[1]-v[1])[0])==null?void 0:r[0];x&&(b=x);break}case"initialPlacement":b=k}if(y!==b)return{reset:{placement:b}}}return{}}}},g.hide=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(i){let{rects:h}=i,{strategy:s="referenceHidden",...y}=V(n,i);switch(s){case"referenceHidden":{let u=ut(await ct(i,{...y,elementContext:"reference"}),h.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:ht(u)}}}case"escaped":{let u=ut(await ct(i,{...y,altBoundary:!0}),h.floating);return{data:{escapedOffsets:u,escaped:ht(u)}}}default:return{}}}}},g.inline=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(i){let{placement:h,elements:s,rects:y,platform:u,strategy:w}=i,{padding:k=2,x:W,y:M}=V(n,i),L=Array.from(await(u.getClientRects==null?void 0:u.getClientRects(s.reference))||[]),p=(function(P){let O=P.slice().sort((C,S)=>C.y-S.y),H=[],B=null;for(let C=0;C<O.length;C++){let S=O[C];!B||S.y-B.y>B.height/2?H.push([S]):H[H.length-1].push(S),B=S}return H.map(C=>dt(pt(C)))})(L),E=dt(pt(L)),m=nt(k),T=await u.getElementRects({reference:{getBoundingClientRect:function(){if(p.length===2&&p[0].left>p[1].right&&W!=null&&M!=null)return p.find(P=>W>P.left-m.left&&W<P.right+m.right&&M>P.top-m.top&&M<P.bottom+m.bottom)||E;if(p.length>=2){if(A(h)==="y"){let F=p[0],J=p[p.length-1],K=N(h)==="top",ot=F.top,z=J.bottom,X=K?F.left:J.left,t=K?F.right:J.right;return{top:ot,bottom:z,left:X,right:t,width:t-X,height:z-ot,x:X,y:ot}}let P=N(h)==="left",O=G(...p.map(F=>F.right)),H=Q(...p.map(F=>F.left)),B=p.filter(F=>P?F.left===H:F.right===O),C=B[0].top,S=B[B.length-1].bottom;return{top:C,bottom:S,left:H,right:O,width:O-H,height:S-C,x:H,y:C}}return E}},floating:s.floating,strategy:w});return y.reference.x!==T.reference.x||y.reference.y!==T.reference.y||y.reference.width!==T.reference.width||y.reference.height!==T.reference.height?{reset:{rects:T}}:{}}}},g.limitShift=function(n){return n===void 0&&(n={}),{options:n,fn(i){let{x:h,y:s,placement:y,rects:u,middlewareData:w}=i,{offset:k=0,mainAxis:W=!0,crossAxis:M=!0}=V(n,i),L={x:h,y:s},p=A(y),E=l(p),m=L[E],T=L[p],P=V(k,i),O=typeof P=="number"?{mainAxis:P,crossAxis:0}:{mainAxis:0,crossAxis:0,...P};if(W){let C=E==="y"?"height":"width",S=u.reference[E]-u.floating[C]+O.mainAxis,F=u.reference[E]+u.reference[C]-O.mainAxis;m<S?m=S:m>F&&(m=F)}if(M){var H,B;let C=E==="y"?"width":"height",S=["top","left"].includes(N(y)),F=u.reference[p]-u.floating[C]+(S&&((H=w.offset)==null?void 0:H[p])||0)+(S?0:O.crossAxis),J=u.reference[p]+u.reference[C]+(S?0:((B=w.offset)==null?void 0:B[p])||0)-(S?O.crossAxis:0);T<F?T=F:T>J&&(T=J)}return{[E]:m,[p]:T}}}},g.offset=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(i){var h,s;let{x:y,y:u,placement:w,middlewareData:k}=i,W=await(async function(M,L){let{placement:p,platform:E,elements:m}=M,T=await(E.isRTL==null?void 0:E.isRTL(m.floating)),P=N(p),O=it(p),H=A(p)==="y",B=["left","top"].includes(P)?-1:1,C=T&&H?-1:1,S=V(L,M),{mainAxis:F,crossAxis:J,alignmentAxis:K}=typeof S=="number"?{mainAxis:S,crossAxis:0,alignmentAxis:null}:{mainAxis:S.mainAxis||0,crossAxis:S.crossAxis||0,alignmentAxis:S.alignmentAxis};return O&&typeof K=="number"&&(J=O==="end"?-1*K:K),H?{x:J*C,y:F*B}:{x:F*B,y:J*C}})(i,n);return w===((h=k.offset)==null?void 0:h.placement)&&(s=k.arrow)!=null&&s.alignmentOffset?{}:{x:y+W.x,y:u+W.y,data:{...W,placement:w}}}}},g.rectToClientRect=dt,g.shift=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(i){let{x:h,y:s,placement:y}=i,{mainAxis:u=!0,crossAxis:w=!1,limiter:k={fn:O=>{let{x:H,y:B}=O;return{x:H,y:B}}},...W}=V(n,i),M={x:h,y:s},L=await ct(i,W),p=A(N(y)),E=l(p),m=M[E],T=M[p];if(u){let O=E==="y"?"bottom":"right";m=mt(m+L[E==="y"?"top":"left"],m,m-L[O])}if(w){let O=p==="y"?"bottom":"right";T=mt(T+L[p==="y"?"top":"left"],T,T-L[O])}let P=k.fn({...i,[E]:m,[p]:T});return{...P,data:{x:P.x-h,y:P.y-s,enabled:{[E]:u,[p]:w}}}}}},g.size=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(i){var h,s;let{placement:y,rects:u,platform:w,elements:k}=i,{apply:W=()=>{},...M}=V(n,i),L=await ct(i,M),p=N(y),E=it(y),m=A(y)==="y",{width:T,height:P}=u.floating,O,H;p==="top"||p==="bottom"?(O=p,H=E===(await(w.isRTL==null?void 0:w.isRTL(k.floating))?"start":"end")?"left":"right"):(H=p,O=E==="end"?"top":"bottom");let B=P-L.top-L.bottom,C=T-L.left-L.right,S=Q(P-L[O],B),F=Q(T-L[H],C),J=!i.middlewareData.shift,K=S,ot=F;if((h=i.middlewareData.shift)!=null&&h.enabled.x&&(ot=C),(s=i.middlewareData.shift)!=null&&s.enabled.y&&(K=B),J&&!E){let X=G(L.left,0),t=G(L.right,0),e=G(L.top,0),o=G(L.bottom,0);m?ot=T-2*(X!==0||t!==0?X+t:G(L.left,L.right)):K=P-2*(e!==0||o!==0?e+o:G(L.top,L.bottom))}await W({...i,availableWidth:ot,availableHeight:K});let z=await w.getDimensions(k.floating);return T!==z.width||P!==z.height?{reset:{rects:!0}}:{}}}}})});var Ut=It((Rt,$t)=>{(function(g,R){typeof Rt=="object"&&typeof $t<"u"?R(Rt,Et()):typeof define=="function"&&define.amd?define(["exports","./floatingUICore"],R):R((g=typeof globalThis<"u"?globalThis:g||self).FloatingUIDOM={},g.FloatingUICore)})(Rt,function(g,R){"use strict";let at=Math.min,lt=Math.max,Q=Math.round,G=Math.floor,st=t=>({x:t,y:t});function gt(){return typeof window<"u"}function mt(t){return it(t)?(t.nodeName||"").toLowerCase():"#document"}function V(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function N(t){var e;return(e=(it(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function it(t){return!!gt()&&(t instanceof Node||t instanceof V(t).Node)}function l(t){return!!gt()&&(t instanceof Element||t instanceof V(t).Element)}function c(t){return!!gt()&&(t instanceof HTMLElement||t instanceof V(t).HTMLElement)}function A(t){return!(!gt()||typeof ShadowRoot>"u")&&(t instanceof ShadowRoot||t instanceof V(t).ShadowRoot)}function D(t){let{overflow:e,overflowX:o,overflowY:r,display:a}=rt(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+o)&&!["inline","contents"].includes(a)}function I(t){return["table","td","th"].includes(mt(t))}function j(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function _(t){let e=nt(),o=l(t)?rt(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>!!o[r]&&o[r]!=="none")||!!o.containerType&&o.containerType!=="normal"||!e&&!!o.backdropFilter&&o.backdropFilter!=="none"||!e&&!!o.filter&&o.filter!=="none"||["transform","translate","scale","rotate","perspective","filter"].some(r=>(o.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(o.contain||"").includes(r))}function nt(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function dt(t){return["html","body","#document"].includes(mt(t))}function rt(t){return V(t).getComputedStyle(t)}function ct(t){return l(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ut(t){if(mt(t)==="html")return t;let e=t.assignedSlot||t.parentNode||A(t)&&t.host||N(t);return A(e)?e.host:e}function ht(t){let e=ut(t);return dt(e)?t.ownerDocument?t.ownerDocument.body:t.body:c(e)&&D(e)?e:ht(e)}function pt(t,e,o){var r;e===void 0&&(e=[]),o===void 0&&(o=!0);let a=ht(t),f=a===((r=t.ownerDocument)==null?void 0:r.body),b=V(a);if(f){let x=n(b);return e.concat(b,b.visualViewport||[],D(a)?a:[],x&&o?pt(x):[])}return e.concat(a,pt(a,[],o))}function n(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function i(t){let e=rt(t),o=parseFloat(e.width)||0,r=parseFloat(e.height)||0,a=c(t),f=a?t.offsetWidth:o,b=a?t.offsetHeight:r,x=Q(o)!==f||Q(r)!==b;return x&&(o=f,r=b),{width:o,height:r,$:x}}function h(t){return l(t)?t:t.contextElement}function s(t){let e=h(t);if(!c(e))return st(1);let o=e.getBoundingClientRect(),{width:r,height:a,$:f}=i(e),b=(f?Q(o.width):o.width)/r,x=(f?Q(o.height):o.height)/a;return b&&Number.isFinite(b)||(b=1),x&&Number.isFinite(x)||(x=1),{x:b,y:x}}let y=st(0);function u(t){let e=V(t);return nt()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:y}function w(t,e,o,r){e===void 0&&(e=!1),o===void 0&&(o=!1);let a=t.getBoundingClientRect(),f=h(t),b=st(1);e&&(r?l(r)&&(b=s(r)):b=s(t));let x=(function(et,Z,$){return Z===void 0&&(Z=!1),!(!$||Z&&$!==V(et))&&Z})(f,o,r)?u(f):st(0),d=(a.left+x.x)/b.x,v=(a.top+x.y)/b.y,q=a.width/b.x,Y=a.height/b.y;if(f){let et=V(f),Z=r&&l(r)?V(r):r,$=et,tt=n($);for(;tt&&r&&Z!==$;){let U=s(tt),ft=tt.getBoundingClientRect(),yt=rt(tt),vt=ft.left+(tt.clientLeft+parseFloat(yt.paddingLeft))*U.x,bt=ft.top+(tt.clientTop+parseFloat(yt.paddingTop))*U.y;d*=U.x,v*=U.y,q*=U.x,Y*=U.y,d+=vt,v+=bt,$=V(tt),tt=n($)}}return R.rectToClientRect({width:q,height:Y,x:d,y:v})}function k(t,e){let o=ct(t).scrollLeft;return e?e.left+o:w(N(t)).left+o}function W(t,e,o){o===void 0&&(o=!1);let r=t.getBoundingClientRect();return{x:r.left+e.scrollLeft-(o?0:k(t,r)),y:r.top+e.scrollTop}}function M(t,e,o){let r;if(e==="viewport")r=(function(a,f){let b=V(a),x=N(a),d=b.visualViewport,v=x.clientWidth,q=x.clientHeight,Y=0,et=0;if(d){v=d.width,q=d.height;let Z=nt();(!Z||Z&&f==="fixed")&&(Y=d.offsetLeft,et=d.offsetTop)}return{width:v,height:q,x:Y,y:et}})(t,o);else if(e==="document")r=(function(a){let f=N(a),b=ct(a),x=a.ownerDocument.body,d=lt(f.scrollWidth,f.clientWidth,x.scrollWidth,x.clientWidth),v=lt(f.scrollHeight,f.clientHeight,x.scrollHeight,x.clientHeight),q=-b.scrollLeft+k(a),Y=-b.scrollTop;return rt(x).direction==="rtl"&&(q+=lt(f.clientWidth,x.clientWidth)-d),{width:d,height:v,x:q,y:Y}})(N(t));else if(l(e))r=(function(a,f){let b=w(a,!0,f==="fixed"),x=b.top+a.clientTop,d=b.left+a.clientLeft,v=c(a)?s(a):st(1);return{width:a.clientWidth*v.x,height:a.clientHeight*v.y,x:d*v.x,y:x*v.y}})(e,o);else{let a=u(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return R.rectToClientRect(r)}function L(t,e){let o=ut(t);return!(o===e||!l(o)||dt(o))&&(rt(o).position==="fixed"||L(o,e))}function p(t,e,o){let r=c(e),a=N(e),f=o==="fixed",b=w(t,!0,f,e),x={scrollLeft:0,scrollTop:0},d=st(0);function v(){d.x=k(a)}if(r||!r&&!f)if((mt(e)!=="body"||D(a))&&(x=ct(e)),r){let Y=w(e,!0,f,e);d.x=Y.x+e.clientLeft,d.y=Y.y+e.clientTop}else a&&v();f&&!r&&a&&v();let q=!a||r||f?st(0):W(a,x);return{x:b.left+x.scrollLeft-d.x-q.x,y:b.top+x.scrollTop-d.y-q.y,width:b.width,height:b.height}}function E(t){return rt(t).position==="static"}function m(t,e){if(!c(t)||rt(t).position==="fixed")return null;if(e)return e(t);let o=t.offsetParent;return N(t)===o&&(o=o.ownerDocument.body),o}function T(t,e){let o=V(t);if(j(t))return o;if(!c(t)){let a=ut(t);for(;a&&!dt(a);){if(l(a)&&!E(a))return a;a=ut(a)}return o}let r=m(t,e);for(;r&&I(r)&&E(r);)r=m(r,e);return r&&dt(r)&&E(r)&&!_(r)?o:r||(function(a){let f=ut(a);for(;c(f)&&!dt(f);){if(_(f))return f;if(j(f))return null;f=ut(f)}return null})(t)||o}let P={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:o,offsetParent:r,strategy:a}=t,f=a==="fixed",b=N(r),x=!!e&&j(e.floating);if(r===b||x&&f)return o;let d={scrollLeft:0,scrollTop:0},v=st(1),q=st(0),Y=c(r);if((Y||!Y&&!f)&&((mt(r)!=="body"||D(b))&&(d=ct(r)),c(r))){let Z=w(r);v=s(r),q.x=Z.x+r.clientLeft,q.y=Z.y+r.clientTop}let et=!b||Y||f?st(0):W(b,d,!0);return{width:o.width*v.x,height:o.height*v.y,x:o.x*v.x-d.scrollLeft*v.x+q.x+et.x,y:o.y*v.y-d.scrollTop*v.y+q.y+et.y}},getDocumentElement:N,getClippingRect:function(t){let{element:e,boundary:o,rootBoundary:r,strategy:a}=t,f=[...o==="clippingAncestors"?j(e)?[]:(function(d,v){let q=v.get(d);if(q)return q;let Y=pt(d,[],!1).filter(tt=>l(tt)&&mt(tt)!=="body"),et=null,Z=rt(d).position==="fixed",$=Z?ut(d):d;for(;l($)&&!dt($);){let tt=rt($),U=_($);U||tt.position!=="fixed"||(et=null),(Z?!U&&!et:!U&&tt.position==="static"&&et&&["absolute","fixed"].includes(et.position)||D($)&&!U&&L(d,$))?Y=Y.filter(ft=>ft!==$):et=tt,$=ut($)}return v.set(d,Y),Y})(e,this._c):[].concat(o),r],b=f[0],x=f.reduce((d,v)=>{let q=M(e,v,a);return d.top=lt(q.top,d.top),d.right=at(q.right,d.right),d.bottom=at(q.bottom,d.bottom),d.left=lt(q.left,d.left),d},M(e,b,a));return{width:x.right-x.left,height:x.bottom-x.top,x:x.left,y:x.top}},getOffsetParent:T,getElementRects:async function(t){let e=this.getOffsetParent||T,o=this.getDimensions,r=await o(t.floating);return{reference:p(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){let{width:e,height:o}=i(t);return{width:e,height:o}},getScale:s,isElement:l,isRTL:function(t){return rt(t).direction==="rtl"}};function O(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}let H=R.detectOverflow,B=R.offset,C=R.autoPlacement,S=R.shift,F=R.flip,J=R.size,K=R.hide,ot=R.arrow,z=R.inline,X=R.limitShift;return g.arrow=ot,g.autoPlacement=C,g.autoUpdate=function(t,e,o,r){r===void 0&&(r={});let{ancestorScroll:a=!0,ancestorResize:f=!0,elementResize:b=typeof ResizeObserver=="function",layoutShift:x=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,v=h(t),q=a||f?[...v?pt(v):[],...pt(e)]:[];q.forEach(U=>{a&&U.addEventListener("scroll",o,{passive:!0}),f&&U.addEventListener("resize",o)});let Y=v&&x?(function(U,ft){let yt,vt=null,bt=N(U);function Pt(){var wt;clearTimeout(yt),(wt=vt)==null||wt.disconnect(),vt=null}return(function wt(Lt,xt){Lt===void 0&&(Lt=!1),xt===void 0&&(xt=1),Pt();let Ot=U.getBoundingClientRect(),{left:Ct,top:St,width:Dt,height:kt}=Ot;if(Lt||ft(),!Dt||!kt)return;let Ft={rootMargin:-G(St)+"px "+-G(bt.clientWidth-(Ct+Dt))+"px "+-G(bt.clientHeight-(St+kt))+"px "+-G(Ct)+"px",threshold:lt(0,at(1,xt))||1},Bt=!0;function Ht(Mt){let At=Mt[0].intersectionRatio;if(At!==xt){if(!Bt)return wt();At?wt(!1,At):yt=setTimeout(()=>{wt(!1,1e-7)},1e3)}At!==1||O(Ot,U.getBoundingClientRect())||wt(),Bt=!1}try{vt=new IntersectionObserver(Ht,{...Ft,root:bt.ownerDocument})}catch{vt=new IntersectionObserver(Ht,Ft)}vt.observe(U)})(!0),Pt})(v,o):null,et,Z=-1,$=null;b&&($=new ResizeObserver(U=>{let[ft]=U;ft&&ft.target===v&&$&&($.unobserve(e),cancelAnimationFrame(Z),Z=requestAnimationFrame(()=>{var yt;(yt=$)==null||yt.observe(e)})),o()}),v&&!d&&$.observe(v),$.observe(e));let tt=d?w(t):null;return d&&(function U(){let ft=w(t);tt&&!O(tt,ft)&&o(),tt=ft,et=requestAnimationFrame(U)})(),o(),()=>{var U;q.forEach(ft=>{a&&ft.removeEventListener("scroll",o),f&&ft.removeEventListener("resize",o)}),Y?.(),(U=$)==null||U.disconnect(),$=null,d&&cancelAnimationFrame(et)}},g.computePosition=(t,e,o)=>{let r=new Map,a={platform:P,...o},f={...a.platform,_c:r};return R.computePosition(t,e,{...a,platform:f})},g.detectOverflow=H,g.flip=F,g.getOverflowAncestors=pt,g.hide=K,g.inline=z,g.limitShift=X,g.offset=B,g.platform=P,g.shift=S,g.size=J,window.FloatingUIDOM=g,g})});var Jt=Wt(Ut()),Kt=Wt(Et());(function(){"use strict";let g=new Map,R=new Map;if(!document.querySelector("[data-tui-popover-portal-container]")){let l=document.createElement("div");l.setAttribute("data-tui-popover-portal-container",""),l.className="fixed inset-0 z-[9999] pointer-events-none",document.body.appendChild(l)}if(!document.getElementById("popover-animations")){let l=document.createElement("style");l.id="popover-animations",l.textContent=`
|
|
@keyframes popover-in { 0% { opacity: 0; transform: scale(0.95); } 100% { opacity: 1; transform: scale(1); } }
|
|
@keyframes popover-out { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.95); } }
|
|
[data-tui-popover-id].popover-animate-in { animation: popover-in 0.15s cubic-bezier(0.16, 1, 0.3, 1); }
|
|
[data-tui-popover-id].popover-animate-out { animation: popover-out 0.1s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
|
|
`,document.head.appendChild(l)}function at(l,c){if(!window.FloatingUIDOM)return;let{computePosition:A,offset:D,flip:I,shift:j,arrow:_}=window.FloatingUIDOM,nt=c.querySelector("[data-tui-popover-arrow]"),dt=c.getAttribute("data-tui-popover-placement")||"bottom",rt=parseInt(c.getAttribute("data-tui-popover-offset"))||(nt?8:4),ct=[D(rt),I({padding:10}),j({padding:10})];nt&&ct.push(_({element:nt,padding:5}));let ut=l,ht=0;for(let pt of l.children){let n=pt.getBoundingClientRect?.();if(n){let i=n.width*n.height;i>ht&&(ht=i,ut=pt)}}A(ut,c,{placement:dt,middleware:ct}).then(({x:pt,y:n,placement:i,middlewareData:h})=>{if(Object.assign(c.style,{left:`${pt}px`,top:`${n}px`}),nt&&h.arrow){let{x:s,y}=h.arrow;nt.setAttribute("data-tui-popover-placement",i),Object.assign(nt.style,{left:s!=null?`${s}px`:"",top:y!=null?`${y}px`:""})}c.getAttribute("data-tui-popover-match-width")==="true"&&c.style.setProperty("--popover-trigger-width",`${ut.offsetWidth}px`)})}function lt(l){if(!window.FloatingUIDOM)return;let c=l.getAttribute("data-tui-popover-trigger");if(!c)return;let A=document.getElementById(c);if(!A)return;for(let j of document.querySelectorAll('[data-tui-popover-exclusive="true"][data-tui-popover-open="true"]')){let _=j.id;_&&_!==c&&!j.contains(l)&&G(_)}let D=document.querySelector("[data-tui-popover-portal-container]");D&&A.parentNode!==D&&D.appendChild(A),A.style.display="block",A.classList.remove("popover-animate-out"),A.classList.add("popover-animate-in"),A.setAttribute("data-tui-popover-open","true"),document.querySelectorAll(`[data-tui-popover-trigger="${c}"]`).forEach(j=>{j.setAttribute("data-tui-popover-open","true")}),at(l,A);let I=window.FloatingUIDOM.autoUpdate(l,A,()=>at(l,A),{animationFrame:!0});g.set(c,I)}function Q(l){let c=document.querySelector(`[data-tui-popover-trigger="${l}"]`);c&<(c)}function G(l,c=!1){let A=document.getElementById(l);if(!A)return;let D=g.get(l);D&&(D(),g.delete(l));let I=R.get(l);I&&(clearTimeout(I.enter),clearTimeout(I.leave),R.delete(l)),A.setAttribute("data-tui-popover-open","false"),document.querySelectorAll(`[data-tui-popover-trigger="${l}"]`).forEach(_=>{_.setAttribute("data-tui-popover-open","false")});function j(){A.style.display="none",A.classList.remove("popover-animate-in","popover-animate-out")}c?j():(A.classList.remove("popover-animate-in"),A.classList.add("popover-animate-out"),setTimeout(j,150))}function st(l){return document.getElementById(l)?.getAttribute("data-tui-popover-open")==="true"||!1}function gt(l){st(l)?G(l):Q(l)}function mt(l=null){document.querySelectorAll('[data-tui-popover-open="true"][data-tui-popover-id]').forEach(c=>{c.id&&c.id!==l&&G(c.id)})}document.addEventListener("click",l=>{let c=l.target.closest("[data-tui-popover-trigger]");if(c&&c.getAttribute("data-tui-popover-type")!=="hover"){if(c.querySelector(':disabled, [disabled], [aria-disabled="true"]'))return;l.stopPropagation();let I=c.getAttribute("data-tui-popover-trigger");I&>(I);return}let A=l.target.closest("[data-tui-popover-id]");document.querySelectorAll('[data-tui-popover-open="true"][data-tui-popover-id]').forEach(D=>{if(D!==A&&D.getAttribute("data-tui-popover-disable-clickaway")!=="true"){let I=D.id,j=document.querySelectorAll(`[data-tui-popover-trigger="${I}"]`),_=!1;for(let nt of j)if(nt.contains(l.target)){_=!0;break}_||G(I)}})});function V(l,c){let A=document.getElementById(c);if(!A)return;let D=parseInt(A.getAttribute("data-tui-popover-hover-delay"))||100,I=R.get(c)||{};clearTimeout(I.leave),I.enter=setTimeout(()=>lt(l),D),R.set(c,I)}function N(l,c){let A=document.getElementById(l);if(!A)return;let D=parseInt(A.getAttribute("data-tui-popover-hover-out-delay"))||200,I=R.get(l)||{};clearTimeout(I.enter),c||(I.leave=setTimeout(()=>G(l),D),R.set(l,I))}document.addEventListener("mouseover",l=>{let c=l.target.closest("[data-tui-popover-trigger]");if(c&&!c.contains(l.relatedTarget)&&c.getAttribute("data-tui-popover-type")==="hover"){let D=c.getAttribute("data-tui-popover-trigger");D&&V(c,D)}let A=l.target.closest("[data-tui-popover-id]");if(A&&!A.contains(l.relatedTarget)&&A.getAttribute("data-tui-popover-open")==="true"){let D=A.id,I=document.querySelectorAll(`[data-tui-popover-trigger="${D}"]`);for(let j of I)if(j.getAttribute("data-tui-popover-type")==="hover"){let _=R.get(D)||{};clearTimeout(_.leave),R.set(D,_);break}}}),document.addEventListener("mouseout",l=>{let c=l.target.closest("[data-tui-popover-trigger]");if(c&&!c.contains(l.relatedTarget)&&c.getAttribute("data-tui-popover-type")==="hover"){let D=c.getAttribute("data-tui-popover-trigger"),I=document.getElementById(D);N(D,I?.contains(l.relatedTarget))}let A=l.target.closest("[data-tui-popover-id]");if(A&&!A.contains(l.relatedTarget)&&A.getAttribute("data-tui-popover-open")==="true"){let D=A.id,I=document.querySelectorAll(`[data-tui-popover-trigger="${D}"]`),j=!1,_=!1;for(let nt of I)nt.getAttribute("data-tui-popover-type")==="hover"&&(j=!0,nt.contains(l.relatedTarget)&&(_=!0));j&&!_&&N(D,!1)}}),document.addEventListener("keydown",l=>{l.key==="Escape"&&document.querySelectorAll('[data-tui-popover-open="true"][data-tui-popover-id]').forEach(c=>{c.getAttribute("data-tui-popover-disable-esc")!=="true"&&G(c.id)})});function it(){document.querySelectorAll("[data-tui-popover-trigger]").forEach(l=>{l.querySelector(':disabled, [disabled], [aria-disabled="true"]')?(l.classList.add("cursor-not-allowed","opacity-50"),l.classList.remove("cursor-pointer")):(l.classList.remove("cursor-not-allowed","opacity-50"),l.classList.add("cursor-pointer"))})}document.addEventListener("DOMContentLoaded",it),new MutationObserver(it).observe(document.body,{subtree:!0,attributes:!0,attributeFilter:["disabled","aria-disabled"],childList:!0}),window.closePopover=G,window.tui=window.tui||{},window.tui.popover={open:Q,close:G,closeAll:mt,toggle:gt,isOpen:st}})();})();
|