/**
 * @license
 * Copyright 2023 Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import{a as d}from"./chunk.YI4JTY4T.js";import{f as n,g as o,k as r}from"./chunk.4LA6HEA7.js";var s=class{constructor(a){this._labelElement=a}addLabelClass(a){n(a,this._labelElement)}removeLabelClass(a){o(a,this._labelElement)}hasLabelClass(a){return this._labelElement.classList.contains(a)}getWidth(){return this._labelElement.offsetParent!=null?this._labelElement.scrollWidth:r(this._labelElement).width}addLabelListener(a,t){this._labelElement.addEventListener(a,t)}removeLabelListener(a,t){this._labelElement.removeEventListener(a,t)}};var A={FLOATING_LABEL:"forge-floating-label",FLOAT_ABOVE:"forge-floating-label--float-above",FLOAT_ABOVE_END_KEYFRAME:"forge-floating-label--float-above-end-keyframe",UNFLOAT_ABOVE_START_KEYFRAME:"forge-floating-label--unfloat-above-start-keyframe"},e={classes:A};var l=class{constructor(a){this._adapter=a;this._floatAnimationEndHandler=()=>this._handleFloatAnimationEnd()}initialize(){this._adapter.addLabelClass(e.classes.FLOATING_LABEL),d.BLINK&&this._adapter.addLabelListener("transitionend",this._floatAnimationEndHandler)}disconnect({cancelFloat:a=!1}={}){a&&this._activeFrame&&window.cancelAnimationFrame(this._activeFrame),this._adapter.removeLabelClass(e.classes.FLOATING_LABEL),this._adapter.removeLabelClass(e.classes.FLOAT_ABOVE),this._adapter.removeLabelClass(e.classes.FLOAT_ABOVE_END_KEYFRAME),this._adapter.removeLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME),this._floatAnimationEndHandler&&this._adapter.removeLabelListener("transitionend",this._floatAnimationEndHandler)}float(a,t=!1){a?(this._adapter.hasLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME)&&this._adapter.removeLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME),this._activeFrame=window.requestAnimationFrame(()=>{this._activeFrame=window.requestAnimationFrame(()=>{(t||this.isFloating)&&this._adapter.addLabelClass(e.classes.FLOAT_ABOVE_END_KEYFRAME),this._adapter.addLabelClass(e.classes.FLOAT_ABOVE)})})):(this._adapter.removeLabelClass(e.classes.FLOAT_ABOVE),this._adapter.hasLabelClass(e.classes.FLOAT_ABOVE_END_KEYFRAME)&&(this._adapter.removeLabelClass(e.classes.FLOAT_ABOVE_END_KEYFRAME),this._adapter.addLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME),this._activeFrame=window.requestAnimationFrame(()=>{this._activeFrame=window.requestAnimationFrame(()=>{this._adapter.removeLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME)})})))}getWidth(){return this._adapter.getWidth()}get isFloating(){return this._adapter.hasLabelClass(e.classes.FLOAT_ABOVE)}_handleFloatAnimationEnd(){this._adapter.hasLabelClass(e.classes.FLOAT_ABOVE)&&!this._adapter.hasLabelClass(e.classes.FLOAT_ABOVE_END_KEYFRAME)?this._adapter.addLabelClass(e.classes.FLOAT_ABOVE_END_KEYFRAME):this._adapter.hasLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME)&&this._adapter.removeLabelClass(e.classes.UNFLOAT_ABOVE_START_KEYFRAME)}};var _=class{constructor(a){this._labelElement=a;this._foundation=new l(new s(this._labelElement)),this._foundation.initialize()}get isFloating(){return this._foundation.isFloating}destroy({cancelFloat:a=!1}={}){this._foundation.disconnect({cancelFloat:a}),this._labelElement=void 0}float(a,t=!1){this._foundation.float(a,t)}getWidth(){return this._foundation.getWidth()}};export{s as a,e as b,l as c,_ as d};
//# sourceMappingURL=chunk.DBKVUCUQ.js.map
