import{c as n,o as e,f as t,s as i}from"./p-DDtwbwIl.js";const o="pds-truncation-tooltip";function s(){if(document.querySelector("[data-pds-truncation-tooltip]"))return;const n=document.createElement("style");n.setAttribute("data-pds-truncation-tooltip","");n.textContent=`\n    .${o} {\n      position: fixed;\n      z-index: var(--pine-z-index-nuclear, 9999);\n    }\n    .${o}__content {\n      background-color: var(--pine-color-primary, #1a1a2e);\n      border-radius: calc(var(--pine-dimension-xs, 4px) * 1.25);\n      box-shadow: var(--pine-box-shadow, 0 2px 8px rgba(0,0,0,0.15));\n      color: var(--pine-color-text-primary, #fff);\n      cursor: text;\n      font-family: var(--pine-font-family-body, sans-serif);\n      font-size: var(--pine-font-size-body-sm, 0.875rem);\n      letter-spacing: var(--pine-letter-spacing, normal);\n      line-height: var(--pine-line-height-body, 1.5);\n      max-width: 320px;\n      opacity: 0;\n      padding: var(--pine-dimension-xs, 4px) calc(var(--pine-dimension-md, 12px) / 2);\n      transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;\n      user-select: text;\n      visibility: hidden;\n      width: max-content;\n      word-break: break-word;\n    }\n    .${o}--visible .${o}__content {\n      opacity: 1;\n      visibility: visible;\n    }\n  `;document.head.appendChild(n)}function a(n){return n.scrollWidth>n.clientWidth}function r(r){const{hostEl:l,contentEl:c,getTooltipText:u,placement:f="top"}=r;s();let p=null;let d=false;let m=false;let v=false;let x=null;let b=null;let y=null;if(typeof ResizeObserver!=="undefined"){b=new ResizeObserver((()=>{if(y){clearTimeout(y)}y=setTimeout((()=>{y=null;if(p&&p.isConnected&&!a(c)){z()}}),100)}));b.observe(c)}function h(){if(p)return;const n=u();if(!n||n.trim()==="")return;p=document.createElement("div");p.className=o;p.setAttribute("role","tooltip");p.setAttribute("aria-hidden","false");const e=document.createElement("div");e.className=`${o}__content`;e.textContent=n.trim();p.appendChild(e);document.body.appendChild(p);p.addEventListener("mouseenter",O);p.addEventListener("mouseleave",j);w().then((()=>{if(p){p.classList.add(`${o}--visible`)}}))}async function w(){if(!p)return;try{const{x:o,y:s}=await n(l,p,{placement:f,strategy:"fixed",middleware:[e(4),t(),i({padding:5})]});Object.assign(p.style,{left:`${o}px`,top:`${s}px`})}catch(n){if(p){const n=l.getBoundingClientRect();const e=p.getBoundingClientRect();const t=5;const i=Math.max(t,Math.min(n.left,window.innerWidth-e.width-t));const o=Math.max(t,n.top-e.height-8);p.style.left=`${i}px`;p.style.top=`${o}px`}}}function $(){if(p){p.removeEventListener("mouseenter",O);p.removeEventListener("mouseleave",j);p.classList.remove(`${o}--visible`);if(p.parentNode&&p.isConnected){try{p.parentNode.removeChild(p)}catch(n){}}p=null}}function g(){if(x!==null){clearTimeout(x);x=null}}function T(){g();if(!a(c))return;h()}function z(){if(d||m||v)return;$()}function _(){g();x=setTimeout((()=>{x=null;z()}),100)}function k(){d=true;T()}function M(){d=false;_()}function O(){m=true;g()}function j(){m=false;_()}function D(){v=true;T()}function E(){v=false;_()}l.addEventListener("mouseenter",k);l.addEventListener("mouseleave",M);l.addEventListener("focusin",D);l.addEventListener("focusout",E);return()=>{g();if(y){clearTimeout(y);y=null}if(b){b.disconnect()}l.removeEventListener("mouseenter",k);l.removeEventListener("mouseleave",M);l.removeEventListener("focusin",D);l.removeEventListener("focusout",E);$()}}export{r as s};
//# sourceMappingURL=p-BNSGedhN.js.map