-
Notifications
You must be signed in to change notification settings - Fork 1
/
src_app_custom-elements_contact-form_contact-form_module_ts.e4576fd9f4fd6a45.js
2 lines (2 loc) · 10.5 KB
/
src_app_custom-elements_contact-form_contact-form_module_ts.e4576fd9f4fd6a45.js
1
2
"use strict";(self.webpackChunksite=self.webpackChunksite||[]).push([["src_app_custom-elements_contact-form_contact-form_module_ts"],{7036:($,y,a)=>{a.r(y),a.d(y,{ContactFormModule:()=>P});var E=a(3267),v=a(52),t=a(5460),M=a(1780),l=a(9696),h=a(1030),m=a(9480),f=a(264),k=a(5272),I=a(3441);const b=(0,f.W4)({passive:!0});let w=(()=>{var n;class r{constructor(e,i){this._platform=e,this._ngZone=i,this._monitoredElements=new Map}monitor(e){if(!this._platform.isBrowser)return k.k;const i=(0,m.mk)(e),o=this._monitoredElements.get(i);if(o)return o.subject;const u=new I.E,d="cdk-text-field-autofilled",_=c=>{"cdk-text-field-autofill-start"!==c.animationName||i.classList.contains(d)?"cdk-text-field-autofill-end"===c.animationName&&i.classList.contains(d)&&(i.classList.remove(d),this._ngZone.run(()=>u.next({target:c.target,isAutofilled:!1}))):(i.classList.add(d),this._ngZone.run(()=>u.next({target:c.target,isAutofilled:!0})))};return this._ngZone.runOutsideAngular(()=>{i.addEventListener("animationstart",_,b),i.classList.add("cdk-text-field-autofill-monitored")}),this._monitoredElements.set(i,{subject:u,unlisten:()=>{i.removeEventListener("animationstart",_,b)}}),u}stopMonitoring(e){const i=(0,m.mk)(e),o=this._monitoredElements.get(i);o&&(o.unlisten(),o.subject.complete(),i.classList.remove("cdk-text-field-autofill-monitored"),i.classList.remove("cdk-text-field-autofilled"),this._monitoredElements.delete(i))}ngOnDestroy(){this._monitoredElements.forEach((e,i)=>this.stopMonitoring(i))}}return(n=r).\u0275fac=function(e){return new(e||n)(t.CoB(f.WU),t.CoB(t.WW2))},n.\u0275prov=t.wxM({token:n,factory:n.\u0275fac,providedIn:"root"}),r})(),R=(()=>{var n;class r{}return(n=r).\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.a4G({type:n}),n.\u0275inj=t.s3X({}),r})();var g=a(6929);const F=new t.UbH("MAT_INPUT_VALUE_ACCESSOR"),S=["button","checkbox","file","hidden","image","radio","range","reset","submit"];let H=0,N=(()=>{var n;class r{get disabled(){return this._disabled}set disabled(e){this._disabled=(0,m.W6)(e),this.focused&&(this.focused=!1,this.stateChanges.next())}get id(){return this._id}set id(e){this._id=e||this._uid}get required(){return this._required??this.ngControl?.control?.hasValidator(l.AQ.required)??!1}set required(e){this._required=(0,m.W6)(e)}get type(){return this._type}set type(e){this._type=e||"text",this._validateType(),!this._isTextarea&&(0,f.mU)().has(this._type)&&(this._elementRef.nativeElement.type=this._type)}get errorStateMatcher(){return this._errorStateTracker.matcher}set errorStateMatcher(e){this._errorStateTracker.matcher=e}get value(){return this._inputValueAccessor.value}set value(e){e!==this.value&&(this._inputValueAccessor.value=e,this.stateChanges.next())}get readonly(){return this._readonly}set readonly(e){this._readonly=(0,m.W6)(e)}get errorState(){return this._errorStateTracker.errorState}set errorState(e){this._errorStateTracker.errorState=e}constructor(e,i,o,u,d,_,c,B,V,A){this._elementRef=e,this._platform=i,this.ngControl=o,this._autofillMonitor=B,this._formField=A,this._uid="mat-input-"+H++,this.focused=!1,this.stateChanges=new I.E,this.controlType="mat-input",this.autofilled=!1,this._disabled=!1,this._type="text",this._readonly=!1,this._neverEmptyInputTypes=["date","datetime","datetime-local","month","time","week"].filter(x=>(0,f.mU)().has(x)),this._iOSKeyupListener=x=>{const p=x.target;!p.value&&0===p.selectionStart&&0===p.selectionEnd&&(p.setSelectionRange(1,1),p.setSelectionRange(0,0))};const C=this._elementRef.nativeElement,T=C.nodeName.toLowerCase();this._inputValueAccessor=c||C,this._previousNativeValue=this.value,this.id=this.id,i.IOS&&V.runOutsideAngular(()=>{e.nativeElement.addEventListener("keyup",this._iOSKeyupListener)}),this._errorStateTracker=new g.mY(_,o,d,u,this.stateChanges),this._isServer=!this._platform.isBrowser,this._isNativeSelect="select"===T,this._isTextarea="textarea"===T,this._isInFormField=!!A,this._isNativeSelect&&(this.controlType=C.multiple?"mat-native-select-multiple":"mat-native-select")}ngAfterViewInit(){this._platform.isBrowser&&this._autofillMonitor.monitor(this._elementRef.nativeElement).subscribe(e=>{this.autofilled=e.isAutofilled,this.stateChanges.next()})}ngOnChanges(){this.stateChanges.next()}ngOnDestroy(){this.stateChanges.complete(),this._platform.isBrowser&&this._autofillMonitor.stopMonitoring(this._elementRef.nativeElement),this._platform.IOS&&this._elementRef.nativeElement.removeEventListener("keyup",this._iOSKeyupListener)}ngDoCheck(){this.ngControl&&(this.updateErrorState(),null!==this.ngControl.disabled&&this.ngControl.disabled!==this.disabled&&(this.disabled=this.ngControl.disabled,this.stateChanges.next())),this._dirtyCheckNativeValue(),this._dirtyCheckPlaceholder()}focus(e){this._elementRef.nativeElement.focus(e)}updateErrorState(){this._errorStateTracker.updateErrorState()}_focusChanged(e){e!==this.focused&&(this.focused=e,this.stateChanges.next())}_onInput(){}_dirtyCheckNativeValue(){const e=this._elementRef.nativeElement.value;this._previousNativeValue!==e&&(this._previousNativeValue=e,this.stateChanges.next())}_dirtyCheckPlaceholder(){const e=this._getPlaceholder();if(e!==this._previousPlaceholder){const i=this._elementRef.nativeElement;this._previousPlaceholder=e,e?i.setAttribute("placeholder",e):i.removeAttribute("placeholder")}}_getPlaceholder(){return this.placeholder||null}_validateType(){S.indexOf(this._type)}_isNeverEmpty(){return this._neverEmptyInputTypes.indexOf(this._type)>-1}_isBadInput(){let e=this._elementRef.nativeElement.validity;return e&&e.badInput}get empty(){return!(this._isNeverEmpty()||this._elementRef.nativeElement.value||this._isBadInput()||this.autofilled)}get shouldLabelFloat(){if(this._isNativeSelect){const e=this._elementRef.nativeElement,i=e.options[0];return this.focused||e.multiple||!this.empty||!!(e.selectedIndex>-1&&i&&i.label)}return this.focused||!this.empty}setDescribedByIds(e){e.length?this._elementRef.nativeElement.setAttribute("aria-describedby",e.join(" ")):this._elementRef.nativeElement.removeAttribute("aria-describedby")}onContainerClick(){this.focused||this.focus()}_isInlineSelect(){const e=this._elementRef.nativeElement;return this._isNativeSelect&&(e.multiple||e.size>1)}}return(n=r).\u0275fac=function(e){return new(e||n)(t.GI1(t.GMv),t.GI1(f.WU),t.GI1(l.eq,10),t.GI1(l.SC,8),t.GI1(l.uW,8),t.GI1(g.u9),t.GI1(F,10),t.GI1(w),t.GI1(t.WW2),t.GI1(h.Y$,8))},n.\u0275dir=t.Sc5({type:n,selectors:[["input","matInput",""],["textarea","matInput",""],["select","matNativeControl",""],["input","matNativeControl",""],["textarea","matNativeControl",""]],hostAttrs:[1,"mat-mdc-input-element"],hostVars:18,hostBindings:function(e,i){1&e&&t.qCj("focus",function(){return i._focusChanged(!0)})("blur",function(){return i._focusChanged(!1)})("input",function(){return i._onInput()}),2&e&&(t.SoX("id",i.id)("disabled",i.disabled)("required",i.required),t.e48("name",i.name||null)("readonly",i.readonly&&!i._isNativeSelect||null)("aria-invalid",i.empty&&i.required?null:i.errorState)("aria-required",i.required)("id",i.id),t.eAK("mat-input-server",i._isServer)("mat-mdc-form-field-textarea-control",i._isInFormField&&i._isTextarea)("mat-mdc-form-field-input-control",i._isInFormField)("mdc-text-field__input",i._isInFormField)("mat-mdc-native-select-inline",i._isInlineSelect()))},inputs:{disabled:"disabled",id:"id",placeholder:"placeholder",name:"name",required:"required",type:"type",errorStateMatcher:"errorStateMatcher",userAriaDescribedBy:[t.Wk5.None,"aria-describedby","userAriaDescribedBy"],value:"value",readonly:"readonly"},exportAs:["matInput"],standalone:!0,features:[t.M5G([{provide:h.u0,useExisting:n}]),t.SYr]}),r})(),O=(()=>{var n;class r{}return(n=r).\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.a4G({type:n}),n.\u0275inj=t.s3X({imports:[g.AN,h.wb,h.wb,R,g.AN]}),r})();function L(n,r){if(1&n&&(t.I0R(0,"div",10)(1,"p"),t.OEk(2,"Error sending email"),t.C$Y(),t.I0R(3,"p"),t.OEk(4),t.C$Y()()),2&n){const s=t.GaO(2);t.yG2(4),t.cNF(s.error)}}function z(n,r){if(1&n){const s=t.KQA();t.I0R(0,"form",2,3),t.qCj("ngSubmit",function(){t.usT(s);const i=t.Gew(1),o=t.GaO();return t.CGJ(o.submit(i.value))}),t.I0R(2,"mat-form-field",4)(3,"mat-label"),t.OEk(4,"Name"),t.C$Y(),t.wR5(5,"input",5),t.C$Y(),t.I0R(6,"mat-form-field",4)(7,"mat-label"),t.OEk(8,"Email"),t.C$Y(),t.wR5(9,"input",6),t.C$Y(),t.I0R(10,"mat-form-field",4)(11,"mat-label"),t.OEk(12,"Message"),t.C$Y(),t.wR5(13,"textarea",7),t.C$Y(),t.I0R(14,"button",8),t.OEk(15,"Send"),t.C$Y(),t.yuY(16,L,5,1,"div",9),t.C$Y()}if(2&n){const s=t.Gew(1),e=t.GaO();t.yG2(14),t.E7m("disabled",!s.valid),t.yG2(2),t.E7m("ngIf",e.error)}}function D(n,r){1&n&&(t.I0R(0,"div",11)(1,"p"),t.OEk(2,"Thank you for reaching out."),t.C$Y(),t.I0R(3,"p"),t.OEk(4,"Our team would respond promptly."),t.C$Y()())}let G=(()=>{var n;class r{constructor(e){this.firestore=e,this.emailSent=!1}submit(e){const i=["[email protected]","[email protected]","[email protected]","[email protected]"];(0,v.sB)((0,v.oV)(this.firestore,"mail"),{to:i,from:e.email,replyTo:[e.email,...i],message:{subject:"NgRx Workshops contact",text:`${e.body}\n${e.fromName}`}}).then(()=>this.emailSent=!0,o=>this.error=o)}}return(n=r).\u0275fac=function(e){return new(e||n)(t.GI1(v.OI))},n.\u0275cmp=t.In1({type:n,selectors:[["ngrx-contact-form"]],decls:3,vars:2,consts:[[3,"ngSubmit",4,"ngIf","ngIfElse"],["thankYou",""],[3,"ngSubmit"],["contactForm","ngForm"],["appearance","fill",1,"example-full-width"],["matInput","","required","","ngModel","","name","fromName","placeholder","Enter your name"],["type","email","matInput","","ngModel","","email","","name","email","required","","placeholder","Enter your email"],["type","text","matInput","","ngModel","","name","body","required","","placeholder","Type your message","rows","10"],["mat-raised-button","","color","primary","type","submit",3,"disabled"],["class","alert is-critical",4,"ngIf"],[1,"alert","is-critical"],[1,"alert","is-helpful"]],template:function(e,i){if(1&e&&t.yuY(0,z,17,2,"form",0)(1,D,5,0,"ng-template",null,1,t.gJz),2&e){const o=t.Gew(2);t.E7m("ngIf",!i.emailSent)("ngIfElse",o)}},dependencies:[E.u_,M.Gw,l.sz,l.ot,l.ue,l.u,l.eJ,l.Gc,l._G,l.SC,h.Up,h.w5,N],styles:["[_nghost-%COMP%]{display:block;margin:20px auto;max-width:500px}form[_ngcontent-%COMP%]{display:flex;flex-direction:column}button[_ngcontent-%COMP%]{align-self:end}\n\n/*# sourceMappingURL=contact-form.component.ts-angular-inline--4.css.map*/"]}),r})(),P=(()=>{var n;class r{constructor(){this.customElementComponent=G}}return(n=r).\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.a4G({type:n}),n.\u0275inj=t.s3X({imports:[E.MD,M.oJ,l.y,h.wb,O]}),r})()}}]);
//# sourceMappingURL=src_app_custom-elements_contact-form_contact-form_module_ts.e4576fd9f4fd6a45.js.map