// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define(["exports","./dom","./debounce"],function(L,Na,Oa){function M(a,b){return"function"===typeof a?a(b):a}function F(a){return a.split("-")[0]}function C(a){return a.split("-")[1]}function W(a){return"x"===a?"y":"x"}function ha(a){return"y"===a?"height":"width"}function P(a){return["top","bottom"].includes(F(a))?"y":"x"}function na(a,b,c){void 0===c&&(c=!1);const d=C(a),e=W(P(a));a=ha(e);c="x"===e?d===(c?"end":"start")?"right":"left":"start"===d?"bottom":"top";b.reference[a]>b.floating[a]&&(c= X(c));return[c,X(c)]}function Pa(a){const b=X(a);return[Y(a),b,Y(b)]}function Y(a){return a.replace(/start|end/g,b=>Qa[b])}function Ra(a,b,c){const d=["left","right"],e=["right","left"],f=["top","bottom"],g=["bottom","top"];switch(a){case "top":case "bottom":return c?b?e:d:b?d:e;case "left":case "right":return b?f:g;default:return[]}}function Sa(a,b,c,d){const e=C(a);a=Ra(F(a),"start"===c,d);e&&(a=a.map(f=>f+"-"+e),b&&(a=a.concat(a.map(Y))));return a}function X(a){return a.replace(/left|right|bottom|top/g, b=>Ta[b])}function oa(a){return"number"!==typeof a?{top:0,right:0,bottom:0,left:0,...a}:{top:a,right:a,bottom:a,left:a}}function Z(a){const {x:b,y:c,width:d,height:e}=a;return{width:d,height:e,top:c,left:b,right:b+d,bottom:c+e,x:b,y:c}}function pa(a,b,c){let {reference:d,floating:e}=a;var f=P(b);a=W(P(b));var g=ha(a),h=F(b);f="y"===f;const l=d.x+d.width/2-e.width/2,k=d.y+d.height/2-e.height/2;g=d[g]/2-e[g]/2;switch(h){case "top":h={x:l,y:d.y-e.height};break;case "bottom":h={x:l,y:d.y+d.height};break; case "right":h={x:d.x+d.width,y:k};break;case "left":h={x:d.x-e.width,y:k};break;default:h={x:d.x,y:d.y}}switch(C(b)){case "start":h[a]-=g*(c&&f?-1:1);break;case "end":h[a]+=g*(c&&f?-1:1)}return h}async function S(a,b){var c;void 0===b&&(b={});const {x:d,y:e,platform:f,rects:g,elements:h,strategy:l}=a,{boundary:k="clippingAncestors",rootBoundary:r="viewport",elementContext:n="floating",altBoundary:u=!1,padding:v=0}=M(b,a);a=oa(v);var m=h[u?"floating"===n?"reference":"floating":n];b=Z(await f.getClippingRect({element:(null!= (c=await (null==f.isElement?void 0:f.isElement(m)))?c:1)?m:m.contextElement||await (null==f.getDocumentElement?void 0:f.getDocumentElement(h.floating)),boundary:k,rootBoundary:r,strategy:l}));m="floating"===n?{x:d,y:e,width:g.floating.width,height:g.floating.height}:g.reference;const p=await (null==f.getOffsetParent?void 0:f.getOffsetParent(h.floating));c=await (null==f.isElement?void 0:f.isElement(p))?await (null==f.getScale?void 0:f.getScale(p))||{x:1,y:1}:{x:1,y:1};m=Z(f.convertOffsetParentRelativeRectToViewportRelativeRect? await f.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:m,offsetParent:p,strategy:l}):m);return{top:(b.top-m.top+a.top)/c.y,bottom:(m.bottom-b.bottom+a.bottom)/c.y,left:(b.left-m.left+a.left)/c.x,right:(m.right-b.right+a.right)/c.x}}function Ua(a,b,c){return(a?[...c.filter(d=>C(d)===a),...c.filter(d=>C(d)!==a)]:c.filter(d=>F(d)===d)).filter(d=>a?C(d)===a||(b?Y(d)!==d:!1):!0)}function qa(a,b){return{top:a.top-b.height,right:a.right-b.width,bottom:a.bottom-b.height,left:a.left- b.width}}function ra(a){return sa.some(b=>0<=a[b])}async function Va(a,b){const {placement:c,platform:d,elements:e}=a;var f=await (null==d.isRTL?void 0:d.isRTL(e.floating)),g=F(c);const h=C(c),l="y"===P(c);g=["left","top"].includes(g)?-1:1;f=f&&l?-1:1;a=M(b,a);let {mainAxis:k,crossAxis:r,alignmentAxis:n}="number"===typeof a?{mainAxis:a,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...a};h&&"number"===typeof n&&(r="end"===h?-1*n:n);return l?{x:r*f,y:k*g}:{x:k*g,y:r*f}} function J(a){return ta(a)?(a.nodeName||"").toLowerCase():"#document"}function A(a){var b;return(null==a||null==(b=a.ownerDocument)?void 0:b.defaultView)||window}function G(a){var b;return null==(b=(ta(a)?a.ownerDocument:a.document)||window.document)?void 0:b.documentElement}function ta(a){return a instanceof Node||a instanceof A(a).Node}function H(a){return a instanceof Element||a instanceof A(a).Element}function D(a){return a instanceof HTMLElement||a instanceof A(a).HTMLElement}function ua(a){return"undefined"=== typeof ShadowRoot?!1:a instanceof ShadowRoot||a instanceof A(a).ShadowRoot}function T(a){const {overflow:b,overflowX:c,overflowY:d,display:e}=B(a);return/auto|scroll|overlay|hidden|clip/.test(b+d+c)&&!["inline","contents"].includes(e)}function ia(a){const b=ja(),c=B(a);return"none"!==c.transform||"none"!==c.perspective||(c.containerType?"normal"!==c.containerType:!1)||!b&&(c.backdropFilter?"none"!==c.backdropFilter:!1)||!b&&(c.filter?"none"!==c.filter:!1)||["transform","perspective","filter"].some(d=> (c.willChange||"").includes(d))||["paint","layout","strict","content"].some(d=>(c.contain||"").includes(d))}function ja(){return"undefined"!==typeof CSS&&CSS.supports?CSS.supports("-webkit-backdrop-filter","none"):!1}function aa(a){return["html","body","#document"].includes(J(a))}function B(a){return A(a).getComputedStyle(a)}function ba(a){return H(a)?{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}:{scrollLeft:a.pageXOffset,scrollTop:a.pageYOffset}}function Q(a){if("html"===J(a))return a;a=a.assignedSlot|| a.parentNode||ua(a)&&a.host||G(a);return ua(a)?a.host:a}function va(a){const b=Q(a);return aa(b)?a.ownerDocument?a.ownerDocument.body:a.body:D(b)&&T(b)?b:va(b)}function U(a,b,c){var d;void 0===b&&(b=[]);void 0===c&&(c=!0);const e=va(a);a=e===(null==(d=a.ownerDocument)?void 0:d.body);d=A(e);return a?b.concat(d,d.visualViewport||[],T(e)?e:[],d.frameElement&&c?U(d.frameElement):[]):b.concat(e,U(e,[],c))}function wa(a){var b=B(a);let c=parseFloat(b.width)||0;b=parseFloat(b.height)||0;var d=D(a);const e= d?a.offsetWidth:c;a=d?a.offsetHeight:b;if(d=ca(c)!==e||ca(b)!==a)c=e,b=a;return{width:c,height:b,$:d}}function ka(a){return H(a)?a:a.contextElement}function R(a){var b=ka(a);if(!D(b))return{x:1,y:1};a=b.getBoundingClientRect();const {width:c,height:d,$:e}=wa(b);b=(e?ca(a.width):a.width)/c;a=(e?ca(a.height):a.height)/d;b&&Number.isFinite(b)||(b=1);a&&Number.isFinite(a)||(a=1);return{x:b,y:a}}function xa(a){a=A(a);return ja()&&a.visualViewport?{x:a.visualViewport.offsetLeft,y:a.visualViewport.offsetTop}: Wa}function N(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!1);var e=a.getBoundingClientRect(),f=ka(a),g={x:1,y:1};b&&(d?H(d)&&(g=R(d)):g=R(a));a=c;void 0===a&&(a=!1);a=!d||a&&d!==A(f)?!1:a;b=a?xa(f):{x:0,y:0};a=(e.left+b.x)/g.x;b=(e.top+b.y)/g.y;c=e.width/g.x;e=e.height/g.y;if(f){g=A(f);f=d&&H(d)?A(d):d;var h=g;for(g=h.frameElement;g&&d&&f!==h;){h=R(g);var l=g.getBoundingClientRect();const k=B(g),r=l.left+(g.clientLeft+parseFloat(k.paddingLeft))*h.x;l=l.top+(g.clientTop+parseFloat(k.paddingTop))*h.y; a*=h.x;b*=h.y;c*=h.x;e*=h.y;a+=r;b+=l;h=A(g);g=h.frameElement}}return Z({width:c,height:e,x:a,y:b})}function ya(a){return Xa.some(b=>{try{return a.matches(b)}catch(c){return!1}})}function za(a){return N(G(a)).left+ba(a).scrollLeft}function Aa(a,b,c){if("viewport"===b){b=A(a);var d=G(a);b=b.visualViewport;a=d.clientWidth;d=d.clientHeight;var e=0,f=0;if(b){a=b.width;d=b.height;const g=ja();if(!g||g&&"fixed"===c)e=b.offsetLeft,f=b.offsetTop}c={width:a,height:d,x:e,y:f}}else"document"===b?(f=G(a),c=G(f), e=ba(f),b=f.ownerDocument.body,a=I(c.scrollWidth,c.clientWidth,b.scrollWidth,b.clientWidth),d=I(c.scrollHeight,c.clientHeight,b.scrollHeight,b.clientHeight),f=-e.scrollLeft+za(f),e=-e.scrollTop,"rtl"===B(b).direction&&(f+=I(c.clientWidth,b.clientWidth)-a),c={width:a,height:d,x:f,y:e}):H(b)?(a=N(b,!0,"fixed"===c),c=a.top+b.clientTop,a=a.left+b.clientLeft,d=D(b)?R(b):{x:1,y:1},c={width:b.clientWidth*d.x,height:b.clientHeight*d.y,x:a*d.x,y:c*d.y}):(c=xa(a),c={...b,x:b.x-c.x,y:b.y-c.y});return Z(c)}function Ba(a, b){a=Q(a);return a===b||!H(a)||aa(a)?!1:"fixed"===B(a).position||Ba(a,b)}function Ya(a,b){var c=b.get(a);if(c)return c;c=U(a,[],!1).filter(g=>H(g)&&"body"!==J(g));let d=null;const e="fixed"===B(a).position;let f=e?Q(a):a;for(;H(f)&&!aa(f);){const g=B(f),h=ia(f);h||"fixed"!==g.position||(d=null);(e?!h&&!d:!h&&"static"===g.position&&d&&["absolute","fixed"].includes(d.position)||T(f)&&!h&&Ba(a,f))?c=c.filter(l=>l!==f):d=g;f=Q(f)}b.set(a,c);return c}function Ca(a,b){return D(a)&&"fixed"!==B(a).position? b?b(a):a.offsetParent:null}function Da(a,b){const c=A(a);if(!D(a)||ya(a))return c;let d=Ca(a,b);for(;d&&["table","td","th"].includes(J(d))&&"static"===B(d).position;)d=Ca(d,b);if(d&&("html"===J(d)||"body"===J(d)&&"static"===B(d).position&&!ia(d)))return c;if(!(b=d))a:{for(a=Q(a);D(a)&&!aa(a);){if(ia(a)){b=a;break a}a=Q(a)}b=null}return b||c}function Za(a,b){function c(){var h;clearTimeout(f);null==(h=e)||h.disconnect();e=null}function d(h,l){function k(t){t=t[0].intersectionRatio;if(t!==l){if(!q)return d(); t?d(!1,t):f=setTimeout(()=>{d(!1,1E-7)},100)}q=!1}void 0===h&&(h=!1);void 0===l&&(l=1);c();const {left:r,top:n,width:u,height:v}=a.getBoundingClientRect();h||b();if(u&&v){h=da(n);var m=da(g.clientWidth-(r+u)),p=da(g.clientHeight-(n+v)),w=da(r);h={rootMargin:-h+"px "+-m+"px "+-p+"px "+-w+"px",threshold:I(0,K(1,l))||1};var q=!0;try{e=new IntersectionObserver(k,{...h,root:g.ownerDocument})}catch(t){e=new IntersectionObserver(k,h)}e.observe(a)}}let e=null,f;const g=G(a);d(!0);return c}function $a(a,b, c,d){function e(){const q=N(a);!w||q.x===w.x&&q.y===w.y&&q.width===w.width&&q.height===w.height||c();w=q;p=requestAnimationFrame(e)}void 0===d&&(d={});const {ancestorScroll:f=!0,ancestorResize:g=!0,elementResize:h="function"===typeof ResizeObserver,layoutShift:l="function"===typeof IntersectionObserver,animationFrame:k=!1}=d,r=ka(a),n=f||g?[...(r?U(r):[]),...U(b)]:[];n.forEach(q=>{f&&q.addEventListener("scroll",c,{passive:!0});g&&q.addEventListener("resize",c)});const u=r&&l?Za(r,c):null;let v=-1, m=null;h&&(m=new ResizeObserver(q=>{[q]=q;q&&q.target===r&&m&&(m.unobserve(b),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var t;null==(t=m)||t.observe(b)}));c()}),r&&!k&&m.observe(r),m.observe(b));let p,w=k?N(a):null;k&&e();c();return()=>{var q;n.forEach(t=>{f&&t.removeEventListener("scroll",c);g&&t.removeEventListener("resize",c)});null==u||u();null==(q=m)||q.disconnect();m=null;k&&cancelAnimationFrame(p)}}function ab(a){a:{for(var b=a;b;b=la(b))if(b instanceof Element&&"none"===getComputedStyle(b).display){a= null;break a}for(a=la(a);a;a=la(a))if(a instanceof Element&&(b=getComputedStyle(a),"contents"!==b.display&&("static"!==b.position||"none"!==b.filter||"BODY"===a.tagName)))break a;a=null}return a}function la(a){return a.assignedSlot?a.assignedSlot:a.parentNode instanceof ShadowRoot?a.parentNode.host:a.parentNode}function Ea(a){const b=window.devicePixelRatio||1;return Math.round(a*b)/b}function bb({placement:a,flipDisabled:b,flipPlacements:c,offsetDistance:d,offsetSkidding:e,arrowEl:f,type:g}){const h= [cb(),db()];return"menu"===g?[...h,Fa({fallbackPlacements:c||"top-start top top-end bottom-start bottom bottom-end".split(" ")})]:"popover"===g||"tooltip"===g?(d=[...h,eb({mainAxis:"number"===typeof d?d:0,crossAxis:"number"===typeof e?e:0})],"auto"===a||"auto-start"===a||"auto-end"===a?d.push(fb({alignment:"auto-start"===a?"start":"auto-end"===a?"end":null})):b||d.push(Fa(c?{fallbackPlacements:c}:{})),f&&d.push(gb({element:f})),d):[]}async function Ga(a,b,c){if(c.isConnected){V.set(a,{state:"pending"}); var d;b=$a(b,c,()=>{const e=a.reposition();d||=e});V.set(a,{state:"active",cleanUp:b});return d}}function Ha(a,b,c){c&&b&&(b=V.get(a),"active"===b?.state&&b.cleanUp(),V.delete(a),ea.get(a)?.cancel(),ea.delete(a))}const sa=["top","right","bottom","left"],Ia=["start","end"],Ja=sa.reduce((a,b)=>a.concat(b,b+"-"+Ia[0],b+"-"+Ia[1]),[]),K=Math.min,I=Math.max,ca=Math.round,da=Math.floor,Ta={left:"right",right:"left",bottom:"top",top:"bottom"},Qa={start:"end",end:"start"},hb=async(a,b,c)=>{const {placement:d= "bottom",strategy:e="absolute",middleware:f=[],platform:g}=c;c=f.filter(Boolean);const h=await (null==g.isRTL?void 0:g.isRTL(b));let l=await g.getElementRects({reference:a,floating:b,strategy:e}),{x:k,y:r}=pa(l,d,h),n=d,u={},v=0;for(let m=0;m= v&&(v++,"object"===typeof y&&(y.placement&&(n=y.placement),y.rects&&(l=!0===y.rects?await g.getElementRects({reference:a,floating:b,strategy:e}):y.rects),{x:k,y:r}=pa(l,n,h)),m=-1)}return{x:k,y:r,placement:n,strategy:e,middlewareData:u}},eb=function(a){void 0===a&&(a=0);return{name:"offset",options:a,async fn(b){var c,d;const {x:e,y:f,placement:g,middlewareData:h}=b;b=await Va(b,a);return g===(null==(c=h.offset)?void 0:c.placement)&&null!=(d=h.arrow)&&d.alignmentOffset?{}:{x:e+b.x,y:f+b.y,data:{...b, placement:g}}}}},Wa={x:0,y:0},Xa=[":popover-open",":modal"],ma={convertOffsetParentRelativeRectToViewportRelativeRect:function(a){let {elements:b,rect:c,offsetParent:d,strategy:e}=a;a="fixed"===e;const f=G(d);var g=b?ya(b.floating):!1;if(d===f||g&&a)return c;g={scrollLeft:0,scrollTop:0};let h={x:1,y:1};var l=0,k=0;const r=D(d);if(r||!r&&!a){if("body"!==J(d)||T(f))g=ba(d);D(d)&&(a=N(d),h=R(d),l=a.x+d.clientLeft,k=a.y+d.clientTop)}return{width:c.width*h.x,height:c.height*h.y,x:c.x*h.x-g.scrollLeft* h.x+l,y:c.y*h.y-g.scrollTop*h.y+k}},getDocumentElement:G,getClippingRect:function(a){let {element:b,boundary:c,rootBoundary:d,strategy:e}=a;a=[...("clippingAncestors"===c?Ya(b,this._c):[].concat(c)),d];a=a.reduce((f,g)=>{g=Aa(b,g,e);f.top=I(g.top,f.top);f.right=K(g.right,f.right);f.bottom=K(g.bottom,f.bottom);f.left=I(g.left,f.left);return f},Aa(b,a[0],e));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:Da,getElementRects:async function(a){const b=this.getDimensions; var c=a.reference,d=await (this.getOffsetParent||Da)(a.floating),e=a.strategy,f=D(d);const g=G(d);e="fixed"===e;c=N(c,!0,e,d);let h={scrollLeft:0,scrollTop:0};var l=0,k=0;if(f||!f&&!e){if("body"!==J(d)||T(g))h=ba(d);f?(f=N(d,!0,e,d),l=f.x+d.clientLeft,k=f.y+d.clientTop):g&&(l=za(g))}return{reference:{x:c.left+h.scrollLeft-l,y:c.top+h.scrollTop-k,width:c.width,height:c.height},floating:{x:0,y:0,...(await b(a.floating))}}},getClientRects:function(a){return Array.from(a.getClientRects())},getDimensions:function(a){const {width:b, height:c}=wa(a);return{width:b,height:c}},getScale:R,isElement:H,isRTL:function(a){return"rtl"===B(a).direction}},fb=function(a){void 0===a&&(a={});return{name:"autoPlacement",options:a,async fn(b){var c,d,e;const {rects:f,middlewareData:g,placement:h,platform:l,elements:k}=b,{crossAxis:r=!1,alignment:n,allowedPlacements:u=Ja,autoAlignment:v=!0,...m}=M(a,b);var p=void 0!==n||u===Ja?Ua(n||null,v,u):u,w=await S(b,m);b=(null==(c=g.autoPlacement)?void 0:c.index)||0;c=p[b];if(null==c)return{};var q=na(c, f,await (null==l.isRTL?void 0:l.isRTL(k.floating)));if(h!==c)return{reset:{placement:p[0]}};q=[w[F(c)],w[q[0]],w[q[1]]];w=[...((null==(d=g.autoPlacement)?void 0:d.overflows)||[]),{placement:c,overflows:q}];if(d=p[b+1])return{data:{index:b+1,overflows:w},reset:{placement:d}};d=w.map(t=>{const x=C(t.placement);return[t.placement,x&&r?t.overflows.slice(0,2).reduce((y,z)=>y+z,0):t.overflows[0],t.overflows]}).sort((t,x)=>t[1]-x[1]);p=(null==(e=d.filter(t=>t[2].slice(0,C(t[0])?2:3).every(x=>0>=x))[0])? void 0:e[0])||d[0][0];return p!==h?{data:{index:b+1,overflows:w},reset:{placement:p}}:{}}}},cb=function(a){void 0===a&&(a={});return{name:"shift",options:a,async fn(b){const {x:c,y:d,placement:e}=b,{mainAxis:f=!0,crossAxis:g=!1,limiter:h={fn:m=>{let {x:p,y:w}=m;return{x:p,y:w}}},...l}=M(a,b);var k={x:c,y:d};const r=await S(b,l),n=P(F(e)),u=W(n);let v=k[u];k=k[n];f&&(v=I(v+r["y"===u?"top":"left"],K(v,v-r["y"===u?"bottom":"right"])));g&&(k=I(k+r["y"===n?"top":"left"],K(k,k-r["y"===n?"bottom":"right"]))); b=h.fn({...b,[u]:v,[n]:k});return{...b,data:{x:b.x-c,y:b.y-d}}}}},Fa=function(a){void 0===a&&(a={});return{name:"flip",options:a,async fn(b){var c,d;const {placement:e,middlewareData:f,rects:g,initialPlacement:h,platform:l,elements:k}=b,{mainAxis:r=!0,crossAxis:n=!0,fallbackPlacements:u,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:p=!0,...w}=M(a,b);if(null!=(c=f.arrow)&&c.alignmentOffset)return{};c=F(e);var q=F(h)===h;const t=await (null==l.isRTL?void 0:l.isRTL(k.floating)); q=u||(q||!p?[X(h)]:Pa(h));u||"none"===m||q.push(...Sa(h,p,m,t));q=[h,...q];const x=await S(b,w),y=[];b=(null==(d=f.flip)?void 0:d.overflows)||[];r&&y.push(x[c]);n&&(d=na(e,g,t),y.push(x[d[0]],x[d[1]]));b=[...b,{placement:e,overflows:y}];if(!y.every(E=>0>=E)){var z,fa;d=((null==(z=f.flip)?void 0:z.index)||0)+1;if(z=q[d])return{data:{index:d,overflows:b},reset:{placement:z}};z=null==(fa=b.filter(E=>0>=E.overflows[0]).sort((E,O)=>E.overflows[1]-O.overflows[1])[0])?void 0:fa.placement;if(!z)switch(v){case "bestFit":var Ka; (fa=null==(Ka=b.map(E=>[E.placement,E.overflows.filter(O=>0O+ib,0)]).sort((E,O)=>E[1]-O[1])[0])?void 0:Ka[0])&&(z=fa);break;case "initialPlacement":z=h}if(e!==z)return{reset:{placement:z}}}return{}}}},db=function(a){void 0===a&&(a={});return{name:"hide",options:a,async fn(b){var {rects:c}=b;const {strategy:d="referenceHidden",...e}=M(a,b);switch(d){case "referenceHidden":return b=await S(b,{...e,elementContext:"reference"}),c=qa(b,c.reference),{data:{referenceHiddenOffsets:c,referenceHidden:ra(c)}}; case "escaped":return b=await S(b,{...e,altBoundary:!0}),c=qa(b,c.floating),{data:{escapedOffsets:c,escaped:ra(c)}};default:return{}}}}},gb=a=>({name:"arrow",options:a,async fn(b){const {x:c,y:d,placement:e,rects:f,platform:g,elements:h,middlewareData:l}=b,{element:k,padding:r=0}=M(a,b)||{};if(null==k)return{};var n=oa(r);b={x:c,y:d};const u=W(P(e));var v=ha(u),m=await g.getDimensions(k),p="y"===u,w=p?"top":"left",q=p?"bottom":"right",t=p?"clientHeight":"clientWidth",x=f.reference[v]+f.reference[u]- b[u]-f.floating[v];const y=b[u]-f.reference[u],z=await (null==g.getOffsetParent?void 0:g.getOffsetParent(k));(p=z?z[t]:0)&&await (null==g.isElement?void 0:g.isElement(z))||(p=h.floating[t]||f.floating[v]);t=x/2-y/2;x=p/2-m[v]/2-1;w=K(n[w],x);q=K(n[q],x);n=p-m[v]-q;p=p/2-m[v]/2+t;t=I(w,K(p,n));m=(v=!l.arrow&&null!=C(e)&&p!==t&&0>f.reference[v]/2-(pa(b,ab)})();const La=async(a,{referenceEl:b,floatingEl:c,overlayPositioning:d="absolute",placement:e,flipDisabled:f,flipPlacements:g,offsetDistance:h,offsetSkidding:l,arrowEl:k,type:r})=>{if(!b||!c)return null;if("auto"===e||"auto-start"===e||"auto-end"===e)var n=void 0;else n=["left","right"],"rtl"===Na.getElementDir(c)&&n.reverse(),n=e.replace(/leading/gi,n[0]).replace(/trailing/gi,n[1]);e={strategy:d,placement:n,middleware:bb({placement:e,flipDisabled:f,flipPlacements:g,offsetDistance:h, offsetSkidding:l,arrowEl:k,type:r})};d=new Map;e={platform:ma,...e};b=hb(b,c,{...e,platform:{...e.platform,_c:d}});const {x:u,y:v,placement:m,strategy:p,middlewareData:w}=await b;if(k&&w.arrow){const {x:q,y:t}=w.arrow;b=m.split("-")[0];d=null!=q?"left":"top";e=jb[b];"floatingLayout"in a&&(a.floatingLayout="left"===b||"right"===b?"horizontal":"vertical");Object.assign(k.style,{left:"",top:"",bottom:"",right:"",[d]:`${"left"==d?q:t}px`,[b]:"100%",transform:e})}b=(k=w.hide?.referenceHidden?"hidden": null)?"none":null;c.setAttribute("data-placement",m);({open:a}=a);Object.assign(c.style,{visibility:k,pointerEvents:b,position:p,transform:a?`translate(${Ea(u)}px,${Ea(v)}px)`:"",top:0,left:0})},Ma="top bottom right left top-start top-end bottom-start bottom-end right-start right-end left-start left-end".split(" "),jb={top:"",left:"rotate(-90deg)",bottom:"rotate(180deg)",right:"rotate(90deg)"},V=new WeakMap,ea=new WeakMap,kb=Math.ceil(Math.hypot(4,4));L.FloatingCSS={animation:"calcite-floating-ui-anim", animationActive:"calcite-floating-ui-anim--active"};L.connectFloatingUI=async function(a,b,c){if(c&&b&&(Ha(a,b,c),Object.assign(c.style,{visibility:"hidden",pointerEvents:"none",position:a.overlayPositioning}),a.open))return Ga(a,b,c)};L.defaultMenuPlacement="bottom-start";L.defaultOffsetDistance=kb;L.disconnectFloatingUI=Ha;L.filterComputedPlacements=function(a,b){const c=a.filter(d=>Ma.includes(d));c.length!==a.length&&console.warn(`${b.tagName}: Invalid value found in: flipPlacements. Try any of these: ${Ma.map(d=> `"${d}"`).join(", ").trim()}`,{el:b});return c};L.reposition=async function(a,b,c=!1){if(a.open&&b.floatingEl&&b.referenceEl){if(!V.get(a))return Ga(a,b.referenceEl,b.floatingEl);c?(c=ea.get(a),c||(c=Oa.debounce(La,100,{leading:!0,maxWait:100}),ea.set(a,c))):c=La;await c(a,b)}}});