Outlook_Addin_LLM/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs

2 lines
8.9 KiB
JavaScript

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 f,limitShift as u,computePosition as a}from"@floating-ui/core";const d=Math.min,h=Math.max,p=Math.round,m=Math.floor,g=t=>({x:t,y:t});function y(t){return x(t)?(t.nodeName||"").toLowerCase():"#document"}function w(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function v(t){var e;return null==(e=(x(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function x(t){return t instanceof Node||t instanceof w(t).Node}function b(t){return t instanceof Element||t instanceof w(t).Element}function L(t){return t instanceof HTMLElement||t instanceof w(t).HTMLElement}function T(t){return"undefined"!=typeof ShadowRoot&&(t instanceof ShadowRoot||t instanceof w(t).ShadowRoot)}function R(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=D(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(i)}function E(t){return["table","td","th"].includes(y(t))}function S(t){return[":popover-open",":modal"].some((e=>{try{return t.matches(e)}catch(t){return!1}}))}function C(t){const e=F(),n=b(t)?D(t):t;return"none"!==n.transform||"none"!==n.perspective||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","perspective","filter"].some((t=>(n.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(n.contain||"").includes(t)))}function F(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function O(t){return["html","body","#document"].includes(y(t))}function D(t){return w(t).getComputedStyle(t)}function H(t){return b(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function W(t){if("html"===y(t))return t;const e=t.assignedSlot||t.parentNode||T(t)&&t.host||v(t);return T(e)?e.host:e}function M(t){const e=W(t);return O(e)?t.ownerDocument?t.ownerDocument.body:t.body:L(e)&&R(e)?e:M(e)}function P(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=M(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),c=w(i);if(r){const t=z(c);return e.concat(c,c.visualViewport||[],R(i)?i:[],t&&n?P(t):[])}return e.concat(i,P(i,[],n))}function z(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function V(t){const e=D(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=L(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 b(t)?t:t.contextElement}function N(t){const e=A(t);if(!L(e))return g(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 B=g(0);function k(t){const e=w(t);return F()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:B}function I(e,n,o,i){void 0===n&&(n=!1),void 0===o&&(o=!1);const r=e.getBoundingClientRect(),c=A(e);let l=g(1);n&&(i?b(i)&&(l=N(i)):l=N(e));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==w(t))&&e}(c,o,i)?k(c):g(0);let f=(r.left+s.x)/l.x,u=(r.top+s.y)/l.y,a=r.width/l.x,d=r.height/l.y;if(c){const t=w(c),e=i&&b(i)?w(i):i;let n=t,o=z(n);for(;o&&i&&e!==n;){const t=N(o),e=o.getBoundingClientRect(),i=D(o),r=e.left+(o.clientLeft+parseFloat(i.paddingLeft))*t.x,c=e.top+(o.clientTop+parseFloat(i.paddingTop))*t.y;f*=t.x,u*=t.y,a*=t.x,d*=t.y,f+=r,u+=c,n=w(o),o=z(n)}}return t({width:a,height:d,x:f,y:u})}function q(t){return I(v(t)).left+H(t).scrollLeft}function X(e,n,o){let i;if("viewport"===n)i=function(t,e){const n=w(t),o=v(t),i=n.visualViewport;let r=o.clientWidth,c=o.clientHeight,l=0,s=0;if(i){r=i.width,c=i.height;const t=F();(!t||t&&"fixed"===e)&&(l=i.offsetLeft,s=i.offsetTop)}return{width:r,height:c,x:l,y:s}}(e,o);else if("document"===n)i=function(t){const e=v(t),n=H(t),o=t.ownerDocument.body,i=h(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=h(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let c=-n.scrollLeft+q(t);const l=-n.scrollTop;return"rtl"===D(o).direction&&(c+=h(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:c,y:l}}(v(e));else if(b(n))i=function(t,e){const n=I(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=L(t)?N(t):g(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:i*r.x,y:o*r.y}}(n,o);else{const t=k(e);i={...n,x:n.x-t.x,y:n.y-t.y}}return t(i)}function Y(t,e){const n=W(t);return!(n===e||!b(n)||O(n))&&("fixed"===D(n).position||Y(n,e))}function $(t,e,n){const o=L(e),i=v(e),r="fixed"===n,c=I(t,!0,r,e);let l={scrollLeft:0,scrollTop:0};const s=g(0);if(o||!o&&!r)if(("body"!==y(e)||R(i))&&(l=H(e)),o){const t=I(e,!0,r,e);s.x=t.x+e.clientLeft,s.y=t.y+e.clientTop}else i&&(s.x=q(i));return{x:c.left+l.scrollLeft-s.x,y:c.top+l.scrollTop-s.y,width:c.width,height:c.height}}function _(t){return"static"===D(t).position}function j(t,e){return L(t)&&"fixed"!==D(t).position?e?e(t):t.offsetParent:null}function G(t,e){const n=w(t);if(S(t))return n;if(!L(t)){let e=W(t);for(;e&&!O(e);){if(b(e)&&!_(e))return e;e=W(e)}return n}let o=j(t,e);for(;o&&E(o)&&_(o);)o=j(o,e);return o&&O(o)&&_(o)&&!C(o)?n:o||function(t){let e=W(t);for(;L(e)&&!O(e);){if(C(e))return e;if(S(e))return null;e=W(e)}return null}(t)||n}const J={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r="fixed"===i,c=v(o),l=!!e&&S(e.floating);if(o===c||l&&r)return n;let s={scrollLeft:0,scrollTop:0},f=g(1);const u=g(0),a=L(o);if((a||!a&&!r)&&(("body"!==y(o)||R(c))&&(s=H(o)),L(o))){const t=I(o);f=N(o),u.x=t.x+o.clientLeft,u.y=t.y+o.clientTop}return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-s.scrollLeft*f.x+u.x,y:n.y*f.y-s.scrollTop*f.y+u.y}},getDocumentElement:v,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?S(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=P(t,[],!1).filter((t=>b(t)&&"body"!==y(t))),i=null;const r="fixed"===D(t).position;let c=r?W(t):t;for(;b(c)&&!O(c);){const e=D(c),n=C(c);n||"fixed"!==e.position||(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&["absolute","fixed"].includes(i.position)||R(c)&&!n&&Y(t,c))?o=o.filter((t=>t!==c)):i=e,c=W(c)}return e.set(t,o),o}(e,this._c):[].concat(n),o],c=r[0],l=r.reduce(((t,n)=>{const o=X(e,n,i);return t.top=h(o.top,t.top),t.right=d(o.right,t.right),t.bottom=d(o.bottom,t.bottom),t.left=h(o.left,t.left),t}),X(e,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:G,getElementRects:async function(t){const e=this.getOffsetParent||G,n=this.getDimensions,o=await n(t.floating);return{reference:$(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}=V(t);return{width:e,height:n}},getScale:N,isElement:b,isRTL:function(t){return"rtl"===D(t).direction}};function K(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:c="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:s=!1}=o,f=A(t),u=i||r?[...f?P(f):[],...P(e)]:[];u.forEach((t=>{i&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));const a=f&&l?function(t,e){let n,o=null;const i=v(t);function r(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function c(l,s){void 0===l&&(l=!1),void 0===s&&(s=1),r();const{left:f,top:u,width:a,height:p}=t.getBoundingClientRect();if(l||e(),!a||!p)return;const g={rootMargin:-m(u)+"px "+-m(i.clientWidth-(f+a))+"px "+-m(i.clientHeight-(u+p))+"px "+-m(f)+"px",threshold:h(0,d(1,s))||1};let y=!0;function w(t){const e=t[0].intersectionRatio;if(e!==s){if(!y)return c();e?c(!1,e):n=setTimeout((()=>{c(!1,1e-7)}),1e3)}y=!1}try{o=new IntersectionObserver(w,{...g,root:i.ownerDocument})}catch(t){o=new IntersectionObserver(w,g)}o.observe(t)}(!0),r}(f,n):null;let p,g=-1,y=null;c&&(y=new ResizeObserver((t=>{let[o]=t;o&&o.target===f&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame((()=>{var t;null==(t=y)||t.observe(e)}))),n()})),f&&!s&&y.observe(f),y.observe(e));let w=s?I(t):null;return s&&function e(){const o=I(t);!w||o.x===w.x&&o.y===w.y&&o.width===w.width&&o.height===w.height||n();w=o,p=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{i&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==a||a(),null==(t=y)||t.disconnect(),y=null,s&&cancelAnimationFrame(p)}}const Q=e,U=n,Z=o,tt=i,et=r,nt=c,ot=l,it=s,rt=f,ct=u,lt=(t,e,n)=>{const o=new Map,i={platform:J,...n},r={...i.platform,_c:o};return a(t,e,{...i,platform:r})};export{it as arrow,Z as autoPlacement,K as autoUpdate,lt as computePosition,Q as detectOverflow,et as flip,P as getOverflowAncestors,ot as hide,rt as inline,ct as limitShift,U as offset,J as platform,tt as shift,nt as size};