| 123456789101112 |
- const t=Math.min,e=Math.max,n=Math.round,o=Math.floor,i=t=>({x:t,y:t}),r={left:"right",right:"left",bottom:"top",top:"bottom"};function l(n,o,i){return e(n,t(o,i))}function c(t,e){return"function"==typeof t?t(e):t}function s(t){return t.split("-")[0]}function a(t){return t.split("-")[1]}function f(t){return"x"===t?"y":"x"}function u(t){return"y"===t?"height":"width"}function d(t){const e=t[0];return"t"===e||"b"===e?"y":"x"}function h(t){return f(d(t))}function m(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const p=["left","right"],g=["right","left"],y=["top","bottom"],w=["bottom","top"];function x(t,e,n,o){const i=a(t);let r=function(t,e,n){switch(t){case"top":case"bottom":return n?e?g:p:e?p:g;case"left":case"right":return e?y:w;default:return[]}}(s(t),"start"===n,o);return i&&(r=r.map(t=>t+"-"+i),e&&(r=r.concat(r.map(m)))),r}function v(t){const e=s(t);return r[e]+t.slice(e.length)}function b(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function R(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function L(t,e,n){let{reference:o,floating:i}=t;const r=d(e),l=h(e),c=u(l),f=s(e),m="y"===r,p=o.x+o.width/2-i.width/2,g=o.y+o.height/2-i.height/2,y=o[c]/2-i[c]/2;let w;switch(f){case"top":w={x:p,y:o.y-i.height};break;case"bottom":w={x:p,y:o.y+o.height};break;case"right":w={x:o.x+o.width,y:g};break;case"left":w={x:o.x-i.width,y:g};break;default:w={x:o.x,y:o.y}}switch(a(e)){case"start":w[l]-=y*(n&&m?-1:1);break;case"end":w[l]+=y*(n&&m?-1:1)}return w}async function T(t,e){var n;void 0===e&&(e={});const{x:o,y:i,platform:r,rects:l,elements:s,strategy:a}=t,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:m=0}=c(e,t),p=b(m),g=s[h?"floating"===d?"reference":"floating":d],y=R(await r.getClippingRect({element:null==(n=await(null==r.isElement?void 0:r.isElement(g)))||n?g:g.contextElement||await(null==r.getDocumentElement?void 0:r.getDocumentElement(s.floating)),boundary:f,rootBoundary:u,strategy:a})),w="floating"===d?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,x=await(null==r.getOffsetParent?void 0:r.getOffsetParent(s.floating)),v=await(null==r.isElement?void 0:r.isElement(x))&&await(null==r.getScale?void 0:r.getScale(x))||{x:1,y:1},L=R(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:a}):w);return{top:(y.top-L.top+p.top)/v.y,bottom:(L.bottom-y.bottom+p.bottom)/v.y,left:(y.left-L.left+p.left)/v.x,right:(L.right-y.right+p.right)/v.x}}const E=new Set(["left","top"]);function A(){return"undefined"!=typeof window}function O(t){return C(t)?(t.nodeName||"").toLowerCase():"#document"}function S(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function D(t){var e;return null==(e=(C(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function C(t){return!!A()&&(t instanceof Node||t instanceof S(t).Node)}function P(t){return!!A()&&(t instanceof Element||t instanceof S(t).Element)}function F(t){return!!A()&&(t instanceof HTMLElement||t instanceof S(t).HTMLElement)}function W(t){return!(!A()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof S(t).ShadowRoot)}function k(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=q(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&"inline"!==i&&"contents"!==i}function H(t){return/^(table|td|th)$/.test(O(t))}function B(t){try{if(t.matches(":popover-open"))return!0}catch(e){}try{return t.matches(":modal")}catch(e){return!1}}const M=/transform|translate|scale|rotate|perspective|filter/,V=/paint|layout|strict|content/,z=t=>!!t&&"none"!==t;let N;function $(t){const e=P(t)?q(t):t;return z(e.transform)||z(e.translate)||z(e.scale)||z(e.rotate)||z(e.perspective)||!I()&&(z(e.backdropFilter)||z(e.filter))||M.test(e.willChange||"")||V.test(e.contain||"")}function I(){return null==N&&(N="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),N}function j(t){return/^(html|body|#document)$/.test(O(t))}function q(t){return S(t).getComputedStyle(t)}function X(t){return P(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Y(t){if("html"===O(t))return t;const e=
- // Step into the shadow DOM of the parent of a slotted node.
- t.assignedSlot||// DOM Element detected.
- t.parentNode||// ShadowRoot detected.
- W(t)&&t.host||// Fallback.
- D(t);return W(e)?e.host:e}function _(t){const e=Y(t);return j(e)?t.ownerDocument?t.ownerDocument.body:t.body:F(e)&&k(e)?e:_(e)}function G(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=_(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=S(i);if(r){const t=J(l);return e.concat(l,l.visualViewport||[],k(i)?i:[],t&&n?G(t):[])}return e.concat(i,G(i,[],n))}function J(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function K(t){const e=q(t);let o=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=F(t),l=r?t.offsetWidth:o,c=r?t.offsetHeight:i,s=n(o)!==l||n(i)!==c;return s&&(o=l,i=c),{width:o,height:i,$:s}}function Q(t){return P(t)?t:t.contextElement}function U(t){const e=Q(t);if(!F(e))return i(1);const o=e.getBoundingClientRect(),{width:r,height:l,$:c}=K(e);let s=(c?n(o.width):o.width)/r,a=(c?n(o.height):o.height)/l;return s&&Number.isFinite(s)||(s=1),a&&Number.isFinite(a)||(a=1),{x:s,y:a}}const Z=i(0);function tt(t){const e=S(t);return I()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:Z}function et(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const r=t.getBoundingClientRect(),l=Q(t);let c=i(1);e&&(o?P(o)&&(c=U(o)):c=U(t));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==S(t))&&e}(l,n,o)?tt(l):i(0);let a=(r.left+s.x)/c.x,f=(r.top+s.y)/c.y,u=r.width/c.x,d=r.height/c.y;if(l){const t=S(l),e=o&&P(o)?S(o):o;let n=t,i=J(n);for(;i&&o&&e!==n;){const t=U(i),e=i.getBoundingClientRect(),o=q(i),r=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,l=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;a*=t.x,f*=t.y,u*=t.x,d*=t.y,a+=r,f+=l,n=S(i),i=J(n)}}return R({width:u,height:d,x:a,y:f})}function nt(t,e){const n=X(t).scrollLeft;return e?e.left+n:et(D(t)).left+n}function ot(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-nt(t,n),y:n.top+e.scrollTop}}function it(t,n,o){let r;if("viewport"===n)r=function(t,e){const n=S(t),o=D(t),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,c=0,s=0;if(i){r=i.width,l=i.height;const t=I();(!t||t&&"fixed"===e)&&(c=i.offsetLeft,s=i.offsetTop)}const a=nt(o);if(a<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),i="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-e.clientWidth-i);l<=25&&(r-=l)}else a<=25&&(r+=a);return{width:r,height:l,x:c,y:s}}(t,o);else if("document"===n)r=function(t){const n=D(t),o=X(t),i=t.ownerDocument.body,r=e(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth),l=e(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight);let c=-o.scrollLeft+nt(t);const s=-o.scrollTop;return"rtl"===q(i).direction&&(c+=e(n.clientWidth,i.clientWidth)-r),{width:r,height:l,x:c,y:s}}(D(t));else if(P(n))r=function(t,e){const n=et(t,!0,"fixed"===e),o=n.top+t.clientTop,r=n.left+t.clientLeft,l=F(t)?U(t):i(1);return{width:t.clientWidth*l.x,height:t.clientHeight*l.y,x:r*l.x,y:o*l.y}}(n,o);else{const e=tt(t);r={x:n.x-e.x,y:n.y-e.y,width:n.width,height:n.height}}return R(r)}function rt(t,e){const n=Y(t);return!(n===e||!P(n)||j(n))&&("fixed"===q(n).position||rt(n,e))}function lt(t,e,n){const o=F(e),r=D(e),l="fixed"===n,c=et(t,!0,l,e);let s={scrollLeft:0,scrollTop:0};const a=i(0);function f(){a.x=nt(r)}if(o||!o&&!l)if(("body"!==O(e)||k(r))&&(s=X(e)),o){const t=et(e,!0,l,e);a.x=t.x+e.clientLeft,a.y=t.y+e.clientTop}else r&&f();l&&!o&&r&&f();const u=!r||o||l?i(0):ot(r,s);return{x:c.left+s.scrollLeft-a.x-u.x,y:c.top+s.scrollTop-a.y-u.y,width:c.width,height:c.height}}function ct(t){return"static"===q(t).position}function st(t,e){if(!F(t)||"fixed"===q(t).position)return null;if(e)return e(t);let n=t.offsetParent;return D(t)===n&&(n=n.ownerDocument.body),n}function at(t,e){const n=S(t);if(B(t))return n;if(!F(t)){let e=Y(t);for(;e&&!j(e);){if(P(e)&&!ct(e))return e;e=Y(e)}return n}let o=st(t,e);for(;o&&H(o)&&ct(o);)o=st(o,e);return o&&j(o)&&ct(o)&&!$(o)?n:o||function(t){let e=Y(t);for(;F(e)&&!j(e);){if($(e))return e;if(B(e))return null;e=Y(e)}return null}(t)||n}const ft={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:r}=t;const l="fixed"===r,c=D(o),s=!!e&&B(e.floating);if(o===c||s&&l)return n;let a={scrollLeft:0,scrollTop:0},f=i(1);const u=i(0),d=F(o);if((d||!d&&!l)&&(("body"!==O(o)||k(c))&&(a=X(o)),d)){const t=et(o);f=U(o),u.x=t.x+o.clientLeft,u.y=t.y+o.clientTop}const h=!c||d||l?i(0):ot(c,a);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-a.scrollLeft*f.x+u.x+h.x,y:n.y*f.y-a.scrollTop*f.y+u.y+h.y}},getDocumentElement:D,getClippingRect:function(n){let{element:o,boundary:i,rootBoundary:r,strategy:l}=n;const c=[..."clippingAncestors"===i?B(o)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=G(t,[],!1).filter(t=>P(t)&&"body"!==O(t)),i=null;const r="fixed"===q(t).position;let l=r?Y(t):t;for(;P(l)&&!j(l);){const e=q(l),n=$(l);n||"fixed"!==e.position||(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&("absolute"===i.position||"fixed"===i.position)||k(l)&&!n&&rt(t,l))?o=o.filter(t=>t!==l):i=e,l=Y(l)}return e.set(t,o),o}(o,this._c):[].concat(i),r],s=it(o,c[0],l);let a=s.top,f=s.right,u=s.bottom,d=s.left;for(let h=1;h<c.length;h++){const n=it(o,c[h],l);a=e(n.top,a),f=t(n.right,f),u=t(n.bottom,u),d=e(n.left,d)}return{width:f-d,height:u-a,x:d,y:a}},getOffsetParent:at,getElementRects:async function(t){const e=this.getOffsetParent||at,n=this.getDimensions,o=await n(t.floating);return{reference:lt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=K(t);return{width:e,height:n}},getScale:U,isElement:P,isRTL:function(t){return"rtl"===q(t).direction}};function ut(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function dt(n,i,r,l){void 0===l&&(l={});const{ancestorScroll:c=!0,ancestorResize:s=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:f="function"==typeof IntersectionObserver,animationFrame:u=!1}=l,d=Q(n),h=c||s?[...d?G(d):[],...i?G(i):[]]:[];h.forEach(t=>{c&&t.addEventListener("scroll",r,{passive:!0}),s&&t.addEventListener("resize",r)});const m=d&&f?function(n,i){let r,l=null;const c=D(n);function s(){var t;clearTimeout(r),null==(t=l)||t.disconnect(),l=null}return function a(f,u){void 0===f&&(f=!1),void 0===u&&(u=1),s();const d=n.getBoundingClientRect(),{left:h,top:m,width:p,height:g}=d;if(f||i(),!p||!g)return;const y={rootMargin:-o(m)+"px "+-o(c.clientWidth-(h+p))+"px "+-o(c.clientHeight-(m+g))+"px "+-o(h)+"px",threshold:e(0,t(1,u))||1};let w=!0;function x(t){const e=t[0].intersectionRatio;if(e!==u){if(!w)return a();e?a(!1,e):r=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==e||ut(d,n.getBoundingClientRect())||a(),w=!1}try{l=new IntersectionObserver(x,{...y,
- // Handle <iframe>s
- root:c.ownerDocument})}catch(v){l=new IntersectionObserver(x,y)}l.observe(n)}(!0),s}(d,r):null;let p,g=-1,y=null;a&&(y=new ResizeObserver(t=>{let[e]=t;e&&e.target===d&&y&&i&&(y.unobserve(i),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var t;null==(t=y)||t.observe(i)})),r()}),d&&!u&&y.observe(d),i&&y.observe(i));let w=u?et(n):null;return u&&function t(){const e=et(n);w&&!ut(w,e)&&r();w=e,p=requestAnimationFrame(t)}(),r(),()=>{var t;h.forEach(t=>{c&&t.removeEventListener("scroll",r),s&&t.removeEventListener("resize",r)}),null==m||m(),null==(t=y)||t.disconnect(),y=null,u&&cancelAnimationFrame(p)}}const ht=T,mt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:l,middlewareData:f}=e,u=await async function(t,e){const{placement:n,platform:o,elements:i}=t,r=await(null==o.isRTL?void 0:o.isRTL(i.floating)),l=s(n),f=a(n),u="y"===d(n),h=E.has(l)?-1:1,m=r&&u?-1:1,p=c(e,t);let{mainAxis:g,crossAxis:y,alignmentAxis:w}="number"==typeof p?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return f&&"number"==typeof w&&(y="end"===f?-1*w:w),u?{x:y*m,y:g*h}:{x:g*h,y:y*m}}(e,t);return l===(null==(n=f.offset)?void 0:n.placement)&&null!=(o=f.arrow)&&o.alignmentOffset?{}:{x:i+u.x,y:r+u.y,data:{...u,placement:l}}}}},pt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i,platform:r}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:h={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...m}=c(t,e),p={x:n,y:o},g=await r.detectOverflow(e,m),y=d(s(i)),w=f(y);let x=p[w],v=p[y];if(a){const t="y"===w?"bottom":"right";x=l(x+g["y"===w?"top":"left"],x,x-g[t])}if(u){const t="y"===y?"bottom":"right";v=l(v+g["y"===y?"top":"left"],v,v-g[t])}const b=h.fn({...e,[w]:x,[y]:v});return{...b,data:{x:b.x-n,y:b.y-o,enabled:{[w]:a,[y]:u}}}}}},gt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:f,platform:p,elements:g}=e,{mainAxis:y=!0,crossAxis:w=!0,fallbackPlacements:b,fallbackStrategy:R="bestFit",fallbackAxisSideDirection:L="none",flipAlignment:T=!0,...E}=c(t,e);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const A=s(i),O=d(f),S=s(f)===f,D=await(null==p.isRTL?void 0:p.isRTL(g.floating)),C=b||(S||!T?[v(f)]:function(t){const e=v(t);return[m(t),e,m(e)]}(f)),P="none"!==L;!b&&P&&C.push(...x(f,T,L,D));const F=[f,...C],W=await p.detectOverflow(e,E),k=[];let H=(null==(o=r.flip)?void 0:o.overflows)||[];if(y&&k.push(W[A]),w){const t=function(t,e,n){void 0===n&&(n=!1);const o=a(t),i=h(t),r=u(i);let l="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(l=v(l)),[l,v(l)]}(i,l,D);k.push(W[t[0]],W[t[1]])}if(H=[...H,{placement:i,overflows:k}],!k.every(t=>t<=0)){var B,M;const t=((null==(B=r.flip)?void 0:B.index)||0)+1,e=F[t];if(e){if(!("alignment"===w&&O!==d(e))||// We leave the current main axis only if every placement on that axis
- // overflows the main axis.
- H.every(t=>d(t.placement)!==O||t.overflows[0]>0))return{data:{index:t,overflows:H},reset:{placement:e}}}let n=null==(M=H.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:M.placement;if(!n)switch(R){case"bestFit":{var V;const t=null==(V=H.filter(t=>{if(P){const e=d(t.placement);return e===O||// Create a bias to the `y` side axis due to horizontal
- // reading directions favoring greater width.
- "y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:V[0];t&&(n=t);break}case"initialPlacement":n=f}if(i!==n)return{reset:{placement:n}}}return{}}}},yt=e=>({name:"arrow",options:e,async fn(n){const{x:o,y:i,placement:r,rects:s,platform:f,elements:d,middlewareData:m}=n,{element:p,padding:g=0}=c(e,n)||{};if(null==p)return{};const y=b(g),w={x:o,y:i},x=h(r),v=u(x),R=await f.getDimensions(p),L="y"===x,T=L?"top":"left",E=L?"bottom":"right",A=L?"clientHeight":"clientWidth",O=s.reference[v]+s.reference[x]-w[x]-s.floating[v],S=w[x]-s.reference[x],D=await(null==f.getOffsetParent?void 0:f.getOffsetParent(p));let C=D?D[A]:0;C&&await(null==f.isElement?void 0:f.isElement(D))||(C=d.floating[A]||s.floating[v]);const P=O/2-S/2,F=C/2-R[v]/2-1,W=t(y[T],F),k=t(y[E],F),H=W,B=C-R[v]-k,M=C/2-R[v]/2+P,V=l(H,M,B),z=!m.arrow&&null!=a(r)&&M!==V&&s.reference[v]/2-(M<H?W:k)-R[v]/2<0,N=z?M<H?M-H:M-B:0;return{[x]:w[x]+N,data:{[x]:V,centerOffset:M-V-N,...z&&{alignmentOffset:N}},reset:z}}}),wt=(t,e,n)=>{const o=new Map,i={platform:ft,...n},r={...i.platform,_c:o};return(async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:T},s=await(null==l.isRTL?void 0:l.isRTL(e));let a=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=L(a,o,s),d=o,h=0;const m={};for(let p=0;p<r.length;p++){const n=r[p];if(!n)continue;const{name:g,fn:y}=n,{x:w,y:x,data:v,reset:b}=await y({x:f,y:u,initialPlacement:o,placement:d,strategy:i,middlewareData:m,rects:a,platform:c,elements:{reference:t,floating:e}});f=null!=w?w:f,u=null!=x?x:u,m[g]={...m[g],...v},b&&h<50&&(h++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(a=!0===b.rects?await l.getElementRects({reference:t,floating:e,strategy:i}):b.rects),({x:f,y:u}=L(a,d,s))),p=-1)}return{x:f,y:u,placement:d,strategy:i,middlewareData:m}})(t,e,{...i,platform:r})};export{dt as a,yt as b,wt as c,ht as d,gt as f,mt as o,pt as s};
|