!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FitHtmlText=t():e.FitHtmlText=t()}(self,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var n in i)e.o(i,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:i[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{fitText:()=>i});var i=function(e,t){if(void 0===t&&(t={}),void 0!==t.fontMinSize&&t.fontMinSize>0&&t.fontMinSize!==1/0||(t.fontMinSize=8),void 0!==t.fontMaxSize&&t.fontMaxSize>0||(t.fontMaxSize=1/0),void 0===t.containerMaxWidth||!(t.containerMaxWidth>0)||t.containerMaxWidth===1/0){var i=e.getBoundingClientRect();t.containerMaxWidth=i.width}void 0!==t.containerMaxHeight&&t.containerMaxHeight>0||(t.containerMaxHeight=1/0),void 0===t.multipleLines&&(t.multipleLines=!1);var n=window.getComputedStyle(e),o=document.createElement("_measure");o.style.position="absolute",o.style.top="-9999px",o.style.left="-".concat(t.containerMaxWidth,"px"),o.style.visibility="hidden",o.style.border=n.getPropertyValue("border"),o.style.boxSizing=n.getPropertyValue("box-sizing"),o.style.padding=n.getPropertyValue("padding"),o.style.fontFamily=n.getPropertyValue("font-family"),o.style.letterSpacing=n.getPropertyValue("letter-spacing"),e instanceof HTMLInputElement?o.innerText=e.value:o.innerHTML=e.innerHTML,document.body.appendChild(o);var a=t.fontMinSize+1,r=t.fontMinSize;if(t.multipleLines){o.style.display="block",o.style.width="".concat(t.containerMaxWidth,"px"),o.style.wordBreak=n.getPropertyValue("word-break");for(var l=0,d=Number.MIN_SAFE_INTEGER;a<=t.fontMaxSize;){o.style.fontSize="".concat(a,"px");var f=o.getBoundingClientRect();if(f.height>t.containerMaxHeight)break;if(f.height===d){if(3===(l+=1))break}else l=0;d=f.height,r=a,a+=1}}else for(var c=0,h=Number.MIN_SAFE_INTEGER,p=Number.MIN_SAFE_INTEGER;a<=t.fontMaxSize;){o.style.fontSize="".concat(a,"px");var y=o.getBoundingClientRect();if(y.width>t.containerMaxWidth)break;if(y.height>t.containerMaxHeight)break;if(y.width===h){if(3===(c+=1))break}else c=0;var s=y.width-h,g=y.height-p;h=y.width,p=y.height,r=a,a+=Math.max(1,Math.floor(Math.min((t.containerMaxWidth-y.width)/(s+3),(t.containerMaxHeight-y.height)/(g+3))))}document.body.removeChild(o),e.style.fontSize="".concat(r,"px")};return t})()));