(()=>{"use strict";const e=window.React,t=window.wp.element;function l({isActive:t,onToggle:l}){const{logoUrl:n,primaryColor:a,strings:o,links:i}=window.tiSDKFloatData;return(0,e.createElement)("div",{className:"ti-float-widget-panel",style:{"--ti-float-primary-color":a}},(0,e.createElement)("div",{className:"ti-float-widget-panel__header"},(0,e.createElement)("img",{src:n,alt:"Site Logo"}),o.panelGreet&&(0,e.createElement)("p",null,o.panelGreet),o.panelTitle&&(0,e.createElement)("h3",null,o.panelTitle)),(0,e.createElement)("div",{className:"ti-float-widget-panel__content"},i&&i.map(((t,l)=>(0,e.createElement)("a",{key:"ti-float_link_"+l,href:t.link,target:!0===t?.internal?"_self":"_blank"},(0,e.createElement)("span",{className:"dashicons "+t.icon}),t.title))),(0,e.createElement)("a",{href:"#ti-toggle-widget-float",className:"screen-reader-shortcut"},o.closeToggle?o.closeToggle:"Close")))}const n=window.wp.components;function a({isActive:a,onToggle:o,onClose:i}){const{logoUrl:s,strings:c}=window.tiSDKFloatData,r=c.toggleButton,m=a?"":"active",d=a?"active":"";return(0,e.createElement)(t.Fragment,null,(0,e.createElement)("button",{id:"ti-toggle-widget-float",tabIndex:"0",className:"ti-float-button",onClick:o,"aria-label":"","aria-pressed":a,"aria-disabled":!1,title:r},(0,e.createElement)("img",{className:"ti-float-logo "+m,src:s}),(0,e.createElement)("span",{className:"dashicons dashicons-no-alt ti-float-close-icon "+d}),(0,e.createElement)("span",{className:"screen-reader-text"},r),a&&(0,e.createElement)(n.Popover,{variant:"unstyled",placement:"top-end",onFocusOutside:()=>{console.log("Focus Outside"),i()}},(0,e.createElement)(l,null))))}function o(){const[l,n]=(0,t.useState)(!1);return(0,e.createElement)(t.Fragment,null,(0,e.createElement)(a,{isActive:l,onToggle:()=>{n(!l)},onClose:()=>{n(!1)}}))}document.addEventListener("DOMContentLoaded",(()=>{const l=document.querySelector("#ti-sdk-float-widget");l&&(0,t.render)((0,e.createElement)(o,null),l)}))})();