p-02206586.js 5.9 KB

123456
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.97
  5. */
  6. import{e as t}from"./p-91b670e6.js";import"./p-96bf42e5.js";import"./p-af9e6e54.js";import"./p-d5bfadd8.js";import"./p-622f8ecb.js";function n(t){return f(t)&&"fixed"!==i(t).position?function(t){let{offsetParent:n}=t,o=t,r=!1;for(;o&&o!==n;){const{assignedSlot:t}=o;if(t){let e=t.offsetParent;if("contents"===i(t).display){const n=t.hasAttribute("style"),r=t.style.display;t.style.display=i(o).display,e=t.offsetParent,t.style.display=r,n||t.removeAttribute("style")}o=t,n!==e&&(n=e,r=!0)}else if(s(o)&&o.host&&r)break;o=s(o)&&o.host||o.parentNode}return n}(t):null}function o(t){const{reference:n,floating:o,strategy:r}=t;return{reference:L(n,S(o),r),floating:{...T(o),x:0,y:0}}}function r(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function e(t){if(null==t)return window;if(!r(t)){const n=t.ownerDocument;return n&&n.defaultView||window}return t}function i(t){return e(t).getComputedStyle(t)}function u(t){return r(t)?"":t?(t.nodeName||"").toLowerCase():""}function c(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function f(t){return t instanceof e(t).HTMLElement}function l(t){return t instanceof e(t).Element}function s(t){return"undefined"!=typeof ShadowRoot&&(t instanceof e(t).ShadowRoot||t instanceof ShadowRoot)}function d(t){const{overflow:n,overflowX:o,overflowY:r,display:e}=i(t);return/auto|scroll|overlay|hidden/.test(n+r+o)&&!["inline","contents"].includes(e)}function a(t){return["table","td","th"].includes(u(t))}function h(t){const n=/firefox/i.test(c()),o=i(t);return"none"!==o.transform||"none"!==o.perspective||n&&"filter"===o.willChange||n&&!!o.filter&&"none"!==o.filter||["transform","perspective"].some((t=>o.willChange.includes(t)))||["paint","layout","strict","content"].some((t=>{const n=o.contain;return null!=n&&n.includes(t)}))}function p(){return!/^((?!chrome|android).)*safari/i.test(c())}function w(t){return["html","body","#document"].includes(u(t))}const y=Math.min,v=Math.max,g=Math.round;function x(t,n,o){var r,i,u,c;void 0===n&&(n=!1),void 0===o&&(o=!1);const s=t.getBoundingClientRect();let d=1,a=1;n&&f(t)&&(d=t.offsetWidth>0&&g(s.width)/t.offsetWidth||1,a=t.offsetHeight>0&&g(s.height)/t.offsetHeight||1);const h=l(t)?e(t):window,w=!p()&&o,y=(s.left+(w&&null!=(r=null==(i=h.visualViewport)?void 0:i.offsetLeft)?r:0))/d,v=(s.top+(w&&null!=(u=null==(c=h.visualViewport)?void 0:c.offsetTop)?u:0))/a,x=s.width/d,m=s.height/a;return{width:x,height:m,top:v,right:y+x,bottom:v+m,left:y,x:y,y:v}}function m(t){return(n=t,(n instanceof e(n).Node?t.ownerDocument:t.document)||window.document).documentElement;var n}function b(t){return l(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function j(t){return x(m(t)).left+b(t).scrollLeft}function L(t,n,o){const r=f(n),e=m(n),i=x(t,r&&function(t){const n=x(t);return g(n.width)!==t.offsetWidth||g(n.height)!==t.offsetHeight}(n),"fixed"===o);let c={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==o)if(("body"!==u(n)||d(e))&&(c=b(n)),f(n)){const t=x(n,!0);l.x=t.x+n.clientLeft,l.y=t.y+n.clientTop}else e&&(l.x=j(e));return{x:i.left+c.scrollLeft-l.x,y:i.top+c.scrollTop-l.y,width:i.width,height:i.height}}function M(t){return"html"===u(t)?t:t.assignedSlot||t.parentNode||(s(t)?t.host:null)||m(t)}function S(t){const o=e(t);let r=n(t);for(;r&&a(r)&&"static"===i(r).position;)r=n(r);return r&&("html"===u(r)||"body"===u(r)&&"static"===i(r).position&&!h(r))?o:r||function(t){let n=M(t);for(s(n)&&(n=n.host);f(n)&&!w(n);){if(h(n))return n;{const t=n.parentNode;n=s(t)?t.host:t}}return null}(t)||o}function T(t){if(f(t))return{width:t.offsetWidth,height:t.offsetHeight};const n=x(t);return{width:n.width,height:n.height}}function R(t){const n=M(t);return w(n)?t.ownerDocument.body:f(n)&&d(n)?n:R(n)}function k(t,n){var o;void 0===n&&(n=[]);const r=R(t),i=r===(null==(o=t.ownerDocument)?void 0:o.body),u=e(r),c=i?[u].concat(u.visualViewport||[],d(r)?r:[]):r,f=n.concat(c);return i?f:f.concat(k(c))}function A(n,o,r){return"viewport"===o?t(function(t,n){const o=e(t),r=m(t),i=o.visualViewport;let u=r.clientWidth,c=r.clientHeight,f=0,l=0;if(i){u=i.width,c=i.height;const t=p();(t||!t&&"fixed"===n)&&(f=i.offsetLeft,l=i.offsetTop)}return{width:u,height:c,x:f,y:l}}(n,r)):l(o)?function(t,n){const o=x(t,!1,"fixed"===n),r=o.top+t.clientTop,e=o.left+t.clientLeft;return{top:r,left:e,x:e,y:r,right:e+t.clientWidth,bottom:r+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(o,r):t(function(t){var n;const o=m(t),r=b(t),e=null==(n=t.ownerDocument)?void 0:n.body,u=v(o.scrollWidth,o.clientWidth,e?e.scrollWidth:0,e?e.clientWidth:0),c=v(o.scrollHeight,o.clientHeight,e?e.scrollHeight:0,e?e.clientHeight:0);let f=-r.scrollLeft+j(t);const l=-r.scrollTop;return"rtl"===i(e||o).direction&&(f+=v(o.clientWidth,e?e.clientWidth:0)-u),{width:u,height:c,x:f,y:l}}(m(n)))}function B(t){const n=k(t),o=function(t,n){let o=t;for(;o&&!w(o)&&!n.includes(o)&&(!l(o)||!["absolute","fixed"].includes(i(o).position));){const t=M(o);o=s(t)?t.host:t}return o}(t,n);let r=null;if(o&&f(o)){const t=S(o);d(o)?r=o:f(t)&&(r=t)}return l(r)?n.filter((t=>r&&l(t)&&function(t,n){const o=null==n.getRootNode?void 0:n.getRootNode();if(t.contains(n))return!0;if(o&&s(o)){let o=n;do{if(o&&t===o)return!0;o=o.parentNode||o.host}while(o)}return!1}(t,r)&&"body"!==u(t))):[]}function P(t){let{element:n,boundary:o,rootBoundary:r,strategy:e}=t;const i=[..."clippingAncestors"===o?B(n):[].concat(o),r],u=i.reduce(((t,o)=>{const r=A(n,o,e);return t.top=v(r.top,t.top),t.right=y(r.right,t.right),t.bottom=y(r.bottom,t.bottom),t.left=v(r.left,t.left),t}),A(n,i[0],e));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}export{P as getClippingRect,o as getElementRects,S as getOffsetParent}