PageSourceSearch

https://dgac.gob.gt/assets/GlobalSettings-CEu7o96u.js

js dgac.gob.gt collected 2026-10-02 11:15:53 UTC 135,843 bytes, 6 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ShopPaymentMethods-Bvq4L_9z.js","assets/ui-vendor-Cm2ZkKHv.js","assets/useRealtimeQuery-dqtk93Nx.js","assets/table-vendor-C2kIG4hh.js","assets/index-DVu_w4ho.js","assets/radix-vendor-CtEXKD-D.js","assets/chart-vendor-b_bTPWgQ.js","assets/react-vendor-DVzxkp4A.js","assets/index-JjaNiqZo.css","assets/useRealtimeHighlight-CxYp5q7d.js","assets/duplicateGuardService-Bau-AUQB.js","assets/shopEngineService-DssenvXc.js","assets/useShopConfig-x3QpNaze.js","assets/card-CyibmazC.js","assets/switch-CZO0JRho.js","assets/textarea-gQKtTFwB.js","assets/table-CYghJKXr.js","assets/swipeable-card-B4TmfDkz.js","assets/tabs-oAd-VtsP.js","assets/TourButton-BlXtTvkT.js","assets/popover-QQzRiqgZ.js","assets/TenantSubscriptionTab-BBjnLOpz.js"])))=>i.map(i=>d[i]);
2import{c as M,L as Ns,aL as ga,B as k,j as C,I as b,ar as Ae,aF as Ye,f as Pe,X as Qe,g as Ze,Z as Je,n as xs,D as Ys,z as Na,A as Qs,E as Zs,F as Js,aB as va,aJ as ya,aC as ea,Y as fa,v as _a,p as wa,aa as ka,t as As,aG as Ca,aM as Ia,aN as Ta,aO as Ma,aP as hs,G as us,ae as Aa,af as Sa,ag as Ea,ah as Fa,_ as sa}from"./index-DVu_w4ho.js";import{j as e,r as j,a as Ue,ad as vs,ab as Da,ac as Ss,b9 as Oa,at as Es,U as Pa,au as aa,n as Ge,a9 as La,a0 as Ra,P as Ua,aa as Fs,dQ as Ga,dR as Ha,dS as Wa,cK as Ba,c4 as za,bY as ra,Q as Le,b7 as qa,dT as Va,dN as Xa,bg as fs,a7 as Re,S as $a,W as ne,e as ta,bZ as Ka,L as Se,o as Ya,X as Qa,dG as Za,aN as ns,bx as is,bE as Ja,bG as er,s as sr,al as ge,bu as ar,aL as ys,aU as rr,am as oa,da as na,b1 as tr,M as ls,bh as la,m as or,ax as nr,aK as Ds,cH as lr,ay as es,z as ps,cE as ir,c1 as Os,O as oe,be as De,az as cr,N as de,bd as Ps,d as Ls,dU as je,cl as dr,cy as mr,cP as xr,bw as Rs,ao as js,dt as hr,D as ur,dV as pr,E as jr,T as Us,bU as br,y as gr}from"./ui-vendor-Cm2ZkKHv.js";import{o as Gs,s as Hs,p as Nr,a as vr,$ as yr,b as ia,F as fr,C as _r,u as wr,c as kr,d as ss,e as w,l as F,f as X}from"./form-vendor-B6iEaDWH.js";import{T as Cr}from"./TiendaBannerManagerDialog-DyuDjxhQ.js";import{C as L,a as G,b as H,c as W,d as U}from"./card-CyibmazC.js";import{S as $}from"./switch-CZO0JRho.js";import{L as Ir}from"./react-vendor-DVzxkp4A.js";import{T as Tr,a as Mr,b as Ws,c as bs,d as Ar,e as gs}from"./table-CYghJKXr.js";import{u as ca}from"./useCrudPermissions-CAfoXz8E.js";import{A as Sr,a as Er,b as Fr,c as Dr,d as Or,e as Pr,f as Lr,g as Rr}from"./alert-dialog-DtkKANN3.js";import{d as Bs}from"./duplicateGuardService-Bau-AUQB.js";import{T as as}from"./textarea-gQKtTFwB.js";import{L as rs}from"./LoadingSpinner-D1E0_9rk.js";import{a as Ur,S as Gr}from"./useRealtimeQuery-dqtk93Nx.js";import{T as Hr,a as Wr,b as zs,c as qs}from"./tabs-oAd-VtsP.js";import{l as Br,a as zr}from"./uploadLibraryService-BhQ7bbai.js";import"./radix-vendor-CtEXKD-D.js";import"./chart-vendor-b_bTPWgQ.js";import"./table-vendor-C2kIG4hh.js";import"./slider-BZ_z5xWI.js";import"./strapiUploadService-DwfntpDw.js";import"./browser-image-compression-BzWLnoYn.js";function Vs(s,o){try{var i=s()}catch(l){return o(l)}return i&&i.then?i.then(void 0,o):i}function qr(s,o){for(var i={};s.length;){var l=s[0],r=l.code,g=l.message,h=l.path.join(".");if(!i[h])if("unionErrors"in l){var A=l.unionErrors[0].errors[0];i[h]={message:A.message,type:A.code}}else i[h]={message:g,type:r};if("unionErrors"in l&&l.unionErrors.forEach(function(E){return E.errors.forEach(function(V){return s.push(V)})}),o){var I=i[h].types,P=I&&I[l.code];i[h]=ia(h,o,i,r,P?[].concat(P,l.message):l.message)}s.shift()}return i}function Vr(s,o){for(var i={};s.length;){var l=s[0],r=l.code,g=l.message,h=l.path.join(".");if(!i[h])if(l.code==="invalid_union"&&l.errors.length>0){var A=l.errors[0][0];i[h]={message:A.message,type:A.code}}else i[h]={message:g,type:r};if(l.code==="invalid_union"&&l.errors.forEach(function(E){return E.forEach(function(V){return s.push(V)})}),o){var I=i[h].types,P=I&&I[l.code];i[h]=ia(h,o,i,r,P?[].concat(P,l.message):l.message)}s.shift()}return i}function Xr(s,o,i){if(i===void 0&&(i={}),function(l){return"_def"in l&&typeof l._def=="object"&&"typeName"in l._def}(s))return function(l,r,g){try{return Promise.resolve(Vs(function(){return Promise.resolve(s[i.mode==="sync"?"parse":"parseAsync"](l,o)).then(function(h){return g.shouldUseNativeValidation&&Gs({},g),{errors:{},values:i.raw?Object.assign({},l):h}})}
2,function(h){if(function(A){return Array.isArray(A==null?void 0:A.issues)}(h))return{values:{},errors:Hs(qr(h.errors,!g.shouldUseNativeValidation&&g.criteriaMode==="all"),g)};throw h}))}catch(h){return Promise.reject(h)}};if(function(l){return"_zod"in l&&typeof l._zod=="object"}(s))return function(l,r,g){try{return Promise.resolve(Vs(function(){return Promise.resolve((i.mode==="sync"?Nr:vr)(s,l,o)).then(function(h){return g.shouldUseNativeValidation&&Gs({},g),{errors:{},values:i.raw?Object.assign({},l):h}})},function(h){if(function(A){return A instanceof yr}(h))return{values:{},errors:Hs(Vr(h.issues,!g.shouldUseNativeValidation&&g.criteriaMode==="all"),g)};throw h}))}catch(h){return Promise.reject(h)}};throw new Error("Invalid input: not a Zod schema")}const $r=fr,da=j.createContext({}),d=({...s})=>e.jsx(da.Provider,{value:{name:s.name},children:e.jsx(_r,{...s})}),cs=()=>{const s=j.useContext(da),o=j.useContext(ma),i=wr(),l=j.useId(),r=(o==null?void 0:o.id)||l;if(!(s!=null&&s.name))return{id:r,name:"",formItemId:`${r}-form-item`,formDescriptionId:`${r}-form-item-description`,formMessageId:`${r}-form-item-message`,invalid:!1,isDirty:!1,isTouched:!1,isValidating:!1,error:void 0};const g=i.getFieldState(s.name,i.formState);return{id:r,name:s.name,formItemId:`${r}-form-item`,formDescriptionId:`${r}-form-item-description`,formMessageId:`${r}-form-item-message`,...g}},ma=j.createContext({}),c=j.forwardRef(({className:s,...o},i)=>{const l=j.useId();return e.jsx(ma.Provider,{value:{id:l},children:e.jsx("div",{ref:i,className:M("space-y-2",s),...o})})});c.displayName="FormItem";const m=j.forwardRef(({className:s,...o},i)=>{const{error:l,formItemId:r}=cs();return e.jsx(Ns,{ref:i,className:M(l&&"text-destructive",s),htmlFor:r,...o})});m.displayName="FormLabel";const n=j.forwardRef(({...s},o)=>{const{error:i,formItemId:l,formDescriptionId:r,formMessageId:g}=cs();return e.jsx(ga,{ref:o,id:l,"aria-describedby":i?`${r} ${g}`:`${r}`,"aria-invalid":!!i,...s})});n.displayName="FormControl";const N=j.forwardRef(({className:s,...o},i)=>{const{formDescriptionId:l}=cs();return e.jsx("p",{ref:i,id:l,className:M("text-sm text-muted-foreground",s),...o})});N.displayName="FormDescription";const v=j.forwardRef(({className:s,children:o,...i},l)=>{const{error:r,formMessageId:g}=cs(),h=r?String(r==null?void 0:r.message):o;return h?e.jsx("p",{ref:l,id:g,className:M("text-sm font-medium text-destructive",s),...i,children:h}):null});v.displayName="FormMessage";const Kr=({form:s})=>{const[o,i]=Ue.useState(!1),l=!!s.watch("habilitar_envios");return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{
2className:"flex items-center gap-2",children:[e.jsx(vs,{className:"w-5 h-5"}),"Canales de Venta"]}),e.jsx(W,{children:"Habilita los canales de venta que utilizará tu negocio"})]}),e.jsx(U,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(d,{control:s.control,name:"habilitar_ecommerce",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(vs,{className:"w-4 h-4 text-primary"}),"E-commerce"]}),e.jsx(N,{children:"Tienda en línea"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"habilitar_pos",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Da,{className:"w-4 h-4 text-primary"}),"Punto de Venta"]}),e.jsx(N,{children:"Sistema POS"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"habilitar_restaurante",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ss,{className:"w-4 h-4 text-primary"}),"Restaurante"]}),e.jsx(N,{children:"Gestión de mesas"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"habilitar_cocina",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Oa,{className:"w-4 h-4 text-primary"}),"Cocina"]}),e.jsx(N,{children:"Pantalla de cocina"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"habilitar_envios",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Es,{className:"w-4 h-4 text-primary"}),"Envíos"]}),e.jsx(N,{children:"Gestión de entregas"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"habilitar_pilotos",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Pa,{className:"w-4 h-4 text-primary"}),"Pilotos"]}),e.jsx(N,{children:"App de repartidores"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"habilitar_tracking",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(aa,{className:"w-4 h-4 text-primary"}),"Tracking"]}),e.jsx(N,{children:"Rastreo de pedidos"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})})]})})]}),e.jsx(L,{className:"border-emerald-500/20 bg-emerald-500/5 shadow-sm",children:e.jsx(G,{className:"pb-3",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs(H,{
2className:"flex items-center gap-2 text-base font-bold text-foreground",children:[e.jsx(Ge,{className:"w-5 h-5 text-emerald-600 dark:text-emerald-400"}),"Banners y Promociones de Vitrina"]}),e.jsx(W,{className:"mt-1",children:"Configura los anuncios principales, promociones destacadas (% OFF) y llamadas a la acción en la cabecera de la tienda online."})]}),e.jsxs(k,{type:"button",size:"sm",className:"rounded-xl bg-emerald-600 hover:bg-emerald-700 text-white font-bold shrink-0 shadow-sm",onClick:()=>i(!0),children:[e.jsx(Ge,{className:"mr-2 h-4 w-4"}),"Gestionar Banners"]})]})})}),e.jsxs(L,{className:"border-blue-500/20 bg-blue-500/5 shadow-sm",children:[e.jsx(G,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(H,{className:"flex items-center gap-2 text-base font-bold text-foreground",children:[e.jsx(Es,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"}),"Reglas de Entrega y Envío Gratis"]}),e.jsx(W,{className:"mt-1",children:"Define la meta de compra mínima para activar la barra de progreso de Envío Gratis en el carrito y el costo base de flete."})]}),e.jsx(C,{variant:l?"default":"secondary",className:"shrink-0 font-bold",children:l?"Envíos Habilitados":"Módulo Envíos Inactivo"})]})}),e.jsx(U,{className:"space-y-4 pt-1",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:s.control,name:"umbral_envio_gratis",render:({field:r})=>e.jsxs(c,{className:"rounded-xl border bg-background/80 backdrop-blur-sm p-4 shadow-2xs",children:[e.jsxs(m,{className:"text-sm font-semibold text-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Monto Mínimo para Envío Gratis (Q)"}),e.jsx(C,{variant:"outline",className:"text-[11px] font-mono",children:"Meta Dinámica"})]}),e.jsx(n,{children:e.jsx(b,{type:"number",step:"1",min:"0",placeholder:"150",className:"rounded-lg font-mono font-bold text-base",...r,value:r.value??""})}),e.jsx(N,{className:"text-xs",children:"La tienda mostrará la barra de progreso hacia este monto (ej. Q150). Si es 0, no se exige mínimo."}),e.jsx(v,{})]})}),e.jsx(d,{control:s.control,name:"costo_envio_base",render:({field:r})=>e.jsxs(c,{className:"rounded-xl border bg-background/80 backdrop-blur-sm p-4 shadow-2xs",children:[e.jsxs(m,{className:"text-sm font-semibold text-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Costo Base de Envío Estándar (Q)"}),e.jsx(C,{variant:"outline",className:"text-[11px] font-mono",children:"Flete"})]}),e.jsx(n,{children:e.jsx(b,{type:"number",step:"1",min:"0",placeholder:"25",className:"rounded-lg font-mono font-bold text-base",...r,value:r.value??""})}),e.jsx(N,{className:"text-xs",children:"Tarifa de envío estándar sugerida cuando el pedido no alcanza el beneficio de entrega gratuita."}),e.jsx(v,{})]})})]})})]}
2),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(La,{className:"w-5 h-5"}),"Gestión de Inventario"]}),e.jsx(W,{children:"Configura cómo se manejará el inventario en tu sistema"})]}),e.jsx(U,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(d,{control:s.control,name:"manejar_variantes",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ra,{className:"w-4 h-4 text-primary"}),"Variantes"]}),e.jsx(N,{children:"Tallas, colores, etc."})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"manejar_sucursales",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ua,{className:"w-4 h-4 text-primary"}),"Sucursales"]}),e.jsx(N,{children:"Múltiples ubicaciones"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"manejar_bodegas",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Fs,{className:"w-4 h-4 text-primary"}),"Bodegas"]}),e.jsx(N,{children:"Almacenes de stock"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"manejar_multi_bodega",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Fs,{className:"w-4 h-4 text-primary"}),"Multi-Bodega"]}),e.jsx(N,{children:"Transferencias entre bodegas"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"manejar_reservas_inventario",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ga,{className:"w-4 h-4 text-primary"}),"Reservas"]}),e.jsx(N,{children:"Reservar stock por pedido"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})})]})})]}
2),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(Ss,{className:"w-5 h-5"}),"Opciones de Restaurante"]}),e.jsx(W,{children:"Funciones específicas para restaurantes y cafeterías"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(d,{control:s.control,name:"permitir_dividir_cuenta",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ha,{className:"w-4 h-4 text-primary"}),"Dividir Cuenta"]}),e.jsx(N,{children:"Pagos separados por mesa"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"permitir_propina",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Wa,{className:"w-4 h-4 text-primary"}),"Propina"]}),e.jsx(N,{children:"Agregar propina a cuenta"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"permitir_cortesias",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Ba,{className:"w-4 h-4 text-primary"}),"Cortesías"]}),e.jsx(N,{children:"Productos sin cargo"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})})]}),e.jsx(Ae,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:s.control,name:"minutos_expira_reserva",render:({field:r})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(za,{className:"w-4 h-4"}),"Minutos Expiración Reserva"]}),e.jsx(n,{children:e.jsx(b,{type:"number",min:"0",placeholder:"15",...r})}),e.jsx(N,{children:"Tiempo antes de liberar una reserva no confirmada"}),e.jsx(v,{})]})}),e.jsx(d,{control:s.control,name:"restaurante_descuenta_en",render:({field:r})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-4 h-4"}),"Descontar Inventario En"]}),e.jsx(n,{children:e.jsx(b,{type:"number",min:"0",max:"2",placeholder:"0",...r})}),e.jsx(N,{children:"0 = Al ordenar, 1 = Al facturar, 2 = Al entregar"}),e.jsx(v,{})]})})]})]})]}
2),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"w-5 h-5"}),"Métodos de Pago"]}),e.jsx(W,{children:"Habilita los métodos de pago que aceptarás"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(d,{control:s.control,name:"permitir_pago_tarjeta",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Le,{className:"w-4 h-4 text-primary"}),"Tarjeta"]}),e.jsx(N,{children:"Crédito/Débito"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"permitir_transferencia",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(qa,{className:"w-4 h-4 text-primary"}),"Transferencia"]}),e.jsx(N,{children:"Bancaria/Digital"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"permitir_pago_contra_entrega",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Va,{className:"w-4 h-4 text-primary"}),"Contra Entrega"]}),e.jsx(N,{children:"Pago al recibir"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})}),e.jsx(d,{control:s.control,name:"permitir_pago_pos",render:({field:r})=>e.jsxs(c,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(Le,{className:"w-4 h-4 text-primary"}),"POS"]}),e.jsx(N,{children:"Terminal punto de venta"})]}),e.jsx(n,{children:e.jsx($,{checked:r.value,onCheckedChange:r.onChange})})]})})]}),e.jsx(Ae,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:s.control,name:"moneda_global",render:({field:r})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(Xa,{className:"w-4 h-4"}),"Moneda Global"]}),e.jsx(n,{children:e.jsx(b,{placeholder:"GTQ",maxLength:10,...r})}),e.jsx(N,{children:"Código de moneda (ej: GTQ, USD, EUR)"}),e.jsx(v,{})]})}),e.jsx(d,{control:s.control,name:"porcentaje_puntos",render:({field:r})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(fs,{className:"w-4 h-4"}),"Porcentaje de Puntos"]}),e.jsx(n,{children:e.jsx(b,{type:"number",step:"0.01",min:"0",max:"100",placeholder:"1.00",...r})}),e.jsx(N,{children:"% del total que se convierte en puntos (0-100)"}),e.jsx(v,{})]})})]})]})]}),e.jsxs(L,{className:"border-primary/30 bg-gradient-to-br from-card via-card to-primary/5 shadow-md",children:[e.jsxs(G,{children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[e.jsxs(H,{
2className:"flex items-center gap-2 text-base font-bold",children:[e.jsx(Re,{className:"w-5 h-5 text-primary"}),"Pasarelas de Pago Online Multi-Plataforma"]}),e.jsx(C,{variant:"outline",className:"bg-primary/10 text-primary border-primary/30 text-xs font-semibold",children:"Guatemala 🇬🇹 + EE.UU. 🇺🇸 / Global"})]}),e.jsx(W,{children:"Configura y conecta tus credenciales de cobro por internet (API Keys, tokens, sandbox y producción). En el checkout de la tienda pública solo aparecerán aquellas pasarelas que actives."})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇬🇹 QPayPro"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇬🇹 Recurrente"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇬🇹 Págalo"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇬🇹 NeoNet / VisaNet"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇬🇹 BAC Compra-Click"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇺🇸 Stripe (Apple/Google Pay)"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🌐 PayPal Global"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇺🇸 Authorize.Net"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🇺🇸 Square"}),e.jsx(C,{variant:"secondary",className:"text-xs",children:"🏦 Transferencia Bancaria Directa"})]}),e.jsxs("div",{className:"rounded-xl border border-border/80 bg-background/60 p-4 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("p",{className:"text-sm font-bold text-foreground flex items-center gap-1.5",children:[e.jsx($a,{className:"w-4 h-4 text-emerald-500"}),"Administrador de Credenciales y Pasarelas Activas"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define llaves públicas, secretas, webhook secrets y modo de prueba (Sandbox) o producción para cada procesador de pago."})]}),e.jsx(k,{asChild:!0,className:"gap-1.5 shrink-0 rounded-xl font-bold shadow-sm",children:e.jsxs(Ir,{to:"/shop/payment-methods",children:[e.jsx("span",{children:"Configurar Pasarelas"}),e.jsx(ne,{className:"w-4 h-4"})]})})]})]})]}),e.jsx(Cr,{abierto:o,onOpenChange:i})]})};class Yr{async getTaxes(){var o,i,l,r,g;try{return{success:!0,data:((i=(o=(await Ye.get(Pe("crm-impuestos?populate=*"),{headers:{...Ze(),"Cache-Control":"no-cache, no-store, must-revalidate"},timeout:Qe.TIMEOUT})).data)==null?void 0:o.data)==null?void 0:i.map(I=>({id:I.id,documentId:I.documentId,nombre:I.nombre,porcentaje:I.porcentaje,createdAt:I.createdAt,updatedAt:I.updatedAt,publishedAt:I.publishedAt})))||[]}}catch(h){return console.error("Error fetching taxes:",h),Je(h),{success:!1,error:((g=(r=(l=h.response)==null?void 0:l.data)==null?void 0:r.error)==null?void 0:g.message)||h.message||"Error al obtener impuestos"}}}async createTax(o){var i,l,r,g,h,A,I,P,E,V,u;try{if((await Bs.exists({endpoint:"crm-impuestos",field:"nombre",value:o==null?void 0:o.nombre})).exists)return{success:!1,error:"Ya existe un impuesto con ese nombre"};const R=await Ye.post(Pe("crm-impuestos"),{data:o},{headers:Ze(),timeout:Qe.TIMEOUT}),D={id:(l=(i=R.data)==null?void 0:i.data)==null?void 0:l.id,documentId:(g=(r=R.data)==null?void 0:r.data)==null?void 0:g.documentId,nombre:(A=(h=R.data)==null?void 0:h.data)==null?void 0:A.nombre,porcentaje:(P=(I=R.data)==null?void 0:I.data)==null?void 0:P.porcentaje};return xs({moduleName:"Impuesto",action:"created",record:D,recordId:D.documentId||D.id,route:"/shop/payment-methods",payload:o}),{success:!0,data:D}}catch(K){return console.error("Error creating tax:",K),Je(K),{success:!1,error:((u=(V=(E=K.response)==null?void 0:E.data)==null?void 0:V.error)==null?void 0:u.message)||K.message||"Error al crear impuesto"}}}async updateTax(o,i){var l,r,g,h,A,I,P,E,V,u,K;try{if((await Bs.exists({endpoint:"crm-impuestos",field:"nombre",value:i==null?void 0:i.nombre,excludeDocumentId:o})).exists)return{success:!1,error:"Ya existe un impuesto con ese nombre"};const D=await Ye.put(Pe(`crm-impuestos/${o}`),{data:i},{headers:Ze(),timeout:Qe.TIMEOUT}),Y={id:(r=(l=D.data)==null?void 0:l.data)==null?void 0:r.id,documentId:(h=(g=D.data)==null?void 0:g.data)==null?void 0:h.documentId,nombre:(I=(A=D.data)==null?void 0:A.data)==null?void 0:I.nombre,porcentaje:(E=(P=D.data)==null?void 0:P.data)==null?void 0:E.porcentaje};return xs({moduleName:"Impuesto",action:"updated",record:Y,recordId:Y.documentId||Y.id,route:"/shop/payment-methods",payload:i}),{success:!0,data:Y}}catch(R){return console.error("Error updating tax:",R),Je(R),{success:!1,error:((K=(u=(V=R.response)==null?void 0:V.data)==null?void 0:u.error)==null?void 0:K.message)||R.message||"Error al actualizar impuesto"}}}async deleteTax(o){var i,l,r;try{return await Ye.delete(Pe(`crm-impuestos/${o}`),{headers:Ze(),timeout:Qe.TIMEOUT}),xs({moduleName:"Impuesto",action:"deleted",record:{id:o},recordId:o,payload:{eliminado:!0}}),{success:!0}}catch(g){return console.error("Error deleting tax:",g),Je(g),{success:!1,error:((r=(l=(i=g.response)==null?void 0:i.data)==null?void 0:l.error)==null?void 0:r.message)||g.message||"Error al eliminar impuesto"}}}}const ts=new Yr,Qr=({onTaxesChange:s})=>{const{toast:o}=ea(),{canCreate:i,canUpdate:l,canDelete:r}=ca("api::crm-impuesto.crm-impuesto"),[g,h]=j.useState([]),[A,I]=j.useState(!0),[P,E]=j.useState(!1),[V,u]=j.useState(!1),[K,R]=j.useState(!1),[D,Y]=j.useState(null),[ae,re]=j.useState(null),[Q,y]=j.useState({nombre:"",porcentaje:""}),[B,te]=j.useState({nombre:"",porcentaje:""}),[_,z]=j.useState({nombre:"",porcentaje:""});j.useEffect(()=>{se()},[]);const se=async()=>{try{I(!0);const x=await ts.getTaxes();x.success&&h(x.data||[])}catch(x){console.error("Error loading taxes:",x),o({title:"Error",description:"No se pudieron cargar los impuestos",variant:"destructive"})}finally{I(!1)}},ie=j.useCallback((x,q)=>{const T={nombre:"",porcentaje:""};let S=!0;if(x.trim()?x.length>50&&(T.nombre="Máximo 50 caracteres",S=!1):(T.nombre="El nombre es requerido",S=!1),!q)T.porcentaje="El porcentaje es requerido",S=!1;else{const J=parseFloat(q);isNaN(J)?(T.porcentaje="Debe ser un número",S=!1):(J<0||J>100)&&(T.porcentaje="Debe estar entre 0 y 100",S=!1)}return z(T),S},[]),fe=async()=>
2{if(!i||!ie(B.nombre,B.porcentaje))return;const x={id:Date.now(),nombre:B.nombre,porcentaje:parseFloat(B.porcentaje)};h(q=>[...q,x]),te({nombre:"",porcentaje:""}),z({nombre:"",porcentaje:""}),u(!1);try{E(!0);const q=await ts.createTax({nombre:x.nombre,porcentaje:x.porcentaje});if(q.success&&q.data)h(T=>T.map(S=>S.id===x.id?q.data:S)),o({title:"Éxito",description:"Impuesto creado correctamente"}),s==null||s();else throw new Error(q.error)}catch(q){h(T=>T.filter(S=>S.id!==x.id)),o({title:"Error",description:q instanceof Error?q.message:"No se pudo crear el impuesto",variant:"destructive"})}finally{E(!1)}},xe=x=>{l&&(re(x.id),y({nombre:x.nombre,porcentaje:x.porcentaje.toString()}),z({nombre:"",porcentaje:""}))},Ne=()=>{re(null),y({nombre:"",porcentaje:""}),z({nombre:"",porcentaje:""})},_e=async x=>{if(!l||!ie(Q.nombre,Q.porcentaje))return;const q=g.find(S=>S.id===x);if(!q)return;const T={nombre:Q.nombre,porcentaje:parseFloat(Q.porcentaje)};h(S=>S.map(J=>J.id===x?{...J,...T}:J)),re(null);try{E(!0);const S=await ts.updateTax(x,T);if(S.success)o({title:"Éxito",description:"Impuesto actualizado correctamente"}),s==null||s();else throw new Error(S.error)}catch(S){h(J=>J.map(ce=>ce.id===x?q:ce)),o({title:"Error",description:S instanceof Error?S.message:"No se pudo actualizar el impuesto",variant:"destructive"})}finally{E(!1)}},ee=async()=>{if(!r||!D)return;const x=D,q=g.findIndex(T=>T.id===x.id);h(T=>T.filter(S=>S.id!==x.id)),R(!1),Y(null);try{E(!0);const T=await ts.deleteTax(x.id);if(T.success)o({title:"Éxito",description:"Impuesto eliminado correctamente"}),s==null||s();else throw new Error(T.error)}catch(T){h(S=>{const J=[...S];return J.splice(q,0,x),J}),o({title:"Error",description:T instanceof Error?T.message:"No se pudo eliminar el impuesto",variant:"destructive"})}finally{E(!1)}},he=x=>{r&&(Y(x),R(!0))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(H,{
2className:"flex items-center gap-2",children:[e.jsx(ta,{className:"w-5 h-5"}),"Impuestos del Sistema"]}),e.jsx(W,{children:"Administra los impuestos que se aplicarán a tus productos y servicios"})]}),i&&e.jsxs(Ys,{open:V,onOpenChange:x=>{u(x),x||(te({nombre:"",porcentaje:""}),z({nombre:"",porcentaje:""}))},children:[e.jsx(Na,{asChild:!0,children:e.jsxs(k,{className:"gap-2",children:[e.jsx(Ka,{className:"w-4 h-4"}),"Nuevo Impuesto"]})}),e.jsxs(Qs,{children:[e.jsxs(Zs,{children:[e.jsx(Js,{children:"Crear Nuevo Impuesto"}),e.jsx(va,{children:"Ingresa los datos del nuevo impuesto"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ns,{htmlFor:"nombre",children:"Nombre del Impuesto *"}),e.jsx(b,{id:"nombre",placeholder:"ej: IVA, ISR, etc.",value:B.nombre,onChange:x=>{te({...B,nombre:x.target.value}),_.nombre&&z({..._,nombre:""})},className:_.nombre?"border-destructive":"",maxLength:50}),_.nombre&&e.jsx("p",{className:"text-sm text-destructive",children:_.nombre})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Ns,{htmlFor:"porcentaje",children:"Porcentaje (%) *"}),e.jsx(b,{id:"porcentaje",type:"number",step:"0.01",min:"0",max:"100",placeholder:"12.00",value:B.porcentaje,onChange:x=>{te({...B,porcentaje:x.target.value}),_.porcentaje&&z({..._,porcentaje:""})},className:_.porcentaje?"border-destructive":""}),_.porcentaje&&e.jsx("p",{className:"text-sm text-destructive",children:_.porcentaje})]})]}),e.jsxs(ya,{children:[e.jsx(k,{variant:"outline",onClick:()=>u(!1),children:"Cancelar"}),e.jsx(k,{onClick:fe,disabled:P,children:P?e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-4 h-4 mr-2 animate-spin"}),"Guardando..."]}):"Crear Impuesto"})]})]})]})]})}),e.jsx(U,{children:A?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(Se,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):g.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:"No hay impuestos configurados"}),e.jsx("p",{className:"text-sm",children:"Crea tu primer impuesto usando el botón de arriba"})]}):e.jsxs(Tr,{children:[e.jsx(Mr,{children:e.jsxs(Ws,{children:[e.jsx(bs,{children:"Nombre"}),e.jsx(bs,{className:"text-right",children:"Porcentaje"}),e.jsx(bs,{className:"text-right w-[120px]",children:"Acciones"})]})}),e.jsx(Ar,{children:g.map(x=>e.jsxs(Ws,{children:[e.jsx(gs,{className:"font-medium",children:ae===x.id?e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{value:Q.nombre,onChange:q=>{y({...Q,nombre:q.target.value}),_.nombre&&z({..._,nombre:""})},className:`h-8 ${_.nombre?"border-destructive":""}`,maxLength:50,autoFocus:!0}),_.nombre&&e.jsx("p",{className:"text-xs text-destructive",children:_.nombre})]}):x.nombre}),e.jsx(gs,{className:"text-right",children:ae===x.id?e.jsxs("div",{className:"space-y-1",children:[e.jsx(b,{type:"number",step:"0.01",min:"0",max:"100",value:Q.porcentaje,onChange:q=>{y({...Q,porcentaje:q.target.value}),_.porcentaje&&z({..._,porcentaje:""})},className:`h-8 w-24 ml-auto ${_.porcentaje?"border-destructive":""}`}),_.porcentaje&&e.jsx("p",{className:"text-xs text-destructive",children:_.porcentaje})]}):e.jsxs(C,{variant:"secondary",children:[x.porcentaje,"%"]})}),e.jsx(gs,{className:"text-right",children:ae===x.id?e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[l&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8 text-green-600 hover:text-green-700 hover:bg-green-50",onClick:()=>_e(x.id),disabled:P,children:e.jsx(Ya,{className:"w-4 h-4"})}),l&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Ne,children:e.jsx(Qa,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-center justify-end gap-1",children:[l&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>xe(x),children:e.jsx(Za,{className:"w-4 h-4"})}),r&&e.jsx(k,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>he(x),children:e.jsx(ns,{className:"w-4 h-4"})})]})})]},x.id))})]})})]}),e.jsx(Sr,{open:r&&K,onOpenChange:R,children:e.jsxs(Er,{children:[e.jsxs(Fr,{children:[e.jsx(Dr,{children:"¿Eliminar impuesto?"}),e.jsxs(Or,{children:["Esta acción no se puede deshacer. Se eliminará permanentemente el impuesto",e.jsxs("span",{className:"font-medium",children:[' "',D==null?void 0:D.nombre,'"']}),"."]})]}),e.jsxs(Pr,{children:[e.jsx(Lr,{children:"Cancelar"}),e.jsx(Rr,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Eliminar"})]})]})})]})};function Zr({open:s,prefix:o}){const[i,l]=j.useState([]),[r,g]=j.useState(!1),[h,A]=j.useState(!1),[I,P]=j.useState(""),[E,V]=j.useState(1),[u,K]=j.useState(!1),R=24,D=j.useCallback(async(y=E)=>{g(!0);try{const B=await Br({page:y,pageSize:R,search:I,prefix:o,group:"image"});l(B.data),K(B.hasMore),V(y)}finally{g(!1)}},[E,o,I]);j.useEffect(()=>{s&&D(1)},[s,D]),j.useEffect(()=>{if(!s)return;const y=setTimeout(()=>{D(1)},250);return()=>clearTimeout(y)},[s,I,o,D]);const Y=j.useCallback(async y=>{const B=Array.from(y);if(B.length!==0){A(!0);try{const te=new FormData;
2if(B.forEach(z=>{const se=z.slice(0,z.size,z.type),ie=new File([se],`${o}${z.name}`,{type:z.type});te.append("files",ie)}),!(await fetch(Pe("/upload"),{method:"POST",headers:fa(),body:te})).ok)throw new Error("No se pudieron subir los archivos");await D(1)}finally{A(!1)}}},[D,o]),ae=j.useMemo(()=>i,[i]),re=j.useCallback(y=>_a(y.url)||y.url,[]),Q=j.useCallback(y=>zr(y),[]);return{files:i,filteredFiles:ae,loading:r,uploading:h,search:I,setSearch:P,page:E,setPage:V,hasMore:u,fetchFiles:D,uploadFiles:Y,getFileUrl:re,getPreviewUrl:Q}}function Jr({open:s,onOpenChange:o,onSelect:i,title:l="Biblioteca de archivos de configuración",prefix:r="config-global-"}){const[g,h]=j.useState("grid"),[A,I]=j.useState("browse"),{filteredFiles:P,loading:E,uploading:V,search:u,setSearch:K,page:R,hasMore:D,fetchFiles:Y,uploadFiles:ae,getFileUrl:re,getPreviewUrl:Q}=Zr({open:s,prefix:r});return e.jsx(Ys,{open:s,onOpenChange:o,children:e.jsxs(Qs,{size:"xl",className:"h-[85vh] flex flex-col p-0",children:[e.jsx(Zs,{className:"px-6 py-4 border-b",children:e.jsx(Js,{children:l})}),e.jsxs(Hr,{value:A,onValueChange:y=>I(y),className:"flex-1 flex flex-col px-6",children:[e.jsxs(Wr,{className:"grid w-full grid-cols-2 mt-4",children:[e.jsx(zs,{value:"browse",children:"Biblioteca"}),e.jsx(zs,{value:"upload",children:"Subir"})]}),e.jsxs(qs,{value:"browse",className:"flex-1 flex flex-col m-0 pt-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[e.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[e.jsx(is,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(b,{value:u,onChange:y=>K(y.target.value),placeholder:"Buscar archivo...",className:"pl-9"})]}),e.jsxs("div",{className:"flex items-center border rounded-lg",children:[e.jsx(k,{type:"button",variant:g==="grid"?"secondary":"ghost",size:"sm",className:"h-8 px-2",onClick:()=>h("grid"),children:e.jsx(Ja,{className:"h-4 w-4"})}),e.jsx(k,{type:"button",variant:g==="list"?"secondary":"ghost",size:"sm",className:"h-8 px-2",onClick:()=>h("list"),children:e.jsx(er,{className:"h-4 w-4"})})]}),e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:()=>Y(1),disabled:E,children:[e.jsx(sr,{className:M("h-4 w-4 mr-2",E&&"animate-spin")}),"Actualizar"]})]}),e.jsx(wa,{className:"flex-1 pb-4",children:E?e.jsx("div",{className:M(g==="grid"?"grid grid-cols-2 md:grid-cols-4 gap-4":"space-y-2"),children:Array.from({length:8}).map((y,B)=>e.jsx(ka,{className:g==="grid"?"aspect-square rounded-lg":"h-16 rounded-lg"},B))}):P.length===0?e.jsxs("div",{className:"flex h-48 flex-col items-center justify-center text-muted-foreground",children:[e.jsx(ge,{className:"h-10 w-10 mb-3 opacity-50"}),e.jsx("p",{children:"No hay archivos de configuración todavía"})]}):g==="grid"?e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:P.map(y=>e.jsxs("button",{type:"button",onClick:()=>{i(y),o(!1)},className:"group rounded-lg border overflow-hidden text-left hover:border-primary transition-colors",children:[e.jsx("img",{src:Q(y),alt:y.name,className:"w-full aspect-square object-cover bg-muted/40"}),e.jsxs("div",{className:"p-3",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:y.name.replace(r,"")}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.width&&y.height?`${y.width}x${y.height}`:"Archivo"})]})]},y.id))}):e.jsx("div",{className:"space-y-2",children:P.map(y=>e.jsxs("button",{type:"button",onClick:()=>{i(y),o(!1)},className:"w-full flex items-center gap-3 rounded-lg border p-3 hover:border-primary transition-colors text-left",children:[e.jsx("img",{src:Q(y),alt:y.name,className:"w-12 h-12 object-cover rounded-md border bg-muted/40"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:y.name.replace(r,"")}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:re(y)})]}),e.jsx(C,{variant:"outline",children:"Seleccionar"})]},y.id))})}),e.jsxs("div",{className:"flex items-center justify-between border-t pt-3 pb-1",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Página ",R,P.length>0?` · ${P.length} archivo(s)`:""]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{type:"button",variant:"outline",size:"sm",disabled:E||R<=1,onClick:()=>Y(R-1),children:e.jsx(ar,{className:"h-4 w-4"})}),e.jsx(k,{type:"button",variant:"outline",size:"sm",disabled:E||!D,onClick:()=>Y(R+1),children:e.jsx(ys,{className:"h-4 w-4"})})]})]})]}),e.jsx(qs,{value:"upload",className:"m-0 py-4",children:e.jsxs("label",{className:"flex min-h-[260px] cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-muted-foreground
2/30 p-8 text-center hover:border-primary transition-colors",children:[e.jsx(rr,{className:M("h-10 w-10 mb-3",V?"animate-pulse text-primary":"text-muted-foreground")}),e.jsx("p",{className:"text-base font-medium",children:V?"Subiendo archivos...":"Subir archivo de configuración"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"La carga se guarda en una colección aislada para configuración."}),e.jsx(b,{type:"file",className:"hidden",accept:"image/*",multiple:!0,disabled:V,onChange:async y=>{var B;if((B=y.target.files)!=null&&B.length)try{await ae(y.target.files),As.success("Archivo subido a la biblioteca de configuración"),I("browse")}catch{As.error("No se pudo subir el archivo")}finally{y.target.value=""}}})]})})]})]})})}const et=Ue.lazy(()=>sa(()=>import("./ShopPaymentMethods-Bvq4L_9z.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),st=Ue.lazy(()=>sa(()=>import("./TenantSubscriptionTab-BBjnLOpz.js"),__vite__mapDeps([21,1,13,4,5,6,3,7,8,18,16]))),Me=w().optional().refine(s=>!s||s===""||/^https?:\/\/.+/.test(s),{message:"URL inválida (debe iniciar con http:// o https://)"}),be=w().optional().refine(s=>!s||s===""||!isNaN(Number(s))&&Number(s)>=0,{message:"Debe ser un número positivo"}),at=w().optional().refine(s=>!s||s===""||!isNaN(Number(s))&&Number(s)>=0&&Number(s)<=100,{message:"Debe ser un porcentaje entre 0 y 100"}),rt=w().optional().refine(s=>!s||s===""||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s),{message:"Email inválido"}),Oe=w().optional().refine(s=>!s||s===""||/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(s),{message:"Color inválido (usar formato #RRGGBB)"}),tt=w().optional().refine(s=>!s||s===""||/^G-[A-Z0-9]+$/i.test(s),{message:"Usa un ID válido tipo G-XXXXXXXX"}),ot=w().optional().refine(s=>!s||s===""||/^AW-\d+$/i.test(s),{message:"Usa un ID válido tipo AW-123456789"}),nt=w().optional().refine(s=>!s||s===""||/^GTM-[A-Z0-9]+$/i.test(s),{message:"Usa un ID válido tipo GTM-XXXXXXX"}),lt=w().max(8e3,"Máximo 8000 caracteres").optional().refine(s=>!s||s.trim()===""?!0:/googletagmanager\.com|google-analytics\.com|gtag\(|G-[A-Z0-9]+|AW-\d+|GTM-[A-Z0-9]+/i.test(s),{message:"Pega un script válido de Google Analytics, Google Ads o Tag Manager"}),os=s=>{if(!s)return-1;const o=s.match(/^(\d{1,2}):(\d{2})/);return o?parseInt(o[1])*60+parseInt(o[2]):-1},it=ss({siteName:w().min(1,"El nombre del sitio es requerido").max(100,"Máximo 100 caracteres"),tagline:w().max(200,"Máximo 200 caracteres").optional().or(F("")),name_sub_dominio:w().optional().refine(s=>!s||s===""||/^[a-z0-9-]+$/.test(s),{message:"Solo letras minúsculas, números y guiones"}),pagina_web_url:Me,googleAnalyticsId:tt.or(F("")),googleAdsId:ot.or(F("")),googleTagManagerId:nt.or(F("")),googleTagScript:lt.or(F("")),contactEmail:rt,contactPhone:w().max(20,"Máximo 20 caracteres").optional().or(F("")),chatWhatsApp:w().optional().refine(s=>!s||s===""||/^\d+$/.test(s),{message:"Solo números permitidos"}),address:w().max(300,"Máximo 300 caracteres").optional().or(F("")),colors:ss({primaryColor:Oe,secondaryColor:Oe,accentColor:Oe,backgroundColor:Oe,textColor:Oe}).optional(),seo:ss({metaTitle:w().max(60,"Máximo 60 caracteres para SEO").optional().or(F("")),metaDescription:w().max(160,"Máximo 160 caracteres para SEO").optional().or(F("")),twitterHandle:w().max(50,"Máximo 50 caracteres").optional().or(F("")),keywords:w().max(200,"Máximo 200 caracteres").optional().or(F(""))}).optional(),socials:ss({facebookUrl:Me,twitterUrl:Me,instagramUrl:Me,linkedinUrl:Me,youtubeUrl:Me}).optional(),tokenOpenRouter:w().optional().or(F("")),ollamaBaseUrl:w().optional().or(F("")),ollamaModel:w().optional().or(F("")),ollamaToken:w().optional().or(F("")),tokenChatIa1:w().optional().or(F("")),tokenChatIa2:w().optional().or(F("")),tockenChatIa3:w().optional().or(F("")),tockenChatIa4:w().optional().or(F("")),tockenChatIa5:w().optional().or(F("")),telegramToken:w().optional().or(F("")),telegramChatId:w().optional().or(F("")),MAILCOW_ALLOWED_HOSTS:w().optional().or(F("")),MAILCOW_API_KEY:w().optional().or(F("")),MAILCOW_PROXY_TIMEOUT_MS:be,telegramChatIdChekin:w().optional().or(F("")),guardarFotosMarcaje:X().optional(),marcaje_habilitar_facial:X().optional(),marcaje_habilitar_qr:X().optional(),marcaje_habilitar_rfi
2d:X().optional(),montoHora:be,montoHoraExtra:be,horasDescanso:be,turnoDiaInicio:w().optional().or(F("")),turnoDiaFin:w().optional().or(F("")),turnoTardeInicio:w().optional().or(F("")),turnoTardeFin:w().optional().or(F("")),turnoNocheInicio:w().optional().or(F("")),turnoNocheFin:w().optional().or(F("")),habilitar_ecommerce:X().optional(),habilitar_pos:X().optional(),habilitar_restaurante:X().optional(),habilitar_cocina:X().optional(),habilitar_envios:X().optional(),habilitar_pilotos:X().optional(),habilitar_tracking:X().optional(),manejar_variantes:X().optional(),manejar_sucursales:X().optional(),manejar_bodegas:X().optional(),manejar_multi_bodega:X().optional(),manejar_reservas_inventario:X().optional(),permitir_dividir_cuenta:X().optional(),permitir_propina:X().optional(),permitir_cortesias:X().optional(),permitir_pago_tarjeta:X().optional(),permitir_transferencia:X().optional(),permitir_pago_contra_entrega:X().optional(),permitir_pago_pos:X().optional(),moneda_global:w().max(10,"Máximo 10 caracteres").optional().or(F("")),porcentaje_puntos:at,minutos_expira_reserva:be,restaurante_descuenta_en:be,umbral_envio_gratis:be,costo_envio_base:be}).refine(s=>{if(!s.turnoDiaInicio||!s.turnoDiaFin)return!0;const o=os(s.turnoDiaInicio),i=os(s.turnoDiaFin);return o===-1||i===-1?!0:o<i},{message:"Turno Día: La hora de inicio debe ser menor que la hora de fin",path:["turnoDiaInicio"]}).refine(s=>
2{if(!s.turnoTardeInicio||!s.turnoTardeFin)return!0;const o=os(s.turnoTardeInicio),i=os(s.turnoTardeFin);return o===-1||i===-1?!0:o<i},{message:"Turno Tarde: La hora de inicio debe ser menor que la hora de fin",path:["turnoTardeInicio"]}).refine(()=>!0,{message:"",path:[]}),Xs={siteName:"general",tagline:"general",name_sub_dominio:"general",pagina_web_url:"general",googleAnalyticsId:"seo",googleAdsId:"seo",googleTagManagerId:"seo",googleTagScript:"seo",contactEmail:"general",contactPhone:"general",chatWhatsApp:"general",address:"general",colors:"colors",seo:"seo",socials:"social",tokenOpenRouter:"integrations",ollamaBaseUrl:"integrations",ollamaModel:"integrations",ollamaToken:"integrations",tokenChatIa1:"integrations",tokenChatIa2:"integrations",tockenChatIa3:"integrations",tockenChatIa4:"integrations",tockenChatIa5:"integrations",telegramToken:"integrations",telegramChatId:"integrations",MAILCOW_ALLOWED_HOSTS:"mail",MAILCOW_API_KEY:"mail",MAILCOW_PROXY_TIMEOUT_MS:"mail",telegramChatIdChekin:"checkin",guardarFotosMarcaje:"checkin",marcaje_habilitar_facial:"checkin",marcaje_habilitar_qr:"checkin",marcaje_habilitar_rfid:"checkin",montoHora:"checkin",montoHoraExtra:"checkin",horasDescanso:"checkin",turnoDiaInicio:"checkin",turnoDiaFin:"checkin",turnoTardeInicio:"checkin",turnoTardeFin:"checkin",turnoNocheInicio:"checkin",turnoNocheFin:"checkin",habilitar_ecommerce:"sales",habilitar_pos:"sales",habilitar_restaurante:"sales",habilitar_cocina:"sales",habilitar_envios:"sales",habilitar_pilotos:"sales",habilitar_tracking:"sales",manejar_variantes:"sales",manejar_sucursales:"sales",manejar_bodegas:"sales",manejar_multi_bodega:"sales",manejar_reservas_inventario:"sales",permitir_dividir_cuenta:"sales",permitir_propina:"sales",permitir_cortesias:"sales",permitir_pago_tarjeta:"sales",permitir_transferencia:"sales",permitir_pago_contra_entrega:"sales",permitir_pago_pos:"sales",moneda_global:"sales",porcentaje_puntos:"sales",minutos_expira_reserva:"sales",restaurante_descuenta_en:"sales"},ct={siteName:"Nombre del Sitio",tagline:"Eslogan",name_sub_dominio:"Subdominio",pagina_web_url:"URL Página Web",googleAnalyticsId:"Google Analytics",googleAdsId:"Google Ads",googleTagManagerId:"Google Tag Manager",googleTagScript:"Script de Google",contactEmail:"Email de Contacto",contactPhone:"Teléfono",chatWhatsApp:"WhatsApp",address:"Dirección",MAILCOW_ALLOWED_HOSTS:"Hosts permitidos (Mailcow)",MAILCOW_API_KEY:"API Key (Mailcow)",MAILCOW_PROXY_TIMEOUT_MS:"Timeout del proxy (ms)",guardarFotosMarcaje:"Guardar fotos de marcaje",marcaje_habilitar_facial:"Reconocimiento Facial",marcaje_habilitar_qr:"Código QR / Gafetes",marcaje_habilitar_rfid:"Tarjeta / Llavero RFID",montoHora:"Monto por Hora",montoHoraExtra:"Monto Hora Extra",horasDescanso:"Horas de Descanso",turnoDiaInicio:"Turno Día Inicio",turnoDiaFin:"Turno Día Fin",turnoTardeInicio:"Turno Tarde Inicio",turnoTardeFin:"Turno Tarde Fin",turnoNocheInicio:"Turno Noche Inicio",turnoNocheFin:"Turno Noche Fin",moneda_global:"Moneda Global",porcentaje_puntos:"Porcentaje Puntos",minutos_expira_reserva:"Minutos Expiración Reserva",restaurante_descuenta_en:"Restaurante Descuenta En",umbral_envio_gratis:"Monto Mínimo Envío Gratis",costo_envio_base:"Costo Base de Envío"},le={siteName:{level:"required",label:"Nombre del Sitio",tab:"general"},favicon:{level:"required",label:"Favicon",tab:"images"},tagline:{level:"recommended",label:"Eslogan",tab:"general"},contactEmail:{level:"recommended",label:"Email de Contacto",tab:"general"},contactPhone:{level:"recommended",label:"Teléfono",tab:"general"},pagina_web_url:{level:"recommended",label:"URL Página Web",tab:"general"},logoMain:{level:"recommended",label:"Logo Principal",tab:"images"},logoAlt:{level:"recommended",label:"Logo Alternativo",tab:"images"},logoMobile:{level:"recommended",label:"Logo Móvil",tab:"images"}},dt=[{id:"general",label:"General",description:"Nombre, contacto y URL",icon:Re},{id:"images",label:"Imágenes",description:"Logos y favicon",icon:ge},{id:"colors",label:"Colores",description:"Paleta de colores del tema",icon:oa},{id:"seo",label:"SEO",description:"Meta tags y búsqueda",icon:is},{id:"social",label:"Redes sociales",description:"Perfiles en redes",icon:na},{id:"integrations",label:"Integraciones",description:"IA y Telegram",icon:tr},{id:"mail",label:"Correo",description:"Proxy Mailcow por tenant",icon:ls},{id:"checkin",label:"Marcaje",description:"Turnos y configuración RR.HH",icon:la},{id:"sales",label:"Comercial",description:"Canales de venta y vitrina",icon:vs},{id:"payments",label:"Cobros de tu Negocio",description:"Pasarelas para tienda, POS y envíos",icon:Le},{id:"subscription",label:"Mi Suscripción KINVO",description:"Plan, renovación y facturación a nosotros",icon:Ge}],mt="config-global-",xt={siteName:"",tagline:"",name_sub_dominio:"",pagina_web_url:"",googleAnalyticsId:"",googleAdsId:"",googleTagManagerId:"",googleTagScript:"",contactEmail:"",contactPhone:"",chatWhatsApp:"",address:"",colors:{primaryColor:"#2881E7",secondaryColor:"#36D2F1",accentColor:"#2777F6",backgroundColor:"#FFFFFF",textColor:"#000000"}
2,seo:{metaTitle:"",metaDescription:"",twitterHandle:"",keywords:""},socials:{facebookUrl:"",twitterUrl:"",instagramUrl:"",linkedinUrl:"",youtubeUrl:""},tokenOpenRouter:"",ollamaBaseUrl:"",ollamaModel:"llama3.2",ollamaToken:"",tokenChatIa1:"",tokenChatIa2:"",tockenChatIa3:"",tockenChatIa4:"",tockenChatIa5:"",telegramToken:"",telegramChatId:"",MAILCOW_ALLOWED_HOSTS:"",MAILCOW_API_KEY:"",MAILCOW_PROXY_TIMEOUT_MS:"15000",telegramChatIdChekin:"",guardarFotosMarcaje:!0,marcaje_habilitar_facial:!0,marcaje_habilitar_qr:!1,marcaje_habilitar_rfid:!1,montoHora:"",montoHoraExtra:"",horasDescanso:"",turnoDiaInicio:"06:00",turnoDiaFin:"14:00",turnoTardeInicio:"14:00",turnoTardeFin:"22:00",turnoNocheInicio:"22:00",turnoNocheFin:"06:00",habilitar_ecommerce:!1,habilitar_pos:!1,habilitar_restaurante:!1,habilitar_cocina:!1,habilitar_envios:!1,habilitar_pilotos:!1,habilitar_tracking:!1,manejar_variantes:!1,manejar_sucursales:!1,manejar_bodegas:!1,manejar_multi_bodega:!1,manejar_reservas_inventario:!1,permitir_dividir_cuenta:!1,permitir_propina:!1,permitir_cortesias:!1,permitir_pago_tarjeta:!1,permitir_transferencia:!1,permitir_pago_contra_entrega:!1,permitir_pago_pos:!1,moneda_global:"",porcentaje_puntos:"",minutos_expira_reserva:"",restaurante_descuenta_en:"",umbral_envio_gratis:"",costo_envio_base:""},me=s=>s&&s!==""?Number(s):null,$s=s=>{if(!s||typeof s!="string")return"";try{const o=s.trim().toLowerCase();return o?o.startsWith("http://")||o.startsWith("https://")?new URL(o).hostname.toLowerCase().replace(/^www\./,""):o.split("/")[0].replace(/^www\./,""):""}catch{return""}},Ks=s=>{var l;if(!Array.isArray(s)||s.length===0)return null;const o=$s(((l=window.location)==null?void 0:l.hostname)||"");return o?s.find(r=>{const g=r,h=(g==null?void 0:g.attributes)??r??{},A=$s(String((h==null?void 0:h.pagina_web_url)||(h==null?void 0:h.paginaWebUrl)||(h==null?void 0:h.websiteUrl)||""));return A&&A===o})||s[0]||null:s[0]||null},ht=s=>{var o,i,l,r,g,h,A,I,P,E,V,u,K,R,D,Y,ae,re,Q,y,B,te,_,z,se,ie,fe,xe,Ne,_e,ee,he,x,q,T,S,J,ce,Ee;return{siteName:(s==null?void 0:s.siteName)||"",tagline:(s==null?void 0:s.tagline)||"",name_sub_dominio:(s==null?void 0:s.name_sub_dominio)||"",pagina_web_url:(s==null?void 0:s.pagina_web_url)||"",googleAnalyticsId:(s==null?void 0:s.googleAnalyticsId)||"",googleAdsId:(s==null?void 0:s.googleAdsId)||"",googleTagManagerId:(s==null?void 0:s.googleTagManagerId)||"",googleTagScript:(s==null?void 0:s.googleTagScript)||"",contactEmail:(s==null?void 0:s.contactEmail)||"",contactPhone:(s==null?void 0:s.contactPhone)||"",chatWhatsApp:((o=s==null?void 0:s.chatWhatsApp)==null?void 0:o.toString())||"",address:(s==null?void 0:s.address)||"",colors:{primaryColor:((i=s==null?void 0:s.colors)==null?void 0:i.primaryColor)||"#2881E7",secondaryColor:((l=s==null?void 0:s.colors)==null?void 0:l.secondaryColor)||"#36D2F1",accentColor:((r=s==null?void 0:s.colors)==null?void 0:r.accentColor)||"#2777F6",backgroundColor:((g=s==null?void 0:s.colors)==null?void 0:g.backgroundColor)||"#FFFFFF",textColor:((h=s==null?void 0:s.colors)==null?void 0:h.textColor)||"#000000"},seo:{metaTitle:((A=s==null?void 0:s.seo)==null?void 0:A.metaTitle)||"",metaDescription:((I=s==null?void 0:s.seo)==null?void 0:I.metaDescription)||"",twitterHandle:((P=s==null?void 0:s.seo)==null?void 0:P.twitterHandle)||"",keywords:((E=s==null?void 0:s.seo)==null?void 0:E.keywords)||""},socials:{facebookUrl:((V=s==null?void 0:s.socials)==null?void 0:V.facebookUrl)||"",twitterUrl:((u=s==null?void 0:s.socials)==null?void 0:u.twitterUrl)||"",instagramUrl:((K=s==null?void 0:s.socials)==null?void 0:K.instagramUrl)||"",linkedinUrl:((R=s==null?void 0:s.socials)==null?void 0:R.linkedinUrl)||"",youtubeUrl:((D=s==null?void 0:s.socials)==null?void 0:D.youtubeUrl)||""},tokenOpenRouter:(s==null?void 0:s.tokenOpenRouter)||((ae=(Y=s==null?void 0:s.modulos)==null?void 0:Y.ai)==null?void 0:ae.tokenOpenRouter)||((re=s==null?void 0:s.modulos)==null?void 0:re.tokenOpenRouter)||typeof window<"u"&&localStorage.getItem("kinvo_openrouter_token")||"",ollamaBaseUrl:(s==null?void 0:s.ollamaBaseUrl)||((y=(Q=s==null?void 0:s.modulos)==null?void 0:Q.ai)==null?void 0:y.ollamaBaseUrl)||typeof window<"u"&&localStorage.getItem("kinvo_ollama_url")!=="http://localhost:11434"&&localStorage.getItem("kinvo_ollama_url")||""||"",ollamaModel:(s==null?void 0:s.ollamaModel)||((te=(B=s==null?void 0:s.modulos)==null?void 0:B.ai)==null?void 0:te.ollamaModel)||typeof window<"u"&&localStorage.getItem("kinvo_ollama_model")||""||"llama3.2",ollamaToken:(s==null?void 0:s.ollamaToken)||((z=(_=s==null?void 0:s.modulos)==null?void 0:_.ai)==null?void 0:z.ollamaToken)||typeof window<"u"&&localStorage.getItem("kinvo_ollama_token")||""||"",tokenChatIa1:(s==null?void 0:s.tokenChatIa1)||"",tokenChatIa2:(s==null?void 0:s.tokenChatIa2)||"",tockenChatIa3:(s==null?void 0:s.tockenChatIa3)||"",tockenChatIa4:(s==null?void 0:s.tockenChatIa4)||"",tockenChatIa5:(s==null?void 0:s.tockenChatIa5)||"",telegramToken:(s==null?void 0:s.telegramToken)||"",telegramChatId:(s==null?void 0:s.telegramChatId)||"",MAILCOW_ALLOWED_HOSTS:(s==null?void 0:s.MAILCOW_ALLOWED_HOSTS)||"",MAILCOW_API_KEY:(s==null?void 0:s.MAILCOW_API_KEY)||"",MAILCOW_PROXY_TIMEOUT_MS:((se=s==null?void 0:s.MAILCOW_PROXY_TIMEOUT_MS)==null?void 0:se.toString())||"15000",telegramChatIdChekin:(s==null?void 0:s.telegramChatIdChekin)||"",guardarFotosMarcaje:(s==null?void 0:s.guardarFotosMarcaje)!==!1,marcaje_habilitar_facial:((fe=(ie=s==null?void 0:s.modulos)==null?void 0:ie.marcaje)==null?void 0:fe.habilitar_facial)??(s==null?void 0:s.marcaje_habilitar_facial)??!0,marcaje_habilitar_qr:((Ne=(xe=s==null?void 0:s.modulos)==null?void 0:xe.marcaje)==null?void 0:Ne.habilitar_qr)??(s==null?void 0:s.marcaje_habilitar_qr)??!1,marcaje_habilitar_rfi
2d:((ee=(_e=s==null?void 0:s.modulos)==null?void 0:_e.marcaje)==null?void 0:ee.habilitar_rfid)??(s==null?void 0:s.marcaje_habilitar_rfid)??!1,montoHora:((he=s==null?void 0:s.montoHora)==null?void 0:he.toString())||"",montoHoraExtra:((x=s==null?void 0:s.montoHoraExtra)==null?void 0:x.toString())||"",horasDescanso:((q=s==null?void 0:s.horasDescanso)==null?void 0:q.toString())||"",turnoDiaInicio:(s==null?void 0:s.turnoDiaInicio)||"06:00",turnoDiaFin:(s==null?void 0:s.turnoDiaFin)||"14:00",turnoTardeInicio:(s==null?void 0:s.turnoTardeInicio)||"14:00",turnoTardeFin:(s==null?void 0:s.turnoTardeFin)||"22:00",turnoNocheInicio:(s==null?void 0:s.turnoNocheInicio)||"22:00",turnoNocheFin:(s==null?void 0:s.turnoNocheFin)||"06:00",habilitar_ecommerce:(s==null?void 0:s.habilitar_ecommerce)||!1,habilitar_pos:(s==null?void 0:s.habilitar_pos)||!1,habilitar_restaurante:(s==null?void 0:s.habilitar_restaurante)||!1,habilitar_cocina:(s==null?void 0:s.habilitar_cocina)||!1,habilitar_envios:(s==null?void 0:s.habilitar_envios)||!1,habilitar_pilotos:(s==null?void 0:s.habilitar_pilotos)||!1,habilitar_tracking:(s==null?void 0:s.habilitar_tracking)||!1,manejar_variantes:(s==null?void 0:s.manejar_variantes)||!1,manejar_sucursales:(s==null?void 0:s.manejar_sucursales)||!1,manejar_bodegas:(s==null?void 0:s.manejar_bodegas)||!1,manejar_multi_bodega:(s==null?void 0:s.manejar_multi_bodega)||!1,manejar_reservas_inventario:(s==null?void 0:s.manejar_reservas_inventario)||!1,permitir_dividir_cuenta:(s==null?void 0:s.permitir_dividir_cuenta)||!1,permitir_propina:(s==null?void 0:s.permitir_propina)||!1,permitir_cortesias:(s==null?void 0:s.permitir_cortesias)||!1,permitir_pago_tarjeta:(s==null?void 0:s.permitir_pago_tarjeta)||!1,permitir_transferencia:(s==null?void 0:s.permitir_transferencia)||!1,permitir_pago_contra_entrega:(s==null?void 0:s.permitir_pago_contra_entrega)||!1,permitir_pago_pos:(s==null?void 0:s.permitir_pago_pos)||!1,moneda_global:(s==null?void 0:s.moneda_global)||"",porcentaje_puntos:((T=s==null?void 0:s.porcentaje_puntos)==null?void 0:T.toString())||"",minutos_expira_reserva:((S=s==null?void 0:s.minutos_expira_reserva)==null?void 0:S.toString())||"",restaurante_descuenta_en:((J=s==null?void 0:s.restaurante_descuenta_en)==null?void 0:J.toString())||"",umbral_envio_gratis:((ce=s==null?void 0:s.umbral_envio_gratis)==null?void 0:ce.toString())||"",costo_envio_base:((Ee=s==null?void 0:s.costo_envio_base)==null?void 0:Ee.toString())||""}},Pt=()=>{var Cs,Is,Ts;const{canUpdate:s}=ca("api::global.global"),{toast:o}=ea(),i=j.useRef(!1),l=j.useRef(null),{data:r,isLoading:g,refetch:h}=Ur(["global-settings"],us.getGlobalConfigList,Gr.GLOBAL_SETTINGS,{staleTime:0,refetchOnWindowFocus:!0,refetchInterval:2500,refetchIntervalInBackground:!0}),[A,I]=j.useState(!1),P=Ca(),[E,V]=j.useState(!1),u=j.useMemo(()=>{const a=(r==null?void 0:r.data)||r;if(Array.isArray(a)){const p=Ks(a);return(p==null?void 0:p.attributes)??p??null}return(a==null?void 0:a.attributes)??a??null},[r]),[K,R]=j.useState(!1),[D,Y]=j.useState(!1),[ae,re]=j.useState(!1),[Q,y]=j.useState(!1),[B,te]=j.useState([]),[_,z]=j.useState(()=>localStorage.getItem("global-settings-active-tab")||"general"),[se,ie]=j.useState(null),[fe,xe]=j.useState(!1),[Ne,_e]=j.useState(null),[ee,he]=j.useState({}),[x,q]=j.useState({}),T=a=>{q(p=>({...p,[a]:!p[a]}))},[S,J]=j.useState("channels"),[ce,Ee]=j.useState("desktop"),t=kr({resolver:Xr(it),defaultValues:xt}),_s=j.useMemo(()=>{const a=(r==null?void 0:r.data)||r;return Array.isArray(a)?a:a?[a]:[]},[r]),ue=j.useMemo(()=>{const a=Ks(_s);if(!a)return null;const p=(a==null?void 0:a.attributes)??a;return{id:(a==null?void 0:a.id)??null,documentId:(a==null?void 0:a.documentId)??null,data:p}},[_s]);j.useEffect(()=>{if(!u)return;const a=JSON.stringify({id:(ue==null?void 0:ue.id)??null,documentId:(ue==null?void 0:ue.documentId)??null,updatedAt:(u==null?void 0:u.updatedAt)??null});(!i.current||!t.formState.isDirty&&Object.keys(ee).length===0&&l.current!==a)&&(t.reset(ht(u)),i.current=!0,l.current=a)},[u,ue,t,ee]),j.useEffect(()=>{localStorage.setItem("global-settings-active-tab",_)},[_]),j.useEffect(()=>{let a=!0;return Ia.getConfig().then(p=>{a&&ie(p)}),()=>{a=!1}},[]);const we=t.watch(),ke=j.useMemo(()=>{const a=[];return we.siteName||a.push({key:"siteName",...le.siteName}),we.tagline||a.push({key:"tagline",...le.tagline}),we.contactEmail||a.push({key:"contactEmail",...le.contactEmail}),we.contactPhone||a.push({key:"contactPhone",...le.contactPhone}),we.pagina_web_url||a.push({key:"pagina_web_url",...le.pagina_web_url}),u!=null&&u.favicon||a.push({key:"favicon",...le.favicon}),u!=null&&u.logoMain||a.push({key:"logoMain",...le.logoMain}),u!=null&&u.logoAlt||a.push({key:"logoAlt",...le.logoAlt}),u!=null&&u.logoMobile||a.push({key:"logoMobile",...le.logoMobile}),a},[we,u]),Ce=j.useMemo(()=>dt.filter(a=>a.id==="checkin"?(se==null?void 0:se.marking)??!0:a.id==="sales"||a.id==="payments"?(se==null?void 0:se.shop)??!0:!0),[se]);j.useEffect(()=>{Ce.some(a=>a.id===_)||z("general")},[Ce,_]);const ws=j.useMemo(()=>{const a={};return ke.forEach(({tab:p,level:f})=>{a[p]||(a[p]={required:0,recommended:0}),a[p][f]++}
2),Object.keys(t.formState.errors).forEach(p=>{const f=Xs[p]||"general";a[f]||(a[f]={required:0,recommended:0}),a[f].required++}),a},[ke,t.formState.errors]),ks=()=>e.jsx("span",{className:"text-destructive text-xs font-bold ml-0.5",title:"Campo obligatorio",children:"*"}),He=()=>e.jsx(C,{variant:"outline",className:"text-[10px] h-4 px-1 py-0 text-amber-600 border-amber-300 bg-amber-50 dark:bg-amber-950/30 dark:border-amber-700 dark:text-amber-400 ml-1 font-normal",children:"Recomendado"}),We=({field:a})=>{const p=!!(u!=null&&u[a]),f=le[a];return p?e.jsx(Ls,{className:"w-4 h-4 text-green-500 ml-auto"}):(f==null?void 0:f.level)==="required"?e.jsx("span",{className:"ml-auto text-[10px] font-semibold text-destructive border border-destructive/40 bg-destructive/5 rounded px-1.5 py-0.5",children:"Requerido"}):e.jsx("span",{className:"ml-auto text-[10px] font-semibold text-amber-600 border border-amber-300 bg-amber-50 dark:bg-amber-950/30 rounded px-1.5 py-0.5",children:"Recomendado"})},xa=()=>e.jsx(L,{className:"sticky top-24",children:e.jsx(U,{className:"p-2",children:e.jsx("nav",{className:"space-y-1",children:Ce.map(a=>{const p=a.icon,f=_===a.id,O=ws[a.id];return e.jsxs("button",{type:"button",onClick:()=>z(a.id),className:M("w-full flex items-center gap-3 px-3 py-3 rounded-lg transition-all duration-200 group text-left",f?"bg-primary text-primary-foreground shadow-md":"hover:bg-muted text-muted-foreground hover:text-foreground"),children:[e.jsx(p,{className:M("h-5 w-5 flex-shrink-0",f?"text-primary-foreground":"text-muted-foreground group-hover:text-foreground")}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:M("text-sm font-medium truncate",f?"text-primary-foreground":""),children:a.label}),e.jsx("p",{className:M("text-xs truncate",f?"text-primary-foreground/70":"text-muted-foreground"),children:a.description})]}),O&&(O.required>0||O.recommended>0)&&e.jsx("span",{className:M("w-2 h-2 rounded-full flex-shrink-0",O.required>0?f?"bg-red-300":"bg-destructive":f?"bg-amber-200":"bg-amber-400")}),e.jsx(ys,{className:M("h-4 w-4 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",f?"opacity-100 text-primary-foreground":"")})]},a.id)})})})}),ds=Ce.find(a=>a.id===_)||Ce[0],ha=ds.icon,ua=()=>e.jsxs(Aa,{open:E,onOpenChange:V,children:[e.jsx(Sa,{asChild:!0,children:e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-4 py-3 rounded-lg bg-primary text-primary-foreground shadow-md",children:[e.jsx(ha,{className:"h-5 w-5 flex-shrink-0 text-primary-foreground"}),e.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[e.jsx("p",{className:"text-sm font-medium truncate text-primary-foreground",children:ds.label}),e.jsx("p",{className:"text-xs truncate text-primary-foreground/70",children:ds.description})]}),e.jsx(gr,{className:M("h-4 w-4 text-primary-foreground transition-transform duration-200",E&&"rotate-180")})]})}),e.jsx(Ea,{className:"w-[calc(100vw-2rem)] max-w-md bg-card border border-border shadow-sm",align:"start",sideOffset:8,children:Ce.map(a=>{const p=a.icon,f=_===a.id,O=ws[a.id];return e.jsxs(Fa,{onClick:()=>{z(a.id),V(!1)},className:M("flex items-center gap-3 px-3 py-3 rounded-lg cursor-pointer",f?"bg-primary text-primary-foreground":"hover:bg-muted text-muted-foreground hover:text-foreground"),children:[e.jsx(p,{className:M("h-5 w-5 flex-shrink-0",f?"text-primary-foreground":"text-muted-foreground")}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:M("text-sm font-medium truncate",f?"text-primary-foreground":""),children:a.label}),e.jsx("p",{className:M("text-xs truncate",f?"text-primary-foreground/70":"text-muted-foreground"),children:a.description})]}),O&&(O.required>0||O.recommended>0)&&e.jsx("span",{className:M("w-2 h-2 rounded-full flex-shrink-0",O.required>0?"bg-destructive":"bg-amber-400")}),f&&e.jsx(ys,{className:"h-4 w-4 text-primary-foreground flex-shrink-0"})]},a.id)})})]}),Ie=a=>a?a.includes(".")?a:a.length===5?`${a}:00.000`:a.length===8?`${a}.000`:a:null,Z=a=>Object.prototype.hasOwnProperty.call(ee,a)?ee[a]:(u==null?void 0:u[a])||null,ms=a=>{s&&he(p=>({...p,[a]:null}))},Be=(a,p)=>{const f=Z(a);return!f||typeof f!="object"?p:f.name||p},pe=a=>{const p=Z(a);if(!p||typeof p!="object")return null;const{width:f,height:O}=p;return!f||!O?null:`${f}x${O}px`},ze=a=>{const p=Z(a);return p?us.buildImageUrl(p):null},qe=a=>{_e(a),xe(!0)},pa=a=>{!Ne||!s||(he(p=>({...p,[Ne]:a})),xe(!1))},ja=async a=>{var p,f,O,ve,Ve,Te,Xe,$e,Fe;if(s){if(!Z("favicon")){z("images"),o({title:"Campo obligatorio faltante",description:"El Favicon es requerido. Por favor sube una imagen en la pestaña Imágenes.",variant:"destructive"});return}try{I(!0);const ye={siteName:a.siteName,tagline:a.tagline||"",name_sub_dominio:a.name_sub_dominio||"",pagina_web_url:a.pagina_web_url||"",googleAnalyticsId:a.googleAnalyticsId||"",googleAdsId:a.googleAdsId||"",googleTagManagerId:a.googleTagManagerId||"",googleTagScript:a.googleTagScript||"",contactEmail:a.contactEmail||"",contactPhone:a.contactPhone||"",chatWhatsApp:a.chatWhatsApp?parseInt(a.chatWhatsApp):null,address:a.address||"",...a.colors&&{colors:a.colors},...a.seo&&{seo:a.seo},...a.socials&&{socials:a.socials},tokenOpenRouter:a.tokenOpenRouter||"",ollamaBaseUrl:a.ollamaBaseUrl||"",ollamaModel:a.ollamaModel||"",ollamaToken:a.ollamaToken||"",tokenChatIa1:a.tokenChatIa1||"",tokenChatIa2:a.tokenChatIa2||"",tockenChatIa3:a.tockenChatIa3||"",tockenChatIa4:a.tockenChatIa4||"",tockenChatIa5:a.tockenChatIa5||"",telegramToken:a.telegramToken||"",telegramChatId:a.telegramChatId||"",MAILCOW_ALLOWED_HOSTS:a.MAILCOW_ALLOWED_HOSTS||"",MAILCOW_API_KEY:a.MAILCOW_API_KEY||"",MAILCOW_PROXY_TIMEOUT_MS:me(a.MAILCOW_PROXY_TIMEOUT_MS)??15e3,telegramChatIdChekin:a.telegramChatIdChekin||"",guardarFotosMarcaje:a.guardarFotosMarcaje!==!1,marcaje_habilitar_facial:a.marcaje_habilitar_facial!==!1,marcaje_habilitar_qr:!!a.marcaje_habilitar_qr,marcaje_habilitar_rfi
2d:!!a.marcaje_habilitar_rfid,modulos:{...(u==null?void 0:u.modulos)||{},marcaje:{habilitar_facial:a.marcaje_habilitar_facial!==!1,habilitar_qr:!!a.marcaje_habilitar_qr,habilitar_rfid:!!a.marcaje_habilitar_rfid},ai:{...((p=u==null?void 0:u.modulos)==null?void 0:p.ai)||{},tokenOpenRouter:a.tokenOpenRouter||"",ollamaBaseUrl:a.ollamaBaseUrl||"",ollamaModel:a.ollamaModel||"",ollamaToken:a.ollamaToken||""}},montoHora:me(a.montoHora),montoHoraExtra:me(a.montoHoraExtra),horasDescanso:me(a.horasDescanso),turnoDiaInicio:Ie(a.turnoDiaInicio),turnoDiaFin:Ie(a.turnoDiaFin),turnoTardeInicio:Ie(a.turnoTardeInicio),turnoTardeFin:Ie(a.turnoTardeFin),turnoNocheInicio:Ie(a.turnoNocheInicio),turnoNocheFin:Ie(a.turnoNocheFin),habilitar_ecommerce:a.habilitar_ecommerce||!1,habilitar_pos:a.habilitar_pos||!1,habilitar_restaurante:a.habilitar_restaurante||!1,habilitar_cocina:a.habilitar_cocina||!1,habilitar_envios:a.habilitar_envios||!1,habilitar_pilotos:a.habilitar_pilotos||!1,habilitar_tracking:a.habilitar_tracking||!1,manejar_variantes:a.manejar_variantes||!1,manejar_sucursales:a.manejar_sucursales||!1,manejar_bodegas:a.manejar_bodegas||!1,manejar_multi_bodega:a.manejar_multi_bodega||!1,manejar_reservas_inventario:a.manejar_reservas_inventario||!1,permitir_dividir_cuenta:a.permitir_dividir_cuenta||!1,permitir_propina:a.permitir_propina||!1,permitir_cortesias:a.permitir_cortesias||!1,permitir_pago_tarjeta:a.permitir_pago_tarjeta||!1,permitir_transferencia:a.permitir_transferencia||!1,permitir_pago_contra_entrega:a.permitir_pago_contra_entrega||!1,permitir_pago_pos:a.permitir_pago_pos||!1,moneda_global:a.moneda_global||"",porcentaje_puntos:me(a.porcentaje_puntos),minutos_expira_reserva:me(a.minutos_expira_reserva),restaurante_descuenta_en:me(a.restaurante_descuenta_en),umbral_envio_gratis:me(a.umbral_envio_gratis),costo_envio_base:me(a.costo_envio_base),favicon:Object.prototype.hasOwnProperty.call(ee,"favicon")?((f=ee.favicon)==null?void 0:f.id)??null:((O=u==null?void 0:u.favicon)==null?void 0:O.id)??null,logoMain:Object.prototype.hasOwnProperty.call(ee,"logoMain")?((ve=ee.logoMain)==null?void 0:ve.id)??null:((Ve=u==null?void 0:u.logoMain)==null?void 0:Ve.id)??null,logoAlt:Object.prototype.hasOwnProperty.call(ee,"logoAlt")?((Te=ee.logoAlt)==null?void 0:Te.id)??null:((Xe=u==null?void 0:u.logoAlt)==null?void 0:Xe.id)??null,logoMobile:Object.prototype.hasOwnProperty.call(ee,"logoMobile")?(($e=ee.logoMobile)==null?void 0:$e.id)??null:((Fe=u==null?void 0:u.logoMobile)==null?void 0:Fe.id)??null},Ms=await us.updateGlobalConfig(ye,ue);if(Ms.success){hs.invalidateConfigCache(),await h(),he({}),t.reset(a);try{const Ke=localStorage.getItem("global_config_cache");if(Ke){const ba=JSON.parse(Ke);localStorage.setItem("global_config_cache",JSON.stringify({...ba,...ye,marcaje_habilitar_facial:a.marcaje_habilitar_facial!==!1,marcaje_habilitar_qr:!!a.marcaje_habilitar_qr,marcaje_habilitar_rfid:!!a.marcaje_habilitar_rfid}))}localStorage.setItem("kinvo_openrouter_token",a.tokenOpenRouter||""),localStorage.setItem("kinvo_ollama_url",a.ollamaBaseUrl||""),localStorage.setItem("kinvo_ollama_model",a.ollamaModel||""),localStorage.setItem("kinvo_ollama_token",a.ollamaToken||"")}catch(Ke){console.warn("Error updating cache:",Ke)}typeof window<"u"&&window.dispatchEvent(new CustomEvent("kinvo:global-config-updated",{detail:ye})),o({title:"Éxito",description:"Configuración actualizada correctamente"})}else throw new Error(Ms.error)}catch(ye){console.error("❌ Error en onSubmit:",ye),o({title:"Error",description:ye instanceof Error?ye.message:"Error al actualizar configuración",variant:"destructive"})}finally{I(!1)}}};return g&&!r?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx(rs,{})}):e.jsx("div",{className:"container mx-auto p-6 max-w-6xl",children:e.jsxs(or.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-foreground text-3xl font-bold",children:"Configuración Global"}),e.jsx("p",{className:"text-muted-foreground",children:"Administra la configuración general de tu aplicación"})]}),e.jsxs(C,{variant:"outline",className:"bg-primary/10 text-primary border-primary/20",children:[e.jsx(nr,{className:"w-4 h-4 mr-2"}),"Sistema"]})]}),e.jsx(Ae,{}),e.jsx($r,{...t,children:e.jsx("form",{onSubmit:t.handleSubmit(ja,a=>{console.error("❌ Errores de validación:",a);const p=Object.keys(a),f=p[0],O=Xs[f]||"general";z(O);const ve=p.slice(0,3).map(Te=>{var Fe;const Xe=ct[Te]||Te,$e=((Fe=a[Te])==null?void 0:Fe.message)||"Error de validación";return`• ${Xe}: ${$e}`}).join(`
3`),Ve=p.length>3?`
4...y ${p.length-3} más`:"";o({title:"Errores de validación",description:e.jsxs("div",{className:"mt-2 text-sm whitespace-pre-line",children:[ve,Ve]}),variant:"destructive",duration:6e3})}),className:"mt-0",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 items-start",children:[e.jsx("aside",{className:"lg:col-span-3",children:P?ua():xa()}),e.jsxs("div",{className:"lg:col-span-9 space-y-6",children:[_==="general"&&e.jsx("div",{className:"space-y-6",children:e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2",children:[e.jsx(Re,{className:"w-5 h-5"}),"Información General"]}),e.jsx(W,{children:"Configuración básica de tu aplicación"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"siteName",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center",children:["Nombre del Sitio",e.jsx(ks,{})]}),e.jsx(n,{children:e.jsx(b,{placeholder:"Mi Aplicación CRM",...a})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"tagline",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center flex-wrap gap-x-1",children:["Eslogan",e.jsx(He,{})]}),e.jsx(n,{children:e.jsx(b,{placeholder:"Tu CRM de confianza",...a})}),e.jsx(v,{})]})})]}),e.jsx(Ae,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"name_sub_dominio",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(Ds,{className:"w-4 h-4"}),"Subdominio"]}),e.jsx(n,{children:e.jsx(b,{placeholder:"mi-tienda",...a})}),e.jsx(N,{children:"Nombre del subdominio (ej: mi-tienda.tudominio.com)"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"pagina_web_url",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center flex-wrap gap-x-1",children:[e.jsx(Re,{className:"w-4 h-4"}),"URL Página Web",e.jsx(He,{})]}),e.jsx(n,{children:e.jsx(b,{placeholder:"https://www.miempresa.com",...a})}),e.jsx(N,{children:"URL completa de tu página web principal"}),e.jsx(v,{})]})})]}),e.jsx(Ae,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"contactEmail",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center flex-wrap gap-x-1",children:[e.jsx(ls,{className:"w-4 h-4"}),"Email de Contacto",e.jsx(He,{})]}),e.jsx(n,{children:e.jsx(b,{placeholder:"[email protected]",...a})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"contactPhone",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center flex-wrap gap-x-1",children:[e.jsx(lr,{className:"w-4 h-4"}),"Teléfono de Contacto",e.jsx(He,{})]}),e.jsx(n,{children:e.jsx(b,{placeholder:"+502 1234-5678",...a})}),e.jsx(v,{})]})})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e.jsx(d,{control:t.control,name:"chatWhatsApp",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(es,{className:"w-4 h-4"}),"WhatsApp (Número)"]}),e.jsx(n,{children:e.jsx(b,{type:"number",placeholder:"50212345678",...a})}),e.jsx(N,{children:"Número completo con código de país (sin + ni espacios)"}),e.jsx(v,{})]})})}),e.jsx(d,{control:t.control,name:"address",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(aa,{className:"w-4 h-4"}),"Dirección"]}),e.jsx(n,{children:e.jsx(as,{placeholder:"Dirección completa de tu empresa...",className:"min-h-[80px]",...a})}),e.jsx(v,{})]})})]})]})}),_==="images"&&e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(L,{className:Z("favicon")?"":"border-destructive/50 bg-destructive/5",children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2 text-sm",children:[e.jsx(ps,{className:"w-4 h-4"}),"Favicon",e.jsx(ks,{}),e.jsx(We,{field:"favicon"})]}),e.jsx(W,{className:"text-xs",children:"Icono que aparece en la pestaña del navegador"})]}),e.jsxs(U,{className:"space-y-4",children:[Z("favicon")&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("img",{src:ze("favicon"),alt:"Favicon actual",className:"w-12 h-12 rounded-lg border"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:Be("favicon","Favicon seleccionado")}),pe("favicon")&&e.jsx("p",{className:"text-xs text-muted-foreground",children:pe("favicon")})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:()=>qe("favicon"),children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),Z("favicon")?"Cambiar Favicon":"Biblioteca"]})})]})]}),e.jsxs(L,{className:Z("logoMain")?"":"border-amber-300/50 bg-amber-50/30 dark:bg-amber-950/10",children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2 text-sm",children:[e.jsx(ps,{className:"w-4 h-4"}),"Logo Principal",e.jsx(We,{field:"logoMain"})]}),e.jsx(W,{className:"text-xs",children:"Logo principal de la aplicación"})]}),e.jsxs(U,{className:"space-y-4",children:[Z("logoMain")&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("img",{src:ze("logoMain"),alt:"Logo principal actual",className:"w-12 h-12 rounded-lg border"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:Be("logoMain","Logo seleccionado")}),pe("logoMain")&&e.jsx("p",{className:"text-xs text-muted-foreground",children:pe("logoMain")})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:()=>qe("logoMain"),children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),Z("logoMain")?"Cambiar Logo":"Biblioteca"]}),Z("logoMain")&&e.jsxs(k,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10",onClick:()=>ms("logoMain"),children:[e.jsx(ns,{className:"w-4 h-4 mr-1"}),"Quitar"]})]})]})]}),e.jsxs(L,{className:Z("logoAlt")?"":"border-amber-300/50 bg-amber-50/30 dark:bg-amber-950/10",children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2 text-sm",children:[e.jsx(ir,{className:"w-4 h-4"}),"Logo Alternativo",e.jsx(We,{field:"logoAlt"})]}),e.jsx(W,{className:"text-xs",children:"Logo para temas alternativos"})]}),e.jsxs(U,{className:"space-y-4",children:[Z("logoAlt")&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("img",{src:ze("logoAlt"),alt:"Logo alternativo actual",className:"w-12 h-12 rounded-lg border"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:Be("logoAlt","Logo seleccionado")}),pe("logoAlt")&&e.jsx("p",{className:"text-xs text-muted-foreground",children:pe("logoAlt")})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:()=>qe("logoAlt"),children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),Z("logoAlt")?"Cambiar Logo":"Biblioteca"]}),Z("logoAlt")&&e.jsxs(k,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10",onClick:()=>ms("logoAlt"),children:[e.jsx(ns,{className:"w-4 h-4 mr-1"}),"Quitar"]})]})]})]}),e.jsxs(L,{className:Z("logoMobile")?"":"border-amber-300/50 bg-amber-50/30 dark:bg-amber-950/10",children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2 text-sm",children:[e.jsx(Os,{className:"w-4 h-4"}),"Logo Móvil",e.jsx(We,{field:"logoMobile"})]}),e.jsx(W,{className:"text-xs",children:"Logo optimizado para dispositivos móviles"})]}),e.jsxs(U,{className:"space-y-4",children:[Z("logoMobile")&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/30 rounded-lg",children:[e.jsx("img",{src:ze("logoMobile"),alt:"Logo móvil actual",className:"w-12 h-12 rounded-lg border"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:Be("logoMobile","Logo seleccionado")}),pe("logoMobile")&&e.jsx("p",{className:"text-xs text-muted-foreground",children:pe("logoMobile")})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:()=>qe("logoMobile"),children:[e.jsx(ge,{className:"w-4 h-4 mr-2"}),Z("logoMobile")?"Cambiar Logo":"Biblioteca"]}),Z("logoMobile")&&e.jsxs(k,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10",onClick:()=>ms("logoMobile"),children:[e.jsx(ns,{className:"w-4 h-4 mr-1"}),"Quitar"]})]})]})]})]})}),_==="colors"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2",children:[e.jsx(oa,{className:"w-5 h-5"}),"Esquema de Colores"]}),e.jsx(W,{children:"Define los colores principales de tu aplicación"})]}),e.jsx(U,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsx(d,{control:t.control,name:"colors.primaryColor",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Color Primario"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{children:e.jsx(b,{type:"color",className:"w-16 h-10 p-1",...a})}),e.jsx(n,{children:e.jsx(b,{placeholder:"#2881E7",...a})})]}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"colors.secondaryColor",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Color Secundario"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{children:e.jsx(b,{type:"color",className:"w-16 h-10 p-1",...a})}),e.jsx(n,{children:e.jsx(b,{placeholder:"#36D2F1",...a})})]}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"colors.accentColor",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Color de Acento"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{children:e.jsx(b,{type:"color",className:"w-16 h-10 p-1",...a})}),e.jsx(n,{children:e.jsx(b,{placeholder:"#2777F6",...a})})]}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"colors.backgroundColor",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Color de Fondo"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{children:e.jsx(b,{type:"color",className:"w-16 h-10 p-1",...a})}),e.jsx(n,{children:e.jsx(b,{placeholder:"#FFFFFF",...a})})]}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"colors.textColor",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Color de Texto"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{children:e.jsx(b,{type:"color",className:"w-16 h-10 p-1",...a})}),e.jsx(n,{children:e.jsx(b,{placeholder:"#000000",...a})})]}),e.jsx(v,{})]})})]})})]}),e.jsxs(L,{className:"border-border/80 shadow-sm overflow-hidden",children:[e.jsx(G,{className:"bg-muted/10 border-b border-border/40 pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{
4className:"text-sm font-bold flex items-center gap-2",children:[e.jsx(oe,{className:"w-4 h-4 text-primary"}),"Vista Previa del Tema en Tiempo Real"]}),e.jsx(W,{className:"text-xs",children:"Así lucirán los encabezados, botones, tarjetas y textos con tu paleta seleccionada"})]}),e.jsx(C,{variant:"outline",className:"text-[10px] font-mono",children:"Preview en vivo"})]})}),e.jsxs(U,{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"rounded-xl border shadow-inner p-4 transition-all duration-300 space-y-4",style:{backgroundColor:t.watch("colors.backgroundColor")||"#FFFFFF",color:t.watch("colors.textColor")||"#000000"},children:[e.jsxs("div",{className:"rounded-lg p-3 flex items-center justify-between shadow-sm",style:{backgroundColor:t.watch("colors.primaryColor")||"#2881E7",color:"#FFFFFF"},children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-base font-bold tracking-tight",children:t.watch("siteName")||"KINVO Suite"})}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"opacity-90 font-medium",children:"Inicio"}),e.jsx("span",{className:"opacity-70",children:"Módulos"}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-semibold",style:{backgroundColor:t.watch("colors.accentColor")||"#2777F6",color:"#FFFFFF"},children:"Pro"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1",children:[e.jsxs("div",{className:"p-3 rounded-lg border bg-black/5 dark:bg-white/5 space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold",style:{color:t.watch("colors.textColor")||"#000000"},children:"Tarjeta de Ejemplo"}),e.jsx("p",{className:"text-[11px] opacity-75",children:"Texto informativo que demuestra el contraste con el fondo."}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx("button",{type:"button",className:"px-2.5 py-1 text-xs rounded-md font-semibold text-white shadow-sm",style:{backgroundColor:t.watch("colors.primaryColor")||"#2881E7"},children:"Botón Primario"}),e.jsx("button",{type:"button",className:"px-2.5 py-1 text-xs rounded-md font-semibold text-white shadow-sm",style:{backgroundColor:t.watch("colors.secondaryColor")||"#36D2F1"},children:"Secundario"})]})]}),e.jsxs("div",{className:"p-3 rounded-lg border bg-black/5 dark:bg-white/5 space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold",style:{color:t.watch("colors.textColor")||"#000000"},children:"Etiquetas y Acentos"}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold text-white",style:{backgroundColor:t.watch("colors.primaryColor")||"#2881E7"},children:"Primario"}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold text-white",style:{backgroundColor:t.watch("colors.secondaryColor")||"#36D2F1"},children:"Secundario"}),e.jsx("span",{className:"px-2 py-0.5 rounded text-[10px] font-bold text-white",style:{backgroundColor:t.watch("colors.accentColor")||"#2777F6"},children:"Acento"})]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pt-2 flex-wrap",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Paletas rápidas:"}),e.jsx(k,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{t.setValue("colors.primaryColor","#2881E7",{shouldDirty:!0}),t.setValue("colors.secondaryColor","#36D2F1",{shouldDirty:!0}),t.setValue("colors.accentColor","#2777F6",{shouldDirty:!0}),t.setValue("colors.backgroundColor","#FFFFFF",{shouldDirty:!0}),t.setValue("colors.textColor","#000000",{shouldDirty:!0})},children:"KINVO Azul"}),e.jsx(k,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{t.setValue("colors.primaryColor","#059669",{shouldDirty:!0}),t.setValue("colors.secondaryColor","#10B981",{shouldDirty:!0}),t.setValue("colors.accentColor","#34D399",{shouldDirty:!0}),t.setValue("colors.backgroundColor","#F0FDF4",{shouldDirty:!0}),t.setValue("colors.textColor","#064E3B",{shouldDirty:!0})},children:"Esmeralda"}),e.jsx(k,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{t.setValue("colors.primaryColor","#7C3AED",{shouldDirty:!0}),t.setValue("colors.secondaryColor","#8B5CF6",{shouldDirty:!0}),t.setValue("colors.accentColor","#A78BFA",{shouldDirty:!0}),t.setValue("colors.backgroundColor","#FAF5FF",{shouldDirty:!0}),t.setValue("colors.textColor","#3B0764",{shouldDirty:!0})},children:"Púrpura"}),e.jsx(k,{type:"button",variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{t.setValue("colors.primaryColor","#3B82F6",{shouldDirty:!0}),t.setValue("colors.secondaryColor","#60A5FA",{shouldDirty:!0}),t.setValue("colors.accentColor","#93C5FD",{shouldDirty:!0}),t.setValue("colors.backgroundColor","#0F172A",{shouldDirty:!0}),t.setValue("colors.textColor","#F8FAFC",{shouldDirty:!0})},children:"Dark Slate"})]})]})]})]}),_==="seo"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2",children:[e.jsx(is,{className:"w-5 h-5"}),"Configuración SEO"]}),e.jsx(W,{children:"Optimiza tu aplicación para motores de búsqueda"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"seo.metaTitle",render:({field:a})=>{const p=(a.value||"").length;return e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(m,{children:"Título Meta"}),e.jsxs("span",{className:M("text-[10px] font-mono",p>60?"text-destructive font-bold":p>=30?"text-emerald-600":"text-muted-foreground"),children:[p,"/60 car."]})]}),e.jsx(n,{children:e.jsx(b,{placeholder:"Mi CRM - Sistema de Gestión",...a})}),e.jsx(N,{children:"Aparece en la pestaña y en los resultados de Google (ideal: 50-60 car.)"}),e.jsx(v,{})]})}}),e.jsx(d,{control:t.control,name:"seo.twitterHandle",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Usuario de Twitter"}),e.jsx(n,{children:e.jsx(b,{placeholder:"@miempresa",...a})}),e.jsx(N,{children:"Handle de Twitter/X para tarjetas OpenGraph"}),e.jsx(v,{})]})})]}),e.jsx(d,{control:t.control,name:"seo.metaDescription",render:({field:a})=>{const p=(a.value||"").length;return e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(m,{children:"Descripción Meta"}),e.jsxs("span",{className:M("text-[10px] font-mono",p>160?"text-destructive font-bold":p>=100?"text-emerald-600":"text-muted-foreground"),children:[p,"/160 car."]})]}),e.jsx(n,{children:e.jsx(as,{placeholder:"Descripción concisa de tu aplicación o negocio para buscadores...",className:"min-h-[80px]",...a})}),e.jsx(N,{children:"Resumen visible en buscadores y redes al compartir enlaces (ideal: 120-160 car.)"}),e.jsx(v,{})]})}}),e.jsx(d,{control:t.control,name:"seo.keywords",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Palabras Clave"}),e.jsx(n,{children:e.jsx(b,{placeholder:"CRM, gestión, ventas, clientes",...a})}),e.jsx(N,{children:"Palabras clave separadas por comas"}),e.jsx(v,{})]})})]})]}),e.jsxs(L,{className:"border-border/80 shadow-sm overflow-hidden",children:[e.jsx(G,{className:"bg-muted/10 border-b border-border/40 pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(H,{
4className:"text-sm font-bold flex items-center gap-2",children:[e.jsx(is,{className:"w-4 h-4 text-primary"}),"Previsualización en Resultados de Google (SERP)"]}),e.jsx(W,{className:"text-xs",children:"Así es como se visualiza tu negocio cuando los usuarios te buscan en Google"})]}),e.jsxs("div",{className:"flex items-center gap-1 bg-muted p-0.5 rounded-lg",children:[e.jsxs("button",{type:"button",onClick:()=>Ee("desktop"),className:M("px-2.5 py-1 text-xs rounded-md font-medium transition-all flex items-center gap-1",ce==="desktop"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(ps,{className:"w-3.5 h-3.5"}),"Escritorio"]}),e.jsxs("button",{type:"button",onClick:()=>Ee("mobile"),className:M("px-2.5 py-1 text-xs rounded-md font-medium transition-all flex items-center gap-1",ce==="mobile"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Os,{className:"w-3.5 h-3.5"}),"Móvil"]})]})]})}),e.jsx(U,{className:"p-4",children:e.jsxs("div",{className:M("rounded-xl border bg-card p-4 transition-all duration-300 shadow-sm",ce==="mobile"?"max-w-sm mx-auto":"w-full"),children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mb-1",children:[e.jsx("div",{className:"w-4 h-4 rounded-full bg-primary/10 flex items-center justify-center text-primary text-[10px] font-bold",children:"G"}),e.jsxs("div",{className:"truncate",children:[e.jsx("span",{className:"font-semibold text-foreground",children:t.watch("siteName")||"KINVO Suite"}),e.jsx("span",{className:"text-muted-foreground ml-1",children:t.watch("pagina_web_url")||(t.watch("name_sub_dominio")?`https://${t.watch("name_sub_dominio")}.kinvo.app`:"https://www.miempresa.com")})]})]}),e.jsx("h3",{className:"text-base sm:text-lg font-medium text-blue-700 dark:text-blue-400 hover:underline cursor-pointer truncate",children:t.watch("seo.metaTitle")||t.watch("siteName")||"Título del Sitio - Tu Negocio"}),e.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1 line-clamp-2 leading-relaxed",children:t.watch("seo.metaDescription")||t.watch("tagline")||"Configura la descripción meta en los campos superiores para personalizar el texto que tus clientes verán al encontrarte en los buscadores."})]})})]}
4),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(ta,{className:"w-5 h-5"}),"Google Ads y métricas"]}),e.jsx(W,{children:"Conecta Google Analytics, Google Ads o Tag Manager para medición pública del tenant."})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(d,{control:t.control,name:"googleAnalyticsId",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Google Analytics"}),e.jsx(n,{children:e.jsx(b,{placeholder:"G-XXXXXXXXXX",...a})}),e.jsx(N,{children:"ID de medición GA4."}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"googleAdsId",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Google Ads"}),e.jsx(n,{children:e.jsx(b,{placeholder:"AW-123456789",...a})}),e.jsx(N,{children:"ID base de conversión o remarketing."}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"googleTagManagerId",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Tag Manager"}),e.jsx(n,{children:e.jsx(b,{placeholder:"GTM-XXXXXXX",...a})}),e.jsx(N,{children:"Contenedor GTM si el tenant lo usa."}),e.jsx(v,{})]})})]}),e.jsx(d,{control:t.control,name:"googleTagScript",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Script de Google"}),e.jsx(n,{children:e.jsx(as,{placeholder:"Pega aquí el script de Google. El sistema extrae G-, AW- o GTM- y genera los tags de forma segura.",className:"min-h-[140px] font-mono text-xs",...a})}),e.jsx(N,{children:"No se publica JavaScript arbitrario; solo se toman IDs válidos de Google para mantener segura la página pública."}),e.jsx(v,{})]})})]})]})]}),_==="social"&&e.jsx("div",{className:"space-y-6",children:e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2",children:[e.jsx(na,{className:"w-5 h-5"}),"Redes Sociales"]}),e.jsx(W,{children:"Enlaces a tus perfiles en redes sociales"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsx(d,{control:t.control,name:"socials.facebookUrl",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"w-4 h-4 text-blue-600"}),"Facebook"]}),e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{placeholder:"https://facebook.com/miempresa",...a}),a.value&&e.jsx(k,{type:"button",variant:"outline",size:"icon",className:"shrink-0",title:"Abrir página de Facebook",asChild:!0,children:e.jsx("a",{href:a.value.startsWith("http")?a.value:`https://${a.value}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(ne,{className:"w-4 h-4"})})})]})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"socials.twitterUrl",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(es,{className:"w-4 h-4 text-sky-500"}),"Twitter / X"]}),e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{placeholder:"https://twitter.com/miempresa",...a}),a.value&&e.jsx(k,{type:"button",variant:"outline",size:"icon",className:"shrink-0",title:"Abrir perfil de Twitter / X",asChild:!0,children:e.jsx("a",{href:a.value.startsWith("http")?a.value:`https://${a.value}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(ne,{className:"w-4 h-4"})})})]})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"socials.instagramUrl",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(ge,{className:"w-4 h-4 text-pink-600"}),"Instagram"]}),e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{placeholder:"https://instagram.com/miempresa",...a}),a.value&&e.jsx(k,{type:"button",variant:"outline",size:"icon",className:"shrink-0",title:"Abrir perfil de Instagram",asChild:!0,children:e.jsx("a",{href:a.value.startsWith("http")?a.value:`https://${a.value}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(ne,{className:"w-4 h-4"})})})]})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"socials.linkedinUrl",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(Ds,{className:"w-4 h-4 text-blue-700"}),"LinkedIn"]}),e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{placeholder:"https://linkedin.com/company/miempresa",...a}),a.value&&e.jsx(k,{type:"button",variant:"outline",size:"icon",className:"shrink-0",title:"Abrir página de LinkedIn",asChild:!0,children:e.jsx("a",{href:a.value.startsWith("http")?a.value:`https://${a.value}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(ne,{className:"w-4 h-4"})})})]})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"socials.youtubeUrl",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-4 h-4 text-red-600"}),"YouTube"]}),e.jsx(n,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{placeholder:"https://youtube.com/c/miempresa",...a}),a.value&&e.jsx(k,{type:"button",variant:"outline",size:"icon",className:"shrink-0",title:"Abrir canal de YouTube",asChild:!0,children:e.jsx("a",{href:a.value.startsWith("http")?a.value:`https://${a.value}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(ne,{className:"w-4 h-4"})})})]})}),e.jsx(v,{})]})})]})]})}),_==="integrations"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{
4className:"flex items-center gap-2",children:[e.jsx(cr,{className:"w-5 h-5"}),"Integraciones de IA"]}),e.jsx(W,{children:"Tokens de acceso para servicios de Inteligencia Artificial"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl border border-indigo-500/30 bg-gradient-to-r from-indigo-500/5 via-purple-500/5 to-transparent space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ge,{className:"w-4 h-4 text-indigo-500"}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"OpenRouter (Gateway Universal & Pruebas en Local)"})]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",t.watch("tokenOpenRouter")?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30 font-medium":"bg-muted text-muted-foreground"),children:t.watch("tokenOpenRouter")?"Configurado":"Sin configurar"})]}),e.jsx(d,{control:t.control,name:"tokenOpenRouter",render:({field:a})=>e.jsxs(c,{children:[e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.tokenOpenRouter?"text":"password",placeholder:"sk-or-v1-...",className:"pr-10 font-mono text-xs bg-background/80",...a}),e.jsx("button",{type:"button",onClick:()=>T("tokenOpenRouter"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.tokenOpenRouter?"Ocultar token":"Mostrar token",children:x.tokenOpenRouter?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{className:"text-xs",children:"Token universal para acceder a cientos de modelos (Claude 3.5 Sonnet, GPT-4o, DeepSeek V3/R1, Llama 3.3, Gemini) con una sola clave. Ideal para pruebas locales y producción unificada."}),e.jsx(v,{})]})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1 border-t border-border/40",children:[e.jsx(k,{type:"button",variant:"outline",size:"sm",disabled:ae||!t.watch("tokenOpenRouter"),onClick:async()=>{const a=t.getValues("tokenOpenRouter");if(!a){o({title:"Token requerido",description:"Ingresa tu token de OpenRouter antes de probar la conexión",variant:"destructive"});return}re(!0);const p=await Ta.testConnection(a);re(!1),p.success?o({title:"✅ Conexión con OpenRouter Exitosa",description:"El token es válido y la API respondió correctamente con el gateway."}):o({title:"❌ Error en OpenRouter",description:p.error||"No se pudo autenticar con OpenRouter",variant:"destructive"})},className:"h-8 text-xs gap-1.5",children:ae?e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-3.5 h-3.5 animate-spin"}),"Probando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"w-3.5 h-3.5 text-indigo-500"}),"Probar Conexión OpenRouter"]})}),e.jsxs("a",{href:"https://openrouter.ai/keys",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-indigo-600 dark:text-indigo-400 hover:underline flex items-center gap-1",children:["Obtener clave en OpenRouter.ai",e.jsx(ne,{className:"w-3 h-3"})]})]})]}),e.jsxs("div",{className:"p-4 rounded-xl border border-emerald-500/30 bg-gradient-to-r from-emerald-500/5 via-teal-500/5 to-transparent space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ps,{className:"w-4 h-4 text-emerald-500"}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Ollama (LLM Local / Servidor O
4n-Premise)"})]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",(Cs=t.watch("ollamaBaseUrl"))!=null&&Cs.trim()?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30 font-medium":"bg-muted text-muted-foreground"),children:(Is=t.watch("ollamaBaseUrl"))!=null&&Is.trim()?"Configurado":"Sin configurar"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsx(d,{control:t.control,name:"ollamaBaseUrl",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{className:"text-xs font-medium",children:"URL Base del Servidor Ollama"}),e.jsx(n,{children:e.jsx(b,{placeholder:"http://localhost:11434",className:"font-mono text-xs bg-background/80",...a})}),e.jsx(N,{className:"text-[11px]",children:"Dirección IP o endpoint local de Ollama (ej: http://localhost:11434 o http://192.168.1.50:11434)."}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"ollamaModel",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{className:"text-xs font-medium",children:"Modelo Local por Defecto"}),e.jsx(n,{children:e.jsx(b,{placeholder:"llama3.2",className:"font-mono text-xs bg-background/80",...a})}),e.jsx(N,{className:"text-[11px]",children:"Nombre del modelo en Ollama (ej: llama3.2, deepseek-r1, mistral, qwen2.5)."}),e.jsx(v,{})]})})]}),e.jsx(d,{control:t.control,name:"ollamaToken",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{className:"text-xs font-medium",children:"Token / Clave de Acceso (Opcional)"}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.ollamaToken?"text":"password",placeholder:"Opcional: Bearer token si está tras proxy o VPN",className:"pr-10 font-mono text-xs bg-background/80",...a}),e.jsx("button",{type:"button",onClick:()=>T("ollamaToken"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.ollamaToken?"Ocultar token":"Mostrar token",children:x.ollamaToken?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{className:"text-[11px]",children:"Déjalo en blanco si tu servidor Ollama no requiere autenticación en tu red local."}),e.jsx(v,{})]})}),B.length>0&&e.jsxs("div",{className:"p-2.5 rounded-lg bg-background/80 border border-emerald-500/20 text-xs space-y-1.5",children:[e.jsxs("div",{className:"font-medium text-emerald-600 dark:text-emerald-400 flex items-center gap-1.5",children:[e.jsx(Ls,{className:"w-3.5 h-3.5"}),"Modelos locales detectados en servidor (",B.length,"):"]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:B.map(a=>e.jsx(C,{variant:"secondary",className:"text-[10px] cursor-pointer hover:bg-emerald-500/20 transition-colors",onClick:()=>t.setValue("ollamaModel",a,{shouldDirty:!0}),title:"Clic para seleccionar este modelo como predeterminado",children:a},a))})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 pt-1 border-t border-border/40",children:[e.jsx(k,{type:"button",variant:"outline",size:"sm",disabled:Q,onClick:async()=>{var ve;const a=t.getValues("ollamaBaseUrl")||"http://localhost:11434",p=t.getValues("ollamaModel")||"llama3.2",f=t.getValues("ollamaToken");y(!0);const O=await Ma.testConnection({baseUrl:a,model:p,token:f});y(!1),O.success?(O.models&&O.models.length>0&&te(O.models),o({title:"✅ Conexión con Ollama Exitosa",description:`Servidor activo en ${a}${O.latencyMs?` (${O.latencyMs}ms)`:""}.${(ve=O.models)!=null&&ve.length?` Se detectaron ${O.models.length} modelos instalados.`:""}`})):o({title:"❌ Error al conectar con Ollama",description:O.error||"No se pudo conectar con el servidor Ollama.",variant:"destructive"})},className:"h-8 text-xs gap-1.5",children:Q?e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-3.5 h-3.5 animate-spin"}),"Probando servidor..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ps,{className:"w-3.5 h-3.5 text-emerald-500"}),"Probar Conexión Ollama"]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground hidden sm:inline",children:'Tip: OLLAMA_ORIGINS="*" ollama serve'}),e.jsxs("a",{href:"https://ollama.com/library",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-emerald-600 dark:text-emerald-400 hover:underline flex items-center gap-1",children:["Catálogo de Modelos",e.
4jsx(ne,{className:"w-3 h-3"})]})]})]})]}),e.jsx(Ae,{className:"my-2"}),e.jsx("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wider px-1",children:"Proveedores Directos (Opcional)"}),e.jsx(d,{control:t.control,name:"tokenChatIa1",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-primary"}),"Token Gemini (Chat IA 1)"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.tokenChatIa1?"text":"password",placeholder:"AIzaSy...",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("tokenChatIa1"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.tokenChatIa1?"Ocultar token":"Mostrar token",children:x.tokenChatIa1?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Token principal para Google Gemini (IA)"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"tokenChatIa2",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-emerald-600"}),"Token OpenAI (Chat IA 2)"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.tokenChatIa2?"text":"password",placeholder:"sk-proj-...",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("tokenChatIa2"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.tokenChatIa2?"Ocultar token":"Mostrar token",children:x.tokenChatIa2?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Token para OpenAI (ChatGPT / GPT-4o)"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"tockenChatIa3",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-blue-600"}),"Token DeepSeek (Chat IA 3)"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.tockenChatIa3?"text":"password",placeholder:"sk-...",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("tockenChatIa3"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.tockenChatIa3?"Ocultar token":"Mostrar token",children:x.tockenChatIa3?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Token para DeepSeek (DeepSeek V3 / R1)"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"tockenChatIa4",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-amber-600"}),"Token Claude / Anthropic (Chat IA 4)"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.tockenChatIa4?"text":"password",placeholder:"sk-ant-...",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("tockenChatIa4"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.tockenChatIa4?"Ocultar token":"Mostrar token",children:x.tockenChatIa4?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Token de API para Claude (Anthropic Sonnet / Opus)"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"tockenChatIa5",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-purple-600"}),"Token Kimi / Moonshot (Chat IA 5)"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.tockenChatIa5?"text":"password",placeholder:"sk-...",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("tockenChatIa5"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.tockenChatIa5?"Ocultar token":"Mostrar token",children:x.tockenChatIa5?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Token de API para Kimi (Moonshot AI)"}),e.jsx(v,{})]})})]})]}
4),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-5 h-5"}),"Integración con Telegram"]}),e.jsx(W,{children:"Configuración para notificaciones y bot de Telegram"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsx(d,{control:t.control,name:"telegramToken",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-sky-500"}),"Token del Bot"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.telegramToken?"text":"password",placeholder:"1234567890:ABCDEF...",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("telegramToken"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.telegramToken?"Ocultar token":"Mostrar token",children:x.telegramToken?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Token de acceso del bot de Telegram (obtenido de @BotFather)"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"telegramChatId",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(es,{className:"w-4 h-4"}),"Chat ID"]}),e.jsx(n,{children:e.jsx(b,{placeholder:"-1001234567890",...a})}),e.jsx(N,{children:"ID del chat o canal donde se enviarán las notificaciones"}),e.jsx(v,{})]})}),e.jsxs("div",{className:"pt-4 border-t",children:[e.jsx(k,{type:"button",variant:"outline",className:"w-full",disabled:K||!t.watch("telegramToken")||!t.watch("telegramChatId"),onClick:async()=>{const a=t.getValues("telegramToken"),p=t.getValues("telegramChatId");if(!a||!p){o({title:"Campos requeridos",description:"Ingresa el Token del Bot y el Chat ID antes de probar",variant:"destructive"});return}R(!0);const f=await hs.sendTestMessage(a,p);R(!1),f.success?o({title:"✅ Conexión exitosa",description:"El mensaje de prueba fue enviado correctamente a Telegram"}):o({title:"❌ Error de conexión",description:f.error||"No se pudo enviar el mensaje de prueba",variant:"destructive"})},children:K?e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-4 h-4 mr-2 animate-spin"}),"Probando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-4 h-4 mr-2"}),"Probar Conexión de Telegram"]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:"Enviará un mensaje de prueba al chat configurado"})]})]})]})]}),_==="mail"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(H,{
4className:"flex items-center gap-2",children:[e.jsx(ls,{className:"w-5 h-5 text-primary"}),"Configuración de Correo (Mailcow)"]}),e.jsx(W,{children:"Parámetros del proxy y servidor de correo institucional por tenant"})]}),e.jsx(C,{variant:"outline",className:"text-xs bg-primary/10 text-primary border-primary/30",children:"Proxy Mailcow KINVO"})]})}),e.jsxs(U,{className:"space-y-4",children:[e.jsx(d,{control:t.control,name:"MAILCOW_ALLOWED_HOSTS",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hosts permitidos"}),e.jsx(n,{children:e.jsx(as,{placeholder:"mail.miempresa.com,mail2.miempresa.com",className:"min-h-[90px] font-mono text-xs",...a})}),e.jsx(N,{children:"Lista de dominios u hostnames permitidos para el servicio de correo, separados por coma."}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"MAILCOW_API_KEY",render:({field:a})=>e.jsxs(c,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"w-4 h-4 text-primary"}),"API Key de Mailcow"]}),e.jsx(C,{variant:"outline",className:M("text-[10px] px-2 py-0.5",a.value?"bg-emerald-500/10 text-emerald-600 border-emerald-500/30":"bg-muted text-muted-foreground"),children:a.value?"Configurado":"Sin configurar"})]}),e.jsx(n,{children:e.jsxs("div",{className:"relative flex items-center",children:[e.jsx(b,{type:x.MAILCOW_API_KEY?"text":"password",placeholder:"Ingresa la API key de Mailcow",className:"pr-10 font-mono text-xs",...a}),e.jsx("button",{type:"button",onClick:()=>T("MAILCOW_API_KEY"),className:"absolute right-2.5 text-muted-foreground hover:text-foreground transition-colors p-1",title:x.MAILCOW_API_KEY?"Ocultar API key":"Mostrar API key",children:x.MAILCOW_API_KEY?e.jsx(de,{className:"w-4 h-4"}):e.jsx(oe,{className:"w-4 h-4"})})]})}),e.jsx(N,{children:"Clave maestra utilizada por el backend para el proxy seguro de buzones y sincronización."}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"MAILCOW_PROXY_TIMEOUT_MS",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Timeout del proxy (ms)"}),e.jsx(n,{children:e.jsx(b,{type:"number",min:"1000",step:"500",placeholder:"15000",...a})}),e.jsx(N,{children:"Tiempo máximo de espera en milisegundos para solicitudes al proxy (por defecto: 15000 ms)."}),e.jsx(v,{})]})})]})]}),e.jsxs(L,{className:"border-border/60 bg-muted/20",children:[e.jsxs(G,{className:"pb-3",children:[e.jsxs(H,{
4className:"text-base flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4 text-primary"}),"Accesos Rápidos y Administración de Correo"]}),e.jsx(W,{children:"Enlaces directos para que los colaboradores y administradores gestionen sus buzones."})]}),e.jsx(U,{children:e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(k,{type:"button",variant:"outline",size:"sm",className:"gap-2",asChild:!0,children:e.jsxs("a",{href:"/webmail",target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ls,{className:"w-4 h-4 text-blue-500"}),"Abrir Webmail",e.jsx(ne,{className:"w-3 h-3 text-muted-foreground ml-1"})]})}),e.jsx(k,{type:"button",variant:"outline",size:"sm",className:"gap-2",asChild:!0,children:e.jsxs("a",{href:"/admin-mail",target:"_blank",rel:"noopener noreferrer",children:[e.jsx(je,{className:"w-4 h-4 text-emerald-500"}),"Panel Mailcow Admin",e.jsx(ne,{className:"w-3 h-3 text-muted-foreground ml-1"})]})})]})})]})]}),_==="checkin"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(L,{className:"border-border/80 shadow-sm overflow-hidden",children:[e.jsx(G,{className:"bg-muted/10 border-b border-border/40 pb-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(H,{
4className:"flex items-center gap-2 text-lg font-bold",children:[e.jsx(la,{className:"w-5 h-5 text-primary"}),"Métodos de Marcaje Permitidos (Estaciones y Kioscos)"]}),e.jsx(W,{children:"Define qué tecnologías de marcaje están habilitadas para los colaboradores en tu empresa."})]}),e.jsx(C,{variant:"outline",className:"w-fit bg-primary/10 text-primary border-primary/30 font-semibold px-2.5 py-0.5",children:"Multi-Método KINVO"})]})}),e.jsxs(U,{className:"space-y-4 pt-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(d,{control:t.control,name:"marcaje_habilitar_facial",render:({field:a})=>e.jsxs(c,{className:M("flex flex-col justify-between p-4 rounded-xl border transition-all duration-200",a.value!==!1?"border-blue-500/50 bg-blue-500/5 shadow-sm":"border-border/60 bg-muted/10 opacity-75"),children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-blue-500/10 text-blue-600 dark:text-blue-400",children:e.jsx(dr,{className:"w-6 h-6"})}),e.jsx(C,{variant:"secondary",className:"text-[10px] bg-blue-500/15 text-blue-700 dark:text-blue-300 border-none font-semibold",children:"Por Defecto (ON)"})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-base font-bold block cursor-pointer",children:"Biometría Facial"}),e.jsx(N,{className:"text-xs mt-1 leading-relaxed",children:"Identificación por reconocimiento de rostro en tiempo real con IA, detección facial rápida y anti-spoofing."})]})]}),e.jsxs("div",{className:"pt-3 flex items-center justify-between border-t border-border/40 mt-3",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:a.value!==!1?"Habilitado":"Deshabilitado"}),e.jsx(n,{children:e.jsx($,{checked:a.value!==!1,onCheckedChange:a.onChange})})]})]})}),e.jsx(d,{control:t.control,name:"marcaje_habilitar_qr",render:({field:a})=>e.jsxs(c,{className:M("flex flex-col justify-between p-4 rounded-xl border transition-all duration-200",a.value?"border-emerald-500/50 bg-emerald-500/5 shadow-sm":"border-border/60 bg-muted/10 opacity-75"),children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:e.jsx(mr,{className:"w-6 h-6"})}),e.jsx(C,{variant:"outline",className:"text-[10px] border-emerald-500/30 text-emerald-700 dark:text-emerald-300 font-semibold",children:"Gafetes / Móvil"})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-base font-bold block cursor-pointer",children:"Código QR / Gafete"}),e.jsx(N,{className:"text-xs mt-1 leading-relaxed",children:"Escaneo instantáneo de credenciales impresas o gafetes digitales desde la cámara del kiosco o tablet."})]})]}),e.jsxs("div",{className:"pt-3 flex items-center justify-between border-t border-border/40 mt-3",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:a.value?"Habilitado":"Deshabilitado"}),e.jsx(n,{children:e.jsx($,{checked:!!a.value,onCheckedChange:a.onChange})})]})]})}),e.jsx(d,{control:t.control,name:"marcaje_habilitar_rfid",render:({field:a})=>e.jsxs(c,{className:M("flex flex-col justify-between p-4 rounded-xl border transition-all duration-200",a.value?"border-purple-500/50 bg-purple-500/5 shadow-sm":"border-border/60 bg-muted/10 opacity-75"),children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"p-2.5 rounded-xl bg-purple-500/10 text-purple-600 dark:text-purple-400",children:e.jsx(xr,{className:"w-6 h-6"})}),e.jsx(C,{variant:"outline",className:"text-[10px] border-purple-500/30 text-purple-700 dark:text-purple-300 font-semibold",children:"Proximidad USB/NFC"})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-base font-bold block cursor-pointer",children:"Tarjeta / Llavero RFID"}),e.jsx(N,{className:"text-xs mt-1 leading-relaxed",children:"Marcaje por proximidad mediante lectores USB HID estándar o NFC. Ideal para flujo masivo de personal en turnos."})]})]}),e.jsxs("div",{className:"pt-3 flex items-center justify-between border-t border-border/40 mt-3",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:a.value?"Habilitado":"Deshabilitado"}),e.jsx(n,{children:e.jsx($,{checked:!!a.value,onCheckedChange:a.onChange})})]})]})})]}),e.jsxs("div",{className:"flex items-start gap-2.5 p-3.5 text-xs bg-muted/40 rounded-xl border border-border/60 text-muted-foreground",children:[e.jsx(Rs,{className:"w-4 h-4 text-primary shrink-0 mt-0.5"}),e.jsxs("span",{className:"leading-relaxed",children:[e.jsx("strong",{className:"text-foreground font-semibold",children:"Regla de Kioscos y Estaciones:"})," Si mantienes solo 1 método activo (como Reconocimiento Facial por defecto), la pantalla de marcaje entrará directamente a él sin interrumpir el flujo. Si activas 2 o los 3 métodos, la estación preguntará al operador o usuario qué método utilizar en ese dispositivo y recordará la elección para rapidez diaria."]})]})]})]}
4),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(De,{className:"w-5 h-5"}),"Notificaciones de Marcaje"]}),e.jsx(W,{children:"Chat de Telegram exclusivo para notificaciones de entrada/salida de empleados"})]}),e.jsxs(U,{className:"space-y-4",children:[e.jsx(d,{control:t.control,name:"guardarFotosMarcaje",render:({field:a})=>e.jsxs(c,{className:"flex flex-col gap-4 rounded-lg border border-border/70 bg-muted/20 p-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs(m,{className:"flex items-center gap-2 text-base",children:[e.jsx(ge,{className:"w-4 h-4"}),"Guardar fotos de marcaje"]}),e.jsx(N,{children:"Actívalo para adjuntar evidencia fotográfica al registro. Si lo desactivas, el marcaje guarda más rápido y no consume almacenamiento con fotos."})]}),e.jsx(n,{children:e.jsx($,{checked:a.value!==!1,onCheckedChange:a.onChange})})]})}),e.jsx(d,{control:t.control,name:"telegramChatIdChekin",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(es,{className:"w-4 h-4"}),"Chat ID de Check-in"]}),e.jsx(n,{children:e.jsx(b,{placeholder:"-1001234567890",...a})}),e.jsx(N,{children:"ID del chat o canal donde se enviarán las notificaciones de marcaje (usa el mismo Token del bot)"}),e.jsx(v,{})]})}),e.jsxs("div",{className:"pt-4 border-t",children:[e.jsx(k,{type:"button",variant:"outline",className:"w-full",disabled:D||!t.watch("telegramToken")||!t.watch("telegramChatIdChekin"),onClick:async()=>{const a=t.getValues("telegramToken"),p=t.getValues("telegramChatIdChekin");if(!a||!p){o({title:"Campos requeridos",description:"Ingresa el Token del Bot (en Integraciones) y el Chat ID de Check-in",variant:"destructive"});return}Y(!0);const f=await hs.sendTestMessage(a,p,`🔔 *Prueba de Notificación de Marcaje*
5
6✅ La configuración de Telegram para Check-in está funcionando correctamente.`);Y(!1),f.success?o({title:"✅ Conexión exitosa",description:"El mensaje de prueba fue enviado al chat de Check-in"}):o({title:"❌ Error de conexión",description:f.error||"No se pudo enviar el mensaje de prueba",variant:"destructive"})},children:D?e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-4 h-4 mr-2 animate-spin"}),"Probando..."]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{className:"w-4 h-4 mr-2"}),"Probar Conexión de Marcaje"]})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center",children:"Enviará un mensaje de prueba al chat de notificaciones de marcaje"})]})]})]}
6),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(js,{className:"w-5 h-5"}),"Configuración de Pagos"]}),e.jsx(W,{children:"Tarifas por hora de trabajo y horas extra"})]}),e.jsx(U,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx(d,{control:t.control,name:"montoHora",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(js,{className:"w-4 h-4"}),"Monto por Hora (Q)"]}),e.jsx(n,{children:e.jsx(b,{type:"number",step:"0.01",placeholder:"15.00",...a})}),e.jsx(N,{children:"Tarifa estándar por hora"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"montoHoraExtra",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(js,{className:"w-4 h-4"}),"Monto Hora Extra (Q)"]}),e.jsx(n,{children:e.jsx(b,{type:"number",step:"0.01",placeholder:"22.50",...a})}),e.jsx(N,{children:"Tarifa por hora extra"}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"horasDescanso",render:({field:a})=>e.jsxs(c,{children:[e.jsxs(m,{className:"flex items-center gap-2",children:[e.jsx(hr,{className:"w-4 h-4"}),"Horas de Descanso"]}),e.jsx(n,{children:e.jsx(b,{type:"number",placeholder:"1",...a})}),e.jsx(N,{children:"Horas de descanso por turno"}),e.jsx(v,{})]})})]})})]}
6),e.jsxs(L,{children:[e.jsxs(G,{children:[e.jsxs(H,{className:"flex items-center gap-2",children:[e.jsx(ra,{className:"w-5 h-5"}),"Configuración de Turnos"]}),e.jsx(W,{children:"Horarios predeterminados para cada turno de trabajo"})]}),e.jsxs(U,{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 border border-border rounded-lg bg-yellow-500/5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(ur,{className:"w-5 h-5 text-yellow-500"}),e.jsx("h4",{className:"font-medium",children:"Turno Día"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"turnoDiaInicio",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hora Inicio"}),e.jsx(n,{children:e.jsx(b,{type:"time",...a})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"turnoDiaFin",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hora Fin"}),e.jsx(n,{children:e.jsx(b,{type:"time",...a})}),e.jsx(v,{})]})})]})]}),e.jsxs("div",{className:"p-4 border border-border rounded-lg bg-orange-500/5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(pr,{className:"w-5 h-5 text-orange-500"}),e.jsx("h4",{className:"font-medium",children:"Turno Tarde"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"turnoTardeInicio",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hora Inicio"}),e.jsx(n,{children:e.jsx(b,{type:"time",...a})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"turnoTardeFin",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hora Fin"}),e.jsx(n,{children:e.jsx(b,{type:"time",...a})}),e.jsx(v,{})]})})]})]}),e.jsxs("div",{className:"p-4 border border-border rounded-lg bg-indigo-500/5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(jr,{className:"w-5 h-5 text-indigo-500"}),e.jsx("h4",{className:"font-medium",children:"Turno Noche"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(d,{control:t.control,name:"turnoNocheInicio",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hora Inicio"}),e.jsx(n,{children:e.jsx(b,{type:"time",...a})}),e.jsx(v,{})]})}),e.jsx(d,{control:t.control,name:"turnoNocheFin",render:({field:a})=>e.jsxs(c,{children:[e.jsx(m,{children:"Hora Fin"}),e.jsx(n,{children:e.jsx(b,{type:"time",...a})}),e.jsx(v,{})]})})]})]})]})]})]}),_==="sales"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2 p-1 bg-muted/50 rounded-lg w-fit border border-border/60",children:[e.jsxs(k,{type:"button",size:"sm",variant:S==="channels"?"default":"ghost",onClick:()=>J("channels"),className:"gap-2 text-xs font-medium",children:[e.jsx(Le,{className:"w-3.5 h-3.5"}),"Canales y Métodos de Pago"]}),e.jsxs(k,{type:"button",size:"sm",variant:S==="taxes"?"default":"ghost",onClick:()=>J("taxes"),className:"gap-2 text-xs font-medium",children:[e.jsx(fs,{className:"w-3.5 h-3.5"}),"Impuestos y Retenciones"]})]}),S==="channels"&&e.jsx(Kr,{form:t,globalConfig:u}),S==="taxes"&&e.jsx(Qr,{globalConfig:u,onTaxesChange:()=>h()})]}),_==="payments"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-xl border border-emerald-500/30 bg-emerald-50/50 dark:bg-emerald-950/20 p-4 space-y-2",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{className:"bg-emerald-600 text-white font-semibold text-xs",children:"Dinero Directo a Tu Cuenta"}),e.jsx("span",{className:"text-sm font-bold text-foreground",children:"Pasarelas de Cobro de tu Negocio"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 text-[11px]",children:[e.jsx(C,{variant:"outline",className:"border-emerald-500/30 text-emerald-700 dark:text-emerald-300",children:"🛒 Tienda Online"}),e.jsx(C,{variant:"outline",className:"border-emerald-500/30 text-emerald-700 dark:text-emerald-300",children:"💻 Punto de Venta (POS)"}),e.jsx(C,{variant:"outline",className:"border-emerald-500/30 text-emerald-700 dark:text-emerald-300",children:"🚚 Envíos / Contra Entrega"}),e.jsx(C,{variant:"outline",className:"border-emerald-500/30 text-emerald-700 dark:text-emerald-300",children:"📊 Proyectos & Finanzas"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["Configura aquí los métodos y procesadores donde ",e.jsx("strong",{children:"tus propios clientes te pagarán a ti"}),". Todos los ingresos por ventas van 100% directos a tus cuentas bancarias o de procesador (Stripe, Págalo, BAC, transferencias, efectivo contra entrega). KINVO no retiene fondos de tus ventas."]})]}),e.jsx(Ue.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(rs,{})}),children:e.jsx(et,{})})]}),_==="subscription"&&e.jsx("div",{className:"space-y-6",children:e.jsx(Ue.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(rs,{})}),children:e.jsx(st,{licenciaId:((Ts=u==null?void 0:u.licencia)==null?void 0:Ts.id)||(u==null?void 0:u.licencia),onNavigateToPayments:()=>z("payments")})})}),ke.length>0&&e.jsxs("div",{className:"rounded-lg border border-amber-300/60 bg-amber-50/60 dark:bg-amber-950/20 dark:border-amber-700/40 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Us,{className:"w-4 h-4 text-amber-500 shrink-0"}),e.jsxs("span",{className:"text-sm font-medium text-amber-700 dark:text-amber-400",children:["Configuración incompleta —"," ",ke.filter(a=>a.level==="required").length>0?"hay campos obligatorios sin completar":"algunos campos recomendados están vacíos"]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-1",children:ke.map(({key:a,label:p,tab:f,level:O})=>e.jsxs("button",{type:"button",onClick:()=>z(f),className:`flex items-center gap-2 text-xs px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors text-left ${O==="required"?"text-destructive":"text-amber-600 dar
6k:text-amber-400"}`,children:[O==="required"?e.jsx(Rs,{className:"w-3 h-3 shrink-0"}):e.jsx(Us,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{children:p}),e.jsx("span",{className:"text-muted-foreground/60 ml-auto",children:"→ ir"})]},a))}),ke.some(a=>a.level==="required")&&e.jsx("p",{className:"text-xs text-destructive font-medium",children:"Los campos con * son obligatorios — el guardado está bloqueado hasta completarlos."})]}),e.jsxs("div",{className:"flex items-center justify-end gap-4 pt-6 border-t",children:[e.jsxs(k,{type:"button",variant:"outline",onClick:()=>h(),disabled:g,children:[e.jsx(oe,{className:"w-4 h-4 mr-2"}),"Recargar"]}),s&&e.jsxs(k,{type:"submit",disabled:A,className:"bg-primary hover:opacity-90",children:[A?e.jsx(rs,{className:"mr-2"}):e.jsx(br,{className:"w-4 h-4 mr-2"}),A?"Guardando...":"Guardar Cambios"]})]})]})]})})}),e.jsx(Jr,{open:fe,onOpenChange:xe,onSelect:pa,title:"Biblioteca de archivos de configuración",prefix:mt})]})})};export{Pt as default};

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.