import{r as t,c as o,h as i,H as s,g as r}from"./p-811c9fd4.js";import{f as e,l as n,a,d as l}from"./p-f021dfd0.js";import{w as h,f as c}from"./p-f3727652.js";import{D as v}from"./p-874fa941.js";const d=class{constructor(i){t(this,i),this.vInteractionChange=o(this,"vInteractionChange",7),this.keyboardDisposal=new v,this.showTapHighlight=!1,this.hidden=!1,this.isTouch=!1,h(this,["isTouch"])}onKeysChange(){if(this.keyboardDisposal.empty(),e(this.keys))return;const t=c(this),o=this.keys.split("/");this.keyboardDisposal.add(n(t,"keydown",(t=>{o.includes(t.key)&&this.button.click()})))}connectedCallback(){this.findTooltip(),this.onKeysChange()}componentWillLoad(){this.findTooltip()}disconnectedCallback(){this.keyboardDisposal.empty()}onTouchStart(){this.showTapHighlight=!0,setTimeout((()=>{this.showTapHighlight=!1}),100)}findTooltip(){const t=this.el.querySelector("vime-tooltip");return a(t)||(this.describedBy=t.id),t}onShowTooltip(){const t=this.findTooltip();a(t)||(t.active=!0),this.vInteractionChange.emit(!0)}onHideTooltip(){const t=this.findTooltip();a(t)||(t.active=!1),this.button.blur(),this.vInteractionChange.emit(!1)}onFocus(){this.el.dispatchEvent(new window.Event("focus",{bubbles:!0})),this.onShowTooltip()}onBlur(){this.el.dispatchEvent(new window.Event("blur",{bubbles:!0})),this.onHideTooltip()}onMouseEnter(){this.onShowTooltip()}onMouseLeave(){this.onHideTooltip()}render(){return i(s,{class:{hidden:this.hidden}},i("button",{class:{notTouch:!this.isTouch,tapHighlight:this.showTapHighlight},id:this.identifier,type:"button","aria-label":this.label,"aria-haspopup":e(this.menu)?void 0:"true","aria-controls":this.menu,"aria-expanded":e(this.menu)?void 0:this.expanded?"true":"false","aria-pressed":e(this.pressed)?void 0:this.pressed?"true":"false","aria-hidden":this.hidden?"true":"false","aria-describedby":this.describedBy,onTouchStart:this.onTouchStart.bind(this),onFocus:this.onFocus.bind(this),onBlur:this.onBlur.bind(this),onMouseEnter:this.onMouseEnter.bind(this),onMouseLeave:this.onMouseLeave.bind(this),ref:t=>{this.button=t}},i("slot",null)))}get el(){return r(this)}static get watchers(){return{keys:["onKeysChange"]}}};d.style="vime-control.hidden{display:none}vime-control button{display:flex;align-items:center;flex-direction:row;border:var(--vm-control-border);cursor:pointer;flex-shrink:0;color:var(--vm-control-color);background:var(--vm-control-bg, transparent);border-radius:var(--vm-control-border-radius);padding:var(--vm-control-padding);position:relative;pointer-events:auto;transition:all 0.3s ease;transform:scale(var(--vm-control-scale, 1))}vime-control button:focus{outline:0}vime-control button.tapHighlight{background:var(--vm-control-tap-highlight)}vime-control button.notTouch:focus,vime-control button.notTouch:hover,vime-control button.notTouch[aria-expanded=true]{background:var(--vm-control-focus-bg);color:var(--vm-control-focus-color);transform:scale(calc(var(--vm-control-scale, 1) + 0.1))}";const p=class{constructor(o){t(this,o)}render(){return i("svg",{xmlns:"http://www.w3.org/2000/svg",role:"presentation",focusable:"false"},l(this.href)?i("use",{href:this.href}):i("slot",null))}};p.style="vime-icon>svg{display:block;color:var(--vm-icon-color);width:var(--vm-icon-width, 18px);height:var(--vm-icon-height, 18px);transform:scale(var(--vm-icon-scale, 1));fill:currentColor;pointer-events:none}";let u=0;const m=class{constructor(o){t(this,o),this.hasLoaded=!1,this.hidden=!1,this.active=!1,this.position="top",this.isTouch=!1,h(this,["isTouch"])}componentDidLoad(){this.hasLoaded=!0}getId(){const t=this.el.id;return l(t)&&t.length>0?t:(u+=1,"vime-tooltip-"+u)}render(){return i(s,{id:this.getId(),role:"tooltip","aria-hidden":!this.active||this.isTouch?"true":"false",class:{hidden:!this.hasLoaded||this.hidden,onTop:"top"===this.position,onBottom:"bottom"===this.position,growLeft:"left"===this.direction,growRight:"right"===this.direction}},i("slot",null))}get el(){return r(this)}};m.style="vime-tooltip{left:50%;transform:translateX(-50%);line-height:1.3;pointer-events:none;position:absolute;opacity:0;white-space:nowrap;visibility:hidden;background:var(--vm-tooltip-bg);border-radius:var(--vm-tooltip-border-radius);box-shadow:var(--vm-tooltip-box-shadow);color:var(--vm-tooltip-color);font-size:var(--vm-tooltip-font-size);padding:var(--vm-tooltip-padding);transition:opacity var(--vm-tooltip-fade-duration) var(--vm-tooltip-fade-timing-func);z-index:var(--vm-tooltip-z-index)}vime-tooltip[aria-hidden=false]{opacity:1;visibility:visible}vime-tooltip.hidden{display:none}vime-tooltip.onTop{bottom:100%;margin-bottom:var(--vm-tooltip-spacing)}vime-tooltip.onBottom{top:100%;margin-top:var(--vm-tooltip-spacing)}vime-tooltip.growLeft{left:auto;right:0;transform:none}vime-tooltip.growRight{left:0;transform:none}";export{d as vime_control,p as vime_icon,m as vime_tooltip}