(function(){/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
var l=this||self;function m(a,b){a=a.split(".");for(var c=l,d;a.length&&(d=a.shift());)a.length||b===void 0?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b};var p=/^(\d+|\d*\.\d+)px$/i,q=/^(\d+|\d*\.\d+)em$/i;function r(a,b){b.forEach(function(c){if(a.g.every(function(e){return e.element!=c})&&!c.hasAttribute("gwd-dont-fit")){var d=t(a,c);a.g.push(d)}})}function v(){var a=w;a.g.forEach(function(b){x(b)});a.g=[]}function y(a,b){b.forEach(function(c){for(var d=0;d<a.g.length;d++){var e=a.g[d];if(e.element==c){x(e);a.g.splice(d,1);break}}})}
function x(a){a.o!=null&&(a.element.style.fontSize=a.o);if(a.l!=null){for(;a.element.firstChild;)a.element.removeChild(a.element.lastChild);for(var b=a.l.cloneNode(!0);b.childNodes.length>0;)a.element.appendChild(b.firstChild)}}
function t(a,b){var c=window.getComputedStyle(b),d=b.style.fontSize,e=b.cloneNode(!0),f={clientWidth:b.clientWidth,clientHeight:b.clientHeight},h=!1,g=a.h;b.hasAttribute("data-gwd-fit-font-size")&&(g=b.getAttribute("data-gwd-fit-font-size")!="false");var k=z(c.fontSize);c=k||24;var n=parseInt(b.getAttribute("gwd-min-font-size-px"),10);n=isFinite(n)?n:a.i;g=g&&(!k||k>n)&&(b.scrollHeight>f.clientHeight||b.scrollWidth>f.clientWidth);k=!1;if(g){var u=z(window.getComputedStyle(b).fontSize);u!=null&&(h=
A(a,b,u));c=B(b,f,n,c);c==-1?(b.style.fontSize=n+"px",k=!0):b.style.fontSize=c+"px"}c=a.m;b.hasAttribute("gwd-fitting-truncate")&&(c=b.getAttribute("gwd-fitting-truncate")!="false");c&&(k||b.scrollHeight>f.clientHeight||b.scrollWidth>f.clientWidth)&&(C(a,b,f,null),h=!0);return{element:b,o:g?d:null,l:h?e:null}}function B(a,b,c,d){return D(a,b,c,d,function(e,f){e.style.fontSize=f+"px"})}
function C(a,b,c,d){if(d&&d.nodeType!=1&&d.nodeType!=3)return!1;var e=d?d:b;if(e.nodeType==3||e.children.length==0){var f=e.textContent;if(f=="")return!1;if(e!=b){e.textContent="\u2026";if(b.scrollHeight>c.clientHeight||b.scrollWidth>c.clientWidth)return!1;e.textContent=f}a=D(b,c,0,f.length,function(g,k){e.textContent=f.slice(0,k)+"\u2026"});e.textContent=a==-1?"":f.slice(0,a)+"\u2026";return a!=-1}for(d=e.childNodes.length-1;d>=0;d--){var h=e.childNodes[d];if(C(a,b,c,h))return!0;e.removeChild(h)}return!1}
function D(a,b,c,d,e){d=Math.floor(d);for(var f=-1,h=0;h<50;){var g=Math.floor((c+d)/2);e(a,g);if(a.scrollHeight>b.clientHeight||a.scrollWidth>b.clientWidth){if(g==c)return f;d=g-1}else{f=g;if(c==d)return f;c=g+1}h++}return-1}
function A(a,b,c){if(b.hasAttribute("gwd-dont-fit"))return!1;for(var d=!1,e=b.children.length,f=0;f<e;f++){var h=b.children[f],g=window.getComputedStyle(h).fontSize,k=z(g);if(k)h.style.fontSize=k/c+"em",d=!0;else if(g=(g=q.exec(g||""))?parseFloat(g[1]):null)k=g*c;else return!1;h=A(a,h,k);d=d||h}return d}function z(a){return(a=p.exec(a||""))?parseFloat(a[1]):null};var E="color font-family font-size font-style font-weight font-stretch text-align white-space".split(" "),F=/[^\s\xA0]/;function G(a){var b=H;if(b.g.get(a)){a.ownerDocument.compareDocumentPosition(a)&Node.DOCUMENT_POSITION_DISCONNECTED||I(b,a);var c=document.createElement("gwd-attached");a.appendChild(c);var d=function(){c.removeEventListener("attached",d);I(b,a);a.removeChild(c)};c.addEventListener("attached",d)}}
function I(a,b){var c=a.g.get(b),d=a.h.get(b)||{};if(c){c.j.style.display="none";b.insertBefore(c.j,b.firstChild);try{y(a.i,[b]);for(var e=getComputedStyle(c.parent),f=0;f<E.length;f++){var h=E[f],g=e.getPropertyValue(h);!d.hasOwnProperty(h)&&g&&b.style.setProperty(h,g,"")}b.removeAttribute("gwd-dont-fit");r(a.i,[b])}finally{b.removeChild(c.j)}}};var w=new function(){this.g=[];this.i=10;this.h=!0;this.m=!1},H=new function(){this.i=w;this.g=new WeakMap;this.h=new WeakMap};m("gwd.textfitting.applyStylePreservation",function(a){G(a)});m("gwd.textfitting.fit",function(a){r(w,a)});
m("gwd.textfitting.saveInitialText",function(a){for(var b=H,c=document.createNodeIterator(a,NodeFilter.SHOW_TEXT,null,!1),d=null,e;e=c.nextNode();)if(F.test(e.textContent)){d=e;break}if(d&&(c=d.parentNode,c!=a)){a.setAttribute("gwd-dont-fit","");for(d=c;d.parentNode!=a;)d=d.parentNode;b.g.set(a,{j:d,parent:c})}});m("gwd.textfitting.saveStyleOverride",function(a,b,c){var d=H,e=d.h.get(a)||{};e[b]=c;d.h.set(a,e)});m("gwd.textfitting.setFontSizeReductionEnabled",function(a){w.h=a});
m("gwd.textfitting.setMinFontSizePx",function(a){w.i=a});m("gwd.textfitting.setTruncationEnabled",function(a){w.m=a});m("gwd.textfitting.unfitAll",function(){v()});}).call(this);
