import{w as t,p as i,s as e,i as o,n as a,l as s,R as n,M as r,m as l,j as c}from"./p-BxEPsDRj.js";import{n as p,r as d,c as h}from"./p-CrMmJdZ6.js";const f=i({message:"",open:false,triggerRect:{width:0,height:0,top:0,left:0},variant:"shade"});const u={state:f,subscribe(t){return o(f,(()=>t(f)))},subscribeKey(t,i){return e(f,t,i)},showTooltip({message:t,triggerRect:i,variant:e}){f.open=true;f.message=t;f.triggerRect=i;f.variant=e},hide(){f.open=false;f.message="";f.triggerRect={width:0,height:0,top:0,left:0}}};const m=t(u);var w=a`
  :host {
    width: 100%;
    display: block;
  }
`;var v=undefined&&undefined.__decorate||function(t,i,e,o){var a=arguments.length,s=a<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,e):o,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(t,i,e,o);else for(var r=t.length-1;r>=0;r--)if(n=t[r])s=(a<3?n(s):a>3?n(i,e,s):n(i,e))||s;return a>3&&s&&Object.defineProperty(i,e,s),s};let g=class t extends s{constructor(){super();this.unsubscribe=[];this.text="";this.open=m.state.open;this.unsubscribe.push(n.subscribeKey("view",(()=>{m.hide()})),r.subscribeKey("open",(t=>{if(!t){m.hide()}})),m.subscribeKey("open",(t=>{this.open=t})))}disconnectedCallback(){this.unsubscribe.forEach((t=>t()));m.hide()}render(){return l`
      <div
        @pointermove=${this.onMouseEnter.bind(this)}
        @pointerleave=${this.onMouseLeave.bind(this)}
      >
        ${this.renderChildren()}
      </div>
    `}renderChildren(){return l`<slot></slot> `}onMouseEnter(){const t=this.getBoundingClientRect();if(!this.open){const i=document.querySelector("w3m-modal");const e={width:t.width,height:t.height,left:t.left,top:t.top};if(i){const o=i.getBoundingClientRect();e.left=t.left-(window.innerWidth-o.width)/2;e.top=t.top-(window.innerHeight-o.height)/2}m.showTooltip({message:this.text,triggerRect:e,variant:"shade"})}}onMouseLeave(t){if(!this.contains(t.relatedTarget)){m.hide()}}};g.styles=[w];v([p()],g.prototype,"text",void 0);v([d()],g.prototype,"open",void 0);g=v([h("w3m-tooltip-trigger")],g);var x=c`
  :host {
    pointer-events: none;
  }

  :host > wui-flex {
    display: var(--w3m-tooltip-display);
    opacity: var(--w3m-tooltip-opacity);
    padding: 9px ${({spacing:t})=>t["3"]} 10px ${({spacing:t})=>t["3"]};
    border-radius: ${({borderRadius:t})=>t["3"]};
    color: ${({tokens:t})=>t.theme.backgroundPrimary};
    position: absolute;
    top: var(--w3m-tooltip-top);
    left: var(--w3m-tooltip-left);
    transform: translate(calc(-50% + var(--w3m-tooltip-parent-width)), calc(-100% - 8px));
    max-width: calc(var(--apkt-modal-width) - ${({spacing:t})=>t["5"]});
    transition: opacity ${({durations:t})=>t["lg"]}
      ${({easings:t})=>t["ease-out-power-2"]};
    will-change: opacity;
    opacity: 0;
    animation-duration: ${({durations:t})=>t["xl"]};
    animation-timing-function: ${({easings:t})=>t["ease-out-power-2"]};
    animation-name: fade-in;
    animation-fill-mode: forwards;
  }

  :host([data-variant='shade']) > wui-flex {
    background-color: ${({tokens:t})=>t.theme.foregroundPrimary};
  }

  :host([data-variant='shade']) > wui-flex > wui-text {
    color: ${({tokens:t})=>t.theme.textSecondary};
  }

  :host([data-variant='fill']) > wui-flex {
    background-color: ${({tokens:t})=>t.theme.backgroundPrimary};
    border: 1px solid ${({tokens:t})=>t.theme.borderPrimary};
  }

  wui-icon {
    position: absolute;
    width: 12px !important;
    height: 4px !important;
    color: ${({tokens:t})=>t.theme.foregroundPrimary};
  }

  wui-icon[data-placement='top'] {
    bottom: 0px;
    left: 50%;
    transform: translate(-50%, 95%);
  }

  wui-icon[data-placement='bottom'] {
    top: 0;
    left: 50%;
    transform: translate(-50%, -95%) rotate(180deg);
  }

  wui-icon[data-placement='right'] {
    top: 50%;
    left: 0;
    transform: translate(-65%, -50%) rotate(90deg);
  }

  wui-icon[data-placement='left'] {
    top: 50%;
    right: 0%;
    transform: translate(65%, -50%) rotate(270deg);
  }

  @keyframes fade-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
`;var $=undefined&&undefined.__decorate||function(t,i,e,o){var a=arguments.length,s=a<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,e):o,n;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")s=Reflect.decorate(t,i,e,o);else for(var r=t.length-1;r>=0;r--)if(n=t[r])s=(a<3?n(s):a>3?n(i,e,s):n(i,e))||s;return a>3&&s&&Object.defineProperty(i,e,s),s};let b=class t extends s{constructor(){super();this.unsubscribe=[];this.open=m.state.open;this.message=m.state.message;this.triggerRect=m.state.triggerRect;this.variant=m.state.variant;this.unsubscribe.push(...[m.subscribe((t=>{this.open=t.open;this.message=t.message;this.triggerRect=t.triggerRect;this.variant=t.variant}))])}disconnectedCallback(){this.unsubscribe.forEach((t=>t()))}render(){this.dataset["variant"]=this.variant;const t=this.triggerRect.top;const i=this.triggerRect.left;this.style.cssText=`\n    --w3m-tooltip-top: ${t}px;\n    --w3m-tooltip-left: ${i}px;\n    --w3m-tooltip-parent-width: ${this.triggerRect.width/2}px;\n    --w3m-tooltip-display: ${this.open?"flex":"none"};\n    --w3m-tooltip-opacity: ${this.open?1:0};\n    `;return l`<wui-flex>
      <wui-icon data-placement="top" size="inherit" name="cursor"></wui-icon>
      <wui-text color="primary" variant="sm-regular">${this.message}</wui-text>
    </wui-flex>`}};b.styles=[x];$([d()],b.prototype,"open",void 0);$([d()],b.prototype,"message",void 0);$([d()],b.prototype,"triggerRect",void 0);$([d()],b.prototype,"variant",void 0);b=$([h("w3m-tooltip")],b);
//# sourceMappingURL=p-DujiERu9.js.map