UNPKG

@scania/tegel

Version:
1 lines 25.1 kB
import{r as t,c as e,h as n,H as i,a as r}from"./p-9xxNGlso.js";import{g as o}from"./p-Cn4f8w1e.js";var s="top",a="bottom",u="right",f="left",c="auto",d=[s,a,u,f],l="start",h="end",v="viewport",p="popper",b=d.reduce((function(t,e){return t.concat([e+"-"+l,e+"-"+h])}),[]),m=[].concat(d,[c]).reduce((function(t,e){return t.concat([e,e+"-"+l,e+"-"+h])}),[]),y=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function g(t){return t?(t.nodeName||"").toLowerCase():null}function w(t){if(null==t)return window;if("[object Window]"!==t.toString()){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function x(t){return t instanceof w(t).Element||t instanceof Element}function O(t){return t instanceof w(t).HTMLElement||t instanceof HTMLElement}function j(t){return"undefined"!=typeof ShadowRoot&&(t instanceof w(t).ShadowRoot||t instanceof ShadowRoot)}function k(t){return t.split("-")[0]}var E=Math.max,C=Math.min,S=Math.round;function M(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map((function(t){return t.brand+"/"+t.version})).join(" "):navigator.userAgent}function T(){return!/^((?!chrome|android).)*safari/i.test(M())}function P(t,e,n){void 0===e&&(e=!1),void 0===n&&(n=!1);var i=t.getBoundingClientRect(),r=1,o=1;e&&O(t)&&(r=t.offsetWidth>0&&S(i.width)/t.offsetWidth||1,o=t.offsetHeight>0&&S(i.height)/t.offsetHeight||1);var s=(x(t)?w(t):window).visualViewport,a=!T()&&n,u=(i.left+(a&&s?s.offsetLeft:0))/r,f=(i.top+(a&&s?s.offsetTop:0))/o,c=i.width/r,d=i.height/o;return{width:c,height:d,top:f,right:u+c,bottom:f+d,left:u,x:u,y:f}}function R(t){var e=P(t),n=t.offsetWidth,i=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-i)<=1&&(i=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:i}}function A(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&j(n)){var i=e;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function q(t){return w(t).getComputedStyle(t)}function B(t){return["table","td","th"].indexOf(g(t))>=0}function W(t){return((x(t)?t.ownerDocument:t.document)||window.document).documentElement}function I(t){return"html"===g(t)?t:t.assignedSlot||t.parentNode||(j(t)?t.host:null)||W(t)}function L(t){return O(t)&&"fixed"!==q(t).position?t.offsetParent:null}function H(t){for(var e=w(t),n=L(t);n&&B(n)&&"static"===q(n).position;)n=L(n);return n&&("html"===g(n)||"body"===g(n)&&"static"===q(n).position)?e:n||function(t){var e=/firefox/i.test(M());if(/Trident/i.test(M())&&O(t)&&"fixed"===q(t).position)return null;var n=I(t);for(j(n)&&(n=n.host);O(n)&&["html","body"].indexOf(g(n))<0;){var i=q(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||e&&"filter"===i.willChange||e&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(t)||e}function z(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function D(t,e,n){return E(t,C(e,n))}function _(t){return Object.assign({},{top:0,right:0,bottom:0,left:0},t)}function F(t,e){return e.reduce((function(e,n){return e[n]=t,e}),{})}function U(t){return t.split("-")[1]}var V={top:"auto",right:"auto",bottom:"auto",left:"auto"};function $(t){var e,n=t.popper,i=t.popperRect,r=t.placement,o=t.variation,c=t.offsets,d=t.position,l=t.gpuAcceleration,v=t.adaptive,p=t.roundOffsets,b=t.isFixed,m=c.x,y=void 0===m?0:m,g=c.y,x=void 0===g?0:g,O="function"==typeof p?p({x:y,y:x}):{x:y,y:x};y=O.x,x=O.y;var j=c.hasOwnProperty("x"),k=c.hasOwnProperty("y"),E=f,C=s,M=window;if(v){var T=H(n),P="clientHeight",R="clientWidth";T===w(n)&&"static"!==q(T=W(n)).position&&"absolute"===d&&(P="scrollHeight",R="scrollWidth"),(r===s||(r===f||r===u)&&o===h)&&(C=a,x-=(b&&T===M&&M.visualViewport?M.visualViewport.height:T[P])-i.height,x*=l?1:-1),r!==f&&(r!==s&&r!==a||o!==h)||(E=u,y-=(b&&T===M&&M.visualViewport?M.visualViewport.width:T[R])-i.width,y*=l?1:-1)}var A,B=Object.assign({position:d},v&&V),I=!0===p?function(t,e){var n=t.y,i=e.devicePixelRatio||1;return{x:S(t.x*i)/i||0,y:S(n*i)/i||0}}({x:y,y:x},w(n)):{x:y,y:x};return y=I.x,x=I.y,Object.assign({},B,l?((A={})[C]=k?"0":"",A[E]=j?"0":"",A.transform=(M.devicePixelRatio||1)<=1?"translate("+y+"px, "+x+"px)":"translate3d("+y+"px, "+x+"px, 0)",A):((e={})[C]=k?x+"px":"",e[E]=j?y+"px":"",e.transform="",e))}var G={passive:!0},K={left:"right",right:"left",bottom:"top",top:"bottom"};function N(t){return t.replace(/left|right|bottom|top/g,(function(t){return K[t]}))}var J={start:"end",end:"start"};function Q(t){return t.replace(/start|end/g,(function(t){return J[t]}))}function X(t){var e=w(t);return{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Y(t){return P(W(t)).left+X(t).scrollLeft}function Z(t){var e=q(t);return/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function tt(t){return["html","body","#document"].indexOf(g(t))>=0?t.ownerDocument.body:O(t)&&Z(t)?t:tt(I(t))}function et(t,e){var n;void 0===e&&(e=[]);var i=tt(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),o=w(i),s=r?[o].concat(o.visualViewport||[],Z(i)?i:[]):i,a=e.concat(s);return r?a:a.concat(et(I(s)))}function nt(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function it(t,e,n){return e===v?nt(function(t,e){var n=w(t),i=W(t),r=n.visualViewport,o=i.clientWidth,s=i.clientHeight,a=0,u=0;if(r){o=r.width,s=r.height;var f=T();(f||!f&&"fixed"===e)&&(a=r.offsetLeft,u=r.offsetTop)}return{width:o,height:s,x:a+Y(t),y:u}}(t,n)):x(e)?function(t,e){var n=P(t,!1,"fixed"===e);return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}(e,n):nt(function(t){var e,n=W(t),i=X(t),r=null==(e=t.ownerDocument)?void 0:e.body,o=E(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=E(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-i.scrollLeft+Y(t),u=-i.scrollTop;return"rtl"===q(r||n).direction&&(a+=E(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:s,x:a,y:u}}(W(t)))}function rt(t){var e,n=t.reference,i=t.element,r=t.placement,o=r?k(r):null,c=r?U(r):null,d=n.x+n.width/2-i.width/2,v=n.y+n.height/2-i.height/2;switch(o){case s:e={x:d,y:n.y-i.height};break;case a:e={x:d,y:n.y+n.height};break;case u:e={x:n.x+n.width,y:v};break;case f:e={x:n.x-i.width,y:v};break;default:e={x:n.x,y:n.y}}var p=o?z(o):null;if(null!=p){var b="y"===p?"height":"width";switch(c){case l:e[p]=e[p]-(n[b]/2-i[b]/2);break;case h:e[p]=e[p]+(n[b]/2-i[b]/2)}}return e}function ot(t,e){void 0===e&&(e={});var n=e.placement,i=void 0===n?t.placement:n,r=e.strategy,o=void 0===r?t.strategy:r,f=e.boundary,c=void 0===f?"clippingParents":f,l=e.rootBoundary,h=void 0===l?v:l,b=e.elementContext,m=void 0===b?p:b,y=e.altBoundary,w=void 0!==y&&y,j=e.padding,k=void 0===j?0:j,S=_("number"!=typeof k?k:F(k,d)),M=t.rects.popper,T=t.elements[w?m===p?"reference":p:m],R=function(t,e,n,i){var r="clippingParents"===e?function(t){var e=et(I(t)),n=["absolute","fixed"].indexOf(q(t).position)>=0&&O(t)?H(t):t;return x(n)?e.filter((function(t){return x(t)&&A(t,n)&&"body"!==g(t)})):[]}(t):[].concat(e),o=[].concat(r,[n]),s=o.reduce((function(e,n){var r=it(t,n,i);return e.top=E(r.top,e.top),e.right=C(r.right,e.right),e.bottom=C(r.bottom,e.bottom),e.left=E(r.left,e.left),e}),it(t,o[0],i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}(x(T)?T:T.contextElement||W(t.elements.popper),c,h,o),B=P(t.elements.reference),L=rt({reference:B,element:M,placement:i}),z=nt(Object.assign({},M,L)),D=m===p?z:B,U={top:R.top-D.top+S.top,bottom:D.bottom-R.bottom+S.bottom,left:R.left-D.left+S.left,right:D.right-R.right+S.right},V=t.modifiersData.offset;if(m===p&&V){var $=V[i];Object.keys(U).forEach((function(t){var e=[u,a].indexOf(t)>=0?1:-1,n=[s,a].indexOf(t)>=0?"y":"x";U[t]+=$[n]*e}))}return U}function st(t,e){void 0===e&&(e={});var n=e.boundary,i=e.rootBoundary,r=e.padding,o=e.flipVariations,s=e.allowedAutoPlacements,a=void 0===s?m:s,u=U(e.placement),f=u?o?b:b.filter((function(t){return U(t)===u})):d,c=f.filter((function(t){return a.indexOf(t)>=0}));0===c.length&&(c=f);var l=c.reduce((function(e,o){return e[o]=ot(t,{placement:o,boundary:n,rootBoundary:i,padding:r})[k(o)],e}),{});return Object.keys(l).sort((function(t,e){return l[t]-l[e]}))}var at={name:"flip",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,i=t.name;if(!e.modifiersData[i]._skip){for(var r=n.mainAxis,o=void 0===r||r,d=n.altAxis,h=void 0===d||d,v=n.fallbackPlacements,p=n.padding,b=n.boundary,m=n.rootBoundary,y=n.altBoundary,g=n.flipVariations,w=void 0===g||g,x=n.allowedAutoPlacements,O=e.options.placement,j=k(O),E=v||(j!==O&&w?function(t){if(k(t)===c)return[];var e=N(t);return[Q(t),e,Q(e)]}(O):[N(O)]),C=[O].concat(E).reduce((function(t,n){return t.concat(k(n)===c?st(e,{placement:n,boundary:b,rootBoundary:m,padding:p,flipVariations:w,allowedAutoPlacements:x}):n)}),[]),S=e.rects.reference,M=e.rects.popper,T=new Map,P=!0,R=C[0],A=0;A<C.length;A++){var q=C[A],B=k(q),W=U(q)===l,I=[s,a].indexOf(B)>=0,L=I?"width":"height",H=ot(e,{placement:q,boundary:b,rootBoundary:m,altBoundary:y,padding:p}),z=I?W?u:f:W?a:s;S[L]>M[L]&&(z=N(z));var D=N(z),_=[];if(o&&_.push(H[B]<=0),h&&_.push(H[z]<=0,H[D]<=0),_.every((function(t){return t}))){R=q,P=!1;break}T.set(q,_)}if(P)for(var F=function(t){var e=C.find((function(e){var n=T.get(e);if(n)return n.slice(0,t).every((function(t){return t}))}));if(e)return R=e,"break"},V=w?3:1;V>0&&"break"!==F(V);V--);e.placement!==R&&(e.modifiersData[i]._skip=!0,e.placement=R,e.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}};function ut(t,e,n){return void 0===n&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function ft(t){return[s,u,a,f].some((function(e){return t[e]>=0}))}function ct(t,e,n){void 0===n&&(n=!1);var i,r,o=O(e),s=O(e)&&function(t){var e=t.getBoundingClientRect(),n=S(e.width)/t.offsetWidth||1,i=S(e.height)/t.offsetHeight||1;return 1!==n||1!==i}(e),a=W(e),u=P(t,s,n),f={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&(("body"!==g(e)||Z(a))&&(f=(i=e)!==w(i)&&O(i)?{scrollLeft:(r=i).scrollLeft,scrollTop:r.scrollTop}:X(i)),O(e)?((c=P(e,!0)).x+=e.clientLeft,c.y+=e.clientTop):a&&(c.x=Y(a))),{x:u.left+f.scrollLeft-c.x,y:u.top+f.scrollTop-c.y,width:u.width,height:u.height}}function dt(t){var e=new Map,n=new Set,i=[];function r(t){n.add(t.name),[].concat(t.requires||[],t.requiresIfExists||[]).forEach((function(t){if(!n.has(t)){var i=e.get(t);i&&r(i)}})),i.push(t)}return t.forEach((function(t){e.set(t.name,t)})),t.forEach((function(t){n.has(t.name)||r(t)})),i}var lt={placement:"bottom",modifiers:[],strategy:"absolute"};function ht(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some((function(t){return!(t&&"function"==typeof t.getBoundingClientRect)}))}function vt(t){void 0===t&&(t={});var e=t.defaultModifiers,n=void 0===e?[]:e,i=t.defaultOptions,r=void 0===i?lt:i;return function(t,e,i){void 0===i&&(i=r);var o,s,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},lt,r),modifiersData:{},elements:{reference:t,popper:e},attributes:{},styles:{}},u=[],f=!1,c={state:a,setOptions:function(i){var o="function"==typeof i?i(a.options):i;d(),a.options=Object.assign({},r,a.options,o),a.scrollParents={reference:x(t)?et(t):t.contextElement?et(t.contextElement):[],popper:et(e)};var s,f,l=function(t){var e=dt(t);return y.reduce((function(t,n){return t.concat(e.filter((function(t){return t.phase===n})))}),[])}((s=[].concat(n,a.options.modifiers),f=s.reduce((function(t,e){var n=t[e.name];return t[e.name]=n?Object.assign({},n,e,{options:Object.assign({},n.options,e.options),data:Object.assign({},n.data,e.data)}):e,t}),{}),Object.keys(f).map((function(t){return f[t]}))));return a.orderedModifiers=l.filter((function(t){return t.enabled})),a.orderedModifiers.forEach((function(t){var e=t.options,n=t.effect;if("function"==typeof n){var i=n({state:a,name:t.name,instance:c,options:void 0===e?{}:e});u.push(i||function(){})}})),c.update()},forceUpdate:function(){if(!f){var t=a.elements,e=t.reference,n=t.popper;if(ht(e,n)){a.rects={reference:ct(e,H(n),"fixed"===a.options.strategy),popper:R(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach((function(t){return a.modifiersData[t.name]=Object.assign({},t.data)}));for(var i=0;i<a.orderedModifiers.length;i++)if(!0!==a.reset){var r=a.orderedModifiers[i],o=r.fn,s=r.options;"function"==typeof o&&(a=o({state:a,options:void 0===s?{}:s,name:r.name,instance:c})||a)}else a.reset=!1,i=-1}}},update:(o=function(){return new Promise((function(t){c.forceUpdate(),t(a)}))},function(){return s||(s=new Promise((function(t){Promise.resolve().then((function(){s=void 0,t(o())}))}))),s}),destroy:function(){d(),f=!0}};if(!ht(t,e))return c;function d(){u.forEach((function(t){return t()})),u=[]}return c.setOptions(i).then((function(t){!f&&i.onFirstUpdate&&i.onFirstUpdate(t)})),c}}var pt=vt({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var e=t.state,n=t.instance,i=t.options,r=i.scroll,o=void 0===r||r,s=i.resize,a=void 0===s||s,u=w(e.elements.popper),f=[].concat(e.scrollParents.reference,e.scrollParents.popper);return o&&f.forEach((function(t){t.addEventListener("scroll",n.update,G)})),a&&u.addEventListener("resize",n.update,G),function(){o&&f.forEach((function(t){t.removeEventListener("scroll",n.update,G)})),a&&u.removeEventListener("resize",n.update,G)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var e=t.state;e.modifiersData[t.name]=rt({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var e=t.state,n=t.options,i=n.gpuAcceleration,r=void 0===i||i,o=n.adaptive,s=void 0===o||o,a=n.roundOffsets,u=void 0===a||a,f={placement:k(e.placement),variation:U(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:"fixed"===e.options.strategy};null!=e.modifiersData.popperOffsets&&(e.styles.popper=Object.assign({},e.styles.popper,$(Object.assign({},f,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:u})))),null!=e.modifiersData.arrow&&(e.styles.arrow=Object.assign({},e.styles.arrow,$(Object.assign({},f,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var e=t.state;Object.keys(e.elements).forEach((function(t){var n=e.styles[t]||{},i=e.attributes[t]||{},r=e.elements[t];O(r)&&g(r)&&(Object.assign(r.style,n),Object.keys(i).forEach((function(t){var e=i[t];!1===e?r.removeAttribute(t):r.setAttribute(t,!0===e?"":e)})))}))},effect:function(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach((function(t){var i=e.elements[t],r=e.attributes[t]||{},o=Object.keys(e.styles.hasOwnProperty(t)?e.styles[t]:n[t]).reduce((function(t,e){return t[e]="",t}),{});O(i)&&g(i)&&(Object.assign(i.style,o),Object.keys(r).forEach((function(t){i.removeAttribute(t)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var e=t.state,n=t.name,i=t.options.offset,r=void 0===i?[0,0]:i,o=m.reduce((function(t,n){return t[n]=function(t,e,n){var i=k(t),r=[f,s].indexOf(i)>=0?-1:1,o="function"==typeof n?n(Object.assign({},e,{placement:t})):n,a=o[0],c=o[1];return a=a||0,c=(c||0)*r,[f,u].indexOf(i)>=0?{x:c,y:a}:{x:a,y:c}}(n,e.rects,r),t}),{}),a=o[e.placement],c=a.y;null!=e.modifiersData.popperOffsets&&(e.modifiersData.popperOffsets.x+=a.x,e.modifiersData.popperOffsets.y+=c),e.modifiersData[n]=o}},at,{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var e=t.state,n=t.options,i=t.name,r=n.mainAxis,o=void 0===r||r,c=n.altAxis,d=void 0!==c&&c,h=n.tether,v=void 0===h||h,p=n.tetherOffset,b=void 0===p?0:p,m=ot(e,{boundary:n.boundary,rootBoundary:n.rootBoundary,padding:n.padding,altBoundary:n.altBoundary}),y=k(e.placement),g=U(e.placement),w=!g,x=z(y),O="x"===x?"y":"x",j=e.modifiersData.popperOffsets,S=e.rects.reference,M=e.rects.popper,T="function"==typeof b?b(Object.assign({},e.rects,{placement:e.placement})):b,P="number"==typeof T?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),A=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,q={x:0,y:0};if(j){if(o){var B,W="y"===x?s:f,I="y"===x?a:u,L="y"===x?"height":"width",_=j[x],F=_+m[W],V=_-m[I],$=v?-M[L]/2:0,G=g===l?S[L]:M[L],K=g===l?-M[L]:-S[L],N=e.elements.arrow,J=v&&N?R(N):{width:0,height:0},Q=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},X=Q[W],Y=Q[I],Z=D(0,S[L],J[L]),tt=w?S[L]/2-$-Z-X-P.mainAxis:G-Z-X-P.mainAxis,et=w?-S[L]/2+$+Z+Y+P.mainAxis:K+Z+Y+P.mainAxis,nt=e.elements.arrow&&H(e.elements.arrow),it=null!=(B=null==A?void 0:A[x])?B:0,rt=_+et-it,st=D(v?C(F,_+tt-it-(nt?"y"===x?nt.clientTop||0:nt.clientLeft||0:0)):F,_,v?E(V,rt):V);j[x]=st,q[x]=st-_}if(d){var at,ut=j[O],ft="y"===O?"height":"width",ct=ut+m["x"===x?s:f],dt=ut-m["x"===x?a:u],lt=-1!==[s,f].indexOf(y),ht=null!=(at=null==A?void 0:A[O])?at:0,vt=lt?ct:ut-S[ft]-M[ft]-ht+P.altAxis,pt=lt?ut+S[ft]+M[ft]-ht-P.altAxis:dt,bt=v&&lt?function(t,e,n){var i=D(t,e,n);return i>n?n:i}(vt,ut,pt):D(v?vt:ct,ut,v?pt:dt);j[O]=bt,q[O]=bt-ut}e.modifiersData[i]=q}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var e,n=t.state,i=t.name,r=t.options,o=n.elements.arrow,c=n.modifiersData.popperOffsets,l=k(n.placement),h=z(l),v=[f,u].indexOf(l)>=0?"height":"width";if(o&&c){var p=function(t,e){return _("number"!=typeof(t="function"==typeof t?t(Object.assign({},e.rects,{placement:e.placement})):t)?t:F(t,d))}(r.padding,n),b=R(o),m="y"===h?s:f,y="y"===h?a:u,g=n.rects.reference[v]+n.rects.reference[h]-c[h]-n.rects.popper[v],w=c[h]-n.rects.reference[h],x=H(o),O=x?"y"===h?x.clientHeight||0:x.clientWidth||0:0,j=O/2-b[v]/2+(g/2-w/2),E=D(p[m],j,O-b[v]-p[y]);n.modifiersData[i]=((e={})[h]=E,e.centerOffset=E-j,e)}},effect:function(t){var e=t.state,n=t.options.element,i=void 0===n?"[data-popper-arrow]":n;null!=i&&("string"!=typeof i||(i=e.elements.popper.querySelector(i)))&&A(e.elements.popper,i)&&(e.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var e=t.state,n=t.name,i=e.rects.reference,r=e.rects.popper,o=e.modifiersData.preventOverflow,s=ot(e,{elementContext:"reference"}),a=ot(e,{altBoundary:!0}),u=ut(s,i),f=ut(a,r,o),c=ft(u),d=ft(f);e.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:f,isReferenceHidden:c,hasPopperEscaped:d},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":d})}}]});const bt=class{constructor(n){t(this,n),this.internalTdsShow=e(this,"internalTdsShow",4),this.internalTdsClose=e(this,"internalTdsClose",0),this.defaultShow=!1,this.animation="none",this.show=null,this.placement="auto",this.offsetSkidding=0,this.offsetDistance=8,this.modifiers=[],this.trigger="click",this.autoHide=!0,this.renderedShowValue=!1,this.popperInstance=null,this.isShown=!1,this.disableLogic=!1,this.hasShownAtLeastOnce=!1,this.openedByKeyboard=!1,this.uuid=o(),this.setIsShown=t=>{this.isShown="function"==typeof t?t(this.isShown):t,this.isShown?(this.hasShownAtLeastOnce=!0,this.internalTdsShow.emit()):(this.internalTdsClose.emit(),this.openedByKeyboard=!1)},this.onClickTarget=t=>{t.stopPropagation(),this.openedByKeyboard="keydown"===t.type||"Enter"===t.key||" "===t.key,this.setIsShown((t=>!t))},this.handleShow=t=>{t.stopPropagation(),this.openedByKeyboard="focusin"===t.type,this.setIsShown(!0)},this.handleHide=t=>{t.stopPropagation(),this.setIsShown(!1)}}async close(){this.setIsShown(!1)}onAnyClick(t){"click"===this.trigger&&this.isShown&&null===this.show&&!t.composedPath().includes(this.host)&&this.setIsShown(!1)}onTdsShow(t){null===this.show&&t.target.id!==`tds-popover-core-${this.uuid}`&&this.setIsShown(!1)}handleKeydown(t){"Escape"===t.key&&this.isShown&&this.setIsShown(!1)}onShowChange(t){this.setIsShown(t)}onReferenceElChanged(t,e){t!==e&&this.initialize({referenceEl:t,trigger:this.trigger})}onTriggerChanged(t){this.initialize({referenceEl:this.referenceEl,trigger:t})}onIsShownChange(t){t&&this.openedByKeyboard&&setTimeout((()=>{this.focusFirstElement()}),0)}focusFirstElement(){const t=this.host.querySelectorAll('a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])');t.length>0?t[0].focus():(this.host.setAttribute("tabindex","0"),this.host.focus())}initialize({referenceEl:t,trigger:e}){var n,i,r,o,s,a;this.cleanUp(),this.target=void 0!==t?t:this.selector?document.querySelector(this.selector):null,this.popperInstance=this.target?pt(this.target,this.host,{strategy:"fixed",placement:this.placement,modifiers:[{name:"offset",options:{offset:[this.offsetSkidding,this.offsetDistance]}},...this.modifiers]}):null,this.popperInstance||console.error("Could not initialize: reference element not found."),"click"===e&&null===this.show&&(null===(n=this.target)||void 0===n||n.addEventListener("click",this.onClickTarget),null===(i=this.target)||void 0===i||i.addEventListener("keydown",(t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.openedByKeyboard=!0,this.onClickTarget(t))}))),"hover"!==e&&"hover-popover"!==e||(null===(r=this.target)||void 0===r||r.addEventListener("focusin",this.handleShow),null===(o=this.target)||void 0===o||o.addEventListener("focusout",this.handleHide),null===(s=this.target)||void 0===s||s.addEventListener("mouseenter",this.handleShow),null===(a=this.target)||void 0===a||a.addEventListener("mouseleave",this.handleHide),"hover-popover"===e&&(this.host.addEventListener("mouseenter",this.handleShow),this.host.addEventListener("mouseleave",this.handleHide)))}cleanUp(){var t,e,n,i,r,o,s,a,u;null===(t=this.target)||void 0===t||t.removeEventListener("click",this.onClickTarget),null===(e=this.target)||void 0===e||e.removeEventListener("keydown",this.onClickTarget),null===(n=this.target)||void 0===n||n.removeEventListener("focusin",this.handleShow),null===(i=this.target)||void 0===i||i.removeEventListener("focusout",this.handleHide),null===(r=this.target)||void 0===r||r.removeEventListener("mouseenter",this.handleShow),null===(o=this.target)||void 0===o||o.removeEventListener("mouseleave",this.handleHide),null===(s=this.host)||void 0===s||s.removeEventListener("mouseenter",this.handleShow),null===(a=this.host)||void 0===a||a.removeEventListener("mouseleave",this.handleHide),null===(u=this.popperInstance)||void 0===u||u.destroy()}connectedCallback(){if(void 0===this.selector&&void 0===this.referenceEl)return this.disableLogic=!0,void console.warn("TDS-POPOVER-CORE: Popover internal logic disabled. Please provide a `selector` or `referenceEl` prop");this.initialize({referenceEl:this.referenceEl,trigger:this.trigger})}componentWillLoad(){this.setIsShown(!0===this.show||!0===this.defaultShow)}componentDidRender(){var t;!this.isShown||this.renderedShowValue||this.disableLogic||null===(t=this.popperInstance)||void 0===t||t.update(),this.renderedShowValue=this.isShown}disconnectedCallback(){this.cleanUp()}render(){const t=(e={"is-shown":this.isShown&&"none"===this.animation||void 0===this.animation,"is-hidden":!this.isShown&&"none"===this.animation||void 0===this.animation,"initially-hidden":!this.hasShownAtLeastOnce,"tds-animation-enter-fade":this.isShown&&"fade"===this.animation,"tds-animation-exit-fade":!this.isShown&&"fade"===this.animation},Object.keys(e).filter((t=>e[t])).join(" "));var e;return n(i,{key:"24f0a1d31e1dd556cf3552f3c7a6ede8ce35dfc2",role:this.host.getAttribute("role"),class:t,id:`tds-popover-core-${this.uuid}`},n("slot",{key:"3e8df41cea7f8ed636974571bd1d5e8cbd802732"}))}get host(){return r(this)}static get watchers(){return{show:[{onShowChange:0}],referenceEl:[{onReferenceElChanged:0}],trigger:[{onTriggerChanged:0}],isShown:[{onIsShownChange:0}]}}};bt.style=".sc-tds-popover-core-h{pointer-events:none;display:block}.tds-animation-enter-fade.sc-tds-popover-core-h{animation:tds-fade-in var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-enter) forwards}.tds-animation-exit-fade.sc-tds-popover-core-h{animation:tds-fade-out var(--tds-motion-duration-moderate-01) var(--tds-motion-easing-exit) forwards}.is-shown.sc-tds-popover-core-h{opacity:1;pointer-events:auto;visibility:visible}.is-hidden.sc-tds-popover-core-h{opacity:0;pointer-events:none;visibility:hidden}.initially-hidden.sc-tds-popover-core-h{opacity:0;pointer-events:none;visibility:hidden}";export{bt as tds_popover_core}