"use strict";(self.webpackChunk_descope_web_components_ui=self.webpackChunk_descope_web_components_ui||[]).push([[3241,9458],{13241:(t,e,r)=>{r.r(e),r.d(e,{PasswordStrengthClass:()=>u,componentName:()=>a});var n=r(72270),s=r(25964),o=r(88961),i=r(63200);const a=(0,s.xE)("password-strength");class c extends((0,n.qu)({componentName:a,baseSelector:":host > .wrapper"})){static get observedAttributes(){return["options","value"]}constructor(){super(),this.attachShadow({mode:"open"}).innerHTML='\n      <div class="wrapper">\n        <div class="bars-container"></div>\n        <div class="text-container">\n        </div>\n      </div>\n\t\t',(0,s.fz)("\n        :host {\n\t\t\t\t\tdisplay: inline-flex;\n\t\t\t\t}\n\n        .wrapper {\n          display: inline-flex;\n          position: relative;\n          flex-direction: column;\n          width: 100%;\n          height: 100%;\n          align-items: flex-start;\n        }\n\n        .bar {\n          flex-grow: 1;\n        }\n\n        .bars-container {\n          display: flex;\n          flex-grow: 1;\n          width: 100%;\n        }\n    ",this),this.barsContainer=this.shadowRoot.querySelector(".bars-container"),this.textContainer=this.shadowRoot.querySelector(".text-container")}get options(){return this.getAttribute("options")?.split(",")||[]}getCalcScoreFn=()=>Promise.all([r.e(6558),r.e(1050)]).then(r.bind(r,91050)).then(t=>t.default);#t=-1;async calcScore(){const t=this.getAttribute("value")||"";return t?(await this.getCalcScoreFn())(t).score:-1}renderBars(){this.barsContainer.innerHTML="",this.bars=this.options.map((t,e)=>{const r=document.createElement("div");return r.classList.add("bar"),r.classList.toggle("filled",e<=this.#t),this.barsContainer.appendChild(r),r})}init(){super.init?.(),this.getCalcScoreFn()}async onValueChange(){const t=await this.calcScore();t!==this.#t&&(this.#t=t,this.dispatchEvent(new CustomEvent("score-changed",{bubbles:!0,composed:!0,detail:this.#t})),this.bars?.forEach((t,e)=>{t.classList.toggle("filled",e<=this.#t)}),this.textContainer.innerHTML=this.options[this.#t]||"",-1===this.#t?this.removeAttribute("score"):this.setAttribute("score",this.#t))}attributeChangedCallback(t,e,r){if(e!==r)return"options"===t?this.renderBars():"value"===t?this.onValueChange():void 0}}const{host:l,bar:h,filledBar:p,barsContainer:d,text:b}={host:{selector:()=>":host"},bar:{selector:" .bar"},barsContainer:{selector:" .bars-container"},filledBar:{selector:" .bar.filled"},text:{selector:" .text-container"}},u=(0,i.Zz)((0,o.RF)({componentNameOverride:(0,s.xE)("input-wrapper")}),(0,o.RF)({mappings:{hostWidth:[{...l,property:"width"},{...l,property:"min-width"}],hostDirection:{...l,property:"direction"},hostMinWidth:{...l,property:"min-width"},barHeight:{...h,property:"height"},barBorderRadius:{...h,property:"border-radius"},emptyBarColor:{...h,property:"background-color"},filledBarColor:{...p,property:"background-color"},textColor:{...b,property:"color"},spacing:{property:"gap"},barSpacing:{...d,property:"gap"},fontSize:{},fontWeight:{},fontFamily:{},barTransition:{...h,property:"transition"}}}),o.VO,o.tQ)(c);customElements.define(a,u)}}]);
//# sourceMappingURL=3241.js.map