PageSourceSearch

https://protonvpn.com/blog/_astro/tooltipEngine.CFsIy1AM.js

js protonvpn.com collected 2026-10-01 08:44:11 UTC 4,932 bytes, 1 lines download raw bytes

1import{a as e,o as t,r as n,s as r,t as i}from"./floating-ui.dom.CPn0WIwl.js";import{t as a}from"./constants.Cu7ohYAd.js";var o={id:`proton-tooltip`,openDelay:300,closeDelay:200,ignoreMouseDelay:500,gap:.375,padding:.5,arrowSize:.625,arrowClassName:`absolute rotate-45 bg-inherit`,className:`fixed inset-auto top-0 left-0 z-tooltip m-0 w-max max-w-52 overflow-visible rounded-lg border-0 bg-gray-700 p-3 text-white text-xs leading-normal`},s=Number.parseFloat(getComputedStyle(document.documentElement).fontSize)||16,c=e=>e*s,l=c(o.arrowSize),u=l*Math.SQRT2/2,d=u-l/2,f=typeof HTMLElement<`u`&&`showPopover`in HTMLElement.prototype,p=document.createElement(`div`);p.id=o.id,p.setAttribute(`role`,`tooltip`),p.className=o.className;var m=document.createElement(`div`);m.className=o.arrowClassName,m.style.width=`${o.arrowSize}rem`,m.style.height=`${o.arrowSize}rem`,f?p.popover=`manual`:p.hidden=!0,document.body.append(p);var h=()=>{p.isConnected||(C(),document.body.append(p))},g=e=>{p.textContent=e,p.append(m)},_=e=>{if(!f){p.hidden=!e;return}e?p.showPopover():p.matches(`:popover-open`)&&p.hidePopover()},v=()=>p.dataset.open!==void 0,y=()=>{p.dataset.instant=``},b=e=>{p.dataset.side=e},x=()=>{delete p.dataset.instant,p.dataset.open=``},S=e=>{e?p.dataset.moving=``:delete p.dataset.moving},C=()=>{delete p.dataset.open,delete p.dataset.moving},w=e=>e instanceof Node&&p.contains(e),T=(e,t)=>
1{if(e.getAttribute(`aria-label`)===t)return;let n=e.getAttribute(`aria-describedby`);e.setAttribute(`aria-describedby`,n?`${n} ${o.id}`:o.id)},E=e=>{let t=(e.getAttribute(`aria-describedby`)||``).split(` `).filter(e=>e&&e!==o.id).join(` `);t?e.setAttribute(`aria-describedby`,t):e.removeAttribute(`aria-describedby`)},D={start:[`left`,`right`],end:[`right`,`left`]},O={top:[`borderTopLeftRadius`,`borderTopRightRadius`],bottom:[`borderBottomLeftRadius`,`borderBottomRightRadius`],left:[`borderTopLeftRadius`,`borderBottomLeftRadius`],right:[`borderTopRightRadius`,`borderBottomRightRadius`]},k={top:!0,bottom:!0,left:!1,right:!1},A={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ee={name:`rects`,fn:({rects:e})=>({data:e})},j,M=e=>{let t=e.getAttribute(`data-tooltip-placement`)||`top`,[n,r]=t.split(`-`),i=D[n];if(!i)return t;let a=i[+(getComputedStyle(e).direction===`rtl`)];return r?`${a}-${r}`:a},N=(e,t,n)=>{for(let e of Object.values(O).flat())p.style[e]=``;if(n===void 0)return;j===void 0&&(j=Number.parseFloat(getComputedStyle(p).borderTopLeftRadius)||0);let[r,i]=O[e];n-d<j&&(p.style[r]=`0`),n+l+d>t-j&&(p.style[i]=`0`)},P=async(a,s)=>{let{x:l,y:f,placement:h,middlewareData:g}=await n(a,p,{strategy:`fixed`,placement:M(a),middleware:[t(c(o.gap)+u),e(),r({padding:c(o.padding)}),i({element:m,padding:d}),ee]});if(!s())return;p.style.left=`${l}px`,p.style.top=`${f}px`;let _=A[h.split(`-`)[0]];b(_);let{floating:y}=g.rects,{x:S,y:C,centerOffset:w}=g.arrow||{};m.hidden=!!w;for(let e of Object.values(A))m.style[e]=``;m.style.left=S===void 0?``:`${S}px`,m.style.top=C===void 0?``:`${C}px`,m.style[_]=`${-o.arrowSize/2}rem`,N(_,k[_]?y.width:y.height,m.hidden?void 0:S??C),!v()&&requestAnimationFrame(()=>{s()&&(p.getBoundingClientRect(),x())})},F=`[${a}]`,I,L=0,R=0,z=0,B,V=!1,H=0,U=(e,t)=>e<=0?(t(),0):window.setTimeout(t,e),W=()=>{window.clearTimeout(L),window.clearTimeout(R),window.cancelAnimationFrame(z),I&&(E(I),I=void 0,C(),_(!1))},G=e=>{let t=e.getAttribute(a);if(!t||I===e)return;h();let n=v();n?(I&&E(I),S(!0)):W(),g(t),I=e,T(e,t),n||(y(),_(!0)),P(e,()=>I===e)},K=()=>{I&&(S(!1),window.cancelAnimationFrame(z),z=window.requestAnimationFrame(()=>{let e=I;e&&(e.isConnected?P(e,()=>I===e):W())}))},q=e=>{let{target:t}=e;return t instanceof Element&&t.closest(F)||void 0},J=e=>{if(V)return;let t=q(e);if(!t&&w(e.target)){window.clearTimeout(R);return}if(!t){if(window.clearTimeout(L),I?.contains(document.activeElement))return;window.clearTimeout(R),R=U(o.closeDelay,W);return}window.clearTimeout(R),I!==t&&(window.clearTimeout(L),L=U(o.openDelay,()=>G(t)))},Y=e=>{window.clearTimeout(H),V=!0,B=q(e),B!==I&&W()},X=()=>{B=void 0},Z=()=>{window.clearTimeout(H),H=window.setTimeout(()=>{V=!1},o.ignoreMouseDelay)},Q=()=>{let e=B;B=void 0,e&&(I===e?W():G(e)),Z()},te=()=>{B=void 0,Z()},$=e=>{let t=q(e);t&&G(t)},ne=e=>{q(e)===I&&W()},re=e=>{e.key===`Escape`&&W()},ie=(e,t=!1)=>{document.addEventListener(`mouseover`,J,{passive:!0}),document.addEventListener(`focusin`,$,{passive:!0}),document.addEventListener(`focusout`,ne,{passive:!0}),document.addEventListener(`touchstart`,Y,{passive:!0}),document.addEventListener(`touchmove`,X,{passive:!0}),document.addEventListener(`touchend`,Q,{passive:!0}),document.addEventListener(`touchcancel`,te,{passive:!0}),document.addEventListener(`keydown`,re),window.addEventListener(`resize`,K,{passive:!0}),document.addEventListener(`scroll`,K,{capture:!0,passive:!0}),e.type===`mouseover`?J(e):e.type===`focusin`?$(e):e.type===`touchstart`&&(Y(e),t?Q():Z())};export{ie as init};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.