You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
9.5 KiB
2 lines
9.5 KiB
1 month ago
|
import{rectToClientRect as t,detectOverflow as e,offset as n,autoPlacement as o,shift as i,flip as r,size as c,hide as l,arrow as s,inline as u,limitShift as f,computePosition as a}from"@floating-ui/core";const d=Math.min,h=Math.max,p=Math.round,g=Math.floor,m=t=>({x:t,y:t});function y(){return"undefined"!=typeof window}function w(t){return b(t)?(t.nodeName||"").toLowerCase():"#document"}function x(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function v(t){var e;return null==(e=(b(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function b(t){return!!y()&&(t instanceof Node||t instanceof x(t).Node)}function L(t){return!!y()&&(t instanceof Element||t instanceof x(t).Element)}function T(t){return!!y()&&(t instanceof HTMLElement||t instanceof x(t).HTMLElement)}function R(t){return!(!y()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof x(t).ShadowRoot)}function E(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=H(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(i)}function C(t){return["table","td","th"].includes(w(t))}function S(t){return[":popover-open",":modal"].some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function F(t){const e=D(),n=L(t)?H(t):t;return["transform","translate","scale","rotate","perspective"].some((t=>!!n[t]&&"none"!==n[t]))||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((t=>(n.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(n.contain||"").includes(t)))}function D(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function O(t){return["html","body","#document"].includes(w(t))}function H(t){return x(t).getComputedStyle(t)}function W(t){return L(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function M(t){if("html"===w(t))return t;const e=t.assignedSlot||t.parentNode||R(t)&&t.host||v(t);return R(e)?e.host:e}function P(t){const e=M(t);return O(e)?t.ownerDocument?t.ownerDocument.body:t.body:T(e)&&E(e)?e:P(e)}function z(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=P(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),c=x(i);if(r){const t=B(c);return e.concat(c,c.visualViewport||[],E(i)?i:[],t&&n?z(t):[])}return e.concat(i,z(i,[],n))}function B(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function V(t){const e=H(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=T(t),r=i?t.offsetWidth:n,c=i?t.offsetHeight:o,l=p(n)!==r||p(o)!==c;return l&&(n=r,o=c),{width:n,height:o,$:l}}function A(t){return L(t)?t:t.contextElement}function N(t){const e=A(t);if(!T(e))return m(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=V(e);let c=(r?p(n.width):n.width)/o,l=(r?p(n.height):n.height)/i;return c&&Number.isFinite(c)||(c=1),l&&Number.isFinite(l)||(l=1),{x:c,y:l}}const k=m(0);function I(t){const e=x(t);return D()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:k}function q(e,n,o,i){void 0===n&&(n=!1),void 0===o&&(o=!1);const r=e.getBoundingClientRect(),c=A(e);let l=m(1);n&&(i?L(i)&&(l=N(i)):l=N(e));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==x(t))&&e}(c,o,i)?I(c):m(0);let u=(r.left+s.x)/l.x,f=(r.top+s.y)/l.y,a=r.width/l.x,d=r.height/l.y;if(c){const t=x(c),e=i&&L(i)?x(i):i;let n=t,o=B(n);for(;o&&i&&e!==n;){const t=N(o),e=o.getBoundingClientRect(),i=H(o),r=e.left+(o.clientLeft+parseFloat(i.paddingLeft))*t.x,c=e.top+(o.clientTop+parseFloat(i.paddingTop))*t.y;u*=t.x,f*=t.y,a*=t.x,d*=t.y,u+=r,f+=c,n=x(o),o=B(n)}}return t({width:a,height:d,x:u,y:f})}function X(t,e){const n=W(t).scrollLeft;return e?e.left+n:q(v(t)).left+n}function Y(t,e,n){void 0===n&&(n=!1);const o=t.getBoundingClientRect();return{x:o.left+e.scrollLeft-(n?0:X(t,o)),y:o.top+e.scrollTop}}function $(e,n,o){let i;if("viewport"===n)i=function(t,e)
|