1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[76577],{21643:(t,e,i)=>{i.r(e),i.d(e,{GdsDateOfBirth:()=>p});var a=i(44489),s=i(46058),l=i(12009),n=i(41088),o=i(24291),r=i(85065),h=i(40629),d=i(11598),u=(0,h.b)` 2 :host { 3 position: relative; 4 width: 100%; 5 6 label { 7 display: block; 8 margin-bottom: var(--label-margin-bottom); 9 cursor: pointer; 10 font-size: var(--label-font-size); 11 line-height: var(--label-line-height); 12 font-weight: var(--label-font-weight); 13 color: var(--label-color); 14 } 15 16 .date-of-birth-container { 17 display: contents; 18 } 19 } 20`,p=class extends h.g{constructor(){super(...arguments),this.placeholder="DD/MM/YYYY",this.disabled=!1,this.dataQmAllow=!1,this.dataQmEncrypt=!1,this.dataQmMask=!1,this.ariaLabel=null,this.partialPrefill=!1,this.datePrefix=!1,this.showHide="hide",this.errorState=!1,this.disabledWithPartialPrefill=!1,this._onInput=t=>{if(!this.datePrefix)return void this._dispatchDobInputValueChange();let e=t?.target?.shadowRoot?.querySelector("input")??this.inputEl;if(t?.inputType?.includes("delete")){let t=e.selectionEnd,i=2===t,a=5===t;if(i||a){let t=this._dateToDigitsArr(e.value);i?t.splice(1,1):a&&t.splice(3,1);let s=Array(8).fill(null).map((e,i)=>{let a=t[i]??"_";return 1===i||3===i?a+"/":a}).join("");this.iMaskInstance.value=s,this.setInputSelectionRange()}}else{if(""===e.value||"__/__/____"===e.value)return;let t=this._dateToDigitsArr(e.value);if(1===t.length&&t?.[0]>1)this.iMaskInstance.value=`0${t?.[0]}/__/____`,this.setInputSelectionRange();else if(3===t.length&&t?.[2]>3)this.iMaskInstance.value=`${t?.[0]}${t?.[1]}/0${t?.[2]}/____`,this.setInputSelectionRange();else if(6===t.length){let e=+`${t[4]}${t[5]}`,i=`${t?.[0]}${t?.[1]}/${t?.[2]}${t?.[3]}/20${t[4]}${t[5]}`,a=`${t?.[0]}${t?.[1]}/${t?.[2]}${t?.[3]}/19${t[4]}${t[5]}`;this._isAtLeastMinimumAge(i)?this.iMaskInstance.value=i:19!==e&&20!==e&&(this.iMaskInstance.value=a)}}this._dispatchDobInputValueChange()}}connectedCallback(){super.connectedCallback();let t=new CSSStyleSheet;t.replaceSync(u.cssText),this.shadowRoot.adoptedStyleSheets=[t]}updateInputBasedOnShowHide(){if("show"===this.showHide)if("__/__/____"===this.inputEl.value)this.hiddenValue="",this.inputEl.value="";else{this.hiddenValue=this.inputEl.value;let t=(({input:t,showLastCount:e=0,ignore:i=[]})=>{let a;return a=Array.isArray(i)?i:i?[...i]:[],t.value.split("").map((i,s)=>a.includes(i)||s+1>t.value.length-e?i:"*").join("")})({input:this.inputEl,showLastCount:4,ignore:"/"});this.inputEl.value=t,this.maskedValue=t}else this.hiddenValue&&(this.inputEl.value=this.hiddenValue),this.hiddenValue=""}_onShowHideClicked(){this.focusOutBlock||""===this.inputEl.value&&!this.partialPrefill||(this.showHide="hide"===this.showHide?"show":"hide",this.updateInputBasedOnShowHide())}async firstUpdated(){let t=this.renderRoot.querySelector("gds-input-field");t.updateComplete.then(()=>{this.inputEl=t.renderRoot.querySelector("input"),this.inputEl.addEventListener("focusout",this._onInputFocusOut.bind(this)),this.inputEl.addEventListener("focusin",this._onInputFocusIn.bind(this)),this.inputEl.addEventListener("keydown",this._onKeyDown.bind(this)),this.partialPrefill||this._setMask(),void 0!==this._pendingDob&&(this.setDob(this._pendingDob),this._pendingDob=void 0)})}_showPlaceholder(t){this.iMaskInstance?.updateOptions?.({lazy:t})}_onInputFocusOut(){"show"!==this.showHide?(this.showHide="show",this.updateInputBasedOnShowHide(),this.focusOutBlock=!0,setTimeout(()=>{this.focusOutBlock=!1},300),(""===this.inputEl.value||"__/__/____"===this.inputEl.value)&&this._showPlaceholder(!0)):this.maskedValue&&(this.inputEl.value=this.maskedValue)}setInputSelectionRange(){if(!this.iMaskInstance)return;let t=(this.iMaskInstance.value?.match(/\d+/g)?.join("")??"").length,e=t+(t<3?0:t<5?1:2);this.inputEl.setSelectionRange(e,e)}_onInputFocusIn(){""===this.inputEl.value&&setTimeout(()=>{this._showPlaceholder(!1)}),setTimeout(()=>{this.setInputSelectionRange()})}_onKeyDown(t){if("show"===this.showHide&&"Tab"!==t.key){let e=this.inputEl.selectionStart;t.preventDefault(),this.showHide="hide",this.updateInputBasedOnShowHide(),this.inputEl.setSelectionRange(e,e)}}_dateToDigitsArr(t){return t.match(/\d+/g).join("").split("").map(Number)}_isAtLeastMinimumAge(t){let e=new Date,i=new Date(t),a=e.getFullYear()-i.getFullYear(),s=e.getMonth()-i.getMonth(),l=e.getDate()-i.getDate();return(s<0||0===s&&l<0?a-1:a)>=14}_dispatchDobInputValueChange(){/^[\d_]{2}\/[\d_]{2}\/[\d_]{4}$/.test(this.iMaskInstance.value)&&this.dispatchEvent(new CustomEvent("dob-input-value-change",{detail:{value:this.iMaskInstance.value},...n.a}))}_setMask(){let t=(0,a.a)(this.inputEl,{mask:"00/00/0000",pattern:"m{/}d{/}Y",blocks:{d:{mask:a.a.MaskedRange,from:1,to:99,maxLength:2},m:{mask:a.a.MaskedRange,from:1,to:99,maxLength:2},Y:{mask:a.a.MaskedRange,from:1900,to:9999,maxLength:4}},autofix:!1,lazy:!0});this.iMaskInstance=t}_handlePartialPrefillClick(){this.partialPrefill=!1}_removePartialPrefill(){this.renderRoot.querySelector("gds-input-field").partialPrefill=!1,this.inputEl.value="",this.hiddenValue="",this.partialPrefill=!1,this.disabled=!1,this.disabledWithPartialPrefill=!1,this._setMask(),setTimeout(()=>{this.inputEl.focus()},10)}updated(t){if(t.has("partialPrefill")){let t=this.renderRoot.querySelector("gds-input-field");if(this.partialPrefill)t.partialPrefill=!0,this.disabled=!0,this.disabledWithPartialPrefill=!0;else{if(!this.disabledWithPartialPrefill)return;this._removePartialPrefill()}}}
20_handleSlotChange(t){let e=t.target;"error-message-text"===e.name&&(this.errorState=(0,l.a)(e))}getDob(){return this.iMaskInstance?.value??this.inputEl.value}setDob(t){if(this.hiddenValue=t,this.partialPrefill){if(!this.inputEl){this._pendingDob=t;return}this.inputEl.value=t;return}if(!this.iMaskInstance){this._pendingDob=t;return}this.iMaskInstance.value=t,this._onInput(),this._showPlaceholder(!1)}render(){return(0,h.c)` 21 <gds-input-field 22 input-id="${(0,s.a)(this.inputId)}" 23 name="${(0,s.a)(this.name)}" 24 placeholder="${(0,s.a)(this.placeholder)}" 25 spell-check="false" 26 ?data-qm-allow="${this.dataQmAllow}" 27 ?data-qm-encrypt="${this.dataQmEncrypt}" 28 ?data-qm-mask="${this.dataQmMask}" 29 aria-label="${this.ariaLabel??"Date of Birth. Please enter 2 digit month, 2 digit day, and 4 digit year"}" 30 ?disabled="${this.disabled}" 31 @input="${this._onInput}" 32 auto-complete="${this.autoComplete}" 33 input-value-masking="${"hide"===this.showHide?"unmasked":"masked"}" 34 @input-show-hide-click="${this._onShowHideClicked}" 35 @partial-prefill-click="${this._handlePartialPrefillClick}" 36 input-value-toggle-element 37 label-legend-marker="${(0,s.a)(this.labelLegendMarker)}" 38 > 39 <slot></slot> 40 <span slot="descriptive-copy"> 41 <slot name="descriptive-text"></slot> 42 </span> 43 <span slot="${this.errorState?"error-message-copy":""}"> 44 <slot 45 @slotchange="${this._handleSlotChange}" 46 name="error-message-text" 47 ></slot> 48 </span> 49 </gds-input-field> 50 `}};(0,d.c)([(0,o.b)({type:String,attribute:"input-id"})],p.prototype,"inputId",2),(0,d.c)([(0,o.b)()],p.prototype,"name",2),(0,d.c)([(0,o.b)({reflect:!0})],p.prototype,"placeholder",2),(0,d.c)([(0,o.b)({type:Boolean,reflect:!0})],p.prototype,"disabled",2),(0,d.c)([(0,o.b)({type:Boolean,reflect:!0,attribute:"data-qm-allow"})],p.prototype,"dataQmAllow",2),(0,d.c)([(0,o.b)({type:Boolean,reflect:!0,attribute:"data-qm-encrypt"})],p.prototype,"dataQmEncrypt",2),(0,d.c)([(0,o.b)({type:Boolean,reflect:!0,attribute:"data-qm-mask"})],p.prototype,"dataQmMask",2),(0,d.c)([(0,o.b)({type:String,attribute:"aria-label"})],p.prototype,"ariaLabel",2),(0,d.c)([(0,o.b)({type:String,attribute:"auto-complete"})],p.prototype,"autoComplete",2),(0,d.c)([(0,o.b)({type:Boolean,reflect:!0,attribute:"partial-prefill"})],p.prototype,"partialPrefill",2),(0,d.c)([(0,o.b)({type:Boolean,reflect:!0,attribute:"date-prefix"})],p.prototype,"datePrefix",2),(0,d.c)([(0,o.b)({type:String,reflect:!0,attribute:"label-legend-marker"})],p.prototype,"labelLegendMarker",2),(0,d.c)([(0,o.c)()],p.prototype,"iMaskInstance",2),(0,d.c)([(0,o.c)()],p.prototype,"inputEl",2),(0,d.c)([(0,o.c)()],p.prototype,"hiddenValue",2),(0,d.c)([(0,o.c)()],p.prototype,"focusOutBlock",2),(0,d.c)([(0,o.c)()],p.prototype,"showHide",2),(0,d.c)([(0,o.c)()],p.prototype,"errorState",2),(0,d.c)([(0,o.c)()],p.prototype,"disabledWithPartialPrefill",2),p=(0,d.c)([(0,r.a)("gds-date-of-birth")],p),i(70137),i(31864),i(23827),i(98314),i(8802)}}]);
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.