(function(d,h){typeofexports=="object"&&typeofmodule<"u"?h(exports):typeofdefine=="function"&&define.amd?define(["exports"],h):(d=typeofglobalThis<"u"?globalThis:d||self,h(d.LyzBimEngineSDK={}))})(this,(function(d){"use strict";classh{container;options;groups=[];activeBtnIds=newSet;btnRefs=newMap;dropdownElement=null;hoverTimeout=null;DEFAULT_ICON='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect></svg>';constructor(t){consto=typeoft.container=="string"?document.getElementById(t.container):t.container;if(!o)thrownewError("Container not found");this.container=o,this.options={showLabel:!0,visibility:{},...t},this.initContainer(),this.applyStyles()}initContainer(){this.container.innerHTML="",this.container.classList.add("toolbar-root")}applyStyles(){constt=this.container.style;this.options.backgroundColor&&t.setProperty("--bim-toolbar-bg",this.options.backgroundColor),this.options.btnBackgroundColor&&t.setProperty("--bim-btn-bg",this.options.btnBackgroundColor),this.options.btnHoverColor&&t.setProperty("--bim-btn-hover-bg",this.options.btnHoverColor),this.options.btnActiveColor&&t.setProperty("--bim-btn-active-bg",this.options.btnActiveColor),this.options.iconColor&&t.setProperty("--bim-icon-color",this.options.iconColor),this.options.iconActiveColor&&t.setProperty("--bim-icon-active-color",this.options.iconActiveColor),this.options.textColor&&t.setProperty("--bim-btn-text-color",this.options.textColor),this.options.textActiveColor&&t.setProperty("--bim-btn-text-active-color",this.options.textActiveColor)}setColors(t){this.options={...this.options,...t},this.applyStyles()}addGroup(t,o){if(this.groups.some(i=>i.id===t)){console.warn("Group "+t+" already exists");return}conste={id:t,buttons:[]};if(o){consti=this.groups.findIndex(n=>n.id===o);i!==-1?this.groups.splice(i,0,e):(console.warn(`Target group ${o} not found, appending ${t} to end.`),this.groups.push(e))}elsethis.groups.push(e)}addButton(t){const{groupId:o,parentId:e}=t;if(!o)thrownewError(`Button ${t.id} config must contain 'groupId'`);consti=this.groups.find(s=>s.id===o);if(!i)thrownewError(`Group ${o} not found. Please call addGroup first.`);constn={...t,children:t.children||[]};if(e){consts=this.findButton(i.buttons,e);if(!s)thrownewError(`Parent button ${e} not found in group ${o}`);s.children||(s.children=[]),s.children.push(n)}elsei.buttons.push(n)}findButton(t,o){for(consteoft){if(e.id===o)returne;if(e.children){consti=this.findButton(e.children,o);if(i)returni}}}asyncinit(){const{homeButton:t}=awaitPromise.resolve().then(()=>y),{locationButton:o}=awaitPromise.resolve().then(()=>B),{walkMenuButton:e}=awaitPromise.resolve().then(()=>T),{walkPersonButton:i}=awaitPromise.resolve().then(()=>E),{walkBirdButton:n}=awaitPromise.resolve().then(()=>x),{settingButton:s}=awaitPromise.resolve().then(()=>L),{infoButton:r}=awaitPromise.resolve().then(()=>k);this.addGroup("group-1"),this.addButton(t),this.addButton(e),this.addButton(i),this.addButton(n),this.addButton(o),this.addGroup("group-2"),this.addButton(s),this.addButton(r),this.render()}render(){this.container.innerHTML="",this.btnRefs.clear();constt=document.createElement("div");t.className="toolbar-container",this.groups.forEach((o,e)=>{consti=this.renderGroup(o,e,this.groups.length);t.appendChild(i)}),this.container.appendChild(t)}renderGroup(t,o,e){consti=document.createElement("div");returni.className="opt-btn-group",o<e-1&&i.classList.add("has-divider"),t.buttons.forEach(n=>{if(this.isVisible(n.id)){consts=this.renderButton(n);i.appendChild(s)}}),i}renderButton(t){consto=document.createElement("div");o.className="opt-btn-wrapper";conste=document.createElement("div");e.className="opt-btn",this.activeBtnIds.has(t.id)&&e.classList.add("active"),t.disabled&&e.classList.add("disabled"),this.options.showLabel||(e.classList.add("no-label"),t.label&&(e.title=t.label));consti=document.createElement("div");if(i.className="opt-btn-icon",i.innerHTML=this.getIcon(t.icon),e.appendChild(i),t