1import"./chunk-6KHOHYTW.js";var o=class{constructor(t){this._element=t,this._svg=this._element.querySelector("svg"),this._svg&&(requestAnimationFrame(()=>this._trim()),this._observe(),this._bindTrigger())}_trim(){let t=this._svg;if(!t.getBoundingClientRect().width)return;let e=t.getBBox(),i=t.viewBox.baseVal,a=["data-top","data-bottom","data-left","data-right"].some(n=>this._element.hasAttribute(n)),r=n=>!a||this._element.hasAttribute(n),s={top:r("data-top")?e.y:0,bottom:r("data-bottom")?i.height-(e.y+e.height):0,left:r("data-left")?e.x:0,right:r("data-right")?i.width-(e.x+e.width):0};t.style.cssText=` 2 display: block; 3 margin-top: -${s.top}px; 4 margin-bottom: -${s.bottom}px; 5 margin-left: -${s.left}px; 6 margin-right: -${s.right}px; 7 `}_bindTrigger(){let t=this._element.getAttribute("data-trigger");if(!t)return;let e=document.querySelectorAll(t);if(!e.length){console.warn(`IconTrimModule: Ingen matchning f\xF6r selector "${t}"`);return}this._handleClick=()=>requestAnimationFrame(()=>this._trim()),e.forEach(i=>i.addEventListener("click",this._handleClick)),this._triggers=[...e]}_observe(){this._observer=new MutationObserver(()=>{requestAnimationFrame(()=>this._trim())});let t=this._element;for(;t&&t!==document.body;)this._observer.observe(t,{attributes:!0,attributeFilter:["class","style","hidden"]}),t=t.parentElement}update(){requestAnimationFrame(()=>this._trim())}destroy(){this._observer&&this._observer.disconnect(),this._triggers&&this._triggers.forEach(t=>t.removeEventListener("click",this._handleClick))}};export{o as default}; 8//# sourceMappingURL=icon-trim-module-LAZTISOR.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.