import{$a as X,Cb as Y,Ga as G,Ha as q,Ia as H,Ja as B,L as d,Qa as J,Ra as K,a as P,ra as k,ta as Z,va as Q}from"./chunk-3CM4SKDO.js";import{Ac as A,Da as M,Fb as I,Gb as O,Gc as U,Jc as v,Kc as y,Lb as p,Ra as R,Ub as F,Wb as C,Xc as W,Yb as g,bc as h,cc as _,dc as m,ec as w,f as z,ic as b,jc as S,ma as N,nb as l,oa as x,r as D,s as f,sa as a,tb as T,uc as c,ud as j,yc as L,yd as u,zc as V}from"./chunk-4BRW6LCZ.js";var ne=["switchElement"];function oe(i,s){i&1&&w(0,"nz-icon",3)}function re(i,s){if(i&1&&(b(0),v(1),S()),i&2){let r=c(2);l(),y(r.nzCheckedChildren)}}function ae(i,s){if(i&1&&p(0,re,2,1,"ng-container",6),i&2){let r=c();h("nzStringTemplateOutlet",r.nzCheckedChildren)}}function se(i,s){if(i&1&&(b(0),v(1),S()),i&2){let r=c(2);l(),y(r.nzUnCheckedChildren)}}function le(i,s){if(i&1&&p(0,se,2,1,"ng-container",6),i&2){let r=c();h("nzStringTemplateOutlet",r.nzUnCheckedChildren)}}var ce="switch",de=(()=>{var n;let i,s=[],r=[];return n=class{_nzModuleName=ce;nzConfigService=a(Z);el=a(R).nativeElement;ngZone=a(T);cdr=a(j);focusMonitor=a(X);directionality=a(P);destroyRef=a(M);isChecked=!1;onChange=()=>{};onTouched=()=>{};switchElement;nzLoading=!1;nzDisabled=!1;nzControl=!1;nzCheckedChildren=null;nzUnCheckedChildren=null;nzSize=f(this,s,"default");nzId=(f(this,r),null);dir="ltr";isNzDisableFirstChange=!0;updateValue(e){this.isChecked!==e&&(this.isChecked=e,this.onChange(this.isChecked))}focus(){this.focusMonitor.focusVia(this.switchElement.nativeElement,"keyboard")}blur(){this.switchElement.nativeElement.blur()}constructor(){this.destroyRef.onDestroy(()=>{this.focusMonitor.stopMonitoring(this.switchElement.nativeElement)})}ngOnInit(){this.directionality.change.pipe(d(this.destroyRef)).subscribe(e=>{this.dir=e,this.cdr.detectChanges()}),this.dir=this.directionality.value,k(this.el,"click").pipe(d(this.destroyRef)).subscribe(e=>{e.preventDefault(),!(this.nzControl||this.nzDisabled||this.nzLoading)&&this.ngZone.run(()=>{this.updateValue(!this.isChecked),this.cdr.markForCheck()})}),k(this.switchElement.nativeElement,"keydown").pipe(d(this.destroyRef)).subscribe(e=>{if(this.nzControl||this.nzDisabled||this.nzLoading)return;let{keyCode:t}=e;t!==37&&t!==39&&t!==32&&t!==13||(e.preventDefault(),this.ngZone.run(()=>{t===37?this.updateValue(!1):t===39?this.updateValue(!0):(t===32||t===13)&&this.updateValue(!this.isChecked),this.cdr.markForCheck()}))})}ngAfterViewInit(){this.focusMonitor.monitor(this.switchElement.nativeElement,!0).pipe(d(this.destroyRef)).subscribe(e=>{e||Promise.resolve().then(()=>this.onTouched())})}writeValue(e){this.isChecked=e,this.cdr.markForCheck()}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}setDisabledState(e){this.nzDisabled=this.isNzDisableFirstChange&&this.nzDisabled||e,this.isNzDisableFirstChange=!1,this.cdr.markForCheck()}},(()=>{let e=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;i=[Q()],D(null,null,i,{kind:"field",name:"nzSize",static:!1,private:!1,access:{has:t=>"nzSize"in t,get:t=>t.nzSize,set:(t,o)=>{t.nzSize=o}},metadata:e},s,r),e&&Object.defineProperty(n,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})})(),z(n,"\u0275fac",function(t){return new(t||n)}),z(n,"\u0275cmp",I({type:n,selectors:[["nz-switch"]],viewQuery:function(t,o){if(t&1&&L(ne,7),t&2){let E;V(E=A())&&(o.switchElement=E.first)}},inputs:{nzLoading:[2,"nzLoading","nzLoading",u],nzDisabled:[2,"nzDisabled","nzDisabled",u],nzControl:[2,"nzControl","nzControl",u],nzCheckedChildren:"nzCheckedChildren",nzUnCheckedChildren:"nzUnCheckedChildren",nzSize:"nzSize",nzId:"nzId"},exportAs:["nzSwitch"],features:[W([{provide:Y,useExisting:N(()=>n),multi:!0}])],decls:8,vars:15,consts:[["switchElement",""],["nz-wave","","type","button",1,"ant-switch",3,"disabled","nzWaveExtraNode"],[1,"ant-switch-handle"],["nzType","loading",1,"ant-switch-loading-icon"],[1,"ant-switch-inner"],[1,"ant-click-animating-node"],[4,"nzStringTemplateOutlet"]],template:function(t,o){t&1&&(_(0,"button",1,0)(2,"span",2),C(3,oe,1,0,"nz-icon",3),m(),_(4,"span",4),C(5,ae,1,1,"ng-container")(6,le,1,1,"ng-container"),m(),w(7,"div",5),m()),t&2&&(U("ant-switch-checked",o.isChecked)("ant-switch-loading",o.nzLoading)("ant-switch-disabled",o.nzDisabled)("ant-switch-small",o.nzSize==="small")("ant-switch-rtl",o.dir==="rtl"),h("disabled",o.nzDisabled)("nzWaveExtraNode",!0),F("id",o.nzId),l(3),g(o.nzLoading?3:-1),l(2),g(o.isChecked?5:6))},dependencies:[K,J,q,G,B,H],encapsulation:2,changeDetection:0})),n})(),Te=(()=>{class i{static \u0275fac=function(n){return new(n||i)};static \u0275mod=O({type:i});static \u0275inj=x({imports:[de]})}return i})();export{de as a,Te as b};
