import{b as T,c as k,h as F,i as N,k as V,m as D,n as q,t as j,y as B}from"./chunk-AUG6ZMIQ.js";import{a as U}from"./chunk-IQYEAILM.js";import"./chunk-3NZUMR4F.js";import{c as $}from"./chunk-JQJV7TYV.js";import{c as L,f as P}from"./chunk-YM543BQE.js";import{m as G,o as K,p as R}from"./chunk-STBSUBIU.js";import{Ac as E,Ba as A,Ca as _,Cb as g,Hb as p,Jc as m,Kc as u,Ob as f,Tb as r,Ub as s,Vb as c,Zb as x,_ as S,ac as I,cc as w,kb as n,lb as d,oc as v,qa as b,qc as l,rc as M,sc as h,xb as C}from"./chunk-NW2U37DI.js";import"./chunk-TWZW5B45.js";function O(i,y){i&1&&(r(0,"small",22),l(1),m(2,"translate"),s()),i&2&&(n(),M(u(2,1,"GeminiKey is required")))}function Y(i,y){if(i&1&&(r(0,"div"),g(1,O,3,3,"small",22),s()),i&2){w();let t=v(22);n(),f(t.errors!=null&&t.errors.required?1:-1)}}function z(i,y){i&1&&c(0,"i",21)}var ae=(()=>{class i extends R{constructor(t,o,e,a){super(a),this.adminService=t,this.toastr=o,this.translate=e,this.sendingResponse={}}ngOnInit(){this.getgoogleanalytics(),this.adminService.RefreshRquestAdmin$.pipe(S(this.unSubscribe$)).subscribe({next:()=>this.getgoogleanalytics()})}getgoogleanalytics(){this.loaderService.showLoader(),this.adminService.aisetup().subscribe({next:t=>{this.responce=t,this.loaderService.hideLoader()},error:()=>this.loaderService.hideLoader()})}GoogleAnalytics(t,o){t.valid?(this.sendingResponse[o]=!0,this.adminService.geminiApiStore(t.value).pipe(S(this.unSubscribe$)).subscribe({next:e=>{this.sendingResponse[o]=!1,e.success&&this.toastr.success(this.translate.transform(e.success)),e.geminiKey&&this.toastr.error(this.translate.transform(e.geminiKey))},error:()=>{this.sendingResponse[o]=!1}})):this.toastr.error(this.translate.transform("Invalid values"))}static{this.\u0275fac=function(o){return new(o||i)(d(P),d(G),d(L),d(K))}}static{this.\u0275cmp=b({type:i,selectors:[["app-ai-setup"]],standalone:!0,features:[C,E],decls:30,vars:16,consts:[["FormData","ngForm"],["geminiKey","ngModel"],[3,"title"],[1,"col-xl-12","col-lg-12","col-md-12"],[1,"row"],[1,"col-xl-6"],[1,"card"],[3,"ngSubmit"],[1,"card-header","d-md-flex","d-block"],[1,"card-title","flex-grow-1"],[1,"custom-switch","form-switch"],["type","checkbox","id","myonoffswitch18","ngModel","","name","enableGemini",1,"toggle-class","onoffswitch2-checkbox",3,"checked","ngModel"],["for","myonoffswitch18",1,"toggle-class","onoffswitch2-label"],[1,"card-body"],[1,"form-group"],[1,"form-label"],[1,"text-red"],["type","text","name","geminiKey","required","",1,"form-control",3,"ngModel"],[1,"col-md-12","card-footer"],[1,"form-group","float-end"],["type","submit",1,"btn","btn-secondary",3,"disabled"],[1,"fa","fa-spinner","fa-spin","mx-1"],[1,"text-danger"]],template:function(o,e){if(o&1){let a=x();c(0,"admin-page-header",2),r(1,"div",3)(2,"div",4)(3,"div",5)(4,"div",6)(5,"form",7,0),I("ngSubmit",function(){A(a);let H=v(6);return _(e.GoogleAnalytics(H,"googleAnalytics"))}),r(7,"div",8)(8,"div",9),l(9),m(10,"translate"),s(),r(11,"div",10),c(12,"input",11)(13,"label",12),s()(),r(14,"div",13)(15,"div",14)(16,"label",15),l(17),m(18,"translate"),r(19,"span",16),l(20,"*"),s()(),c(21,"input",17,1),g(23,Y,2,1,"div"),s()(),r(24,"div",18)(25,"div",19)(26,"button",20),l(27),m(28,"translate"),g(29,z,1,0,"i",21),s()()()()()()()()}if(o&2){let a=v(22);p("title","AI setup"),n(9),h(" ",u(10,10,"Gemini AI setup settings")," "),n(3),p("checked",(e.responce==null||e.responce.settings==null?null:e.responce.settings.enableGeminiApi)=="on")("ngModel",(e.responce==null||e.responce.settings==null?null:e.responce.settings.enableGeminiApi)=="on"),n(5),h("",u(18,12,"GEMINI_API_KEY")," "),n(4),p("ngModel",e.responce==null||e.responce.settings==null?null:e.responce.settings.geminiApiKey),n(2),f(a.invalid&&a.touched||a.dirty?23:-1),n(3),p("disabled",e.sendingResponse.googleAnalytics),n(),h("",u(28,14,"Save Changes")," "),n(2),f(e.sendingResponse.googleAnalytics?29:-1)}},dependencies:[U,$,B,q,k,T,F,N,j,D,V]})}}return i})();export{ae as AiSetupComponent};
