componentes-exagono 0.2.43 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +6 -4
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -17183,11 +17183,13 @@ function KA({ open: e, handleClose: r, guests: t, onReenviar: n }) {
|
|
|
17183
17183
|
/* @__PURE__ */ l.jsx(Dt, { onClick: r, startIcon: /* @__PURE__ */ l.jsx("img", { src: lm, width: 20 }), sx: { textTransform: "none", color: "#666", fontSize: "16px", p: 0, minWidth: 0, ml: 0.5, "&:hover": { bgcolor: "transparent" } }, children: "Volver al evento" }),
|
|
17184
17184
|
/* @__PURE__ */ l.jsx(qt, { onClick: r, sx: { position: "absolute", right: 8, top: 12 }, children: /* @__PURE__ */ l.jsx(Qr, {}) })
|
|
17185
17185
|
] }),
|
|
17186
|
-
/* @__PURE__ */ l.jsx($r, { sx: { backgroundColor: "black" } }),
|
|
17187
17186
|
/* @__PURE__ */ l.jsxs(ii, { sx: { p: 2 }, children: [
|
|
17188
|
-
a.length > 0 && /* @__PURE__ */ l.jsxs(
|
|
17189
|
-
/* @__PURE__ */ l.jsx(
|
|
17190
|
-
|
|
17187
|
+
a.length > 0 && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
17188
|
+
/* @__PURE__ */ l.jsx($r, { sx: { backgroundColor: "black" } }),
|
|
17189
|
+
/* @__PURE__ */ l.jsxs($, { sx: { mb: 3 }, children: [
|
|
17190
|
+
/* @__PURE__ */ l.jsx(c, { title: "Invitados", count: a.length }),
|
|
17191
|
+
a.map(i)
|
|
17192
|
+
] })
|
|
17191
17193
|
] }),
|
|
17192
17194
|
o.length > 0 && /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
17193
17195
|
/* @__PURE__ */ l.jsx($r, { sx: { my: 1, backgroundColor: "black" } }),
|
package/dist/index.umd.js
CHANGED
|
@@ -174,7 +174,7 @@ const theme2 = createTheme({ palette: {
|
|
|
174
174
|
} else {
|
|
175
175
|
newResult[${w}] = ${C}.value;
|
|
176
176
|
}
|
|
177
|
-
`)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(D,C)=>S(h,D,C)};let s;const i=Si,a=!np.jitless,u=a&&Pw.value,d=r.catchall;let f;e._zod.parse=(h,y)=>{f??(f=n.value);const g=h.value;return i(g)?a&&u&&y?.async===!1&&y.jitless!==!0?(s||(s=o(r.shape)),h=s(h,y),d?wp([],g,h,y,f,e):h):t(h,y):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function _p(e,r,t,n){for(const s of e)if(s.issues.length===0)return r.value=s.value,r;const o=e.filter(s=>!Fn(s));return o.length===1?(r.value=o[0].value,o[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:t,errors:e.map(s=>s.issues.map(i=>vn(i,n,gn())))}),r)}const CS=Y("$ZodUnion",(e,r)=>{At.init(e,r),mt(e._zod,"optin",()=>r.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>r.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(r.options.every(o=>o._zod.values))return new Set(r.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(r.options.every(o=>o._zod.pattern)){const o=r.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>_c(s.source)).join("|")})$`)}});const t=r.options.length===1,n=r.options[0]._zod.run;e._zod.parse=(o,s)=>{if(t)return n(o,s);let i=!1;const a=[];for(const c of r.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>_p(c,o,e,s)):_p(a,o,e,s)}}),ES=Y("$ZodIntersection",(e,r)=>{At.init(e,r),e._zod.parse=(t,n)=>{const o=t.value,s=r.left._zod.run({value:o,issues:[]},n),i=r.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Sp(t,c,u)):Sp(t,s,i)}});function Dc(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(Ro(e)&&Ro(r)){const t=Object.keys(r),n=Object.keys(e).filter(s=>t.indexOf(s)!==-1),o={...e,...r};for(const s of n){const i=Dc(e[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let n=0;n<e.length;n++){const o=e[n],s=r[n],i=Dc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};t.push(i.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Sp(e,r,t){if(r.issues.length&&e.issues.push(...r.issues),t.issues.length&&e.issues.push(...t.issues),Fn(e))return e;const n=Dc(r.value,t.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const DS=Y("$ZodEnum",(e,r)=>{At.init(e,r);const t=Iw(r.entries),n=new Set(t);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.filter(o=>Rw.has(typeof o)).map(o=>typeof o=="string"?Bn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t,input:i,inst:e}),o}}),kS=Y("$ZodLiteral",(e,r)=>{if(At.init(e,r),r.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(r.values),e._zod.pattern=new RegExp(`^(${r.values.map(t=>typeof t=="string"?Bn(t):t?Bn(t.toString()):String(t)).join("|")})$`),e._zod.parse=(t,n)=>{const o=t.value;return e._zod.values.has(o)||t.issues.push({code:"invalid_value",values:r.values,input:o,inst:e}),t}}),AS=Y("$ZodTransform",(e,r)=>{At.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new rp(e.constructor.name);const o=r.transform(t.value,t);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(t.value=i,t));if(o instanceof Promise)throw new Ln;return t.value=o,t}});function Cp(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}const TS=Y("$ZodOptional",(e,r)=>{At.init(e,r),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${_c(t.source)})?$`):void 0}),e._zod.parse=(t,n)=>{if(r.innerType._zod.optin==="optional"){const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Cp(s,t.value)):Cp(o,t.value)}return t.value===void 0?t:r.innerType._zod.run(t,n)}}),MS=Y("$ZodNullable",(e,r)=>{At.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${_c(t.source)}|null)$`):void 0}),mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(t,n)=>t.value===null?t:r.innerType._zod.run(t,n)}),IS=Y("$ZodDefault",(e,r)=>{At.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);if(t.value===void 0)return t.value=r.defaultValue,t;const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Ep(s,r)):Ep(o,r)}});function Ep(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const OS=Y("$ZodPrefault",(e,r)=>{At.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>(n.direction==="backward"||t.value===void 0&&(t.value=r.defaultValue),r.innerType._zod.run(t,n))}),jS=Y("$ZodNonOptional",(e,r)=>{At.init(e,r),mt(e._zod,"values",()=>{const t=r.innerType._zod.values;return t?new Set([...t].filter(n=>n!==void 0)):void 0}),e._zod.parse=(t,n)=>{const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Dp(s,e)):Dp(o,e)}});function Dp(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}const PS=Y("$ZodCatch",(e,r)=>{At.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>(t.value=s.value,s.issues.length&&(t.value=r.catchValue({...t,error:{issues:s.issues.map(i=>vn(i,n,gn()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=r.catchValue({...t,error:{issues:o.issues.map(s=>vn(s,n,gn()))},input:t.value}),t.issues=[]),t)}}),RS=Y("$ZodPipe",(e,r)=>{At.init(e,r),mt(e._zod,"values",()=>r.in._zod.values),mt(e._zod,"optin",()=>r.in._zod.optin),mt(e._zod,"optout",()=>r.out._zod.optout),mt(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(t,n)=>{if(n.direction==="backward"){const s=r.out._zod.run(t,n);return s instanceof Promise?s.then(i=>Oi(i,r.in,n)):Oi(s,r.in,n)}const o=r.in._zod.run(t,n);return o instanceof Promise?o.then(s=>Oi(s,r.out,n)):Oi(o,r.out,n)}});function Oi(e,r,t){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},t)}const NS=Y("$ZodReadonly",(e,r)=>{At.init(e,r),mt(e._zod,"propValues",()=>r.innerType._zod.propValues),mt(e._zod,"values",()=>r.innerType._zod.values),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(kp):kp(o)}});function kp(e){return e.value=Object.freeze(e.value),e}const $S=Y("$ZodCustom",(e,r)=>{er.init(e,r),At.init(e,r),e._zod.parse=(t,n)=>t,e._zod.check=t=>{const n=t.value,o=r.fn(n);if(o instanceof Promise)return o.then(s=>Ap(s,t,n,e));Ap(o,t,n,e)}});function Ap(e,r,t,n){if(!e){const o={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),r.issues.push(No(o))}}class LS{constructor(){this._map=new Map,this._idmap=new Map}add(r,...t){const n=t[0];if(this._map.set(r,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,r)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(r){const t=this._map.get(r);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(r),this}get(r){const t=r._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(r)};return Object.keys(o).length?o:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function zS(){return new LS}const ji=zS();function BS(e,r){return new e({type:"string",...Ae(r)})}function FS(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ae(r)})}function Tp(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(r)})}function VS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(r)})}function US(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(r)})}function WS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(r)})}function HS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(r)})}function YS(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ae(r)})}function qS(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(r)})}function ZS(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(r)})}function GS(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(r)})}function KS(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(r)})}function QS(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(r)})}function XS(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(r)})}function JS(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(r)})}function eC(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ae(r)})}function tC(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ae(r)})}function rC(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(r)})}function nC(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(r)})}function oC(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(r)})}function sC(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(r)})}function iC(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(r)})}function aC(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(r)})}function cC(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(r)})}function lC(e,r){return new e({type:"string",format:"date",check:"string_format",...Ae(r)})}function uC(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ae(r)})}function dC(e,r){return new e({type:"string",format:"duration",check:"string_format",...Ae(r)})}function fC(e,r){return new e({type:"number",checks:[],...Ae(r)})}function pC(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ae(r)})}function hC(e,r){return new e({type:"boolean",...Ae(r)})}function mC(e){return new e({type:"unknown"})}function gC(e,r){return new e({type:"never",...Ae(r)})}function Mp(e,r){return new mp({check:"less_than",...Ae(r),value:e,inclusive:!1})}function kc(e,r){return new mp({check:"less_than",...Ae(r),value:e,inclusive:!0})}function Ip(e,r){return new gp({check:"greater_than",...Ae(r),value:e,inclusive:!1})}function Ac(e,r){return new gp({check:"greater_than",...Ae(r),value:e,inclusive:!0})}function Op(e,r){return new O_({check:"multiple_of",...Ae(r),value:e})}function jp(e,r){return new P_({check:"max_length",...Ae(r),maximum:e})}function Pi(e,r){return new R_({check:"min_length",...Ae(r),minimum:e})}function Pp(e,r){return new N_({check:"length_equals",...Ae(r),length:e})}function vC(e,r){return new $_({check:"string_format",format:"regex",...Ae(r),pattern:e})}function yC(e){return new L_({check:"string_format",format:"lowercase",...Ae(e)})}function bC(e){return new z_({check:"string_format",format:"uppercase",...Ae(e)})}function xC(e,r){return new B_({check:"string_format",format:"includes",...Ae(r),includes:e})}function wC(e,r){return new F_({check:"string_format",format:"starts_with",...Ae(r),prefix:e})}function _C(e,r){return new V_({check:"string_format",format:"ends_with",...Ae(r),suffix:e})}function $o(e){return new U_({check:"overwrite",tx:e})}function SC(e){return $o(r=>r.normalize(e))}function CC(){return $o(e=>e.trim())}function EC(){return $o(e=>e.toLowerCase())}function DC(){return $o(e=>e.toUpperCase())}function kC(e,r,t){return new e({type:"array",element:r,...Ae(t)})}function AC(e,r,t){return new e({type:"custom",check:"custom",fn:r,...Ae(t)})}function TC(e){const r=MC(t=>(t.addIssue=n=>{if(typeof n=="string")t.issues.push(No(n,t.value,r._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),t.issues.push(No(o))}},e(t.value,t)));return r}function MC(e,r){const t=new er({check:"custom",...Ae(r)});return t._zod.check=e,t}function Rp(e,r){try{var t=e()}catch(n){return r(n)}return t&&t.then?t.then(void 0,r):t}function IC(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,u=c&&c[n.code];t[i]=hc(i,r,t,o,u?[].concat(u,n.message):n.message)}e.shift()}return t}function OC(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,u=c&&c[n.code];t[i]=hc(i,r,t,o,u?[].concat(u,n.message):n.message)}e.shift()}return t}function jC(e,r,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(Rp(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(i){return s.shouldUseNativeValidation&&yc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:ep(IC(i.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,s){try{return Promise.resolve(Rp(function(){return Promise.resolve((t.mode==="sync"?qw:Zw)(e,n,r)).then(function(i){return s.shouldUseNativeValidation&&yc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof Cc})(i))return{values:{},errors:ep(OC(i.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const PC=Y("ZodISODateTime",(e,r)=>{nS.init(e,r),St.init(e,r)});function RC(e){return cC(PC,e)}const NC=Y("ZodISODate",(e,r)=>{oS.init(e,r),St.init(e,r)});function $C(e){return lC(NC,e)}const LC=Y("ZodISOTime",(e,r)=>{sS.init(e,r),St.init(e,r)});function zC(e){return uC(LC,e)}const BC=Y("ZodISODuration",(e,r)=>{iS.init(e,r),St.init(e,r)});function FC(e){return dC(BC,e)}const pr=Y("ZodError",(e,r)=>{Cc.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>Yw(e,t)},flatten:{value:t=>Hw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,bc,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,bc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),VC=Di(pr),UC=ki(pr),WC=Ai(pr),HC=Ti(pr),YC=Qw(pr),qC=Xw(pr),ZC=Jw(pr),GC=e_(pr),KC=t_(pr),QC=r_(pr),XC=n_(pr),JC=o_(pr),Rt=Y("ZodType",(e,r)=>(At.init(e,r),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.check=(...t)=>e.clone({...r,checks:[...r.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(t,n)=>en(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>VC(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>WC(e,t,n),e.parseAsync=async(t,n)=>UC(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>HC(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>YC(e,t,n),e.decode=(t,n)=>qC(e,t,n),e.encodeAsync=async(t,n)=>ZC(e,t,n),e.decodeAsync=async(t,n)=>GC(e,t,n),e.safeEncode=(t,n)=>KC(e,t,n),e.safeDecode=(t,n)=>QC(e,t,n),e.safeEncodeAsync=async(t,n)=>XC(e,t,n),e.safeDecodeAsync=async(t,n)=>JC(e,t,n),e.refine=(t,n)=>e.check(HE(t,n)),e.superRefine=t=>e.check(YE(t)),e.overwrite=t=>e.check($o(t)),e.optional=()=>Hp(e),e.nullable=()=>Yp(e),e.nullish=()=>Hp(Yp(e)),e.nonoptional=t=>LE(e,t),e.array=()=>Fp(e),e.or=t=>DE([e,t]),e.and=t=>AE(e,t),e.transform=t=>Zp(e,OE(t)),e.default=t=>RE(e,t),e.prefault=t=>$E(e,t),e.catch=t=>BE(e,t),e.pipe=t=>Zp(e,t),e.readonly=()=>UE(e),e.describe=t=>{const n=e.clone();return ji.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return ji.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return ji.get(e);const n=e.clone();return ji.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Np=Y("_ZodString",(e,r)=>{Ec.init(e,r),Rt.init(e,r);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(vC(...n)),e.includes=(...n)=>e.check(xC(...n)),e.startsWith=(...n)=>e.check(wC(...n)),e.endsWith=(...n)=>e.check(_C(...n)),e.min=(...n)=>e.check(Pi(...n)),e.max=(...n)=>e.check(jp(...n)),e.length=(...n)=>e.check(Pp(...n)),e.nonempty=(...n)=>e.check(Pi(1,...n)),e.lowercase=n=>e.check(yC(n)),e.uppercase=n=>e.check(bC(n)),e.trim=()=>e.check(CC()),e.normalize=(...n)=>e.check(SC(...n)),e.toLowerCase=()=>e.check(EC()),e.toUpperCase=()=>e.check(DC())}),eE=Y("ZodString",(e,r)=>{Ec.init(e,r),Np.init(e,r),e.email=t=>e.check(FS(tE,t)),e.url=t=>e.check(YS(rE,t)),e.jwt=t=>e.check(aC(vE,t)),e.emoji=t=>e.check(qS(nE,t)),e.guid=t=>e.check(Tp($p,t)),e.uuid=t=>e.check(VS(Ri,t)),e.uuidv4=t=>e.check(US(Ri,t)),e.uuidv6=t=>e.check(WS(Ri,t)),e.uuidv7=t=>e.check(HS(Ri,t)),e.nanoid=t=>e.check(ZS(oE,t)),e.guid=t=>e.check(Tp($p,t)),e.cuid=t=>e.check(GS(sE,t)),e.cuid2=t=>e.check(KS(iE,t)),e.ulid=t=>e.check(QS(aE,t)),e.base64=t=>e.check(oC(hE,t)),e.base64url=t=>e.check(sC(mE,t)),e.xid=t=>e.check(XS(cE,t)),e.ksuid=t=>e.check(JS(lE,t)),e.ipv4=t=>e.check(eC(uE,t)),e.ipv6=t=>e.check(tC(dE,t)),e.cidrv4=t=>e.check(rC(fE,t)),e.cidrv6=t=>e.check(nC(pE,t)),e.e164=t=>e.check(iC(gE,t)),e.datetime=t=>e.check(RC(t)),e.date=t=>e.check($C(t)),e.time=t=>e.check(zC(t)),e.duration=t=>e.check(FC(t))});function hr(e){return BS(eE,e)}const St=Y("ZodStringFormat",(e,r)=>{xt.init(e,r),Np.init(e,r)}),tE=Y("ZodEmail",(e,r)=>{Z_.init(e,r),St.init(e,r)}),$p=Y("ZodGUID",(e,r)=>{Y_.init(e,r),St.init(e,r)}),Ri=Y("ZodUUID",(e,r)=>{q_.init(e,r),St.init(e,r)}),rE=Y("ZodURL",(e,r)=>{G_.init(e,r),St.init(e,r)}),nE=Y("ZodEmoji",(e,r)=>{K_.init(e,r),St.init(e,r)}),oE=Y("ZodNanoID",(e,r)=>{Q_.init(e,r),St.init(e,r)}),sE=Y("ZodCUID",(e,r)=>{X_.init(e,r),St.init(e,r)}),iE=Y("ZodCUID2",(e,r)=>{J_.init(e,r),St.init(e,r)}),aE=Y("ZodULID",(e,r)=>{eS.init(e,r),St.init(e,r)}),cE=Y("ZodXID",(e,r)=>{tS.init(e,r),St.init(e,r)}),lE=Y("ZodKSUID",(e,r)=>{rS.init(e,r),St.init(e,r)}),uE=Y("ZodIPv4",(e,r)=>{aS.init(e,r),St.init(e,r)}),dE=Y("ZodIPv6",(e,r)=>{cS.init(e,r),St.init(e,r)}),fE=Y("ZodCIDRv4",(e,r)=>{lS.init(e,r),St.init(e,r)}),pE=Y("ZodCIDRv6",(e,r)=>{uS.init(e,r),St.init(e,r)}),hE=Y("ZodBase64",(e,r)=>{dS.init(e,r),St.init(e,r)}),mE=Y("ZodBase64URL",(e,r)=>{pS.init(e,r),St.init(e,r)}),gE=Y("ZodE164",(e,r)=>{hS.init(e,r),St.init(e,r)}),vE=Y("ZodJWT",(e,r)=>{gS.init(e,r),St.init(e,r)}),Lp=Y("ZodNumber",(e,r)=>{yp.init(e,r),Rt.init(e,r),e.gt=(n,o)=>e.check(Ip(n,o)),e.gte=(n,o)=>e.check(Ac(n,o)),e.min=(n,o)=>e.check(Ac(n,o)),e.lt=(n,o)=>e.check(Mp(n,o)),e.lte=(n,o)=>e.check(kc(n,o)),e.max=(n,o)=>e.check(kc(n,o)),e.int=n=>e.check(zp(n)),e.safe=n=>e.check(zp(n)),e.positive=n=>e.check(Ip(0,n)),e.nonnegative=n=>e.check(Ac(0,n)),e.negative=n=>e.check(Mp(0,n)),e.nonpositive=n=>e.check(kc(0,n)),e.multipleOf=(n,o)=>e.check(Op(n,o)),e.step=(n,o)=>e.check(Op(n,o)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null});function Ni(e){return fC(Lp,e)}const yE=Y("ZodNumberFormat",(e,r)=>{vS.init(e,r),Lp.init(e,r)});function zp(e){return pC(yE,e)}const bE=Y("ZodBoolean",(e,r)=>{yS.init(e,r),Rt.init(e,r)});function $i(e){return hC(bE,e)}const xE=Y("ZodUnknown",(e,r)=>{bS.init(e,r),Rt.init(e,r)});function Bp(){return mC(xE)}const wE=Y("ZodNever",(e,r)=>{xS.init(e,r),Rt.init(e,r)});function _E(e){return gC(wE,e)}const SE=Y("ZodArray",(e,r)=>{wS.init(e,r),Rt.init(e,r),e.element=r.element,e.min=(t,n)=>e.check(Pi(t,n)),e.nonempty=t=>e.check(Pi(1,t)),e.max=(t,n)=>e.check(jp(t,n)),e.length=(t,n)=>e.check(Pp(t,n)),e.unwrap=()=>e.element});function Fp(e,r){return kC(SE,e,r)}const CE=Y("ZodObject",(e,r)=>{SS.init(e,r),Rt.init(e,r),mt(e,"shape",()=>r.shape),e.keyof=()=>Up(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bp()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bp()}),e.strict=()=>e.clone({...e._zod.def,catchall:_E()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Bw(e,t),e.safeExtend=t=>Fw(e,t),e.merge=t=>Vw(e,t),e.pick=t=>Lw(e,t),e.omit=t=>zw(e,t),e.partial=(...t)=>Uw(Wp,e,t[0]),e.required=(...t)=>Ww(qp,e,t[0])});function Vp(e,r){const t={type:"object",get shape(){return Jr(this,"shape",e?jw(e):{}),this.shape},...Ae(r)};return new CE(t)}const EE=Y("ZodUnion",(e,r)=>{CS.init(e,r),Rt.init(e,r),e.options=r.options});function DE(e,r){return new EE({type:"union",options:e,...Ae(r)})}const kE=Y("ZodIntersection",(e,r)=>{ES.init(e,r),Rt.init(e,r)});function AE(e,r){return new kE({type:"intersection",left:e,right:r})}const Tc=Y("ZodEnum",(e,r)=>{DS.init(e,r),Rt.init(e,r),e.enum=r.entries,e.options=Object.values(r.entries);const t=new Set(Object.keys(r.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(t.has(i))s[i]=r.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Tc({...r,checks:[],...Ae(o),entries:s})},e.exclude=(n,o)=>{const s={...r.entries};for(const i of n)if(t.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Tc({...r,checks:[],...Ae(o),entries:s})}});function Up(e,r){const t=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Tc({type:"enum",entries:t,...Ae(r)})}const TE=Y("ZodLiteral",(e,r)=>{kS.init(e,r),Rt.init(e,r),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function ME(e,r){return new TE({type:"literal",values:Array.isArray(e)?e:[e],...Ae(r)})}const IE=Y("ZodTransform",(e,r)=>{AS.init(e,r),Rt.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new rp(e.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(No(s,t.value,r));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),t.issues.push(No(i))}};const o=r.transform(t.value,t);return o instanceof Promise?o.then(s=>(t.value=s,t)):(t.value=o,t)}});function OE(e){return new IE({type:"transform",transform:e})}const Wp=Y("ZodOptional",(e,r)=>{TS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function Hp(e){return new Wp({type:"optional",innerType:e})}const jE=Y("ZodNullable",(e,r)=>{MS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function Yp(e){return new jE({type:"nullable",innerType:e})}const PE=Y("ZodDefault",(e,r)=>{IS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function RE(e,r){return new PE({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():ap(r)}})}const NE=Y("ZodPrefault",(e,r)=>{OS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function $E(e,r){return new NE({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():ap(r)}})}const qp=Y("ZodNonOptional",(e,r)=>{jS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function LE(e,r){return new qp({type:"nonoptional",innerType:e,...Ae(r)})}const zE=Y("ZodCatch",(e,r)=>{PS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function BE(e,r){return new zE({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}const FE=Y("ZodPipe",(e,r)=>{RS.init(e,r),Rt.init(e,r),e.in=r.in,e.out=r.out});function Zp(e,r){return new FE({type:"pipe",in:e,out:r})}const VE=Y("ZodReadonly",(e,r)=>{NS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function UE(e){return new VE({type:"readonly",innerType:e})}const WE=Y("ZodCustom",(e,r)=>{$S.init(e,r),Rt.init(e,r)});function HE(e,r={}){return AC(WE,e,r)}function YE(e){return TC(e)}const Gp=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,Kp=(e,r)=>{if(!e||!r)return null;const t=e.split("-");if(t.length!==3)return null;const n=parseInt(t[0],10),o=parseInt(t[1],10)-1,s=parseInt(t[2],10),i=r.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),u=new Date(n,o,s,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},qE=Vp({UsuarioID:Ni().nullable().optional(),disID:Ni().nullable().optional(),EsOrganizador:$i().default(!1),Correo:hr().email("Formato de correo inválido"),StatusInvitacion:Up(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),ZE=Vp({titulo:hr().min(1,"El campo Título es requerido.").refine(e=>!e.startsWith(" "),{message:"El título no puede empezar con un espacio en blanco"}),fechaInicio:hr().min(1,"El campo fecha inicio es requerido."),horaInicio:hr().min(1,"La hora de inicio es requerida.").regex(Gp,{message:"Formato inválido"}),horaFin:hr().min(1,"La hora fin es requerida.").regex(Gp,{message:"Formato inválido"}),todoElDia:$i(),fechaFin:hr().optional(),showEndDate:$i().optional(),horaInicio2:hr().optional(),TodoElDia2:$i().optional(),client:hr().nullable().optional(),repetir:hr().optional(),link:hr().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(ME("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:hr().optional(),invitados:Fp(qE).optional().default([]),color:hr().optional(),solID:Ni().nullable().optional(),disID:Ni().nullable().optional()}).refine(e=>e.showEndDate?e.fechaFin&&e.fechaFin.length>0:!0,{message:"La fecha de fin es requerida.",path:["fechaFin"]}).refine(e=>e.fechaFin!==void 0?!!e.fechaFin&&!!e.horaInicio2:!0,{message:"La hora de fin son requeridas.",path:["horaInicio2"]}).refine(e=>{if(e.todoElDia||!e.fechaInicio||!e.horaInicio||!e.fechaFin||!e.horaInicio2)return!0;const r=Kp(e.fechaInicio,e.horaInicio),t=Kp(e.fechaFin,e.horaFin);return!r||!t||!x.isValid(r)||!x.isValid(t)?!0:!(x.isBefore(t,r)&&!x.isSameDay(t,r)||x.isSameDay(r,t)&&x.isBefore(t,r))},{message:"",path:["horaFin"]}),Qp=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("path",{fill:"#333",d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12"}),G.createElement("path",{fill:"#fff",d:"M16.703 7.275c.52.52.541 1.345.046 1.84l-2.874 2.874 2.874 2.873c.495.496.475 1.32-.046 1.841-.52.52-1.344.54-1.84.045l-2.873-2.873-2.874 2.873c-.496.496-1.32.475-1.84-.045-.521-.521-.541-1.345-.046-1.84l2.874-2.874L7.23 9.116c-.495-.496-.475-1.32.045-1.84.521-.521 1.345-.542 1.841-.046l2.874 2.873 2.873-2.873c.496-.496 1.32-.476 1.84.045"})),GE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M7.288%2022.986h-.147a6.2%206.2%200%200%201-4.28-1.85c-2.404-2.404-2.478-6.24-.16-8.557L4.28%2011a1.228%201.228%200%201%201%201.739%201.739L4.44%2014.317c-1.356%201.357-1.282%203.626.16%205.068a3.82%203.82%200%200%200%202.602%201.135c.95%200%201.825-.32%202.479-.974l1.578-1.579a1.23%201.23%200%200%201%201.739%200c.48.481.48%201.258%200%201.739l-1.579%201.578c-1.097%201.098-2.552%201.69-4.13%201.69zM17.98%2012.998a1.23%201.23%200%200%201%200-1.739l1.578-1.578c.654-.654.986-1.53.974-2.466a3.78%203.78%200%200%200-1.134-2.602c-1.443-1.443-3.712-1.517-5.068-.16L12.75%206.03c-.48.48-1.258.48-1.739%200a1.23%201.23%200%200%201%200-1.739l1.579-1.578c2.318-2.319%206.153-2.245%208.558.16a6.23%206.23%200%200%201%201.85%204.279%205.84%205.84%200%200%201-1.69%204.279l-1.578%201.578c-.481.481-1.258.481-1.74%200z'/%3e%3cpath%20d='M14.172%208.11%208.07%2014.214a1.233%201.233%200%200%200%201.743%201.744l6.104-6.104a1.233%201.233%200%201%200-1.744-1.744'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",KE=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("g",{clipPath:"url(#a)"},G.createElement("path",{fill:"#404756",d:"M21.24 5.72a2.98 2.98 0 0 0-2.97-2.96l-5.19-.06c-1.06-.03-2.12.41-2.87 1.17l-7.49 7.49c-.66.66-1.03 1.54-1.03 2.47s.36 1.81 1.03 2.47l4.97 4.97a3.5 3.5 0 0 0 2.47 1.02c.89 0 1.79-.34 2.47-1.02l7.49-7.49c.76-.76 1.18-1.81 1.17-2.88l-.06-5.19zm-4.2 4.43c-.44.44-1.02.66-1.6.66a2.256 2.256 0 1 1 0-4.51 2.256 2.256 0 0 1 1.6 3.85"})),G.createElement("defs",null,G.createElement("clipPath",{id:"a"},G.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Xp="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",QE=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},G.createElement("path",{d:"M13.085 7.331a1.096 1.096 0 1 0-2.192 0v9.316a1.096 1.096 0 0 0 2.192 0z"}),G.createElement("path",{d:"M16.647 10.893H7.33a1.096 1.096 0 1 0 0 2.192h9.316a1.096 1.096 0 0 0 0-2.192"}),G.createElement("path",{d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12m0-21.808c-5.414 0-9.808 4.394-9.808 9.808S6.586 21.808 12 21.808s9.808-4.394 9.808-9.808S17.403 2.192 12 2.192"})),G.createElement("defs",null,G.createElement("clipPath",{id:"a"},G.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),XE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M13.789%2017H3.21C2.542%2017%202%2017.56%202%2018.25s.542%201.25%201.211%201.25H13.79c.669%200%201.211-.56%201.211-1.25S14.458%2017%2013.789%2017M20.718%204H3.282C2.574%204%202%204.56%202%205.25S2.574%206.5%203.282%206.5h17.436C21.426%206.5%2022%205.94%2022%205.25S21.426%204%2020.718%204M20.718%2010.5H3.282C2.574%2010.5%202%2011.06%202%2011.75S2.574%2013%203.282%2013h17.436c.708%200%201.282-.56%201.282-1.25s-.574-1.25-1.282-1.25'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",JE=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("path",{fill:"#2571D6",fillRule:"evenodd",d:"M17.333 11a6.34 6.34 0 0 1 6.334 6.333 6.34 6.34 0 0 1-6.334 6.334c-3.493 0-6.333-2.846-6.333-6.334A6.343 6.343 0 0 1 17.333 11m-.005 2.37c-.437 0-.79.338-.79.754v2.412h-2.414c-.416 0-.754.355-.754.792s.338.792.754.792h2.413v2.412c0 .416.354.754.791.754s.792-.338.792-.754V18.12h2.413c.416 0 .754-.355.754-.792s-.338-.792-.754-.792H18.12v-2.412c0-.416-.355-.754-.792-.754",clipRule:"evenodd"}),G.createElement("path",{fill:"#2571D6",d:"M11.12 12.297a7.97 7.97 0 0 0-1.787 5.036c0 1.763.571 3.392 1.537 4.714H3.044c-.84 0-1.523-.682-1.523-1.523 0-4.544 3.683-8.227 8.217-8.227zM10.995.139c2.925 0 5.3 2.376 5.3 5.3s-2.376 5.3-5.3 5.3v-.01a5.303 5.303 0 0 1-5.3-5.3 5.295 5.295 0 0 1 5.3-5.29"}));var Lo={},Jp;function eD(){if(Jp)return Lo;Jp=1;var e=ct();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var r=e(ht()),t=dt();return Lo.default=(0,r.default)((0,t.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Lo}var tD=eD();const eh=at(tD);var zo={},th;function rD(){if(th)return zo;th=1;var e=ct();Object.defineProperty(zo,"__esModule",{value:!0}),zo.default=void 0;var r=e(ht()),t=dt();return zo.default=(0,r.default)((0,t.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),zo}var nD=rD();const oD=at(nD),rh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",nh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",sD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",iD=e=>{const r=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],t=e.charCodeAt(0)%r.length;return r[t]},aD=(e,r,t,n,o)=>{if(r)return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[l.jsx("img",{src:nh,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return l.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return l.jsx(m.Button,{onClick:()=>{n(t),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"});case"CONFIRMADA":return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[l.jsx("img",{src:sD,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function cD({open:e,handleClose:r,guests:t,onReenviar:n}){const o=t.filter(u=>u.estatus==="CONFIRMADA"||u.isHost),s=t.filter(u=>u.estatus==="PENDIENTE"&&!u.isHost),i=t.filter(u=>u.estatus==="RECHAZADA"&&!u.isHost),a=u=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[l.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[l.jsx(m.Avatar,{sx:{bgcolor:iD(u.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:u.iniciales}),u.estatus==="PENDIENTE"&&l.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:l.jsx(ic,{sx:{fontSize:14,color:"#546E7A"}})})]}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:u.nombre}),aD(u.estatus,u.isHost,u.usrID,n,r)]},u.nombre),c=({title:u,count:d,badgeColor:f})=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:u}),f&&l.jsx(m.Box,{sx:{ml:1,bgcolor:f,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:d})]});return l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[l.jsxs(m.Box,{sx:{p:"16px 8px"},children:[l.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),l.jsx(m.Button,{onClick:r,startIcon:l.jsx("img",{src:rh,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),l.jsx(m.IconButton,{onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Rr,{})})]}),l.jsx(m.Divider,{sx:{backgroundColor:"black"}}),l.jsxs(m.DialogContent,{sx:{p:2},children:[s.length>0&&l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(c,{title:"Invitados",count:s.length}),s.map(a)]}),o.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(c,{title:"Confirmados",count:o.length,badgeColor:"#1976D2"}),o.map(a)]})]}),i.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{children:[l.jsx(c,{title:"No asistirán",count:i.length,badgeColor:"#1976D2"}),i.map(a)]})]})]})]})}const lD=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function uD({guests:e,onReenviar:r}){const[t,n]=v.useState(!1),o=()=>n(!0),s=()=>n(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[l.jsx(m.AvatarGroup,{max:6,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((i,a)=>l.jsx(m.Tooltip,{title:i.nombre,arrow:!0,placement:"top",children:l.jsx(m.Box,{children:l.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:i.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:l.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:l.jsx("img",{src:Sf})}),children:l.jsx(m.Avatar,{sx:{bgcolor:lD(i.iniciales)},children:i.iniciales})})})},a))}),l.jsx(m.Box,{sx:{flexGrow:1}}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:o,children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),l.jsx(oD,{sx:{fontSize:18,ml:.5}})]})]}),l.jsx(cD,{open:t,handleClose:s,guests:e,onReenviar:r})]})}var Bo={},oh;function dD(){if(oh)return Bo;oh=1;var e=ct();Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.default=void 0;var r=e(ht()),t=dt();return Bo.default=(0,r.default)((0,t.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),Bo}var fD=dD();const pD=at(fD),hD=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),sh=e=>{const[r,t]=e.split(":"),n=parseInt(r),o=n>=12?"pm":"am";return`${n%12||12}:${t} ${o}`},ih=e=>e.split(":").slice(0,2).join(":"),mD=({slot:e,onClick:r})=>l.jsxs(m.Box,{onClick:r,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[l.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:hD(e.Fecha)})}),l.jsxs(m.Box,{sx:{py:1.5},children:[l.jsx(m.Typography,{sx:{fontSize:"12px"},children:sh(e.HoraInicio)}),l.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",sh(e.HoraFin)]})]})]});function gD({open:e,handleClose:r,suggestions:t,onSelectSlot:n}){const[o,s]=v.useState(16),a=t.slice(0,o).reduce((d,f)=>{const h=f.Fecha;return d[h]||(d[h]=[]),d[h].push(f),d},{}),c=Object.keys(a),u=d=>{const f={...d,HoraInicio:ih(d.HoraInicio),HoraFin:ih(d.HoraFin)};n(f),r()};return v.useEffect(()=>{s(16)},[e]),l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[l.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),l.jsx(m.Box,{children:l.jsx(m.Button,{startIcon:l.jsx("img",{src:rh,width:20}),onClick:r,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),l.jsx(m.Divider,{}),l.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?l.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):l.jsxs(l.Fragment,{children:[c.map((d,f)=>l.jsxs(m.Box,{sx:{mb:3},children:[l.jsxs(m.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:f===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[f===0?"Mismo día ":"Próximas fechas",f===0&&l.jsx("img",{src:nh,width:15,style:{marginLeft:5}})]}),l.jsx(m.Grid,{container:!0,spacing:2,children:a[d].map((h,y)=>l.jsx(m.Grid,{item:!0,xs:6,sm:3,children:l.jsx(mD,{slot:h,onClick:()=>u(h)})},`${d}-${y}`))})]},d)),t.length>o&&l.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:l.jsx(m.Button,{onClick:()=>s(d=>d+12),startIcon:l.jsx(pD,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const vD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",yD=e=>{const r=["brown","purple","orange","blue","green","yellow","red","grey"],t=e.charCodeAt(0)%r.length;return r[t]};function bD({onSelectGuest:e,availableSuggestions:r,onInputTextChange:t}){const[n,o]=v.useState(null),[s,i]=v.useState(""),a=(u,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(u,d)=>{i(d),t(d)};return l.jsx(m.Autocomplete,{options:r,value:n,inputValue:s,getOptionLabel:u=>u.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(u,d)=>u.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:u=>l.jsx(m.TextField,{...u,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...u.InputProps,startAdornment:l.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:l.jsx("img",{src:vD,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(u,d)=>v.createElement(m.Box,{component:"li",...u,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},l.jsx(m.Avatar,{sx:{bgcolor:yD(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),l.jsx(m.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var Fo={},ah;function xD(){if(ah)return Fo;ah=1;var e=ct();Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.default=void 0;var r=e(ht()),t=dt();return Fo.default=(0,r.default)((0,t.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),Fo}var wD=xD();const _D=at(wD);var Vo={},ch;function SD(){if(ch)return Vo;ch=1;var e=ct();Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.default=void 0;var r=e(ht()),t=dt();return Vo.default=(0,r.default)((0,t.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),Vo}var CD=SD();const Mc=at(CD),ED=e=>e.tieneConflicto?{icon:l.jsx(Mc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:l.jsx(_D,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},DD=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function kD({guests:e,conflictCount:r,onViewSuggestions:t,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return l.jsxs(m.Box,{sx:{p:1},children:[l.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=ED(i),u=DD(i.iniciales);return l.jsx(m.Chip,{label:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[l.jsx(m.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)}),l.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:l.jsx(m.Avatar,{sx:{bgcolor:u,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:i.iniciales}),sx:{backgroundColor:c.fillColor,height:"32px",borderRadius:"100px",border:"1px solid rgba(0,0,0,0.04)",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{backgroundColor:c.fillColor,filter:"brightness(0.97)","& .status-icon-wrapper":{display:"none"},"& .MuiChip-deleteIcon":{display:"inline-block"}},"& .MuiChip-label":{paddingLeft:"4px",paddingRight:"8px",width:"100%",display:"flex"},"& .MuiChip-deleteIcon":{display:"none",fontSize:"18px",color:"#000000",ml:"auto",mr:"4px","&:hover":{color:"#000000"}}},onClick:()=>console.log(`Ver perfil de ${i.nombre}`),onDelete:o(i.nombre)},a)})}),r>0&&l.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[l.jsx(Mc,{sx:{mr:1,fontSize:22}}),l.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",l.jsxs("strong",{children:[r," invitado"]}),r!==1?"s":""]})]}),l.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),t()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function AD(e,r){const[t,n]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{n(e)},r);return()=>{clearTimeout(o)}},[e,r]),t}const TD={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:{xs:"90%",sm:450,md:500},bgcolor:"background.paper",boxShadow:24,p:{xs:2,sm:3},borderRadius:2,maxHeight:"90vh",overflowY:"auto"},lh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],MD=()=>{const e=[];for(let r=0;r<24;r++)for(let t=0;t<60;t+=15){const n=r.toString().padStart(2,"0"),o=t.toString().padStart(2,"0");e.push(`${n}:${o}`)}return e},uh=[],Vn=MD(),Uo=(e,r)=>{if(!e||!r)return null;const t=e.split("-");if(t.length!==3)return null;const n=parseInt(t[0],10),o=parseInt(t[1],10)-1,s=parseInt(t[2],10),i=r.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),u=new Date(s,o,n,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},ID=({isVisible:e,onClose:r,onSave:t,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c,onReenviar:u})=>{const[d,f]=v.useState(!1),[h,y]=v.useState(!1),g=x.format(new Date,"yyyy-MM-dd"),[p,b]=v.useState(""),[_,S]=v.useState([]),[D,C]=v.useState(!1),w=sc(),[F,E]=v.useState([]),[T,I]=v.useState(""),[M,U]=v.useState(uh),[q,V]=v.useState(!1),[H,re]=v.useState(""),[W,$]=v.useState(!1),[ie,ue]=v.useState([]),[N,ee]=v.useState([]),xe=AD(H,300),_e=M.filter(Z=>Z.tieneConflicto).length,{control:fe,handleSubmit:ae,reset:le,formState:{errors:X,isValid:we},watch:ye,setValue:K}=Xf({resolver:jC(ZE),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"HH:mm"),horaFin:x.format(x.addHours(new Date,1),"HH:mm"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[]},mode:"onChange"}),Ie=ye("fechaInicio"),P=ye("fechaFin"),Be=ye("todoElDia");v.useEffect(()=>{if(p.trim()===""||!i||!c||!a){S([]),E([]),K("solID",null),C(!1),I("");return}C(!0);const Z=setTimeout(()=>{w.getClients(p,c,a,i).then(de=>{if(C(!1),de){const Me=de.map(Pe=>Pe.solID);E([...new Set(Me)])}else E([]);const De=Array.from(new Map(de.map(Me=>[Me.nombreCliente,Me])).values());if(De.length>0)S(De),I("");else if(s?.client&&s.solID!==null){const Me=[{solID:s.solID,nombreCliente:s.client}];S(Me),I("Sin resultados")}else S([]),I("Sin resultados")}).catch(de=>{console.error("Error al buscar clientes:",de),C(!1)})},500);return()=>clearTimeout(Z)},[p,i,c,a]),v.useEffect(()=>{if(Ie&&P){const Z=new Date(Ie),de=new Date(P);(Z===de||Z>de)&&K("fechaFin",Ie)}},[Ie,P,K]),v.useEffect(()=>{Ie&&K("fechaFin",Ie)},[Ie]),v.useEffect(()=>{K("showEndDate",d)},[d,K]),v.useEffect(()=>{if(console.log("initialEvent",s),s){const Z=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(f(!Z),K("titulo",s?.titulo),K("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),K("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),K("horaInicio",x.format(s.fechaInicio,"HH:mm")),K("horaFin",x.format(s.fechaFin,"HH:mm")),K("horaInicio2",x.format(s.fechaFin,"HH:mm")),K("descripcion",s.descripcion),K("link",s.link),K("repetir","false"),K("color",s.color),K("todoElDia",s.todoElDia),K("solID",s.solID),K("client",s.client),s.invitados&&s.invitados.length>0){const de=(s?.invitados||[]).map(Pe=>{const Nt=Pe.usrNombre?.trim()||"",Q=Nt.split(/\s+/),ke=Q.length>1?(Q[0][0]+Q[1][0]).toUpperCase():Nt.substring(0,2).toUpperCase();return{nombre:Pe.usrNombre||"Sin nombre",correo:Pe.correo||"",iniciales:ke||"--",usrID:Pe.usuarioID??null,isHost:Pe.esOrganizador||!1,estatus:Pe.statusInvitacion,tieneConflicto:!1,disID:Pe.disID}}),De=localStorage.getItem("nombreAnfitrion")||"Anfitrión",Me={nombre:De,correo:"",iniciales:De.substring(0,2).toUpperCase(),usrID:i??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};U([Me,...de])}else U(uh);s.solID?y(!0):y(!1)}else{const Z=o||new Date,de=new Date,De=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate(),de.getHours(),de.getMinutes()),Me=x.addHours(De,1);le({titulo:"",fechaInicio:x.format(De,"yyyy-MM-dd"),horaInicio:x.format(De,"HH:mm"),fechaFin:x.format(Me,"yyyy-MM-dd"),horaFin:x.format(Me,"HH:mm"),horaInicio2:x.format(Me,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:lh[0],solID:null}),f(!1),y(!1)}},[s,e,o]);const Qe=Z=>({UsuarioID:Z.usrID??null,Correo:Z.correo,EsOrganizador:Z.usrID==i,StatusInvitacion:Z.estatus,disID:c??null}),Fe=ae(Z=>{const de=M.map(Me=>Qe(Me)),De={...Z,invitados:de};t(De,s?.eventoID),r(),le(),f(!1)},Z=>{console.log("Errores de validación:",Z)});v.useEffect(()=>{Be&&(K("horaInicio","00:00"),K("horaFin","23:59"))},[Be,K,ye]);const Le=()=>{const Z=ye("fechaInicio");if(Z){const de=new Date(`${Z}T00:00:00`),De=x.addDays(de,1);K("fechaFin",x.format(De,"yyyy-MM-dd"))}f(!0)},We=ye("fechaInicio"),Xe=ye("horaInicio"),ft=ye("fechaFin"),k=ye("horaFin"),[O,B]=v.useState(null),[ce,se]=v.useState(null);v.useEffect(()=>{(O===null||O!==Xe)&&B(Xe)},[Xe,O]),v.useEffect(()=>{(ce===null||ce!==k)&&se(k??"")},[k,ce]);const j=ye("todoElDia");v.useEffect(()=>{if(j||!Xe||!k||!We||!ft)return;const Z=Uo(We,Xe),de=Uo(ft,k);if(!Z||!de||!x.isValid(Z)||!x.isValid(de))return;const De=x.isSameDay(Z,de),Me=De&&(x.isAfter(Z,de)||Z.getTime()===de.getTime()),Pe=x.isBefore(de,Z)&&!De;(Me||Pe)&&(K("horaFin",""),se(""))},[Xe,We]);const oe=v.useMemo(()=>{if(!Xe||!We)return Vn;const Z=Uo(We,Xe),de=Uo(ft,"00:00");return!Z||!de||!x.isValid(Z)||!x.isValid(de)||x.isBefore(de,Z)&&!x.isSameDay(de,Z)?Vn:x.isSameDay(Z,de)?Vn.filter(De=>{const Me=Uo(ft,De);return Me&&x.isAfter(Me,Z)}):(x.isAfter(de,Z),Vn)},[Xe,We,ft]),Se=v.useMemo(()=>Vn,[]),je=async Z=>{const de=M.some($t=>$t.correo===Z.correo);if($(!0),de)return;const De=c,Me=Z.correo,Pe=Z.usrID,Nt=We,Q=Xe,ke=k;if(!De||!Me||!Nt||!Q||!ke){U($t=>[...$t,{...Z,status:"pending",isHost:!1,hasConflict:!1,usrID:Pe,name:Z.nombre}]);return}let Ee;try{Ee=await w.VerificarConflicto(De,Me,Nt,Q+":00",ke+":00")}catch{Ee={tieneConflicto:!1,usrMail:Z.correo}}const Re=Array.isArray(Ee)?Ee[0]:Ee,Sr={...Z,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(Re.tieneConflicto).toLowerCase()==="true"};if(Sr.tieneConflicto){const $t=await w.getDisponibilidadUsuario(c,Me,Nt,"60");ue($t)}U($t=>[...$t,Sr])},R=Z=>{U(de=>de.filter(De=>De.nombre!==Z))},te=()=>{V(!1)},be=Z=>{const Me=(Z.usrNombre??"").split(" ").map(Pe=>Pe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:Z.usrNombre??"",correo:Z.usrMail??"",iniciales:Me,usrID:Z.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};v.useEffect(()=>{xe.length>2&&c?(async()=>{const De=(await w.getUsuariosInvitados(c,xe)).map(be).filter(Me=>Me.usrID!==i&&!M.some(Pe=>Pe.correo===Me.correo));ee(De)})():ee([])},[xe,M]);const qe=Z=>{re(Z)},Ct=Z=>{const{Fecha:de,HoraInicio:De,HoraFin:Me}=Z,Pe=Nt=>Nt.split(":").slice(0,2).join(":");K("fechaInicio",de),K("fechaFin",de),K("horaInicio",Pe(De)),K("horaFin",Pe(Me)),f(!1),te(),console.log("Formulario actualizado con sugerencia:",{Fecha:de,HoraInicio:De,HoraFin:Me})};return l.jsx(l.Fragment,{children:l.jsx(m.Modal,{open:e,onClose:r,children:l.jsx("form",{onSubmit:Fe,children:l.jsxs(m.Box,{sx:TD,children:[l.jsx(m.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Rr,{})}),l.jsx(m.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent||!s?.esOrganizador?l.jsx(l.Fragment,{children:s?.titulo||"Evento de Google"}):s?"Editar evento":"Agregar evento"}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(ir,{name:"titulo",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!X.titulo,helperText:X.titulo?.message,inputProps:{maxLength:100},sx:{"& .MuiInputLabel-root.Mui-focused":{color:"black"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"black"},"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}})})})}),l.jsxs("div",{className:`row g-2 ${d?"mb-1":"mb-2"}`,children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(ir,{name:"fechaInicio",control:fe,render:({field:Z})=>l.jsx(m.TextField,{fullWidth:!0,...Z,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!X.fechaInicio,helperText:X.fechaInicio?.message})})}),d?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-10 col-md-4",children:l.jsx(ir,{name:"fechaFin",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Ie||g},error:!!X.fechaFin,helperText:X.fechaFin?.message})})}),!s&&l.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:l.jsx(m.IconButton,{onClick:()=>f(!1),sx:{fontSize:18},children:l.jsx(Qp,{})})})]}):l.jsx("div",{className:"col-md-8"})]}),d&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12 d-flex justify-content-center",children:l.jsx(eh,{sx:{color:"#757575",my:1}})})}),l.jsxs("div",{className:"row g-2 mb-2",children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(ir,{name:"horaInicio",control:fe,render:({field:{onChange:Z,value:de,...De}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:Se,value:de||"",onChange:(Me,Pe)=>Z(Pe||""),onInputChange:(Me,Pe)=>Z(Pe),renderInput:Me=>l.jsx(m.TextField,{...Me,...De,size:"small",error:!!X.horaInicio,helperText:X.horaInicio?.message,InputProps:{...Me.InputProps,endAdornment:l.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(ic,{})})}}),disabled:j})})}),!d&&l.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:X.horaInicio?"5px":"0px"},children:l.jsx(eh,{sx:{color:"#757575"}})}),d&&l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(ir,{name:"horaFin",control:fe,render:({field:{onChange:Z,value:de,...De}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:oe,value:de||"",onChange:(Me,Pe)=>Z(Pe||""),onInputChange:(Me,Pe)=>Z(Pe),renderInput:Me=>l.jsx(m.TextField,{...Me,...De,size:"small",error:!!X.horaFin,helperText:X.horaFin?.message,InputProps:{...Me.InputProps,endAdornment:l.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(ic,{})})}}),disabled:j})})}),!d&&l.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:l.jsx(ir,{name:"todoElDia",control:fe,render:({field:Z})=>l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:Z.value,onChange:de=>Z.onChange(de.target.checked)}),label:l.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!d&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Button,{onClick:Le,size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(QE,{})," Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&l.jsx("div",{className:"row mb-2",children:l.jsxs("div",{className:"col-12",children:[!h&&l.jsxs(m.Button,{onClick:()=>y(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(JE,{})," Vincular cliente"]}),h&&l.jsxs("div",{className:"row g-2",children:[l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(ir,{name:"client",control:fe,render:({field:Z})=>l.jsx(m.Autocomplete,{options:_,loading:D,loadingText:"Buscando coincidencias...",getOptionLabel:de=>de.nombreCliente?.trim()||"",value:_.find(de=>de.nombreCliente===Z.value)||(Z.value&&typeof Z.value=="string"?{solID:-1,nombreCliente:Z.value}:null),noOptionsText:T,onInputChange:(de,De)=>{b(De)},onChange:(de,De)=>{Z.onChange(De?De.nombreCliente:"")},renderInput:de=>l.jsx(m.TextField,{...de,placeholder:"Buscar cliente...",size:"small",InputProps:{...de.InputProps,startAdornment:l.jsx("img",{src:Md,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:l.jsxs(l.Fragment,{children:[D?l.jsx(m.CircularProgress,{color:"inherit",size:20}):null,de.InputProps.endAdornment]})}})})})}),l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(ir,{name:"solID",control:fe,render:({field:Z})=>l.jsx(m.Autocomplete,{options:F,noOptionsText:"Sin resultados",getOptionLabel:de=>de.toString(),value:Z.value??null,onChange:(de,De)=>Z.onChange(De),renderInput:de=>l.jsx(m.TextField,{...de,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!_.length})})}),l.jsx("div",{className:"col-2 d-flex align-items-center",children:l.jsx(m.IconButton,{onClick:()=>y(!1),sx:{fontSize:18},children:l.jsx(Qp,{})})})]})]})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(ir,{name:"link",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!X.link,helperText:X.link?.message,InputProps:{startAdornment:l.jsx("img",{src:GE,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(ir,{name:"descripcion",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:l.jsx("img",{src:XE,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(bD,{onSelectGuest:je,availableSuggestions:N,onInputTextChange:qe})})}),W&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(kD,{guests:M,conflictCount:_e,onViewSuggestions:()=>V(!0),onDeleteGuest:R})})}),s?.invitados&&s?.invitados?.length>0&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(m.Box,{children:l.jsx(uD,{guests:M,onReenviar:u})})})}),l.jsx(gD,{open:q,handleClose:te,suggestions:ie,onSelectSlot:Ct}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[l.jsx(KE,{}),lh.map(Z=>l.jsx(ir,{name:"color",control:fe,render:({field:de})=>l.jsx(m.IconButton,{onClick:()=>de.onChange(Z),sx:{width:24,height:24,borderRadius:"50%",bgcolor:Z,border:de.value===Z?"2px solid":"none",borderColor:de.value===Z?"primary.main":"transparent"}})},Z))]})})}),l.jsx("div",{className:"row",children:l.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&l.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:l.jsx("img",{src:Xp,width:15}),hidden:s?s?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),l.jsx(m.Button,{onClick:r,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),l.jsx(m.Button,{onClick:Fe,variant:"contained",disabled:!we,hidden:s?s?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]})})})})},OD={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:450,bgcolor:"background.paper",boxShadow:24,p:2,borderRadius:2,maxHeight:"80vh",overflowY:"auto"},jD=({isOpen:e,onClose:r,events:t,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),r()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return l.jsx(m.Modal,{open:e,onClose:r,children:l.jsxs(m.Box,{sx:OD,children:[l.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[l.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Rr,{})})]}),l.jsx(m.Divider,{}),l.jsx(m.List,{sx:{mt:1},children:t.map(a=>{const c=i(a);return l.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:l.jsx(m.ListItemButton,{onClick:()=>s(a),sx:{py:1,borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.02)",borderLeft:`5px solid ${c?.borderColor}`,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:l.jsxs(m.Box,{sx:{flexGrow:1},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[l.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),l.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),l.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"hh:mm aa").toLowerCase()} - ${x.format(a.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},a.eventoID)})})]})})};var Wo={},dh;function PD(){if(dh)return Wo;dh=1;var e=ct();Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0;var r=e(ht()),t=dt();return Wo.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),Wo}var RD=PD();const ND=at(RD);var Ho={},fh;function $D(){if(fh)return Ho;fh=1;var e=ct();Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var r=e(ht()),t=dt();return Ho.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),Ho}var LD=$D();const zD=at(LD),BD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M19.378%204.405a1.813%201.813%200%201%201%202.565%202.565L9.571%2019.342a1.813%201.813%200%200%201-2.565%200l-4.949-4.949a1.814%201.814%200%200%201%202.428-2.69l.137.126%203.666%203.666z'/%3e%3c/svg%3e",FD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",Ic=v.forwardRef(({id:e,message:r,variant:t},n)=>{const{closeSnackbar:o}=ss.useSnackbar(),s={success:{color:"#fff",icon:l.jsx("img",{width:25,src:BD,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:l.jsx(ND,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:l.jsx(zD,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:l.jsx("img",{src:Xp,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:l.jsx("img",{src:FD,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[t]||s.info;return l.jsx(ss.SnackbarContent,{ref:n,children:l.jsxs(m.Box,{sx:{backgroundColor:"white",color:"#333",padding:"8px 16px",borderRadius:"8px",boxShadow:"0 3px 10px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",width:{xs:"90%",sm:"auto"},minWidth:"300px",borderLeft:`5px solid ${i.color}`},children:[l.jsx(m.Box,{sx:{mr:1.5},children:i.icon}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:r}),l.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:l.jsx(Rr,{fontSize:"small"})})]})})}),ph=v.createContext(void 0),VD=({children:e})=>{const[r,t]=v.useState([]),[n,o]=v.useState([]),[s,i]=v.useState(!1);return l.jsx(ph.Provider,{value:{googleEvents:r,setGoogleEvents:t,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},UD=()=>{const e=v.useContext(ph);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},WD=(e,r,t)=>{const n=(i,a)=>a?new Date(a):i?new Date(i.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let s=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&s.setDate(s.getDate()-1),{eventoID:Math.abs(HD(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:s,todoElDia:!!(e.start.date&&!e.start.dateTime),color:"#4285F4C",hasVideoCall:!!e.conferenceData,link:e.htmlLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!0}};function HD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}function YD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}const qD=(e,r,t)=>{const n=new Date(e.start.dateTime);let o=new Date(e.end.dateTime);return e.isAllDay&&o.setDate(o.getDate()-1),{eventoID:Math.abs(YD(e.id)),titulo:e?.summary||"(Sin título)",descripcion:e.body?.content||"",fechaInicio:n,fechaFin:o,todoElDia:e.isAllDay,color:"#0078D4",hasVideoCall:!!e.onlineMeetingUrl,link:e.webLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},hh="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='49'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M34.559%2048.077c-7.413%200-13.44-6.039-13.44-13.44s6.027-13.44%2013.44-13.44%2013.44%206.027%2013.44%2013.44c0%207.414-6.027%2013.44-13.44%2013.44'/%3e%3cpath%20fill='%23fff'%20d='M39.827%2029.346c.583.583.605%201.505.05%202.06l-3.218%203.219%203.219%203.218c.555.556.532%201.48-.051%202.062-.584.583-1.506.605-2.062.05l-3.218-3.218-3.218%203.218c-.556.555-1.478.533-2.061-.05s-.606-1.506-.05-2.062l3.217-3.218-3.218-3.218c-.555-.555-.533-1.478.05-2.061.583-.584%201.507-.606%202.063-.05l3.217%203.217%203.218-3.218c.556-.555%201.478-.533%202.062.05'/%3e%3cpath%20fill='%23404756'%20d='M30.367.078c1.112%200%202.001.868%202.001%201.954v1.195h.979c4.913%200%208.892%203.887%208.892%208.686v9.237a15.4%2015.4%200%200%200-4.424-1.691v-1.312H4.468V33.63c0%202.389%202%204.343%204.446%204.343H19.4a15.4%2015.4%200%200%200%201.676%204.343H8.892C3.979%2042.317%200%2038.43%200%2033.631V11.913c0-4.8%203.979-8.686%208.892-8.686h1V2.032c0-1.086.89-1.954%202.002-1.954s2%20.868%202%201.954v1.195h14.473V2.032c0-1.085.889-1.954%202-1.954'/%3e%3c/svg%3e",ZD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",GD=({open:e,onClose:r,onConfirm:t,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>l.jsxs(m.Dialog,{open:e,onClose:r,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[l.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Rr,{fontSize:"small"})})}),l.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[l.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),l.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),l.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[l.jsx(m.Button,{variant:"outlined",onClick:r,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),l.jsxs(m.Button,{variant:"contained",onClick:t,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&l.jsx("img",{src:ZD,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),KD=({userId:e,leads30Days:r,leads90Days:t,disId:n,masNombreBD:o,usrNombre:s})=>{const[i,a]=v.useState(new Date),[c,u]=v.useState([]),[d,f]=v.useState(!1),[h,y]=v.useState(null),[g,p]=v.useState(!1),[b,_]=v.useState(null),[S,D]=v.useState([]),{enqueueSnackbar:C}=ss.useSnackbar(),w=sc(),F=mi(),E=nc(),[T,I]=v.useState(!1),[M,U]=v.useState([]),[q,V]=v.useState(null),{session:H,sessionoutlook:re}=Ua(),{googleEvents:W,setGoogleEvents:$,outlookEvents:ie,setOutlookEvents:ue}=UD(),[N,ee]=v.useState([]),[xe,_e]=v.useState([]),[fe,ae]=v.useState([]),[le,X]=v.useState(!1),[we,ye]=v.useState([]),[K,Ie]=v.useState(),P=(Q,ke)=>{U(Q),V(ke),I(!0)},Be=async()=>{if(e===void 0)return;const Q=await w.getNotificacionesXUsuario(e,!1);s?localStorage.setItem("nombreAnfitrion",s):localStorage.setItem("nombreAnfitrion","Anfitrion"),ye(Q)};v.useEffect(()=>{const Q=new Date,ke=x.startOfDay(Q),Ee=x.endOfDay(x.addDays(ke,6)),Re={start:ke,end:Ee},Sr=c.filter($t=>{const Wr={start:$t.fechaInicio,end:$t.fechaFin};return xd(Wr,Re)}).sort(($t,Wr)=>$t.fechaInicio.getTime()-Wr.fechaInicio.getTime());D(Sr)},[c]),v.useEffect(()=>{const Q=async()=>{try{if(e){const Ee=await w.getEventsByUser(e);Be(),u(Ee)}}catch(Ee){console.log("Error al cargar eventos locales:",Ee)}};Q();const ke=setInterval(Q,4e3);return()=>clearInterval(ke)},[e]),v.useEffect(()=>{if(!n||!e)return;const Q=[...c];if(W.length>0&&H?.userEmail){const ke=W.map(Ee=>WD(Ee,n,e));Q.push(...ke)}if(ie.length>0&&re?.userEmail){const ke=ie.map(Ee=>qD(Ee,n,e));Q.push(...ke)}ee(Q)},[c,W,ie,n,e,H?.userEmail,re?.userEmail]);const Qe=async Q=>{try{if(Q?.isGoogleEvent||Q.isOutlookEvent)y(Q),f(!0);else{const ke=await w.getEventById(Q.eventoID);y(ke),f(!0)}}catch(ke){console.error(ke)}},Fe=()=>{f(!1),y(null)},Le=async(Q,ke)=>{let Ee,Re;Q.todoElDia?(Ee=new Date(`${Q.fechaInicio}T${Q.horaInicio}`),Re=new Date(`${Q.fechaInicio}T${Q.horaFin}`)):(Ee=new Date(`${Q.fechaInicio}T${Q.horaInicio}`),Re=Q.fechaFin&&Q.horaFin?new Date(`${Q.fechaFin}T${Q.horaFin}`):new Date(`${Q.fechaInicio}T${Q.horaFin}`));const Sr=x.format(Ee,"yyyy-MM-dd HH:mm:ss.SSS"),$t=x.format(Re,"yyyy-MM-dd HH:mm:ss.SSS");if(ke){const ar={...Q,eventoID:ke,fechaInicio:Sr,fechaFin:$t,solID:Q.solID??null,disID:n??null,client:Q.client,invitados:Q.invitados.map(He=>({usrNombre:He.nombre||He.usrNombre,Correo:He.correo||He.Correo,EsOrganizador:He.isHost||He.EsOrganizador,StatusInvitacion:He.StatusInvitacion,UsuarioID:He.usrID||He.UsuarioID,disID:He.disID||n}))};try{const He=await w.updateEvent(ar);var Wr=c.map(Hr=>Hr.eventoID===He.eventoID?He:Hr);u(Wr),C("El evento se ha actualizado correctamente.",{variant:"success"}),Fe()}catch{C("Error al actualizar Evento",{variant:"error"})}}else{const ar={...Q,fechaInicio:Sr,fechaFin:$t,todoElDia:Q.todoElDia,solID:Q.solID??null,disID:n??null,client:Q.client,invitados:Q.invitados.map(He=>({usrNombre:He.nombre||He.usrNombre,Correo:He.correo||He.Correo,EsOrganizador:He.isHost||He.EsOrganizador,StatusInvitacion:He.StatusInvitacion,UsuarioID:He.usrID||He.UsuarioID,disID:He.disID||n}))};try{const He=await w.createEvent(ar,e);u(Hr=>[...Hr,He]),C("El evento se ha creado con éxito",{variant:"success"}),Fe()}catch{C("Error al guardar Evento",{variant:"error"})}}if(e){const ar=await w.getEventsByUser(e);u(ar)}},We=()=>{a(Q=>new Date(Q.getFullYear(),Q.getMonth()-1,1))},Xe=()=>{a(Q=>new Date(Q.getFullYear(),Q.getMonth()+1,1))},ft=()=>{De("ELIMINAR")},k=()=>{De("RECHAZAR")},O=()=>{_(new Date),f(!0)},B=Q=>{Q&&a(Q)},ce=Q=>{_(Q),f(!0),y(null)},se=async()=>{if(h)try{await w.deleteEvent(h.eventoID),u(c.filter(Q=>Q.eventoID!==h.eventoID)),C("El evento se ha eliminado de tu calendario",{content:(Q,ke)=>l.jsx(Ic,{id:Q,message:String(ke),variant:"delete"})})}catch{C("Error al eliminar Evento",{variant:"error"})}finally{Fe(),Me()}},j=async()=>{if(!(!H?.userEmail||!n)){X(!0);try{const ke=(await F.getGoogleCalendars(H.userEmail,n)).map(Re=>({...Re,selected:!0}));_e(ke);const Ee=ke.map(Re=>Re.id);R(Ee)}catch(Q){console.error("Error Google Cals:",Q)}finally{X(!1)}}},oe=async Q=>{const ke=xe.map(Re=>Re.id===Q?{...Re,selected:!Re.selected}:Re);_e(ke);const Ee=ke.filter(Re=>Re.selected).map(Re=>Re.id);R(Ee)},Se=async()=>{if(!(!re?.userEmail||!n)){X(!0);try{const ke=(await E.getOutlookCalendars(re.userEmail,n)).map(Re=>({...Re,selected:!0}));ae(ke);const Ee=ke.map(Re=>Re.id);te(Ee)}catch(Q){console.error("Error Outlook Cals:",Q)}finally{X(!1)}}},je=async Q=>{const ke=fe.map(Re=>Re.id===Q?{...Re,selected:!Re.selected}:Re);ae(ke);const Ee=ke.filter(Re=>Re.selected).map(Re=>Re.id);te(Ee)};v.useEffect(()=>{j()},[H?.userEmail,n]),v.useEffect(()=>{Se()},[re?.userEmail,n]);const R=async Q=>{if(!H?.userEmail||!n)return;const ke=Q||xe.filter(Ee=>Ee.selected).map(Ee=>Ee.id);try{const Ee={disID:n,year:i.getFullYear(),month:i.getMonth()+1,usrMail:H.userEmail,calendarIds:ke},Re=await F.getGoogleEventsByMonth(Ee);$(Re)}catch(Ee){console.error("Error al obtener eventos de Google:",Ee)}},te=async Q=>{if(!re?.userEmail||!n)return;const ke=Q||fe.filter(Ee=>Ee.selected).map(Ee=>Ee.id);try{const Ee={disID:n,year:i.getFullYear(),month:i.getMonth()+1,usrMail:re.userEmail,calendarIds:ke},Re=await E.getOutlookEventsByMonth(Ee);ue(Re)}catch(Ee){console.error("Error al obtener eventos de Outlook:",Ee)}};if(n===void 0||e===void 0)return l.jsx("div",{children:"Cargando configuración de usuario..."});const be=async(Q,ke)=>{await w.UpdateStatusEvento(Q.evento.eventoID,e,ke)&&(await w.MarcarLeido(Q.notificacionID,e),C(Q?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},qe=async()=>{K&&w.UpdateStatusEvento(K.evento.eventoID,e,"RECHAZADA")&&(await w.MarcarLeido(K.notificacionID,e),await w.MarcarLeido(K.notificacionID,e),C("Haz rechazado la Invitación a "+K?.evento?.titulo,{content:(ke,Ee)=>l.jsx(Ic,{id:ke,message:String(Ee),variant:"rechazar"})}),Me())},Ct=async(Q,ke)=>{try{if(!e)return;Ie(Q),ke=="RECHAZADA"?(k(),console.log("noti",Q)):be(Q,ke)}catch{C("Error al procesar la invitación",{variant:"error"})}},Z=async Q=>{try{if(!h)return;await w.ReenviarNotificacion(h?.eventoID,Q),C("Invitación enviada con éxito",{variant:"success"})}catch(ke){console.error("Error al conectar con la API",ke)}},[de,De]=v.useState(null),Me=()=>De(null),Pe={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:l.jsxs(l.Fragment,{children:["Estás a punto de declinar la invitación de ",l.jsx("strong",{children:K?.evento?.nombreAnfitrion})," a ",l.jsx("strong",{children:K?.evento?.titulo})]}),icon:l.jsx("img",{src:hh}),action:()=>K&&qe()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:l.jsx("img",{src:hh}),action:()=>se()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>se}},Nt=de?Pe[de]:null;return l.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[l.jsx(jv,{header:l.jsx(X2,{currentDate:i,onPrevMonth:We,onNextMonth:Xe,onAddEvent:O,onDateChange:B}),sidebar:l.jsx(Gx,{onEventClick:Qe,upcomingEvents:S,leads30Days:r,leads90Days:t,disID:n,usrID:e,onAddEvent:O,googleCalendars:xe,outlookCalendars:fe,isLoadingCalendars:le,onToggleGoogle:oe,onToggleOutlook:je,notifications:we,unreadCount:we?.filter(Q=>!Q.leida).length,onAceppInvitacion:Ct}),mainContent:l.jsx(lw,{onSeeMoreClick:P,currentDate:i,events:N,onDayClick:ce,onEventClick:Qe})}),d&&l.jsx(ID,{isVisible:d,onClose:Fe,onSave:Le,onDelete:ft,selectedDate:b,initialEvent:h,userId:e,masNombreBD:o,disId:n,onReenviar:Z}),l.jsx(jD,{isOpen:T,onClose:()=>I(!1),events:M,date:q,onEventClick:Qe}),Nt&&l.jsx(GD,{open:!!de,onClose:Me,onConfirm:()=>{Nt.action()},title:Nt.title,description:Nt.description,icon:Nt.icon,confirmText:Nt.confirmText})]})},QD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20fill='%23070c10'%20d='M18.575%203.172A10.829%2010.829%200%200%200%201.564%2016.284l-.028-.051L0%2021.843l5.739-1.506a10.7%2010.7%200%200%200%205.173%201.318%2010.83%2010.83%200%200%200%207.663-18.483m-7.658%2016.655a8.94%208.94%200%200%201-4.62-1.277l.041.023-.329-.194-3.405.894.908-3.321-.214-.34a8.9%208.9%200%200%201-1.376-4.782%209%209%200%201%201%209%209Zm4.935-6.736c-.27-.135-1.6-.789-1.848-.88s-.429-.135-.61.136-.7.879-.856%201.06-.316.2-.586.068a7.5%207.5%200%200%201-2.183-1.349l.007.007a8.2%208.2%200%200%201-1.483-1.842l-.02-.038c-.157-.27-.017-.417.118-.551s.271-.316.406-.473a1.9%201.9%200%200%200%20.267-.44v-.012a.5.5%200%200%200%20.05-.216.5.5%200%200%200-.074-.26c-.068-.135-.609-1.467-.834-2.009s-.444-.455-.609-.464-.338-.009-.519-.009a.99.99%200%200%200-.72.337%203.03%203.03%200%200%200-.947%202.2v.058a5.27%205.27%200%200%200%201.114%202.815v-.011a12.16%2012.16%200%200%200%204.553%204.053l.068.031a14%2014%200%200%200%201.434.539l.109.03a3.6%203.6%200%200%200%201.077.161%203.7%203.7%200%200%200%20.648-.057h-.023a2.8%202.8%200%200%200%201.819-1.274l.007-.012a2.2%202.2%200%200%200%20.19-.9%202.3%202.3%200%200%200-.034-.395v.014c-.067-.113-.248-.18-.519-.316Z'/%3e%3c/svg%3e",XD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='25.085'%20height='18.5'%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='none'%20d='M0%200h25.085v18.5H0z'%20data-name='Rectángulo%204598'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23a)'%20data-name='Grupo%207946'%3e%3cpath%20d='M23.12%205.809V3.226a3.2%203.2%200%200%200-.068-.656l-3.141%202.21a7.8%207.8%200%200%201%203.209%201.032'%20data-name='Trazado%2013329'/%3e%3cpath%20d='M11.847%209.791c-.1.009-.2.023-.308.023a3.78%203.78%200%200%201-2.18-.688L.067%202.58A3.2%203.2%200%200%200%200%203.227V13.98a3.23%203.23%200%200%200%203.226%203.226h9.611a7.86%207.86%200%200%201-.99-7.414'%20data-name='Trazado%2013330'/%3e%3cpath%20d='M12.478%207.369%2021.92.737A3.2%203.2%200%200%200%2019.894%200H3.226a3.2%203.2%200%200%200-2.031.74l9.4%206.628a1.64%201.64%200%200%200%201.881%200'%20data-name='Trazado%2013331'/%3e%3cpath%20d='M23.356%208.407a5.914%205.914%200%201%200%200%208.364%205.92%205.92%200%200%200%200-8.364m-1.833%204.842a.54.54%200%200%201-1.081%200v-1.164l-2.513%202.516a.54.54%200%200%201-.765-.763l2.515-2.515h-1.167a.54.54%200%201%201%200-1.081h2.471a.54.54%200%200%201%20.54.54Z'%20data-name='Trazado%2013332'/%3e%3c/g%3e%3c/svg%3e";function Oc(e,r,t){return e.accessor?e.accessor(r,t):e.field?r?.[e.field]:r?.[e?.key||""]}function JD(e,r){const t=e??"",n=r??"";return t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="number"&&typeof n=="number"?t-n:typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function jc(e,r,t=!0){return typeof e=="function"?e(r):e??t}function e3(e){return e.replace(/[^\d]/g,"")}function t3(e,r){return r}var Yo={},mh;function r3(){if(mh)return Yo;mh=1;var e=ct();Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.default=void 0;var r=e(ht()),t=dt();return Yo.default=(0,r.default)((0,t.jsx)("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAlt"),Yo}var n3=r3();const o3=at(n3);var qo={},gh;function s3(){if(gh)return qo;gh=1;var e=ct();Object.defineProperty(qo,"__esModule",{value:!0}),qo.default=void 0;var r=e(ht()),t=dt();return qo.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchRounded"),qo}var i3=s3();const a3=at(i3);var Zo={},vh;function c3(){if(vh)return Zo;vh=1;var e=ct();Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.default=void 0;var r=e(ht()),t=dt();return Zo.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),Zo}var l3=c3();const u3=at(l3);var Go={},yh;function d3(){if(yh)return Go;yh=1;var e=ct();Object.defineProperty(Go,"__esModule",{value:!0}),Go.default=void 0;var r=e(ht()),t=dt();return Go.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),Go}var f3=d3();const p3=at(f3);function bh(e){return e==="right"?"end":e==="center"?"center":"start"}function xh(e){const r=e.filter(t=>!t.width).length||1;return e.map(t=>typeof t.width=="number"?`${t.width}px`:typeof t.width=="string"?t.width:`minmax(0, ${1/r}fr)`).join(" ")}const h3=1060,Pc=(e,r)=>e.metrics.find(t=>String(t.label).toLowerCase()===r.toLowerCase())?.value??"";function m3({sections:e,detailColumns:r,summaryWidths:t=["1fr",120,120,150],minWidth:n=h3,getDetailColumns:o,onRowClick:s}){function c(d){if(typeof d=="number")return d;if(!d)return 0;const f=/^(\d+)\s*px$/.exec(d.trim());return f?Number(f[1]):/fr$/i.test(d)?160:0}function u(d){const f=d.reduce((g,p)=>g+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return l.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:l.jsxs(m.Box,{children:[l.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(d=>typeof d=="number"?`${d}px`:d).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(d=>l.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:d},d))}),e.map((d,f)=>{const[h,y]=G.useState(!!d.initiallyOpen),g=f%2===1,p=o?o(d):r,b=Math.max(n,u(p));return l.jsxs(m.Box,{children:[l.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:g?"rgba(30,91,206,0.06)":"background.paper",borderTop:"1px solid rgba(0,0,0,0.08)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>y(_=>!_),children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[l.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?l.jsx(p3,{}):l.jsx(u3,{})}),l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:Pc(d,"En Proceso")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:Pc(d,"Finalizadas")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:Pc(d,"Último seg.")})]}),l.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:l.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:xh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"rgba(30,91,206,0.18)",color:"#1a1a1a",borderTop:"1px solid rgba(0,0,0,0.12)",boxSizing:"border-box"},children:p.map(_=>l.jsx(m.Typography,{sx:{justifySelf:bh(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(d.rows??[]).map((_,S)=>l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:xh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:S%2===0?"background.paper":"rgba(30,91,206,0.06)",borderTop:"1px solid rgba(0,0,0,0.06)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>s?.(_,d),children:p.map((D,C)=>{const w=D.accessor?D.accessor(_,S):D.field?_[D.field]:null;return l.jsx(m.Box,{sx:{justifySelf:bh(D.align),textAlign:D.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof w=="string"||typeof w=="number"?l.jsx(m.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(D.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(w),children:w}):w},D.key??C)})},_.id??S))]})})]},d.id)})]})})}var Ko={},wh;function g3(){if(wh)return Ko;wh=1;var e=ct();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.default=void 0;var r=e(ht()),t=dt();return Ko.default=(0,r.default)((0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m3.3 14.71L11 12.41V7h2v4.59l3.71 3.71z"}),"AccessTimeFilled"),Ko}var v3=g3();const y3=at(v3),b3=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",x3=e=>{const r=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return r||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},w3=e=>{const r=(e||"").split(" ").filter(Boolean);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var Qo={},_h;function _3(){if(_h)return Qo;_h=1;var e=ct();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.default=void 0;var r=e(ht()),t=dt();return Qo.default=(0,r.default)((0,t.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),Qo}var S3=_3();const C3=at(S3),Rc=({current:e=0,total:r=0,color:t="#4caf50"})=>l.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:r}).map((n,o)=>l.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?t:"#e0e0e0",display:"flex"}},o))});var Xo={},Sh;function E3(){if(Sh)return Xo;Sh=1;var e=ct();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var r=e(ht()),t=dt();return Xo.default=(0,r.default)((0,t.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),Xo}var D3=E3();const Ch=at(D3);var Jo={},Eh;function k3(){if(Eh)return Jo;Eh=1;var e=ct();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var r=e(ht()),t=dt();return Jo.default=(0,r.default)((0,t.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),Jo}var A3=k3();const T3=at(A3),M3=e=>{const r=String(e??"").toLowerCase().trim();return r==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:r==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:r==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:r==="no sé"||r==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:r==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},I3=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por Asignar";case 2:return"Solicitud Asignada";case 3:return"Solicitud asignada en proceso";case 4:return"Finalizadas sin Venta";case 5:return"Finalizadas con Venta";case 6:return"Rechazadas";case 7:return"Finalizada por sistema";case 8:return"";case 9:return"";case 10:return"Prospección";case 11:return"Interés Real";case 12:return"Proceso de Compra";case 13:return"";case 14:return"En espera de Unidad";case 15:return"Auto Facturado";case 16:return"";case 17:return"";case 18:return"Compró otra Marca";case 19:return"No comprará";default:return null}},O3=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por asignar";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 6:return"Rechazada";case 7:return"Finalizada sin enviar a Ventas";case 8:return"Finalizada enviado a Ventas";default:return null}},j3=e=>{switch(parseInt(String(e??""),10)){case 0:return"Sin asignar";case 1:return"Confirmado";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 4:return"Confirmado";case 5:return"Finalizada";case 6:return"Rechazada";case 10:return"Reagendado";case 20:return"Seguimiento [Cita Finalizada]";case 30:return"Reenvio";case 40:return"Seguimiento [Mecanico]";case 50:return"Seguimiento";default:return null}};function P3(e){const r=new Date(e),t=r.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=r.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${t.replace(".","")} • ${n}`}function R3(e){return e.replace(/<br\s*\/?>/gi,`
|
|
177
|
+
`)}y.write("payload.value = newResult;"),y.write("return payload;");const S=y.compile();return(D,C)=>S(h,D,C)};let s;const i=Si,a=!np.jitless,u=a&&Pw.value,d=r.catchall;let f;e._zod.parse=(h,y)=>{f??(f=n.value);const g=h.value;return i(g)?a&&u&&y?.async===!1&&y.jitless!==!0?(s||(s=o(r.shape)),h=s(h,y),d?wp([],g,h,y,f,e):h):t(h,y):(h.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),h)}});function _p(e,r,t,n){for(const s of e)if(s.issues.length===0)return r.value=s.value,r;const o=e.filter(s=>!Fn(s));return o.length===1?(r.value=o[0].value,o[0]):(r.issues.push({code:"invalid_union",input:r.value,inst:t,errors:e.map(s=>s.issues.map(i=>vn(i,n,gn())))}),r)}const CS=Y("$ZodUnion",(e,r)=>{At.init(e,r),mt(e._zod,"optin",()=>r.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>r.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(r.options.every(o=>o._zod.values))return new Set(r.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(r.options.every(o=>o._zod.pattern)){const o=r.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>_c(s.source)).join("|")})$`)}});const t=r.options.length===1,n=r.options[0]._zod.run;e._zod.parse=(o,s)=>{if(t)return n(o,s);let i=!1;const a=[];for(const c of r.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>_p(c,o,e,s)):_p(a,o,e,s)}}),ES=Y("$ZodIntersection",(e,r)=>{At.init(e,r),e._zod.parse=(t,n)=>{const o=t.value,s=r.left._zod.run({value:o,issues:[]},n),i=r.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Sp(t,c,u)):Sp(t,s,i)}});function Dc(e,r){if(e===r)return{valid:!0,data:e};if(e instanceof Date&&r instanceof Date&&+e==+r)return{valid:!0,data:e};if(Ro(e)&&Ro(r)){const t=Object.keys(r),n=Object.keys(e).filter(s=>t.indexOf(s)!==-1),o={...e,...r};for(const s of n){const i=Dc(e[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let n=0;n<e.length;n++){const o=e[n],s=r[n],i=Dc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};t.push(i.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function Sp(e,r,t){if(r.issues.length&&e.issues.push(...r.issues),t.issues.length&&e.issues.push(...t.issues),Fn(e))return e;const n=Dc(r.value,t.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const DS=Y("$ZodEnum",(e,r)=>{At.init(e,r);const t=Iw(r.entries),n=new Set(t);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.filter(o=>Rw.has(typeof o)).map(o=>typeof o=="string"?Bn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t,input:i,inst:e}),o}}),kS=Y("$ZodLiteral",(e,r)=>{if(At.init(e,r),r.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(r.values),e._zod.pattern=new RegExp(`^(${r.values.map(t=>typeof t=="string"?Bn(t):t?Bn(t.toString()):String(t)).join("|")})$`),e._zod.parse=(t,n)=>{const o=t.value;return e._zod.values.has(o)||t.issues.push({code:"invalid_value",values:r.values,input:o,inst:e}),t}}),AS=Y("$ZodTransform",(e,r)=>{At.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new rp(e.constructor.name);const o=r.transform(t.value,t);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(t.value=i,t));if(o instanceof Promise)throw new Ln;return t.value=o,t}});function Cp(e,r){return e.issues.length&&r===void 0?{issues:[],value:void 0}:e}const TS=Y("$ZodOptional",(e,r)=>{At.init(e,r),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${_c(t.source)})?$`):void 0}),e._zod.parse=(t,n)=>{if(r.innerType._zod.optin==="optional"){const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Cp(s,t.value)):Cp(o,t.value)}return t.value===void 0?t:r.innerType._zod.run(t,n)}}),MS=Y("$ZodNullable",(e,r)=>{At.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"pattern",()=>{const t=r.innerType._zod.pattern;return t?new RegExp(`^(${_c(t.source)}|null)$`):void 0}),mt(e._zod,"values",()=>r.innerType._zod.values?new Set([...r.innerType._zod.values,null]):void 0),e._zod.parse=(t,n)=>t.value===null?t:r.innerType._zod.run(t,n)}),IS=Y("$ZodDefault",(e,r)=>{At.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);if(t.value===void 0)return t.value=r.defaultValue,t;const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Ep(s,r)):Ep(o,r)}});function Ep(e,r){return e.value===void 0&&(e.value=r.defaultValue),e}const OS=Y("$ZodPrefault",(e,r)=>{At.init(e,r),e._zod.optin="optional",mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>(n.direction==="backward"||t.value===void 0&&(t.value=r.defaultValue),r.innerType._zod.run(t,n))}),jS=Y("$ZodNonOptional",(e,r)=>{At.init(e,r),mt(e._zod,"values",()=>{const t=r.innerType._zod.values;return t?new Set([...t].filter(n=>n!==void 0)):void 0}),e._zod.parse=(t,n)=>{const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>Dp(s,e)):Dp(o,e)}});function Dp(e,r){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:r}),e}const PS=Y("$ZodCatch",(e,r)=>{At.init(e,r),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),mt(e._zod,"values",()=>r.innerType._zod.values),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(s=>(t.value=s.value,s.issues.length&&(t.value=r.catchValue({...t,error:{issues:s.issues.map(i=>vn(i,n,gn()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=r.catchValue({...t,error:{issues:o.issues.map(s=>vn(s,n,gn()))},input:t.value}),t.issues=[]),t)}}),RS=Y("$ZodPipe",(e,r)=>{At.init(e,r),mt(e._zod,"values",()=>r.in._zod.values),mt(e._zod,"optin",()=>r.in._zod.optin),mt(e._zod,"optout",()=>r.out._zod.optout),mt(e._zod,"propValues",()=>r.in._zod.propValues),e._zod.parse=(t,n)=>{if(n.direction==="backward"){const s=r.out._zod.run(t,n);return s instanceof Promise?s.then(i=>Oi(i,r.in,n)):Oi(s,r.in,n)}const o=r.in._zod.run(t,n);return o instanceof Promise?o.then(s=>Oi(s,r.out,n)):Oi(o,r.out,n)}});function Oi(e,r,t){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:e.value,issues:e.issues},t)}const NS=Y("$ZodReadonly",(e,r)=>{At.init(e,r),mt(e._zod,"propValues",()=>r.innerType._zod.propValues),mt(e._zod,"values",()=>r.innerType._zod.values),mt(e._zod,"optin",()=>r.innerType._zod.optin),mt(e._zod,"optout",()=>r.innerType._zod.optout),e._zod.parse=(t,n)=>{if(n.direction==="backward")return r.innerType._zod.run(t,n);const o=r.innerType._zod.run(t,n);return o instanceof Promise?o.then(kp):kp(o)}});function kp(e){return e.value=Object.freeze(e.value),e}const $S=Y("$ZodCustom",(e,r)=>{er.init(e,r),At.init(e,r),e._zod.parse=(t,n)=>t,e._zod.check=t=>{const n=t.value,o=r.fn(n);if(o instanceof Promise)return o.then(s=>Ap(s,t,n,e));Ap(o,t,n,e)}});function Ap(e,r,t,n){if(!e){const o={code:"custom",input:t,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),r.issues.push(No(o))}}class LS{constructor(){this._map=new Map,this._idmap=new Map}add(r,...t){const n=t[0];if(this._map.set(r,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,r)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(r){const t=this._map.get(r);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(r),this}get(r){const t=r._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(r)};return Object.keys(o).length?o:void 0}return this._map.get(r)}has(r){return this._map.has(r)}}function zS(){return new LS}const ji=zS();function BS(e,r){return new e({type:"string",...Ae(r)})}function FS(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ae(r)})}function Tp(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ae(r)})}function VS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ae(r)})}function US(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ae(r)})}function WS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ae(r)})}function HS(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ae(r)})}function YS(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ae(r)})}function qS(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ae(r)})}function ZS(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ae(r)})}function GS(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ae(r)})}function KS(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ae(r)})}function QS(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ae(r)})}function XS(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ae(r)})}function JS(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ae(r)})}function eC(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ae(r)})}function tC(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ae(r)})}function rC(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ae(r)})}function nC(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ae(r)})}function oC(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ae(r)})}function sC(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ae(r)})}function iC(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ae(r)})}function aC(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ae(r)})}function cC(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ae(r)})}function lC(e,r){return new e({type:"string",format:"date",check:"string_format",...Ae(r)})}function uC(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ae(r)})}function dC(e,r){return new e({type:"string",format:"duration",check:"string_format",...Ae(r)})}function fC(e,r){return new e({type:"number",checks:[],...Ae(r)})}function pC(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ae(r)})}function hC(e,r){return new e({type:"boolean",...Ae(r)})}function mC(e){return new e({type:"unknown"})}function gC(e,r){return new e({type:"never",...Ae(r)})}function Mp(e,r){return new mp({check:"less_than",...Ae(r),value:e,inclusive:!1})}function kc(e,r){return new mp({check:"less_than",...Ae(r),value:e,inclusive:!0})}function Ip(e,r){return new gp({check:"greater_than",...Ae(r),value:e,inclusive:!1})}function Ac(e,r){return new gp({check:"greater_than",...Ae(r),value:e,inclusive:!0})}function Op(e,r){return new O_({check:"multiple_of",...Ae(r),value:e})}function jp(e,r){return new P_({check:"max_length",...Ae(r),maximum:e})}function Pi(e,r){return new R_({check:"min_length",...Ae(r),minimum:e})}function Pp(e,r){return new N_({check:"length_equals",...Ae(r),length:e})}function vC(e,r){return new $_({check:"string_format",format:"regex",...Ae(r),pattern:e})}function yC(e){return new L_({check:"string_format",format:"lowercase",...Ae(e)})}function bC(e){return new z_({check:"string_format",format:"uppercase",...Ae(e)})}function xC(e,r){return new B_({check:"string_format",format:"includes",...Ae(r),includes:e})}function wC(e,r){return new F_({check:"string_format",format:"starts_with",...Ae(r),prefix:e})}function _C(e,r){return new V_({check:"string_format",format:"ends_with",...Ae(r),suffix:e})}function $o(e){return new U_({check:"overwrite",tx:e})}function SC(e){return $o(r=>r.normalize(e))}function CC(){return $o(e=>e.trim())}function EC(){return $o(e=>e.toLowerCase())}function DC(){return $o(e=>e.toUpperCase())}function kC(e,r,t){return new e({type:"array",element:r,...Ae(t)})}function AC(e,r,t){return new e({type:"custom",check:"custom",fn:r,...Ae(t)})}function TC(e){const r=MC(t=>(t.addIssue=n=>{if(typeof n=="string")t.issues.push(No(n,t.value,r._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),t.issues.push(No(o))}},e(t.value,t)));return r}function MC(e,r){const t=new er({check:"custom",...Ae(r)});return t._zod.check=e,t}function Rp(e,r){try{var t=e()}catch(n){return r(n)}return t&&t.then?t.then(void 0,r):t}function IC(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,u=c&&c[n.code];t[i]=hc(i,r,t,o,u?[].concat(u,n.message):n.message)}e.shift()}return t}function OC(e,r){for(var t={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!t[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];t[i]={message:a.message,type:a.code}}else t[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(f){return e.push(f)})}),r){var c=t[i].types,u=c&&c[n.code];t[i]=hc(i,r,t,o,u?[].concat(u,n.message):n.message)}e.shift()}return t}function jC(e,r,t){if(t===void 0&&(t={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(Rp(function(){return Promise.resolve(e[t.mode==="sync"?"parse":"parseAsync"](n,r)).then(function(i){return s.shouldUseNativeValidation&&yc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:ep(IC(i.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,s){try{return Promise.resolve(Rp(function(){return Promise.resolve((t.mode==="sync"?qw:Zw)(e,n,r)).then(function(i){return s.shouldUseNativeValidation&&yc({},s),{errors:{},values:t.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof Cc})(i))return{values:{},errors:ep(OC(i.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw i}))}catch(i){return Promise.reject(i)}};throw new Error("Invalid input: not a Zod schema")}const PC=Y("ZodISODateTime",(e,r)=>{nS.init(e,r),St.init(e,r)});function RC(e){return cC(PC,e)}const NC=Y("ZodISODate",(e,r)=>{oS.init(e,r),St.init(e,r)});function $C(e){return lC(NC,e)}const LC=Y("ZodISOTime",(e,r)=>{sS.init(e,r),St.init(e,r)});function zC(e){return uC(LC,e)}const BC=Y("ZodISODuration",(e,r)=>{iS.init(e,r),St.init(e,r)});function FC(e){return dC(BC,e)}const pr=Y("ZodError",(e,r)=>{Cc.init(e,r),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>Yw(e,t)},flatten:{value:t=>Hw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,bc,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,bc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),VC=Di(pr),UC=ki(pr),WC=Ai(pr),HC=Ti(pr),YC=Qw(pr),qC=Xw(pr),ZC=Jw(pr),GC=e_(pr),KC=t_(pr),QC=r_(pr),XC=n_(pr),JC=o_(pr),Rt=Y("ZodType",(e,r)=>(At.init(e,r),e.def=r,e.type=r.type,Object.defineProperty(e,"_def",{value:r}),e.check=(...t)=>e.clone({...r,checks:[...r.checks??[],...t.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(t,n)=>en(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>VC(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>WC(e,t,n),e.parseAsync=async(t,n)=>UC(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>HC(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>YC(e,t,n),e.decode=(t,n)=>qC(e,t,n),e.encodeAsync=async(t,n)=>ZC(e,t,n),e.decodeAsync=async(t,n)=>GC(e,t,n),e.safeEncode=(t,n)=>KC(e,t,n),e.safeDecode=(t,n)=>QC(e,t,n),e.safeEncodeAsync=async(t,n)=>XC(e,t,n),e.safeDecodeAsync=async(t,n)=>JC(e,t,n),e.refine=(t,n)=>e.check(HE(t,n)),e.superRefine=t=>e.check(YE(t)),e.overwrite=t=>e.check($o(t)),e.optional=()=>Hp(e),e.nullable=()=>Yp(e),e.nullish=()=>Hp(Yp(e)),e.nonoptional=t=>LE(e,t),e.array=()=>Fp(e),e.or=t=>DE([e,t]),e.and=t=>AE(e,t),e.transform=t=>Zp(e,OE(t)),e.default=t=>RE(e,t),e.prefault=t=>$E(e,t),e.catch=t=>BE(e,t),e.pipe=t=>Zp(e,t),e.readonly=()=>UE(e),e.describe=t=>{const n=e.clone();return ji.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return ji.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return ji.get(e);const n=e.clone();return ji.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Np=Y("_ZodString",(e,r)=>{Ec.init(e,r),Rt.init(e,r);const t=e._zod.bag;e.format=t.format??null,e.minLength=t.minimum??null,e.maxLength=t.maximum??null,e.regex=(...n)=>e.check(vC(...n)),e.includes=(...n)=>e.check(xC(...n)),e.startsWith=(...n)=>e.check(wC(...n)),e.endsWith=(...n)=>e.check(_C(...n)),e.min=(...n)=>e.check(Pi(...n)),e.max=(...n)=>e.check(jp(...n)),e.length=(...n)=>e.check(Pp(...n)),e.nonempty=(...n)=>e.check(Pi(1,...n)),e.lowercase=n=>e.check(yC(n)),e.uppercase=n=>e.check(bC(n)),e.trim=()=>e.check(CC()),e.normalize=(...n)=>e.check(SC(...n)),e.toLowerCase=()=>e.check(EC()),e.toUpperCase=()=>e.check(DC())}),eE=Y("ZodString",(e,r)=>{Ec.init(e,r),Np.init(e,r),e.email=t=>e.check(FS(tE,t)),e.url=t=>e.check(YS(rE,t)),e.jwt=t=>e.check(aC(vE,t)),e.emoji=t=>e.check(qS(nE,t)),e.guid=t=>e.check(Tp($p,t)),e.uuid=t=>e.check(VS(Ri,t)),e.uuidv4=t=>e.check(US(Ri,t)),e.uuidv6=t=>e.check(WS(Ri,t)),e.uuidv7=t=>e.check(HS(Ri,t)),e.nanoid=t=>e.check(ZS(oE,t)),e.guid=t=>e.check(Tp($p,t)),e.cuid=t=>e.check(GS(sE,t)),e.cuid2=t=>e.check(KS(iE,t)),e.ulid=t=>e.check(QS(aE,t)),e.base64=t=>e.check(oC(hE,t)),e.base64url=t=>e.check(sC(mE,t)),e.xid=t=>e.check(XS(cE,t)),e.ksuid=t=>e.check(JS(lE,t)),e.ipv4=t=>e.check(eC(uE,t)),e.ipv6=t=>e.check(tC(dE,t)),e.cidrv4=t=>e.check(rC(fE,t)),e.cidrv6=t=>e.check(nC(pE,t)),e.e164=t=>e.check(iC(gE,t)),e.datetime=t=>e.check(RC(t)),e.date=t=>e.check($C(t)),e.time=t=>e.check(zC(t)),e.duration=t=>e.check(FC(t))});function hr(e){return BS(eE,e)}const St=Y("ZodStringFormat",(e,r)=>{xt.init(e,r),Np.init(e,r)}),tE=Y("ZodEmail",(e,r)=>{Z_.init(e,r),St.init(e,r)}),$p=Y("ZodGUID",(e,r)=>{Y_.init(e,r),St.init(e,r)}),Ri=Y("ZodUUID",(e,r)=>{q_.init(e,r),St.init(e,r)}),rE=Y("ZodURL",(e,r)=>{G_.init(e,r),St.init(e,r)}),nE=Y("ZodEmoji",(e,r)=>{K_.init(e,r),St.init(e,r)}),oE=Y("ZodNanoID",(e,r)=>{Q_.init(e,r),St.init(e,r)}),sE=Y("ZodCUID",(e,r)=>{X_.init(e,r),St.init(e,r)}),iE=Y("ZodCUID2",(e,r)=>{J_.init(e,r),St.init(e,r)}),aE=Y("ZodULID",(e,r)=>{eS.init(e,r),St.init(e,r)}),cE=Y("ZodXID",(e,r)=>{tS.init(e,r),St.init(e,r)}),lE=Y("ZodKSUID",(e,r)=>{rS.init(e,r),St.init(e,r)}),uE=Y("ZodIPv4",(e,r)=>{aS.init(e,r),St.init(e,r)}),dE=Y("ZodIPv6",(e,r)=>{cS.init(e,r),St.init(e,r)}),fE=Y("ZodCIDRv4",(e,r)=>{lS.init(e,r),St.init(e,r)}),pE=Y("ZodCIDRv6",(e,r)=>{uS.init(e,r),St.init(e,r)}),hE=Y("ZodBase64",(e,r)=>{dS.init(e,r),St.init(e,r)}),mE=Y("ZodBase64URL",(e,r)=>{pS.init(e,r),St.init(e,r)}),gE=Y("ZodE164",(e,r)=>{hS.init(e,r),St.init(e,r)}),vE=Y("ZodJWT",(e,r)=>{gS.init(e,r),St.init(e,r)}),Lp=Y("ZodNumber",(e,r)=>{yp.init(e,r),Rt.init(e,r),e.gt=(n,o)=>e.check(Ip(n,o)),e.gte=(n,o)=>e.check(Ac(n,o)),e.min=(n,o)=>e.check(Ac(n,o)),e.lt=(n,o)=>e.check(Mp(n,o)),e.lte=(n,o)=>e.check(kc(n,o)),e.max=(n,o)=>e.check(kc(n,o)),e.int=n=>e.check(zp(n)),e.safe=n=>e.check(zp(n)),e.positive=n=>e.check(Ip(0,n)),e.nonnegative=n=>e.check(Ac(0,n)),e.negative=n=>e.check(Mp(0,n)),e.nonpositive=n=>e.check(kc(0,n)),e.multipleOf=(n,o)=>e.check(Op(n,o)),e.step=(n,o)=>e.check(Op(n,o)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null});function Ni(e){return fC(Lp,e)}const yE=Y("ZodNumberFormat",(e,r)=>{vS.init(e,r),Lp.init(e,r)});function zp(e){return pC(yE,e)}const bE=Y("ZodBoolean",(e,r)=>{yS.init(e,r),Rt.init(e,r)});function $i(e){return hC(bE,e)}const xE=Y("ZodUnknown",(e,r)=>{bS.init(e,r),Rt.init(e,r)});function Bp(){return mC(xE)}const wE=Y("ZodNever",(e,r)=>{xS.init(e,r),Rt.init(e,r)});function _E(e){return gC(wE,e)}const SE=Y("ZodArray",(e,r)=>{wS.init(e,r),Rt.init(e,r),e.element=r.element,e.min=(t,n)=>e.check(Pi(t,n)),e.nonempty=t=>e.check(Pi(1,t)),e.max=(t,n)=>e.check(jp(t,n)),e.length=(t,n)=>e.check(Pp(t,n)),e.unwrap=()=>e.element});function Fp(e,r){return kC(SE,e,r)}const CE=Y("ZodObject",(e,r)=>{SS.init(e,r),Rt.init(e,r),mt(e,"shape",()=>r.shape),e.keyof=()=>Up(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Bp()}),e.loose=()=>e.clone({...e._zod.def,catchall:Bp()}),e.strict=()=>e.clone({...e._zod.def,catchall:_E()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Bw(e,t),e.safeExtend=t=>Fw(e,t),e.merge=t=>Vw(e,t),e.pick=t=>Lw(e,t),e.omit=t=>zw(e,t),e.partial=(...t)=>Uw(Wp,e,t[0]),e.required=(...t)=>Ww(qp,e,t[0])});function Vp(e,r){const t={type:"object",get shape(){return Jr(this,"shape",e?jw(e):{}),this.shape},...Ae(r)};return new CE(t)}const EE=Y("ZodUnion",(e,r)=>{CS.init(e,r),Rt.init(e,r),e.options=r.options});function DE(e,r){return new EE({type:"union",options:e,...Ae(r)})}const kE=Y("ZodIntersection",(e,r)=>{ES.init(e,r),Rt.init(e,r)});function AE(e,r){return new kE({type:"intersection",left:e,right:r})}const Tc=Y("ZodEnum",(e,r)=>{DS.init(e,r),Rt.init(e,r),e.enum=r.entries,e.options=Object.values(r.entries);const t=new Set(Object.keys(r.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(t.has(i))s[i]=r.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Tc({...r,checks:[],...Ae(o),entries:s})},e.exclude=(n,o)=>{const s={...r.entries};for(const i of n)if(t.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Tc({...r,checks:[],...Ae(o),entries:s})}});function Up(e,r){const t=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Tc({type:"enum",entries:t,...Ae(r)})}const TE=Y("ZodLiteral",(e,r)=>{kS.init(e,r),Rt.init(e,r),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function ME(e,r){return new TE({type:"literal",values:Array.isArray(e)?e:[e],...Ae(r)})}const IE=Y("ZodTransform",(e,r)=>{AS.init(e,r),Rt.init(e,r),e._zod.parse=(t,n)=>{if(n.direction==="backward")throw new rp(e.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(No(s,t.value,r));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),t.issues.push(No(i))}};const o=r.transform(t.value,t);return o instanceof Promise?o.then(s=>(t.value=s,t)):(t.value=o,t)}});function OE(e){return new IE({type:"transform",transform:e})}const Wp=Y("ZodOptional",(e,r)=>{TS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function Hp(e){return new Wp({type:"optional",innerType:e})}const jE=Y("ZodNullable",(e,r)=>{MS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function Yp(e){return new jE({type:"nullable",innerType:e})}const PE=Y("ZodDefault",(e,r)=>{IS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function RE(e,r){return new PE({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():ap(r)}})}const NE=Y("ZodPrefault",(e,r)=>{OS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function $E(e,r){return new NE({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():ap(r)}})}const qp=Y("ZodNonOptional",(e,r)=>{jS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function LE(e,r){return new qp({type:"nonoptional",innerType:e,...Ae(r)})}const zE=Y("ZodCatch",(e,r)=>{PS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function BE(e,r){return new zE({type:"catch",innerType:e,catchValue:typeof r=="function"?r:()=>r})}const FE=Y("ZodPipe",(e,r)=>{RS.init(e,r),Rt.init(e,r),e.in=r.in,e.out=r.out});function Zp(e,r){return new FE({type:"pipe",in:e,out:r})}const VE=Y("ZodReadonly",(e,r)=>{NS.init(e,r),Rt.init(e,r),e.unwrap=()=>e._zod.def.innerType});function UE(e){return new VE({type:"readonly",innerType:e})}const WE=Y("ZodCustom",(e,r)=>{$S.init(e,r),Rt.init(e,r)});function HE(e,r={}){return AC(WE,e,r)}function YE(e){return TC(e)}const Gp=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,Kp=(e,r)=>{if(!e||!r)return null;const t=e.split("-");if(t.length!==3)return null;const n=parseInt(t[0],10),o=parseInt(t[1],10)-1,s=parseInt(t[2],10),i=r.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),u=new Date(n,o,s,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},qE=Vp({UsuarioID:Ni().nullable().optional(),disID:Ni().nullable().optional(),EsOrganizador:$i().default(!1),Correo:hr().email("Formato de correo inválido"),StatusInvitacion:Up(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),ZE=Vp({titulo:hr().min(1,"El campo Título es requerido.").refine(e=>!e.startsWith(" "),{message:"El título no puede empezar con un espacio en blanco"}),fechaInicio:hr().min(1,"El campo fecha inicio es requerido."),horaInicio:hr().min(1,"La hora de inicio es requerida.").regex(Gp,{message:"Formato inválido"}),horaFin:hr().min(1,"La hora fin es requerida.").regex(Gp,{message:"Formato inválido"}),todoElDia:$i(),fechaFin:hr().optional(),showEndDate:$i().optional(),horaInicio2:hr().optional(),TodoElDia2:$i().optional(),client:hr().nullable().optional(),repetir:hr().optional(),link:hr().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(ME("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:hr().optional(),invitados:Fp(qE).optional().default([]),color:hr().optional(),solID:Ni().nullable().optional(),disID:Ni().nullable().optional()}).refine(e=>e.showEndDate?e.fechaFin&&e.fechaFin.length>0:!0,{message:"La fecha de fin es requerida.",path:["fechaFin"]}).refine(e=>e.fechaFin!==void 0?!!e.fechaFin&&!!e.horaInicio2:!0,{message:"La hora de fin son requeridas.",path:["horaInicio2"]}).refine(e=>{if(e.todoElDia||!e.fechaInicio||!e.horaInicio||!e.fechaFin||!e.horaInicio2)return!0;const r=Kp(e.fechaInicio,e.horaInicio),t=Kp(e.fechaFin,e.horaFin);return!r||!t||!x.isValid(r)||!x.isValid(t)?!0:!(x.isBefore(t,r)&&!x.isSameDay(t,r)||x.isSameDay(r,t)&&x.isBefore(t,r))},{message:"",path:["horaFin"]}),Qp=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("path",{fill:"#333",d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12"}),G.createElement("path",{fill:"#fff",d:"M16.703 7.275c.52.52.541 1.345.046 1.84l-2.874 2.874 2.874 2.873c.495.496.475 1.32-.046 1.841-.52.52-1.344.54-1.84.045l-2.873-2.873-2.874 2.873c-.496.496-1.32.475-1.84-.045-.521-.521-.541-1.345-.046-1.84l2.874-2.874L7.23 9.116c-.495-.496-.475-1.32.045-1.84.521-.521 1.345-.542 1.841-.046l2.874 2.873 2.873-2.873c.496-.496 1.32-.476 1.84.045"})),GE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M7.288%2022.986h-.147a6.2%206.2%200%200%201-4.28-1.85c-2.404-2.404-2.478-6.24-.16-8.557L4.28%2011a1.228%201.228%200%201%201%201.739%201.739L4.44%2014.317c-1.356%201.357-1.282%203.626.16%205.068a3.82%203.82%200%200%200%202.602%201.135c.95%200%201.825-.32%202.479-.974l1.578-1.579a1.23%201.23%200%200%201%201.739%200c.48.481.48%201.258%200%201.739l-1.579%201.578c-1.097%201.098-2.552%201.69-4.13%201.69zM17.98%2012.998a1.23%201.23%200%200%201%200-1.739l1.578-1.578c.654-.654.986-1.53.974-2.466a3.78%203.78%200%200%200-1.134-2.602c-1.443-1.443-3.712-1.517-5.068-.16L12.75%206.03c-.48.48-1.258.48-1.739%200a1.23%201.23%200%200%201%200-1.739l1.579-1.578c2.318-2.319%206.153-2.245%208.558.16a6.23%206.23%200%200%201%201.85%204.279%205.84%205.84%200%200%201-1.69%204.279l-1.578%201.578c-.481.481-1.258.481-1.74%200z'/%3e%3cpath%20d='M14.172%208.11%208.07%2014.214a1.233%201.233%200%200%200%201.743%201.744l6.104-6.104a1.233%201.233%200%201%200-1.744-1.744'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",KE=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("g",{clipPath:"url(#a)"},G.createElement("path",{fill:"#404756",d:"M21.24 5.72a2.98 2.98 0 0 0-2.97-2.96l-5.19-.06c-1.06-.03-2.12.41-2.87 1.17l-7.49 7.49c-.66.66-1.03 1.54-1.03 2.47s.36 1.81 1.03 2.47l4.97 4.97a3.5 3.5 0 0 0 2.47 1.02c.89 0 1.79-.34 2.47-1.02l7.49-7.49c.76-.76 1.18-1.81 1.17-2.88l-.06-5.19zm-4.2 4.43c-.44.44-1.02.66-1.6.66a2.256 2.256 0 1 1 0-4.51 2.256 2.256 0 0 1 1.6 3.85"})),G.createElement("defs",null,G.createElement("clipPath",{id:"a"},G.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),Xp="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",QE=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},G.createElement("path",{d:"M13.085 7.331a1.096 1.096 0 1 0-2.192 0v9.316a1.096 1.096 0 0 0 2.192 0z"}),G.createElement("path",{d:"M16.647 10.893H7.33a1.096 1.096 0 1 0 0 2.192h9.316a1.096 1.096 0 0 0 0-2.192"}),G.createElement("path",{d:"M12 24C5.38 24 0 18.608 0 12S5.38 0 12 0s12 5.38 12 12-5.38 12-12 12m0-21.808c-5.414 0-9.808 4.394-9.808 9.808S6.586 21.808 12 21.808s9.808-4.394 9.808-9.808S17.403 2.192 12 2.192"})),G.createElement("defs",null,G.createElement("clipPath",{id:"a"},G.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),XE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cg%20fill='%23404756'%20clip-path='url(%23a)'%3e%3cpath%20d='M13.789%2017H3.21C2.542%2017%202%2017.56%202%2018.25s.542%201.25%201.211%201.25H13.79c.669%200%201.211-.56%201.211-1.25S14.458%2017%2013.789%2017M20.718%204H3.282C2.574%204%202%204.56%202%205.25S2.574%206.5%203.282%206.5h17.436C21.426%206.5%2022%205.94%2022%205.25S21.426%204%2020.718%204M20.718%2010.5H3.282C2.574%2010.5%202%2011.06%202%2011.75S2.574%2013%203.282%2013h17.436c.708%200%201.282-.56%201.282-1.25s-.574-1.25-1.282-1.25'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h24v24H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",JE=e=>G.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},G.createElement("path",{fill:"#2571D6",fillRule:"evenodd",d:"M17.333 11a6.34 6.34 0 0 1 6.334 6.333 6.34 6.34 0 0 1-6.334 6.334c-3.493 0-6.333-2.846-6.333-6.334A6.343 6.343 0 0 1 17.333 11m-.005 2.37c-.437 0-.79.338-.79.754v2.412h-2.414c-.416 0-.754.355-.754.792s.338.792.754.792h2.413v2.412c0 .416.354.754.791.754s.792-.338.792-.754V18.12h2.413c.416 0 .754-.355.754-.792s-.338-.792-.754-.792H18.12v-2.412c0-.416-.355-.754-.792-.754",clipRule:"evenodd"}),G.createElement("path",{fill:"#2571D6",d:"M11.12 12.297a7.97 7.97 0 0 0-1.787 5.036c0 1.763.571 3.392 1.537 4.714H3.044c-.84 0-1.523-.682-1.523-1.523 0-4.544 3.683-8.227 8.217-8.227zM10.995.139c2.925 0 5.3 2.376 5.3 5.3s-2.376 5.3-5.3 5.3v-.01a5.303 5.303 0 0 1-5.3-5.3 5.295 5.295 0 0 1 5.3-5.29"}));var Lo={},Jp;function eD(){if(Jp)return Lo;Jp=1;var e=ct();Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.default=void 0;var r=e(ht()),t=dt();return Lo.default=(0,r.default)((0,t.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Lo}var tD=eD();const eh=at(tD);var zo={},th;function rD(){if(th)return zo;th=1;var e=ct();Object.defineProperty(zo,"__esModule",{value:!0}),zo.default=void 0;var r=e(ht()),t=dt();return zo.default=(0,r.default)((0,t.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),zo}var nD=rD();const oD=at(nD),rh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",nh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",sD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",iD=e=>{const r=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],t=e.charCodeAt(0)%r.length;return r[t]},aD=(e,r,t,n,o)=>{if(r)return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[l.jsx("img",{src:nh,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return l.jsx(m.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return l.jsx(m.Button,{onClick:()=>{n(t),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"});case"CONFIRMADA":return l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[l.jsx("img",{src:sD,width:15,style:{marginRight:"5px"}}),l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function cD({open:e,handleClose:r,guests:t,onReenviar:n}){const o=t.filter(u=>u.estatus==="CONFIRMADA"||u.isHost),s=t.filter(u=>u.estatus==="PENDIENTE"&&!u.isHost),i=t.filter(u=>u.estatus==="RECHAZADA"&&!u.isHost),a=u=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[l.jsxs(m.Box,{sx:{position:"relative",mr:2},children:[l.jsx(m.Avatar,{sx:{bgcolor:iD(u.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:u.iniciales}),u.estatus==="PENDIENTE"&&l.jsx(m.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:l.jsx(ic,{sx:{fontSize:14,color:"#546E7A"}})})]}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:u.nombre}),aD(u.estatus,u.isHost,u.usrID,n,r)]},u.nombre),c=({title:u,count:d,badgeColor:f})=>l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:u}),f&&l.jsx(m.Box,{sx:{ml:1,bgcolor:f,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:d})]});return l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[l.jsxs(m.Box,{sx:{p:"16px 8px"},children:[l.jsx(m.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),l.jsx(m.Button,{onClick:r,startIcon:l.jsx("img",{src:rh,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),l.jsx(m.IconButton,{onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Rr,{})})]}),l.jsxs(m.DialogContent,{sx:{p:2},children:[s.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(c,{title:"Invitados",count:s.length}),s.map(a)]})]}),o.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{sx:{mb:3},children:[l.jsx(c,{title:"Confirmados",count:o.length,badgeColor:"#1976D2"}),o.map(a)]})]}),i.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(m.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(m.Box,{children:[l.jsx(c,{title:"No asistirán",count:i.length,badgeColor:"#1976D2"}),i.map(a)]})]})]})]})}const lD=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function uD({guests:e,onReenviar:r}){const[t,n]=v.useState(!1),o=()=>n(!0),s=()=>n(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[l.jsx(m.AvatarGroup,{max:6,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((i,a)=>l.jsx(m.Tooltip,{title:i.nombre,arrow:!0,placement:"top",children:l.jsx(m.Box,{children:l.jsx(m.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:i.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:l.jsx(m.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:l.jsx("img",{src:Sf})}),children:l.jsx(m.Avatar,{sx:{bgcolor:lD(i.iniciales)},children:i.iniciales})})})},a))}),l.jsx(m.Box,{sx:{flexGrow:1}}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:o,children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),l.jsx(oD,{sx:{fontSize:18,ml:.5}})]})]}),l.jsx(cD,{open:t,handleClose:s,guests:e,onReenviar:r})]})}var Bo={},oh;function dD(){if(oh)return Bo;oh=1;var e=ct();Object.defineProperty(Bo,"__esModule",{value:!0}),Bo.default=void 0;var r=e(ht()),t=dt();return Bo.default=(0,r.default)((0,t.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),Bo}var fD=dD();const pD=at(fD),hD=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),sh=e=>{const[r,t]=e.split(":"),n=parseInt(r),o=n>=12?"pm":"am";return`${n%12||12}:${t} ${o}`},ih=e=>e.split(":").slice(0,2).join(":"),mD=({slot:e,onClick:r})=>l.jsxs(m.Box,{onClick:r,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[l.jsx(m.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:l.jsx(m.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:hD(e.Fecha)})}),l.jsxs(m.Box,{sx:{py:1.5},children:[l.jsx(m.Typography,{sx:{fontSize:"12px"},children:sh(e.HoraInicio)}),l.jsxs(m.Typography,{sx:{fontSize:"12px"},children:["a ",sh(e.HoraFin)]})]})]});function gD({open:e,handleClose:r,suggestions:t,onSelectSlot:n}){const[o,s]=v.useState(16),a=t.slice(0,o).reduce((d,f)=>{const h=f.Fecha;return d[h]||(d[h]=[]),d[h].push(f),d},{}),c=Object.keys(a),u=d=>{const f={...d,HoraInicio:ih(d.HoraInicio),HoraFin:ih(d.HoraFin)};n(f),r()};return v.useEffect(()=>{s(16)},[e]),l.jsxs(m.Dialog,{open:e,onClose:r,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[l.jsxs(m.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),l.jsx(m.Box,{children:l.jsx(m.Button,{startIcon:l.jsx("img",{src:rh,width:20}),onClick:r,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),l.jsx(m.Divider,{}),l.jsx(m.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?l.jsx(m.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):l.jsxs(l.Fragment,{children:[c.map((d,f)=>l.jsxs(m.Box,{sx:{mb:3},children:[l.jsxs(m.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:f===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[f===0?"Mismo día ":"Próximas fechas",f===0&&l.jsx("img",{src:nh,width:15,style:{marginLeft:5}})]}),l.jsx(m.Grid,{container:!0,spacing:2,children:a[d].map((h,y)=>l.jsx(m.Grid,{item:!0,xs:6,sm:3,children:l.jsx(mD,{slot:h,onClick:()=>u(h)})},`${d}-${y}`))})]},d)),t.length>o&&l.jsx(m.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:l.jsx(m.Button,{onClick:()=>s(d=>d+12),startIcon:l.jsx(pD,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const vD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",yD=e=>{const r=["brown","purple","orange","blue","green","yellow","red","grey"],t=e.charCodeAt(0)%r.length;return r[t]};function bD({onSelectGuest:e,availableSuggestions:r,onInputTextChange:t}){const[n,o]=v.useState(null),[s,i]=v.useState(""),a=(u,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(u,d)=>{i(d),t(d)};return l.jsx(m.Autocomplete,{options:r,value:n,inputValue:s,getOptionLabel:u=>u.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(u,d)=>u.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:u=>l.jsx(m.TextField,{...u,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...u.InputProps,startAdornment:l.jsx(m.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:l.jsx("img",{src:vD,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(u,d)=>v.createElement(m.Box,{component:"li",...u,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},l.jsx(m.Avatar,{sx:{bgcolor:yD(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),l.jsx(m.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var Fo={},ah;function xD(){if(ah)return Fo;ah=1;var e=ct();Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.default=void 0;var r=e(ht()),t=dt();return Fo.default=(0,r.default)((0,t.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),Fo}var wD=xD();const _D=at(wD);var Vo={},ch;function SD(){if(ch)return Vo;ch=1;var e=ct();Object.defineProperty(Vo,"__esModule",{value:!0}),Vo.default=void 0;var r=e(ht()),t=dt();return Vo.default=(0,r.default)((0,t.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"ErrorOutline"),Vo}var CD=SD();const Mc=at(CD),ED=e=>e.tieneConflicto?{icon:l.jsx(Mc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:l.jsx(_D,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},DD=e=>{const r=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],t=e.charCodeAt(0)%r.length;return r[t]};function kD({guests:e,conflictCount:r,onViewSuggestions:t,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return l.jsxs(m.Box,{sx:{p:1},children:[l.jsx(m.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=ED(i),u=DD(i.iniciales);return l.jsx(m.Chip,{label:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[l.jsx(m.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)}),l.jsx(m.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:l.jsx(m.Avatar,{sx:{bgcolor:u,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:i.iniciales}),sx:{backgroundColor:c.fillColor,height:"32px",borderRadius:"100px",border:"1px solid rgba(0,0,0,0.04)",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{backgroundColor:c.fillColor,filter:"brightness(0.97)","& .status-icon-wrapper":{display:"none"},"& .MuiChip-deleteIcon":{display:"inline-block"}},"& .MuiChip-label":{paddingLeft:"4px",paddingRight:"8px",width:"100%",display:"flex"},"& .MuiChip-deleteIcon":{display:"none",fontSize:"18px",color:"#000000",ml:"auto",mr:"4px","&:hover":{color:"#000000"}}},onClick:()=>console.log(`Ver perfil de ${i.nombre}`),onDelete:o(i.nombre)},a)})}),r>0&&l.jsxs(m.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[l.jsx(Mc,{sx:{mr:1,fontSize:22}}),l.jsxs(m.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",l.jsxs("strong",{children:[r," invitado"]}),r!==1?"s":""]})]}),l.jsx(m.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),t()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function AD(e,r){const[t,n]=v.useState(e);return v.useEffect(()=>{const o=setTimeout(()=>{n(e)},r);return()=>{clearTimeout(o)}},[e,r]),t}const TD={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:{xs:"90%",sm:450,md:500},bgcolor:"background.paper",boxShadow:24,p:{xs:2,sm:3},borderRadius:2,maxHeight:"90vh",overflowY:"auto"},lh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],MD=()=>{const e=[];for(let r=0;r<24;r++)for(let t=0;t<60;t+=15){const n=r.toString().padStart(2,"0"),o=t.toString().padStart(2,"0");e.push(`${n}:${o}`)}return e},uh=[],Vn=MD(),Uo=(e,r)=>{if(!e||!r)return null;const t=e.split("-");if(t.length!==3)return null;const n=parseInt(t[0],10),o=parseInt(t[1],10)-1,s=parseInt(t[2],10),i=r.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),u=new Date(s,o,n,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},ID=({isVisible:e,onClose:r,onSave:t,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c,onReenviar:u})=>{const[d,f]=v.useState(!1),[h,y]=v.useState(!1),g=x.format(new Date,"yyyy-MM-dd"),[p,b]=v.useState(""),[_,S]=v.useState([]),[D,C]=v.useState(!1),w=sc(),[F,E]=v.useState([]),[T,I]=v.useState(""),[M,U]=v.useState(uh),[q,V]=v.useState(!1),[H,re]=v.useState(""),[W,$]=v.useState(!1),[ie,ue]=v.useState([]),[N,ee]=v.useState([]),xe=AD(H,300),_e=M.filter(Z=>Z.tieneConflicto).length,{control:fe,handleSubmit:ae,reset:le,formState:{errors:X,isValid:we},watch:ye,setValue:K}=Xf({resolver:jC(ZE),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"HH:mm"),horaFin:x.format(x.addHours(new Date,1),"HH:mm"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[]},mode:"onChange"}),Ie=ye("fechaInicio"),P=ye("fechaFin"),Be=ye("todoElDia");v.useEffect(()=>{if(p.trim()===""||!i||!c||!a){S([]),E([]),K("solID",null),C(!1),I("");return}C(!0);const Z=setTimeout(()=>{w.getClients(p,c,a,i).then(de=>{if(C(!1),de){const Me=de.map(Pe=>Pe.solID);E([...new Set(Me)])}else E([]);const De=Array.from(new Map(de.map(Me=>[Me.nombreCliente,Me])).values());if(De.length>0)S(De),I("");else if(s?.client&&s.solID!==null){const Me=[{solID:s.solID,nombreCliente:s.client}];S(Me),I("Sin resultados")}else S([]),I("Sin resultados")}).catch(de=>{console.error("Error al buscar clientes:",de),C(!1)})},500);return()=>clearTimeout(Z)},[p,i,c,a]),v.useEffect(()=>{if(Ie&&P){const Z=new Date(Ie),de=new Date(P);(Z===de||Z>de)&&K("fechaFin",Ie)}},[Ie,P,K]),v.useEffect(()=>{Ie&&K("fechaFin",Ie)},[Ie]),v.useEffect(()=>{K("showEndDate",d)},[d,K]),v.useEffect(()=>{if(console.log("initialEvent",s),s){const Z=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(f(!Z),K("titulo",s?.titulo),K("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),K("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),K("horaInicio",x.format(s.fechaInicio,"HH:mm")),K("horaFin",x.format(s.fechaFin,"HH:mm")),K("horaInicio2",x.format(s.fechaFin,"HH:mm")),K("descripcion",s.descripcion),K("link",s.link),K("repetir","false"),K("color",s.color),K("todoElDia",s.todoElDia),K("solID",s.solID),K("client",s.client),s.invitados&&s.invitados.length>0){const de=(s?.invitados||[]).map(Pe=>{const Nt=Pe.usrNombre?.trim()||"",Q=Nt.split(/\s+/),ke=Q.length>1?(Q[0][0]+Q[1][0]).toUpperCase():Nt.substring(0,2).toUpperCase();return{nombre:Pe.usrNombre||"Sin nombre",correo:Pe.correo||"",iniciales:ke||"--",usrID:Pe.usuarioID??null,isHost:Pe.esOrganizador||!1,estatus:Pe.statusInvitacion,tieneConflicto:!1,disID:Pe.disID}}),De=localStorage.getItem("nombreAnfitrion")||"Anfitrión",Me={nombre:De,correo:"",iniciales:De.substring(0,2).toUpperCase(),usrID:i??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};U([Me,...de])}else U(uh);s.solID?y(!0):y(!1)}else{const Z=o||new Date,de=new Date,De=new Date(Z.getFullYear(),Z.getMonth(),Z.getDate(),de.getHours(),de.getMinutes()),Me=x.addHours(De,1);le({titulo:"",fechaInicio:x.format(De,"yyyy-MM-dd"),horaInicio:x.format(De,"HH:mm"),fechaFin:x.format(Me,"yyyy-MM-dd"),horaFin:x.format(Me,"HH:mm"),horaInicio2:x.format(Me,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:lh[0],solID:null}),f(!1),y(!1)}},[s,e,o]);const Qe=Z=>({UsuarioID:Z.usrID??null,Correo:Z.correo,EsOrganizador:Z.usrID==i,StatusInvitacion:Z.estatus,disID:c??null}),Fe=ae(Z=>{const de=M.map(Me=>Qe(Me)),De={...Z,invitados:de};t(De,s?.eventoID),r(),le(),f(!1)},Z=>{console.log("Errores de validación:",Z)});v.useEffect(()=>{Be&&(K("horaInicio","00:00"),K("horaFin","23:59"))},[Be,K,ye]);const Le=()=>{const Z=ye("fechaInicio");if(Z){const de=new Date(`${Z}T00:00:00`),De=x.addDays(de,1);K("fechaFin",x.format(De,"yyyy-MM-dd"))}f(!0)},We=ye("fechaInicio"),Xe=ye("horaInicio"),ft=ye("fechaFin"),k=ye("horaFin"),[O,B]=v.useState(null),[ce,se]=v.useState(null);v.useEffect(()=>{(O===null||O!==Xe)&&B(Xe)},[Xe,O]),v.useEffect(()=>{(ce===null||ce!==k)&&se(k??"")},[k,ce]);const j=ye("todoElDia");v.useEffect(()=>{if(j||!Xe||!k||!We||!ft)return;const Z=Uo(We,Xe),de=Uo(ft,k);if(!Z||!de||!x.isValid(Z)||!x.isValid(de))return;const De=x.isSameDay(Z,de),Me=De&&(x.isAfter(Z,de)||Z.getTime()===de.getTime()),Pe=x.isBefore(de,Z)&&!De;(Me||Pe)&&(K("horaFin",""),se(""))},[Xe,We]);const oe=v.useMemo(()=>{if(!Xe||!We)return Vn;const Z=Uo(We,Xe),de=Uo(ft,"00:00");return!Z||!de||!x.isValid(Z)||!x.isValid(de)||x.isBefore(de,Z)&&!x.isSameDay(de,Z)?Vn:x.isSameDay(Z,de)?Vn.filter(De=>{const Me=Uo(ft,De);return Me&&x.isAfter(Me,Z)}):(x.isAfter(de,Z),Vn)},[Xe,We,ft]),Se=v.useMemo(()=>Vn,[]),je=async Z=>{const de=M.some($t=>$t.correo===Z.correo);if($(!0),de)return;const De=c,Me=Z.correo,Pe=Z.usrID,Nt=We,Q=Xe,ke=k;if(!De||!Me||!Nt||!Q||!ke){U($t=>[...$t,{...Z,status:"pending",isHost:!1,hasConflict:!1,usrID:Pe,name:Z.nombre}]);return}let Ee;try{Ee=await w.VerificarConflicto(De,Me,Nt,Q+":00",ke+":00")}catch{Ee={tieneConflicto:!1,usrMail:Z.correo}}const Re=Array.isArray(Ee)?Ee[0]:Ee,Sr={...Z,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(Re.tieneConflicto).toLowerCase()==="true"};if(Sr.tieneConflicto){const $t=await w.getDisponibilidadUsuario(c,Me,Nt,"60");ue($t)}U($t=>[...$t,Sr])},R=Z=>{U(de=>de.filter(De=>De.nombre!==Z))},te=()=>{V(!1)},be=Z=>{const Me=(Z.usrNombre??"").split(" ").map(Pe=>Pe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:Z.usrNombre??"",correo:Z.usrMail??"",iniciales:Me,usrID:Z.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};v.useEffect(()=>{xe.length>2&&c?(async()=>{const De=(await w.getUsuariosInvitados(c,xe)).map(be).filter(Me=>Me.usrID!==i&&!M.some(Pe=>Pe.correo===Me.correo));ee(De)})():ee([])},[xe,M]);const qe=Z=>{re(Z)},Ct=Z=>{const{Fecha:de,HoraInicio:De,HoraFin:Me}=Z,Pe=Nt=>Nt.split(":").slice(0,2).join(":");K("fechaInicio",de),K("fechaFin",de),K("horaInicio",Pe(De)),K("horaFin",Pe(Me)),f(!1),te(),console.log("Formulario actualizado con sugerencia:",{Fecha:de,HoraInicio:De,HoraFin:Me})};return l.jsx(l.Fragment,{children:l.jsx(m.Modal,{open:e,onClose:r,children:l.jsx("form",{onSubmit:Fe,children:l.jsxs(m.Box,{sx:TD,children:[l.jsx(m.IconButton,{"aria-label":"close",onClick:r,sx:{position:"absolute",right:8,top:12},children:l.jsx(Rr,{})}),l.jsx(m.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent||!s?.esOrganizador?l.jsx(l.Fragment,{children:s?.titulo||"Evento de Google"}):s?"Editar evento":"Agregar evento"}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(ir,{name:"titulo",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!X.titulo,helperText:X.titulo?.message,inputProps:{maxLength:100},sx:{"& .MuiInputLabel-root.Mui-focused":{color:"black"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"black"},"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}})})})}),l.jsxs("div",{className:`row g-2 ${d?"mb-1":"mb-2"}`,children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(ir,{name:"fechaInicio",control:fe,render:({field:Z})=>l.jsx(m.TextField,{fullWidth:!0,...Z,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!X.fechaInicio,helperText:X.fechaInicio?.message})})}),d?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-10 col-md-4",children:l.jsx(ir,{name:"fechaFin",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Ie||g},error:!!X.fechaFin,helperText:X.fechaFin?.message})})}),!s&&l.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:l.jsx(m.IconButton,{onClick:()=>f(!1),sx:{fontSize:18},children:l.jsx(Qp,{})})})]}):l.jsx("div",{className:"col-md-8"})]}),d&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12 d-flex justify-content-center",children:l.jsx(eh,{sx:{color:"#757575",my:1}})})}),l.jsxs("div",{className:"row g-2 mb-2",children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(ir,{name:"horaInicio",control:fe,render:({field:{onChange:Z,value:de,...De}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:Se,value:de||"",onChange:(Me,Pe)=>Z(Pe||""),onInputChange:(Me,Pe)=>Z(Pe),renderInput:Me=>l.jsx(m.TextField,{...Me,...De,size:"small",error:!!X.horaInicio,helperText:X.horaInicio?.message,InputProps:{...Me.InputProps,endAdornment:l.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(ic,{})})}}),disabled:j})})}),!d&&l.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:X.horaInicio?"5px":"0px"},children:l.jsx(eh,{sx:{color:"#757575"}})}),d&&l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(ir,{name:"horaFin",control:fe,render:({field:{onChange:Z,value:de,...De}})=>l.jsx(m.Autocomplete,{freeSolo:!0,options:oe,value:de||"",onChange:(Me,Pe)=>Z(Pe||""),onInputChange:(Me,Pe)=>Z(Pe),renderInput:Me=>l.jsx(m.TextField,{...Me,...De,size:"small",error:!!X.horaFin,helperText:X.horaFin?.message,InputProps:{...Me.InputProps,endAdornment:l.jsx(m.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(ic,{})})}}),disabled:j})})}),!d&&l.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:l.jsx(ir,{name:"todoElDia",control:fe,render:({field:Z})=>l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:Z.value,onChange:de=>Z.onChange(de.target.checked)}),label:l.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!d&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Button,{onClick:Le,size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(QE,{})," Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&l.jsx("div",{className:"row mb-2",children:l.jsxs("div",{className:"col-12",children:[!h&&l.jsxs(m.Button,{onClick:()=>y(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(JE,{})," Vincular cliente"]}),h&&l.jsxs("div",{className:"row g-2",children:[l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(ir,{name:"client",control:fe,render:({field:Z})=>l.jsx(m.Autocomplete,{options:_,loading:D,loadingText:"Buscando coincidencias...",getOptionLabel:de=>de.nombreCliente?.trim()||"",value:_.find(de=>de.nombreCliente===Z.value)||(Z.value&&typeof Z.value=="string"?{solID:-1,nombreCliente:Z.value}:null),noOptionsText:T,onInputChange:(de,De)=>{b(De)},onChange:(de,De)=>{Z.onChange(De?De.nombreCliente:"")},renderInput:de=>l.jsx(m.TextField,{...de,placeholder:"Buscar cliente...",size:"small",InputProps:{...de.InputProps,startAdornment:l.jsx("img",{src:Md,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:l.jsxs(l.Fragment,{children:[D?l.jsx(m.CircularProgress,{color:"inherit",size:20}):null,de.InputProps.endAdornment]})}})})})}),l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(ir,{name:"solID",control:fe,render:({field:Z})=>l.jsx(m.Autocomplete,{options:F,noOptionsText:"Sin resultados",getOptionLabel:de=>de.toString(),value:Z.value??null,onChange:(de,De)=>Z.onChange(De),renderInput:de=>l.jsx(m.TextField,{...de,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!_.length})})}),l.jsx("div",{className:"col-2 d-flex align-items-center",children:l.jsx(m.IconButton,{onClick:()=>y(!1),sx:{fontSize:18},children:l.jsx(Qp,{})})})]})]})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(ir,{name:"link",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!X.link,helperText:X.link?.message,InputProps:{startAdornment:l.jsx("img",{src:GE,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(ir,{name:"descripcion",control:fe,render:({field:Z})=>l.jsx(m.TextField,{...Z,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:l.jsx("img",{src:XE,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(bD,{onSelectGuest:je,availableSuggestions:N,onInputTextChange:qe})})}),W&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(kD,{guests:M,conflictCount:_e,onViewSuggestions:()=>V(!0),onDeleteGuest:R})})}),s?.invitados&&s?.invitados?.length>0&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(m.Box,{children:l.jsx(uD,{guests:M,onReenviar:u})})})}),l.jsx(gD,{open:q,handleClose:te,suggestions:ie,onSelectSlot:Ct}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[l.jsx(KE,{}),lh.map(Z=>l.jsx(ir,{name:"color",control:fe,render:({field:de})=>l.jsx(m.IconButton,{onClick:()=>de.onChange(Z),sx:{width:24,height:24,borderRadius:"50%",bgcolor:Z,border:de.value===Z?"2px solid":"none",borderColor:de.value===Z?"primary.main":"transparent"}})},Z))]})})}),l.jsx("div",{className:"row",children:l.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&l.jsx(m.Button,{onClick:n,variant:"outlined",startIcon:l.jsx("img",{src:Xp,width:15}),hidden:s?s?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),l.jsx(m.Button,{onClick:r,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),l.jsx(m.Button,{onClick:Fe,variant:"contained",disabled:!we,hidden:s?s?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]})})})})},OD={position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:450,bgcolor:"background.paper",boxShadow:24,p:2,borderRadius:2,maxHeight:"80vh",overflowY:"auto"},jD=({isOpen:e,onClose:r,events:t,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),r()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return l.jsx(m.Modal,{open:e,onClose:r,children:l.jsxs(m.Box,{sx:OD,children:[l.jsxs(m.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[l.jsxs(m.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Rr,{})})]}),l.jsx(m.Divider,{}),l.jsx(m.List,{sx:{mt:1},children:t.map(a=>{const c=i(a);return l.jsx(m.ListItem,{disablePadding:!0,sx:{mb:1},children:l.jsx(m.ListItemButton,{onClick:()=>s(a),sx:{py:1,borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.02)",borderLeft:`5px solid ${c?.borderColor}`,"&:hover":{backgroundColor:"rgba(0,0,0,0.04)"}},children:l.jsxs(m.Box,{sx:{flexGrow:1},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[l.jsx(m.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),l.jsx(m.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),l.jsx(m.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"hh:mm aa").toLowerCase()} - ${x.format(a.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},a.eventoID)})})]})})};var Wo={},dh;function PD(){if(dh)return Wo;dh=1;var e=ct();Object.defineProperty(Wo,"__esModule",{value:!0}),Wo.default=void 0;var r=e(ht()),t=dt();return Wo.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error"),Wo}var RD=PD();const ND=at(RD);var Ho={},fh;function $D(){if(fh)return Ho;fh=1;var e=ct();Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.default=void 0;var r=e(ht()),t=dt();return Ho.default=(0,r.default)((0,t.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-6h2zm0-8h-2V7h2z"}),"Info"),Ho}var LD=$D();const zD=at(LD),BD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M19.378%204.405a1.813%201.813%200%201%201%202.565%202.565L9.571%2019.342a1.813%201.813%200%200%201-2.565%200l-4.949-4.949a1.814%201.814%200%200%201%202.428-2.69l.137.126%203.666%203.666z'/%3e%3c/svg%3e",FD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",Ic=v.forwardRef(({id:e,message:r,variant:t},n)=>{const{closeSnackbar:o}=ss.useSnackbar(),s={success:{color:"#fff",icon:l.jsx("img",{width:25,src:BD,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:l.jsx(ND,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:l.jsx(zD,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:l.jsx("img",{src:Xp,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:l.jsx("img",{src:FD,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[t]||s.info;return l.jsx(ss.SnackbarContent,{ref:n,children:l.jsxs(m.Box,{sx:{backgroundColor:"white",color:"#333",padding:"8px 16px",borderRadius:"8px",boxShadow:"0 3px 10px rgba(0,0,0,0.2)",display:"flex",alignItems:"center",width:{xs:"90%",sm:"auto"},minWidth:"300px",borderLeft:`5px solid ${i.color}`},children:[l.jsx(m.Box,{sx:{mr:1.5},children:i.icon}),l.jsx(m.Typography,{variant:"body2",sx:{flexGrow:1},children:r}),l.jsx(m.IconButton,{size:"small",onClick:()=>o(e),children:l.jsx(Rr,{fontSize:"small"})})]})})}),ph=v.createContext(void 0),VD=({children:e})=>{const[r,t]=v.useState([]),[n,o]=v.useState([]),[s,i]=v.useState(!1);return l.jsx(ph.Provider,{value:{googleEvents:r,setGoogleEvents:t,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},UD=()=>{const e=v.useContext(ph);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},WD=(e,r,t)=>{const n=(i,a)=>a?new Date(a):i?new Date(i.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let s=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&s.setDate(s.getDate()-1),{eventoID:Math.abs(HD(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:s,todoElDia:!!(e.start.date&&!e.start.dateTime),color:"#4285F4C",hasVideoCall:!!e.conferenceData,link:e.htmlLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!0}};function HD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}function YD(e){let r=0;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);r=(r<<5)-r+n,r|=0}return r}const qD=(e,r,t)=>{const n=new Date(e.start.dateTime);let o=new Date(e.end.dateTime);return e.isAllDay&&o.setDate(o.getDate()-1),{eventoID:Math.abs(YD(e.id)),titulo:e?.summary||"(Sin título)",descripcion:e.body?.content||"",fechaInicio:n,fechaFin:o,todoElDia:e.isAllDay,color:"#0078D4",hasVideoCall:!!e.onlineMeetingUrl,link:e.webLink,repetir:void 0,solID:null,disID:r,client:null,usrID:t,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},hh="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='48'%20height='49'%20fill='none'%3e%3cpath%20fill='%23E40B1C'%20d='M34.559%2048.077c-7.413%200-13.44-6.039-13.44-13.44s6.027-13.44%2013.44-13.44%2013.44%206.027%2013.44%2013.44c0%207.414-6.027%2013.44-13.44%2013.44'/%3e%3cpath%20fill='%23fff'%20d='M39.827%2029.346c.583.583.605%201.505.05%202.06l-3.218%203.219%203.219%203.218c.555.556.532%201.48-.051%202.062-.584.583-1.506.605-2.062.05l-3.218-3.218-3.218%203.218c-.556.555-1.478.533-2.061-.05s-.606-1.506-.05-2.062l3.217-3.218-3.218-3.218c-.555-.555-.533-1.478.05-2.061.583-.584%201.507-.606%202.063-.05l3.217%203.217%203.218-3.218c.556-.555%201.478-.533%202.062.05'/%3e%3cpath%20fill='%23404756'%20d='M30.367.078c1.112%200%202.001.868%202.001%201.954v1.195h.979c4.913%200%208.892%203.887%208.892%208.686v9.237a15.4%2015.4%200%200%200-4.424-1.691v-1.312H4.468V33.63c0%202.389%202%204.343%204.446%204.343H19.4a15.4%2015.4%200%200%200%201.676%204.343H8.892C3.979%2042.317%200%2038.43%200%2033.631V11.913c0-4.8%203.979-8.686%208.892-8.686h1V2.032c0-1.086.89-1.954%202.002-1.954s2%20.868%202%201.954v1.195h14.473V2.032c0-1.085.889-1.954%202-1.954'/%3e%3c/svg%3e",ZD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",GD=({open:e,onClose:r,onConfirm:t,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>l.jsxs(m.Dialog,{open:e,onClose:r,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[l.jsx(m.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Rr,{fontSize:"small"})})}),l.jsxs(m.DialogContent,{sx:{textAlign:"center",pt:0},children:[l.jsx(m.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),l.jsx(m.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),l.jsx(m.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),l.jsxs(m.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[l.jsx(m.Button,{variant:"outlined",onClick:r,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),l.jsxs(m.Button,{variant:"contained",onClick:t,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&l.jsx("img",{src:ZD,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),KD=({userId:e,leads30Days:r,leads90Days:t,disId:n,masNombreBD:o,usrNombre:s})=>{const[i,a]=v.useState(new Date),[c,u]=v.useState([]),[d,f]=v.useState(!1),[h,y]=v.useState(null),[g,p]=v.useState(!1),[b,_]=v.useState(null),[S,D]=v.useState([]),{enqueueSnackbar:C}=ss.useSnackbar(),w=sc(),F=mi(),E=nc(),[T,I]=v.useState(!1),[M,U]=v.useState([]),[q,V]=v.useState(null),{session:H,sessionoutlook:re}=Ua(),{googleEvents:W,setGoogleEvents:$,outlookEvents:ie,setOutlookEvents:ue}=UD(),[N,ee]=v.useState([]),[xe,_e]=v.useState([]),[fe,ae]=v.useState([]),[le,X]=v.useState(!1),[we,ye]=v.useState([]),[K,Ie]=v.useState(),P=(Q,ke)=>{U(Q),V(ke),I(!0)},Be=async()=>{if(e===void 0)return;const Q=await w.getNotificacionesXUsuario(e,!1);s?localStorage.setItem("nombreAnfitrion",s):localStorage.setItem("nombreAnfitrion","Anfitrion"),ye(Q)};v.useEffect(()=>{const Q=new Date,ke=x.startOfDay(Q),Ee=x.endOfDay(x.addDays(ke,6)),Re={start:ke,end:Ee},Sr=c.filter($t=>{const Wr={start:$t.fechaInicio,end:$t.fechaFin};return xd(Wr,Re)}).sort(($t,Wr)=>$t.fechaInicio.getTime()-Wr.fechaInicio.getTime());D(Sr)},[c]),v.useEffect(()=>{const Q=async()=>{try{if(e){const Ee=await w.getEventsByUser(e);Be(),u(Ee)}}catch(Ee){console.log("Error al cargar eventos locales:",Ee)}};Q();const ke=setInterval(Q,4e3);return()=>clearInterval(ke)},[e]),v.useEffect(()=>{if(!n||!e)return;const Q=[...c];if(W.length>0&&H?.userEmail){const ke=W.map(Ee=>WD(Ee,n,e));Q.push(...ke)}if(ie.length>0&&re?.userEmail){const ke=ie.map(Ee=>qD(Ee,n,e));Q.push(...ke)}ee(Q)},[c,W,ie,n,e,H?.userEmail,re?.userEmail]);const Qe=async Q=>{try{if(Q?.isGoogleEvent||Q.isOutlookEvent)y(Q),f(!0);else{const ke=await w.getEventById(Q.eventoID);y(ke),f(!0)}}catch(ke){console.error(ke)}},Fe=()=>{f(!1),y(null)},Le=async(Q,ke)=>{let Ee,Re;Q.todoElDia?(Ee=new Date(`${Q.fechaInicio}T${Q.horaInicio}`),Re=new Date(`${Q.fechaInicio}T${Q.horaFin}`)):(Ee=new Date(`${Q.fechaInicio}T${Q.horaInicio}`),Re=Q.fechaFin&&Q.horaFin?new Date(`${Q.fechaFin}T${Q.horaFin}`):new Date(`${Q.fechaInicio}T${Q.horaFin}`));const Sr=x.format(Ee,"yyyy-MM-dd HH:mm:ss.SSS"),$t=x.format(Re,"yyyy-MM-dd HH:mm:ss.SSS");if(ke){const ar={...Q,eventoID:ke,fechaInicio:Sr,fechaFin:$t,solID:Q.solID??null,disID:n??null,client:Q.client,invitados:Q.invitados.map(He=>({usrNombre:He.nombre||He.usrNombre,Correo:He.correo||He.Correo,EsOrganizador:He.isHost||He.EsOrganizador,StatusInvitacion:He.StatusInvitacion,UsuarioID:He.usrID||He.UsuarioID,disID:He.disID||n}))};try{const He=await w.updateEvent(ar);var Wr=c.map(Hr=>Hr.eventoID===He.eventoID?He:Hr);u(Wr),C("El evento se ha actualizado correctamente.",{variant:"success"}),Fe()}catch{C("Error al actualizar Evento",{variant:"error"})}}else{const ar={...Q,fechaInicio:Sr,fechaFin:$t,todoElDia:Q.todoElDia,solID:Q.solID??null,disID:n??null,client:Q.client,invitados:Q.invitados.map(He=>({usrNombre:He.nombre||He.usrNombre,Correo:He.correo||He.Correo,EsOrganizador:He.isHost||He.EsOrganizador,StatusInvitacion:He.StatusInvitacion,UsuarioID:He.usrID||He.UsuarioID,disID:He.disID||n}))};try{const He=await w.createEvent(ar,e);u(Hr=>[...Hr,He]),C("El evento se ha creado con éxito",{variant:"success"}),Fe()}catch{C("Error al guardar Evento",{variant:"error"})}}if(e){const ar=await w.getEventsByUser(e);u(ar)}},We=()=>{a(Q=>new Date(Q.getFullYear(),Q.getMonth()-1,1))},Xe=()=>{a(Q=>new Date(Q.getFullYear(),Q.getMonth()+1,1))},ft=()=>{De("ELIMINAR")},k=()=>{De("RECHAZAR")},O=()=>{_(new Date),f(!0)},B=Q=>{Q&&a(Q)},ce=Q=>{_(Q),f(!0),y(null)},se=async()=>{if(h)try{await w.deleteEvent(h.eventoID),u(c.filter(Q=>Q.eventoID!==h.eventoID)),C("El evento se ha eliminado de tu calendario",{content:(Q,ke)=>l.jsx(Ic,{id:Q,message:String(ke),variant:"delete"})})}catch{C("Error al eliminar Evento",{variant:"error"})}finally{Fe(),Me()}},j=async()=>{if(!(!H?.userEmail||!n)){X(!0);try{const ke=(await F.getGoogleCalendars(H.userEmail,n)).map(Re=>({...Re,selected:!0}));_e(ke);const Ee=ke.map(Re=>Re.id);R(Ee)}catch(Q){console.error("Error Google Cals:",Q)}finally{X(!1)}}},oe=async Q=>{const ke=xe.map(Re=>Re.id===Q?{...Re,selected:!Re.selected}:Re);_e(ke);const Ee=ke.filter(Re=>Re.selected).map(Re=>Re.id);R(Ee)},Se=async()=>{if(!(!re?.userEmail||!n)){X(!0);try{const ke=(await E.getOutlookCalendars(re.userEmail,n)).map(Re=>({...Re,selected:!0}));ae(ke);const Ee=ke.map(Re=>Re.id);te(Ee)}catch(Q){console.error("Error Outlook Cals:",Q)}finally{X(!1)}}},je=async Q=>{const ke=fe.map(Re=>Re.id===Q?{...Re,selected:!Re.selected}:Re);ae(ke);const Ee=ke.filter(Re=>Re.selected).map(Re=>Re.id);te(Ee)};v.useEffect(()=>{j()},[H?.userEmail,n]),v.useEffect(()=>{Se()},[re?.userEmail,n]);const R=async Q=>{if(!H?.userEmail||!n)return;const ke=Q||xe.filter(Ee=>Ee.selected).map(Ee=>Ee.id);try{const Ee={disID:n,year:i.getFullYear(),month:i.getMonth()+1,usrMail:H.userEmail,calendarIds:ke},Re=await F.getGoogleEventsByMonth(Ee);$(Re)}catch(Ee){console.error("Error al obtener eventos de Google:",Ee)}},te=async Q=>{if(!re?.userEmail||!n)return;const ke=Q||fe.filter(Ee=>Ee.selected).map(Ee=>Ee.id);try{const Ee={disID:n,year:i.getFullYear(),month:i.getMonth()+1,usrMail:re.userEmail,calendarIds:ke},Re=await E.getOutlookEventsByMonth(Ee);ue(Re)}catch(Ee){console.error("Error al obtener eventos de Outlook:",Ee)}};if(n===void 0||e===void 0)return l.jsx("div",{children:"Cargando configuración de usuario..."});const be=async(Q,ke)=>{await w.UpdateStatusEvento(Q.evento.eventoID,e,ke)&&(await w.MarcarLeido(Q.notificacionID,e),C(Q?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},qe=async()=>{K&&w.UpdateStatusEvento(K.evento.eventoID,e,"RECHAZADA")&&(await w.MarcarLeido(K.notificacionID,e),await w.MarcarLeido(K.notificacionID,e),C("Haz rechazado la Invitación a "+K?.evento?.titulo,{content:(ke,Ee)=>l.jsx(Ic,{id:ke,message:String(Ee),variant:"rechazar"})}),Me())},Ct=async(Q,ke)=>{try{if(!e)return;Ie(Q),ke=="RECHAZADA"?(k(),console.log("noti",Q)):be(Q,ke)}catch{C("Error al procesar la invitación",{variant:"error"})}},Z=async Q=>{try{if(!h)return;await w.ReenviarNotificacion(h?.eventoID,Q),C("Invitación enviada con éxito",{variant:"success"})}catch(ke){console.error("Error al conectar con la API",ke)}},[de,De]=v.useState(null),Me=()=>De(null),Pe={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:l.jsxs(l.Fragment,{children:["Estás a punto de declinar la invitación de ",l.jsx("strong",{children:K?.evento?.nombreAnfitrion})," a ",l.jsx("strong",{children:K?.evento?.titulo})]}),icon:l.jsx("img",{src:hh}),action:()=>K&&qe()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:l.jsx("img",{src:hh}),action:()=>se()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>se}},Nt=de?Pe[de]:null;return l.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[l.jsx(jv,{header:l.jsx(X2,{currentDate:i,onPrevMonth:We,onNextMonth:Xe,onAddEvent:O,onDateChange:B}),sidebar:l.jsx(Gx,{onEventClick:Qe,upcomingEvents:S,leads30Days:r,leads90Days:t,disID:n,usrID:e,onAddEvent:O,googleCalendars:xe,outlookCalendars:fe,isLoadingCalendars:le,onToggleGoogle:oe,onToggleOutlook:je,notifications:we,unreadCount:we?.filter(Q=>!Q.leida).length,onAceppInvitacion:Ct}),mainContent:l.jsx(lw,{onSeeMoreClick:P,currentDate:i,events:N,onDayClick:ce,onEventClick:Qe})}),d&&l.jsx(ID,{isVisible:d,onClose:Fe,onSave:Le,onDelete:ft,selectedDate:b,initialEvent:h,userId:e,masNombreBD:o,disId:n,onReenviar:Z}),l.jsx(jD,{isOpen:T,onClose:()=>I(!1),events:M,date:q,onEventClick:Qe}),Nt&&l.jsx(GD,{open:!!de,onClose:Me,onConfirm:()=>{Nt.action()},title:Nt.title,description:Nt.description,icon:Nt.icon,confirmText:Nt.confirmText})]})},QD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='22'%20height='22'%3e%3cpath%20fill='%23070c10'%20d='M18.575%203.172A10.829%2010.829%200%200%200%201.564%2016.284l-.028-.051L0%2021.843l5.739-1.506a10.7%2010.7%200%200%200%205.173%201.318%2010.83%2010.83%200%200%200%207.663-18.483m-7.658%2016.655a8.94%208.94%200%200%201-4.62-1.277l.041.023-.329-.194-3.405.894.908-3.321-.214-.34a8.9%208.9%200%200%201-1.376-4.782%209%209%200%201%201%209%209Zm4.935-6.736c-.27-.135-1.6-.789-1.848-.88s-.429-.135-.61.136-.7.879-.856%201.06-.316.2-.586.068a7.5%207.5%200%200%201-2.183-1.349l.007.007a8.2%208.2%200%200%201-1.483-1.842l-.02-.038c-.157-.27-.017-.417.118-.551s.271-.316.406-.473a1.9%201.9%200%200%200%20.267-.44v-.012a.5.5%200%200%200%20.05-.216.5.5%200%200%200-.074-.26c-.068-.135-.609-1.467-.834-2.009s-.444-.455-.609-.464-.338-.009-.519-.009a.99.99%200%200%200-.72.337%203.03%203.03%200%200%200-.947%202.2v.058a5.27%205.27%200%200%200%201.114%202.815v-.011a12.16%2012.16%200%200%200%204.553%204.053l.068.031a14%2014%200%200%200%201.434.539l.109.03a3.6%203.6%200%200%200%201.077.161%203.7%203.7%200%200%200%20.648-.057h-.023a2.8%202.8%200%200%200%201.819-1.274l.007-.012a2.2%202.2%200%200%200%20.19-.9%202.3%202.3%200%200%200-.034-.395v.014c-.067-.113-.248-.18-.519-.316Z'/%3e%3c/svg%3e",XD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='25.085'%20height='18.5'%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='none'%20d='M0%200h25.085v18.5H0z'%20data-name='Rectángulo%204598'/%3e%3c/clipPath%3e%3c/defs%3e%3cg%20clip-path='url(%23a)'%20data-name='Grupo%207946'%3e%3cpath%20d='M23.12%205.809V3.226a3.2%203.2%200%200%200-.068-.656l-3.141%202.21a7.8%207.8%200%200%201%203.209%201.032'%20data-name='Trazado%2013329'/%3e%3cpath%20d='M11.847%209.791c-.1.009-.2.023-.308.023a3.78%203.78%200%200%201-2.18-.688L.067%202.58A3.2%203.2%200%200%200%200%203.227V13.98a3.23%203.23%200%200%200%203.226%203.226h9.611a7.86%207.86%200%200%201-.99-7.414'%20data-name='Trazado%2013330'/%3e%3cpath%20d='M12.478%207.369%2021.92.737A3.2%203.2%200%200%200%2019.894%200H3.226a3.2%203.2%200%200%200-2.031.74l9.4%206.628a1.64%201.64%200%200%200%201.881%200'%20data-name='Trazado%2013331'/%3e%3cpath%20d='M23.356%208.407a5.914%205.914%200%201%200%200%208.364%205.92%205.92%200%200%200%200-8.364m-1.833%204.842a.54.54%200%200%201-1.081%200v-1.164l-2.513%202.516a.54.54%200%200%201-.765-.763l2.515-2.515h-1.167a.54.54%200%201%201%200-1.081h2.471a.54.54%200%200%201%20.54.54Z'%20data-name='Trazado%2013332'/%3e%3c/g%3e%3c/svg%3e";function Oc(e,r,t){return e.accessor?e.accessor(r,t):e.field?r?.[e.field]:r?.[e?.key||""]}function JD(e,r){const t=e??"",n=r??"";return t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():typeof t=="number"&&typeof n=="number"?t-n:typeof t=="boolean"&&typeof n=="boolean"?Number(t)-Number(n):String(t).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function jc(e,r,t=!0){return typeof e=="function"?e(r):e??t}function e3(e){return e.replace(/[^\d]/g,"")}function t3(e,r){return r}var Yo={},mh;function r3(){if(mh)return Yo;mh=1;var e=ct();Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.default=void 0;var r=e(ht()),t=dt();return Yo.default=(0,r.default)((0,t.jsx)("path",{d:"M4.25 5.61C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAlt"),Yo}var n3=r3();const o3=at(n3);var qo={},gh;function s3(){if(gh)return qo;gh=1;var e=ct();Object.defineProperty(qo,"__esModule",{value:!0}),qo.default=void 0;var r=e(ht()),t=dt();return qo.default=(0,r.default)((0,t.jsx)("path",{d:"M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"SearchRounded"),qo}var i3=s3();const a3=at(i3);var Zo={},vh;function c3(){if(vh)return Zo;vh=1;var e=ct();Object.defineProperty(Zo,"__esModule",{value:!0}),Zo.default=void 0;var r=e(ht()),t=dt();return Zo.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),Zo}var l3=c3();const u3=at(l3);var Go={},yh;function d3(){if(yh)return Go;yh=1;var e=ct();Object.defineProperty(Go,"__esModule",{value:!0}),Go.default=void 0;var r=e(ht()),t=dt();return Go.default=(0,r.default)((0,t.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),Go}var f3=d3();const p3=at(f3);function bh(e){return e==="right"?"end":e==="center"?"center":"start"}function xh(e){const r=e.filter(t=>!t.width).length||1;return e.map(t=>typeof t.width=="number"?`${t.width}px`:typeof t.width=="string"?t.width:`minmax(0, ${1/r}fr)`).join(" ")}const h3=1060,Pc=(e,r)=>e.metrics.find(t=>String(t.label).toLowerCase()===r.toLowerCase())?.value??"";function m3({sections:e,detailColumns:r,summaryWidths:t=["1fr",120,120,150],minWidth:n=h3,getDetailColumns:o,onRowClick:s}){function c(d){if(typeof d=="number")return d;if(!d)return 0;const f=/^(\d+)\s*px$/.exec(d.trim());return f?Number(f[1]):/fr$/i.test(d)?160:0}function u(d){const f=d.reduce((g,p)=>g+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return l.jsx(m.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:l.jsxs(m.Box,{children:[l.jsx(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(d=>typeof d=="number"?`${d}px`:d).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(d=>l.jsx(m.Typography,{sx:{fontSize:13,fontWeight:800},children:d},d))}),e.map((d,f)=>{const[h,y]=G.useState(!!d.initiallyOpen),g=f%2===1,p=o?o(d):r,b=Math.max(n,u(p));return l.jsxs(m.Box,{children:[l.jsxs(m.Box,{sx:{display:"grid",gridTemplateColumns:t.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:g?"rgba(30,91,206,0.06)":"background.paper",borderTop:"1px solid rgba(0,0,0,0.08)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>y(_=>!_),children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[l.jsx(m.IconButton,{size:"small",disableRipple:!0,children:h?l.jsx(p3,{}):l.jsx(u3,{})}),l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:Pc(d,"En Proceso")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:Pc(d,"Finalizadas")}),l.jsx(m.Typography,{sx:{fontSize:13.5,fontWeight:800},children:Pc(d,"Último seg.")})]}),l.jsx(m.Collapse,{in:h,unmountOnExit:!0,children:l.jsxs(m.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:xh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"rgba(30,91,206,0.18)",color:"#1a1a1a",borderTop:"1px solid rgba(0,0,0,0.12)",boxSizing:"border-box"},children:p.map(_=>l.jsx(m.Typography,{sx:{justifySelf:bh(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(d.rows??[]).map((_,S)=>l.jsx(m.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:xh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:S%2===0?"background.paper":"rgba(30,91,206,0.06)",borderTop:"1px solid rgba(0,0,0,0.06)","&:hover":{bgcolor:"rgba(30,91,206,0.12)"},boxSizing:"border-box",cursor:"pointer"},onClick:()=>s?.(_,d),children:p.map((D,C)=>{const w=D.accessor?D.accessor(_,S):D.field?_[D.field]:null;return l.jsx(m.Box,{sx:{justifySelf:bh(D.align),textAlign:D.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof w=="string"||typeof w=="number"?l.jsx(m.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(D.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(w),children:w}):w},D.key??C)})},_.id??S))]})})]},d.id)})]})})}var Ko={},wh;function g3(){if(wh)return Ko;wh=1;var e=ct();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.default=void 0;var r=e(ht()),t=dt();return Ko.default=(0,r.default)((0,t.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m3.3 14.71L11 12.41V7h2v4.59l3.71 3.71z"}),"AccessTimeFilled"),Ko}var v3=g3();const y3=at(v3),b3=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",x3=e=>{const r=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return r||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},w3=e=>{const r=(e||"").split(" ").filter(Boolean);return r.length>=2?(r[0][0]+r[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var Qo={},_h;function _3(){if(_h)return Qo;_h=1;var e=ct();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.default=void 0;var r=e(ht()),t=dt();return Qo.default=(0,r.default)((0,t.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Create"),Qo}var S3=_3();const C3=at(S3),Rc=({current:e=0,total:r=0,color:t="#4caf50"})=>l.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:r}).map((n,o)=>l.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?t:"#e0e0e0",display:"flex"}},o))});var Xo={},Sh;function E3(){if(Sh)return Xo;Sh=1;var e=ct();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var r=e(ht()),t=dt();return Xo.default=(0,r.default)((0,t.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),Xo}var D3=E3();const Ch=at(D3);var Jo={},Eh;function k3(){if(Eh)return Jo;Eh=1;var e=ct();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var r=e(ht()),t=dt();return Jo.default=(0,r.default)((0,t.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),Jo}var A3=k3();const T3=at(A3),M3=e=>{const r=String(e??"").toLowerCase().trim();return r==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:r==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:r==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:r==="no sé"||r==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:r==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},I3=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por Asignar";case 2:return"Solicitud Asignada";case 3:return"Solicitud asignada en proceso";case 4:return"Finalizadas sin Venta";case 5:return"Finalizadas con Venta";case 6:return"Rechazadas";case 7:return"Finalizada por sistema";case 8:return"";case 9:return"";case 10:return"Prospección";case 11:return"Interés Real";case 12:return"Proceso de Compra";case 13:return"";case 14:return"En espera de Unidad";case 15:return"Auto Facturado";case 16:return"";case 17:return"";case 18:return"Compró otra Marca";case 19:return"No comprará";default:return null}},O3=e=>{switch(parseInt(String(e??""),10)){case 1:return"Por asignar";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 6:return"Rechazada";case 7:return"Finalizada sin enviar a Ventas";case 8:return"Finalizada enviado a Ventas";default:return null}},j3=e=>{switch(parseInt(String(e??""),10)){case 0:return"Sin asignar";case 1:return"Confirmado";case 2:return"Solicitud Asignada";case 3:return"En seguimiento";case 4:return"Confirmado";case 5:return"Finalizada";case 6:return"Rechazada";case 10:return"Reagendado";case 20:return"Seguimiento [Cita Finalizada]";case 30:return"Reenvio";case 40:return"Seguimiento [Mecanico]";case 50:return"Seguimiento";default:return null}};function P3(e){const r=new Date(e),t=r.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=r.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${t.replace(".","")} • ${n}`}function R3(e){return e.replace(/<br\s*\/?>/gi,`
|
|
178
178
|
`).replace(/\r\n/g,`
|
|
179
179
|
`).replace(/\r/g,`
|
|
180
180
|
`)}const N3={Todos:[],"Sin Asignar":["Sin Asignar"],"En prospección":["Prospección"],"Proceso de Compra":["Proceso de Compra"],"En espera de Unidad":["En Espera de Unidad"],"Auto Facturado":["Auto Facturado"],Rechazadas:["Rechazada","Rechazadas"],"Finalizadas sin Venta":["Sin Venta"],"Finalizadas con Venta":["Con Venta"],"En Proceso":["Asignada","Prospección","Sin Asignar","Proceso de Compra","En Espera de Unidad","Auto Facturado","Sin Atender"]},$3={Todos:[],"Selección y presentación de vehículos":["Selección y presentación de vehículos"],"Prueba de Manejo":["Prueba de Manejo"],"Valoración del Auto a cuenta y/o enganche":["Valoración del Auto a cuenta y/o enganche"],"Entrega de vehículo":["Entrega de vehículo"],"Negociación y Cierre":["Negociación y Cierre"]},L3={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function z3(e,r){switch(e){case"pruebas":return O3(r)??"—";case"servicio":return j3(r)??"—";case"nuevos":case"seminuevos":default:return I3(r)??"—"}}function B3({open:e,onClose:r,customer:t,fields:n=[],header:o,extraSections:s,normalTable:i,normalTableColumns:a=[],history:c=[],advisorHistory:u=[],onRequestEdit:d,searchFilter:f,urlsQA:h,solicitudesNuevos:y=[],solicitudesPrueba:g=[],solicitudesServicio:p=[],solicitudesSeminuevos:b=[],onCreateSolicitud:_,isCrmMode:S=!1,onSolicitudBaseUrl:D,onIframeClose:C,reloadInfo:w,idAdminSistemas:F}){if(!t)return null;const E=3,[T,I]=v.useState(null),M=!!T,[U,q]=v.useState(!1),[V,H]=v.useState(null),[re,W]=v.useState(c??[]),[$,ie]=v.useState(null),ue=v.useMemo(()=>[...u].sort((L,J)=>new Date(J.FechaAsignacion).getTime()-new Date(L.FechaAsignacion).getTime()),[u]);v.useEffect(()=>{c&&c.length&&W(c)},[c]);const N=c?.length?c:re,ee=o?.title??(L=>L?.Nombre||L?.name||"Sin título"),xe=o?.infoItems??[],_e=L=>L.nombreAsesor?.trim()||(L.Email?L.Email:"Sistema"),fe=L=>{const J=L||"",ge=J.split(" ").filter(Boolean);return ge.length>=2?(ge[0][0]+ge[1][0]).toUpperCase():(J[0]||"?").toUpperCase()},ae=L=>L?.SolID??L?.solID??L?.SolId??L?.SOLID??null,le=v.useMemo(()=>{const L=N??[];return Array.isArray(L?.[0])?L.flat():L},[N]),X=v.useMemo(()=>{const L=le;return!$||V==null?L:L.filter(J=>{const ge=ae(J);return ge!=null&&String(ge)===String(V)})},[le,$,V]),we=v.useMemo(()=>[...X].sort((L,J)=>new Date(J.fecAlta).getTime()-new Date(L.fecAlta).getTime()),[X]),[ye,K]=v.useState(!1),Ie=v.useMemo(()=>ye?we:we.slice(0,E),[ye,we]),P=Math.max(we.length-E,0),Be=L=>String(L??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),Qe=(L,J)=>Be(JSON.stringify(L)).includes(Be(J)),Fe=(L,J)=>f?f(L,J):Qe(L,J),Le=(L,J)=>{const ge=Be(J).split(/\s+/).filter(Boolean);return ge.length?ge.every(Te=>Fe(L,Te)):!0},[We,Xe]=v.useState(""),[ft,k]=v.useState([]);v.useMemo(()=>i??[],[i]),v.useMemo(()=>{const L=We.trim();return L?(i??[]).filter(J=>Le(J,L)):i??[]},[i,We]);const O=m.useTheme(),B=m.useMediaQuery(O.breakpoints.down("md")),[ce,se]=v.useState(""),[j,oe]=v.useState(!0),[Se,je]=v.useState(!1),R=new Date().toISOString().slice(0,10),te=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[be,qe]=v.useState(te),[Ct,Z]=v.useState(R),[de,De]=v.useState(null),Me=!!de,[Pe,Nt]=v.useState("En Proceso"),[Q,ke]=v.useState("Todos"),[Ee,Re]=v.useState("Todos"),Sr=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],$t=["Selección y presentación de vehículos","Prueba de Manejo","Valoración del Auto a cuenta y/o enganche","Entrega de vehículo","Negociación y Cierre"],Wr=()=>{se(""),oe(!1),je(!1),qe(te),Z(R),Nt("Todos"),ke("Todos"),Re("Todos")},ar=v.useMemo(()=>(ce??"").trim()!==""||Pe!=="Todos"||Q!=="Todos"||j||Se||Ee!=="Todos",[ce,Pe,Q,j,Se,Ee]);function He(L){if(!L)return"";const J=new Date(L);if(isNaN(J.getTime()))return"";const ge=String(J.getDate()).padStart(2,"0"),Te=String(J.getMonth()+1).padStart(2,"0"),Et=String(J.getFullYear()).slice(-2);return`${ge}/${Te}/${Et}`}function Hr(L){const J=L?new Date(L):null;return J&&!isNaN(J.getTime())?J:null}function zc(L,J){let ge=null;for(const Te of L){const Et=Hr(J(Te));if(Et){const wt=Et.getTime();(ge===null||wt>ge)&&(ge=wt)}}return ge?new Date(ge):null}function ns(L){const J=zc(L,ge=>ge.UltimoSeguimiento||ge.FechaCita);return J?He(J.toISOString()):"—"}function os(L){const J=(L??"").toLowerCase().trim();return J==="sin venta"||J==="con venta"||J==="rechazada"||J==="rechazadas"}function zi(L){return L.filter(J=>os(J.EstatusDescripcion)).length}function Bi(L){return L.filter(J=>!os(J.EstatusDescripcion)).length}const Bc=({progress:L,color:J})=>{if(!L)return l.jsx(Rc,{current:0,total:0,color:J});const ge=L.split("/").map(Number);if(ge.length!==2||ge.some(wt=>Number.isNaN(wt)))return l.jsx(Rc,{current:0,total:0,color:J});const[Te,Et]=ge;return l.jsx(Rc,{current:Te,total:Et,color:J})};function Fi(L){return[{key:"fecha",header:"Fecha",accessor:J=>He(J.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:J=>l.jsx(m.Tooltip,{title:J.Vehiculo??"",placement:"top",arrow:!0,children:l.jsx(m.Typography,{component:"span",sx:{fontSize:13,fontWeight:500,display:"block",maxWidth:260,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:"default"},children:J.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:J=>l.jsx(m.Typography,{sx:{fontWeight:800,fontSize:13},children:z3(L,J.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:J=>{const{bg:ge,color:Te}=M3(J.NivelInteres);return l.jsx(m.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:ge,color:Te,fontSize:12,fontWeight:J.NivelInteres?800:500},children:J.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:J=>{const ge=(J.Asesor??"").trim(),Te=Fc=>{if(!Fc)return"";const uk=Fc[0]?.toUpperCase()??"",dk=Fc[1]?.toLowerCase()??"";return`${uk}${dk}`};if(!ge)return l.jsx(m.Tooltip,{title:"",placement:"top",children:l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const Et=ge.split(/\s+/),wt=Et[0]??"",Cr=Et[1]??"",mr=Te(wt),yn=Te(Cr),lk=`${mr}${yn}`||"—";return l.jsx(m.Tooltip,{title:ge,placement:"top",children:l.jsx(m.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:lk})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:J=>J.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:J=>l.jsx(m.Tooltip,{title:J.Actividad??"",placement:"top",arrow:!0,children:l.jsxs(m.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[J.Icon&&l.jsx("span",{style:{color:"#fff",backgroundColor:J.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:l.jsx("i",{className:J.Icon})}),l.jsx(m.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(J.Actividad??"").length?"default":"inherit"},children:J.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:J=>l.jsx(Bc,{progress:J.Avance,color:J.Color}),width:200,align:"left"}]}function A(L){const ge=Fi(L).slice(1);return[{key:"fecha",header:"Fecha",accessor:Te=>He(Te.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Te=>He(Te.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Te=>Te.HoraCita??"—",width:110},...ge]}function ne(L){const J=L.kind;switch(J){case"pruebas":case"servicio":return A(J);case"nuevos":case"seminuevos":default:return Fi(J)}}function me(L,J,ge,Te){return{id:L,kind:ge,title:J,metrics:[{label:"En Proceso",value:Bi(Te)},{label:"Finalizadas",value:zi(Te)},{label:"Último seg.",value:ns(Te)}],rows:Te,initiallyOpen:!1}}const Oe=[me("n-1","Cotización de nuevos","nuevos",y),me("p-1","Prueba de Manejo","pruebas",g),me("s-1","Cita de Servicio","servicio",p),me("sn-1","Cotización para Seminuevos","seminuevos",b)],Ze=v.useMemo(()=>{const L=(ce??"").trim().toLowerCase(),J=(ge,Te)=>{if(L&&!(ge.Vehiculo??"").toLowerCase().includes(L))return!1;const Et=Se?ge.FechaCita:ge.Fecha;if(j&&Et){const wt=Hr(Et??"");if(!wt)return!1;const Cr=be?new Date(`${be}T00:00:00`):null,mr=Ct?new Date(`${Ct}T00:00:00`):null;if(mr&&mr.setDate(mr.getDate()+1),Cr&&wt<Cr||mr&&wt>=mr)return!1}if(Pe!=="Todos"){const wt=(ge.EstatusDescripcion??"").toLowerCase();if(!(N3[Pe]??[]).some(yn=>wt===yn.toLowerCase()))return!1}if(Q!=="Todos"){const wt=(ge.Actividad??"").toLowerCase();if(!($3[Q]??[]).some(yn=>wt===yn.toLowerCase()))return!1}if(Ee!=="Todos"){const wt=(ge.NivelInteres??"").toLowerCase();if(!(L3[Ee]??[]).some(yn=>wt===yn.toLowerCase()))return!1}return!0};return Oe.map(ge=>{const Te=(ge.rows??[]).filter(wt=>J(wt,ge.kind)),Et=[{label:"En Proceso",value:Bi(Te)},{label:"Finalizadas",value:zi(Te)},{label:"Último seg.",value:ns(Te)}];return{...ge,rows:Te,metrics:Et}})},[Oe,ce,j,be,Ct,Se,Pe,Q,Ee]),it={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},Ye=(L,J)=>{const ge=L.SolID;if(!ge)return;const Te=J.kind,Et=it[Te]??"cotizaciones",wt=h?`https://qa2.crm.netcar.com.mx/netcar/${Et}/${ge}`:`https://crmxs.netcar.com.mx/netcar/${Et}/${ge}`,Cr=D?.({row:L,section:J,slug:Et,solId:ge,baseUrl:wt});if(!S){const mr=Cr??wt;H(ge),ie(mr),q(!0)}},ze=()=>{C?.(t),H(null),ie(null),q(!1)},Ft=v.useRef(!1),pt=v.useRef(null),Tt=v.useCallback(()=>{if(!Ft.current){Ft.current=!0;return}pt.current&&window.clearTimeout(pt.current),pt.current=window.setTimeout(()=>{w?.(t)},500)},[w,t]);return v.useEffect(()=>{Ft.current=!1,pt.current&&window.clearTimeout(pt.current)},[$,V]),l.jsx(m.Dialog,{open:e,onClose:r,fullWidth:!0,fullScreen:B,PaperProps:{sx:{height:{xs:"100dvh",md:"90vh"},maxWidth:{xs:"100vw",md:"92vw"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:l.jsxs(m.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[l.jsxs(m.Box,{sx:{width:{xs:"100%",md:405},maxWidth:{xs:"100%",md:405},bgcolor:{xs:"transparent",md:"#40404024"},display:"flex",flexDirection:"column",height:{xs:"auto",md:"100%"},borderRight:{xs:"none",md:"1px solid #EBEEF0"}},children:[l.jsxs(m.Box,{children:[l.jsx(m.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:l.jsxs(m.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[l.jsx(m.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:l.jsx(m.Box,{sx:{flex:1,minWidth:0,pr:1},children:l.jsxs(m.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[ee(t)," ",l.jsx(m.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{r?.(),t&&d?.(t)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:l.jsx(C3,{sx:{fontSize:"1em"}})})]})})}),xe.map((L,J)=>l.jsxs(m.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:L.onClick?"pointer":"default"},onClick:()=>{L.onClick&&L.onClick(t)},children:[L.icon,l.jsx(m.Typography,{variant:"body2",sx:{color:L.inLink?"#336BE1":"#070C10"},style:{},children:L.value(t)})]},J))]})}),l.jsx(m.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((L,J)=>{const ge=L.label?.toLowerCase().startsWith("asesor");return l.jsxs(m.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[l.jsx(m.Box,{sx:{width:"50%"},children:l.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:L.label})}),l.jsxs(m.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[l.jsx("div",{children:L?.avatar?L.avatar(t):null}),l.jsx(m.Typography,{variant:"body2",color:"textPrimary",children:L?.value(t)}),ge&&!F&&l.jsx(m.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:l.jsx(m.IconButton,{size:"small",onClick:Te=>I(Te.currentTarget),sx:{ml:.5},disableRipple:!0,children:l.jsx(y3,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},J)})}),l.jsx(m.Divider,{sx:{my:2}})]}),l.jsx(m.Box,{px:2.5,pb:.5,children:l.jsxs(m.Typography,{children:[l.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!$&&" por solicitud",":"]})}),l.jsxs(m.Box,{sx:{px:2.5,pt:0,gap:2,flex:1,overflowY:"auto",display:"flex",flexDirection:"column",pb:6,maxHeight:{xs:"140px",md:"100%"}},children:[Ie.length===0&&l.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),l.jsxs(m.Box,{children:[Ie?.map((L,J)=>{const ge=_e(L),Te=R3(L.comentario||"");return l.jsxs(m.Box,{sx:{pb:1.5},children:[l.jsxs(m.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:L.tipo||"Evento"}),l.jsx(m.Chip,{size:"small",label:L.auto!=null?`${L.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Te?l.jsx(m.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Te}):null,l.jsxs(m.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[L?.ImgAsesor!=null?l.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:fe(ge),src:L?.ImgAsesor}):l.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:fe(ge)}),l.jsxs(m.Stack,{spacing:0,children:[l.jsx(m.Typography,{variant:"body2",fontWeight:600,children:ge}),l.jsx(m.Typography,{variant:"caption",color:"text.secondary",children:P3(L.fecAlta)})]})]}),J<Ie.length-1&&l.jsx(m.Divider,{sx:{mt:1.25}})]},L.segID??J)}),we.length>E&&l.jsx(m.Box,{sx:{mt:1},children:l.jsx(m.Button,{onClick:()=>K(L=>!L),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:ye?"Ver menos":`Ver más (${P})`})})]})]}),l.jsx(m.Menu,{anchorEl:T,open:M,onClose:()=>I(null),TransitionComponent:m.Fade,MenuListProps:{disablePadding:!0},PaperProps:{sx:{width:320,p:0,overflow:"hidden"}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[l.jsx(m.Box,{sx:{position:"sticky",top:0,zIndex:1,px:1.5,py:1,fontWeight:700,bgcolor:"background.paper",borderBottom:"1px solid",borderColor:"divider"},children:"Historial asesores"}),l.jsxs(m.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[ue.length===0&&l.jsx(m.Box,{sx:{px:1.5,py:1},children:l.jsx(m.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),ue.map((L,J)=>{const ge=x3(L),Te=b3(L.FechaBaja??L.FechaAsignacion);return l.jsx(m.Box,{sx:{px:1,py:.75},children:l.jsxs(m.Stack,{direction:"row",alignItems:"center",spacing:1,children:[l.jsx(m.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:L?.ImgAsesor??void 0,children:w3(ge)}),l.jsx(m.Box,{sx:{flex:1,minWidth:0},children:l.jsx(m.Typography,{variant:"body2",noWrap:!0,children:ge})}),l.jsx(m.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Te})]})},J)})]})]})})]}),U?l.jsxs(m.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[l.jsx(m.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:l.jsx(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:l.jsx(m.Button,{onClick:ze,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:l.jsx(T3,{fontSize:"medium"})})})}),$&&l.jsx("iframe",{src:$,width:"100%",height:"100%",onLoad:Tt,style:{border:0}})]}):l.jsxs(m.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[l.jsx(m.Box,{sx:{mt:{xs:1.5,md:3}},children:l.jsxs(m.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[l.jsx(m.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),l.jsxs(m.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[l.jsxs(m.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[l.jsx(m.TextField,{size:"small",placeholder:"Buscar por vehículo",value:ce,onChange:L=>se(L.target.value),InputProps:{endAdornment:l.jsx(a3,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[l.jsxs(m.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[l.jsx(m.FormControlLabel,{label:l.jsx(m.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:l.jsx(m.Checkbox,{checked:j,onChange:L=>oe(L.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),l.jsx(m.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),l.jsxs(m.Stack,{direction:"row",spacing:1,children:[l.jsx(m.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:be,onChange:L=>qe(L.target.value),disabled:!j,sx:{width:170}}),l.jsx(m.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:Ct,onChange:L=>Z(L.target.value),disabled:!j,sx:{width:170}})]})]}),l.jsx(m.IconButton,{onClick:L=>De(L.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:l.jsx(o3,{})}),ar&&l.jsx(m.Button,{variant:"outlined",onClick:Wr,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),l.jsx(m.Tooltip,{title:ar&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!ar,children:l.jsx("span",{children:l.jsxs(m.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{_?.(t)},disableRipple:!0,children:[l.jsx(Ch,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!ar&&"Crear Solicitud"]})})})]}),l.jsx(m3,{sections:Ze,detailColumns:[],getDetailColumns:ne,onRowClick:Ye})]})]})}),l.jsx(m.Menu,{anchorEl:de,open:Me,onClose:()=>De(null),TransitionComponent:m.Fade,PaperProps:{sx:{p:1.5,width:260,borderRadius:2,boxShadow:3}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:l.jsxs(m.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[l.jsx(m.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),l.jsxs(m.Box,{children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),l.jsx(m.RadioGroup,{value:Pe,onChange:L=>Nt(L.target.value),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos","Sin Asignar","En prospección","Proceso de Compra","En espera de Unidad","Auto Facturado","Rechazadas","Finalizadas sin Venta","Finalizadas con Venta","En Proceso"].map(L=>l.jsx(m.FormControlLabel,{value:L,control:l.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),l.jsxs(m.Box,{children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),l.jsx(m.RadioGroup,{value:Q,onChange:(L,J)=>ke(J),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...$t].map(L=>l.jsx(m.FormControlLabel,{value:L,sx:{alignItems:"start"},control:l.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),l.jsxs(m.Box,{children:[l.jsx(m.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),l.jsx(m.RadioGroup,{value:Ee,onChange:(L,J)=>Re(J),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Sr].map(L=>l.jsx(m.FormControlLabel,{value:L,control:l.jsx(m.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]})]})})]})]})})}const Dh={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function kh(e,r,t){const{fields:n,order:o=["nombreCliente","email","acciones"],header:s={},cells:i={},hide:a={},actions:c}=r,u=c??{},d=u.show??{},f=u.handlers??{},h=u.accessors??{},y=u.icons??{},g=u.className??"d-flex flex-row gap-2 align-items-center ",p=u.tooltip??{},b=y.view??l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[l.jsx("path",{d:"M18.6,6.3c-3.9-3-9.3-3-13.2,0-1.9,1.5-3.2,3.5-3.9,5.7.7,2.3,2,4.3,3.9,5.7,1.9,1.5,4.2,2.3,6.6,2.3,2.4,0,4.7-.8,6.6-2.3,1.9-1.5,3.2-3.5,3.9-5.7-.7-2.3-2-4.3-3.9-5.7ZM17.2,12.1c0,2.9-2.5,5.3-5.4,5.2-2.9,0-5.3-2.5-5.2-5.4,0-2.9,2.5-5.3,5.4-5.2,2.9,0,5.3,2.4,5.2,5.3,0,0,0,0,0,0Z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),_={nombreCliente:{key:"nombreCliente",header:s.nombreCliente??"Cliente",accessor:M=>M[n.nombreCliente],cell:i.nombreCliente,width:190},email:{key:"email",header:s.email??"Correo",accessor:M=>M[n.email],cell:i.email??(M=>{const U=String(M[n.email]??"");return U?l.jsx("a",{href:`mailto:${U}`,children:U}):l.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:i.acciones??(M=>{const U=jc(d.whatsapp,M,!0),q=jc(d.email,M,!0),V=jc(d.view,M,!0),H=h.phone?.(M),re=h.email?.(M),W=ue=>{if(ue.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(M);if(!H)return;const N=h.countryCode??"52",ee=e3(String(H));typeof window<"u"&&window.open(`https://wa.me/${N}${ee}`,"_blank")},$=ue=>{if(ue.stopPropagation(),f.onEmail)return f.onEmail(M);re&&typeof window<"u"&&(window.location.href=`mailto:${re}`)},ie=ue=>{ue.stopPropagation(),f.onView&&f.onView(M)};return l.jsxs("div",{className:g,children:[U&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:W,style:{width:24,height:24},children:l.jsx("img",{src:QD,alt:"WhatsApp"})}),q&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:$,style:{width:24,height:24},children:l.jsx("img",{src:XD,alt:"Email"})}),V&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:ie,style:{width:24,height:24},children:b})]})}),width:120}},S=Object.values(_).filter(M=>!!M),D=(e??[]).filter(M=>!!M?.key),C=new Map;for(const M of S)C.set(String(M.key),M);for(const M of D)C.set(String(M.key),M);const w=[...S.map(M=>String(M.key)),...D.map(M=>String(M.key))],F=Array.from(new Set(o.map(M=>String(M)).filter(M=>C.has(M)))),E=w.filter(M=>!F.includes(M)),T=[...F,...E],I="acciones";if(C.has(I)){const M=T.filter(U=>U!==I);T.splice(0,T.length,...M,I)}return T.map(M=>C.get(M))}function F3(e){const{rows:r,columns:t,clientSort:n=!0,urlsQA:o=!0,defaultSort:s,minWidth:i=1100,rowKey:a=t3,haveOpenDetailFor:c=!0,defaults:u,detailConfig:d,normalTable:f,onRowClick:h,activityHistory:y,advisorHistory:g,forceOpenDetailFor:p,closeDetailFor:b,onRequestEdit:_,searchFilter:S,solicitudesNuevos:D,solicitudesPrueba:C,solicitudesServicio:w,solicitudesSeminuevos:F,onCreateSolicitud:E,isCrmMode:T,onSolicitudBaseUrl:I,onIframeClose:M,reloadInfo:U,idAdminSistemas:q=!1}=e,[V,H]=v.useState(s??null),[re,W]=v.useState({open:!1,customer:null}),[$,ie]=v.useState([]),ue=ae=>{W({open:!0,customer:ae})},N=ae=>{c&&(h?.(ae),W({open:!0,customer:ae}))},ee=()=>{W({open:!1,customer:null}),b?.()},xe=v.useMemo(()=>u?kh(t??[],u):kh(t??[],{fields:{},order:[]}),[t,u]),_e=v.useMemo(()=>{if(!n||!V)return r;const ae=xe.find(X=>X.key===V.key);if(!ae)return r;const le=[...r];return le.sort((X,we)=>{const ye=Oc(ae,X,0),K=Oc(ae,we,0),Ie=JD(ye,K);return V.direction==="asc"?Ie:-Ie}),le},[r,xe,V,n]),fe=v.useMemo(()=>{const ae=d?.getCustomerId;return le=>{const X=ae?.(le)??le?.Id_cliente??le?.CliID??le?.id??le?.ID??le?.Id??"";return String(X)}},[d]);return v.useEffect(()=>{if(!re.open||!re.customer)return;const ae=fe(re.customer);if(!ae)return;const le=(r??[]).find(X=>fe(X)===ae);le&&le!==re.customer&&W(X=>({...X,customer:le}))},[r,re.open,re.customer,fe]),v.useEffect(()=>{p&&ue(p)},[p]),l.jsxs("div",{children:[l.jsx("div",{className:`${Dh.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:l.jsx("div",{className:`${Dh.tableResponsive} table-responsive`,children:l.jsxs("table",{className:"table table-hover align-middle mb-0",children:[l.jsx("thead",{children:l.jsx("tr",{children:xe.map(ae=>l.jsx("th",{style:{fontWeight:600,width:ae.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ae.align??"left"},children:ae.header},ae.key))})}),l.jsx("tbody",{children:_e.map((ae,le)=>l.jsx("tr",{onClick:()=>N?.(ae),role:"button",tabIndex:0,onKeyDown:X=>{(X.key==="Enter"||X.key===" ")&&N?.(ae)},style:{cursor:"pointer"},children:xe.map((X,we)=>{const ye=X.Component?l.jsx(X.Component,{row:ae,index:le}):X.cell?X.cell(ae,le):(()=>{const K=Oc(X,ae,le);return K==null||K===""?"":String(K)})();return l.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:X.align??"left"},children:ye},`${String(X.key)}-${we}`)})},a(ae,le)))})]})})}),re.open&&l.jsx(B3,{open:re.open,onClose:ee,customer:re.customer,fields:d?.dynamicFields,header:d?.header,normalTable:f,history:y,advisorHistory:g,urlsQA:o,onRequestEdit:ae=>{ee(),_?.(ae)},searchFilter:S,solicitudesNuevos:D,solicitudesPrueba:C,solicitudesServicio:w,solicitudesSeminuevos:F,onCreateSolicitud:E,isCrmMode:T,onSolicitudBaseUrl:I,onIframeClose:M,reloadInfo:U,idAdminSistemas:q})]})}const Ah=G.forwardRef(({sx:e,...r},t)=>l.jsx(m.InputBase,{inputRef:t,...r,sx:{height:48,px:1.5,width:"100%",maxWidth:"none",bgcolor:"#EBEEF0",borderRadius:2,border:"1px solid transparent","&:hover":{borderColor:"transparent"},"& .MuiInputBase-input::placeholder":{opacity:.7},...e}}));Ah.displayName="SoftInput";function V3({message:e}){return e?l.jsxs(m.Box,{role:"alert",sx:{mt:1,display:"flex",alignItems:"center",gap:1,bgcolor:"#fdeaea",border:"1px solid rgb(253, 237, 237)",color:"#842029",borderRadius:1,px:2,py:1.25},children:[l.jsx(Mc,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),l.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function U3(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function Nc(e,r){const t=U3(e);return t?r?.isArray?{required:t,validate:n=>Array.isArray(n)&&n.length>0||t}:{required:t,validate:n=>n!==""&&n!==null&&n!==void 0||t}:{}}const Th={"& .MuiOutlinedInput-root .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},"& .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},"& .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},"& .MuiOutlinedInput-root.Mui-error .MuiOutlinedInput-notchedOutline":{borderColor:"transparent"},width:"100%"},W3={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function $c({label:e,errorMsg:r,helperText:t,children:n,sx:o}){return l.jsxs(m.FormControl,{fullWidth:!0,error:!!r,sx:o,className:"1- FieldWrapper",children:[l.jsx(m.FormLabel,{sx:W3,children:e}),n,l.jsx(V3,{message:r||t})]})}function H3(e,r){const{register:t,formState:{errors:n}}=r,o={...Nc(e)};e.minLength&&(o.minLength={value:e.minLength,message:`El campo espera minimo ${e.minLength} caracteres`}),e.maxLength&&(o.maxLength={value:e.maxLength,message:`El campo espera maximo ${e.maxLength} caracteres`}),e.pattern&&(o.pattern={value:e.pattern,message:"Formato inválido"});const s=e.type==="email";s&&!o.pattern&&(o.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Correo electrónico inválido"});const i=/[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]/g,a=/[0-9]/g,c=new Set(["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Home","End","Escape","Enter"]),u=C=>e.onlyNumbers?(C.match(a)??[]).join(""):e.onlyLetters?(C.match(i)??[]).join(""):C,d=(C,w)=>c.has(C)||w?!0:e.onlyNumbers?/^[0-9]$/.test(C):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(C):!0,f=n[e.name]?.message,h=t(e.name,o),y=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,g=C=>{d(C.key,C.ctrlKey||C.metaKey)||C.preventDefault()},p=C=>{const w=C.data??null;w!=null&&(e.onlyNumbers&&/[^0-9]/.test(w)&&C.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(w)&&C.preventDefault())},b=C=>{const w=C.clipboardData.getData("text"),F=u(w);if(F!==w){C.preventDefault();const E=C.target,T=E.selectionStart??E.value.length,I=E.selectionEnd??E.value.length;E.setRangeText(F,T,I,"end"),E.dispatchEvent(new Event("input",{bubbles:!0}))}},_=C=>{const w=u(C.target.value);w!==C.target.value&&(C.target.value=w),y&&C.target.value.length>y&&(C.target.value=C.target.value.slice(0,y)),h.onChange(C)},S={...e.inputProps,...s?{inputMode:"email",autoComplete:"email"}:{},maxLength:y,onKeyDown:g,onBeforeInput:p,onPaste:b,onInvalid:C=>C.preventDefault()},D=e.onlyNumbers||s?"text":e.type??"text";return l.jsx($c,{label:e.label,errorMsg:f,helperText:e.helperText,sx:Th,children:l.jsx(Ah,{placeholder:e.placeholder,type:D,inputProps:S,...h,onChange:_,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function Y3(e,r){const{control:t}=r,n=!!e.multiple;return l.jsx(ir,{name:e.name,control:t,rules:Nc(e,{isArray:n}),render:({field:o,fieldState:s})=>l.jsx($c,{label:e.label,errorMsg:s.error?.message,helperText:e.helperText,sx:Th,children:l.jsxs(m.Select,{...o,multiple:n,displayEmpty:!0,sx:{height:48,backgroundColor:"#EBEEF0","& .MuiSelect-select":{display:"flex",alignItems:"center",py:0}},className:"2-SoftInputData",children:[!n&&l.jsx(m.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(i=>l.jsx(m.MenuItem,{value:i.value,children:i.label},String(i.value)))]})})})}function q3(e,r){return l.jsx(ir,{name:e.name,control:r.control,rules:Nc(e),render:({field:t,fieldState:n})=>l.jsx($c,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:l.jsx(m.RadioGroup,{row:!0,...t,className:"3-RadioFieldRender",children:e.options.map(o=>l.jsx(m.FormControlLabel,{value:o.value,control:l.jsx(m.Radio,{}),label:o.label},String(o.value)))})})})}function Mh(e,r){if(e.render)return e.render(r);switch(e.kind){case"text":return H3(e,r);case"select":return Y3(e,r);case"radio":return q3(e,r);default:return null}}function Z3(e,{initialPerPage:r=25,perPageOptions:t=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:s,deps:i=[]}={}){const a=Array.isArray(e)?e:[],[c,u]=v.useState(1),[d,f]=v.useState(r),{currentItems:h,totalPages:y,showingFrom:g,showingTo:p,totalItems:b}=v.useMemo(()=>{const D=a.length,C=d==="Todos"?1/0:Number(d),w=C===1/0?1:Math.max(1,Math.ceil(D/C)),F=Math.min(c,w),E=C===1/0?D:F*C,T=C===1/0?0:E-C;return{currentItems:C===1/0?a:a.slice(T,E),totalPages:w,showingFrom:D===0?0:T+1,showingTo:C===1/0?D:Math.min(E,D),totalItems:D}},[a,c,d]),_=D=>{const C=Math.max(1,Math.min(D,y||1));u(C),n?.(C),s?.()};return{currentItems:h,totalPages:y,showingFrom:g,showingTo:p,totalItems:b,currentPage:c,itemsPerPage:d,perPageOptions:t,goTo:_,next:()=>_(c+1),prev:()=>_(c-1),setItemsPerPage:D=>{f(D),o?.(D),u(1),s?.()},setCurrentPage:_}}var es={},Ih;function G3(){if(Ih)return es;Ih=1;var e=ct();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var r=e(ht()),t=dt();return es.default=(0,r.default)((0,t.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),es}var K3=G3();const Q3=at(K3);var ts={},Oh;function X3(){if(Oh)return ts;Oh=1;var e=ct();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var r=e(ht()),t=dt();return ts.default=(0,r.default)((0,t.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),ts}var J3=X3();const ek=at(J3),tk=({currentPage:e,totalPages:r,onPageChange:t,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:s,showingFrom:i,showingTo:a,totalItems:c})=>{const u=m.useTheme(),d=m.useMediaQuery(u.breakpoints.down("sm")),f=()=>{if(r<=1)return[1];const g=d?0:2,p=[],b=1,_=r,S=Math.max(b+1,e-g),D=Math.min(_-1,e+g);p.push(b),S>b+1&&p.push("...");for(let C=S;C<=D;C++)C>=b+1&&C<=_-1&&p.push(C);return D<_-1&&p.push("..."),p.push(_),p},h=g=>{const p=g.target.value;o(p)},y=Math.max(1,r);return l.jsxs(m.Box,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},alignItems:"center",justifyContent:{xs:"center",sm:"space-between"},gap:2,my:0,py:2,borderTop:"#D3D4D5 1px solid",px:3},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[l.jsx(m.IconButton,{onClick:()=>t(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:l.jsx(Q3,{fontSize:"large"})}),f().map((g,p)=>g==="..."?l.jsx(m.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):l.jsx(m.Button,{onClick:()=>t(g),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===g?"primary.main":"transparent",fontWeight:e===g?700:400,color:e===g?"#fff":"#5C6372","&:hover":{backgroundColor:e===g?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:g},`p-${g}`)),l.jsx(m.IconButton,{onClick:()=>t(e+1),disabled:e>=y,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:l.jsx(ek,{fontSize:"large"})})]}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[l.jsx(m.Typography,{variant:"body2",children:"Mostrar"}),l.jsx(m.FormControl,{size:"small",sx:{minWidth:72},children:l.jsx(m.Select,{value:n,onChange:h,renderValue:g=>g==="Todos"?"Todos":String(g),children:s.map(g=>l.jsx(m.MenuItem,{value:g,children:g==="Todos"?"Todos":g},String(g)))})}),l.jsx(m.Typography,{variant:"body2",children:"por página"})]})]})};function rk(e){const{open:r,dataAdd:t,fields:n,onSubmit:o,onCancel:s,defaultValues:i,txtBtnGuardar:a,haveId:c=!1,itemsTable:u,filter:d,getId:f,renderRow:h,selectedIds:y,onSelectedChange:g,onSubmitAddData:p,initialSelectedIds:b=[],showAutosPanel:_}=e,S=Xf({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:i});v.useEffect(()=>{i&&S.reset(i)},[i,S]);const[D,C]=v.useState(""),[w,F]=v.useState(b),E=Array.isArray(y)&&!!g,T=E?y:w,I=j=>{const oe=typeof j=="function"?j(T):j;E?g(oe):F(oe)},M=v.useCallback(j=>f?f(j):j?.IdAuto,[f]),U=v.useMemo(()=>{const j=new Map;return(u??[]).forEach((oe,Se)=>j.set(M(oe),Se)),j},[u,M]),q=v.useRef(new Set),V=v.useMemo(()=>{const j=new Map;return(u??[]).forEach(oe=>j.set(f?f(oe):oe?.IdAuto,oe)),j},[u,f]),H=v.useMemo(()=>(n??[]).filter(j=>!!j.required).map(j=>j.name),[n]),re=Pf({control:S.control,name:H}),W=j=>j==null?!1:typeof j=="string"?j.trim().length>0:Array.isArray(j)?j.length>0:typeof j=="number"?!Number.isNaN(j):typeof j=="object"?Object.keys(j).length>0:!0,$=v.useMemo(()=>H.length?re?.every(W)??!1:!0,[re,H]),{handleSubmit:ie,formState:{isSubmitting:ue,isDirty:N,isValid:ee}}=S,xe=d??((j,oe)=>JSON.stringify(j).toLowerCase().includes(oe.toLowerCase())),_e=v.useMemo(()=>D.trim()?u?.filter(j=>xe(j,D)):u,[u,D,xe]),fe=v.useMemo(()=>{if(!_e)return _e;const j=q.current,oe=[..._e];return oe.sort((Se,je)=>{const R=j.has(M(Se))?0:1,te=j.has(M(je))?0:1;if(R!==te)return R-te;const be=U.get(M(Se))??0,qe=U.get(M(je))??0;return be-qe}),oe},[_e,U,M]),{currentItems:ae,totalPages:le,showingFrom:X,showingTo:we,totalItems:ye,currentPage:K,itemsPerPage:Ie,perPageOptions:P,goTo:Be,setItemsPerPage:Qe}=Z3(fe,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[D],scrollTop:()=>{}}),Fe=j=>{const oe=V.get(j)??null;I([j]),p?.({items:oe})},Le=j=>T.includes(j),We=async j=>{try{await o?.(j),S.reset(S.getValues())}catch(oe){console.error("Error al enviar AddCliente:",oe)}},Xe=v.useMemo(()=>{const j=new Map;return(n??[]).forEach(oe=>j.set(String(oe.name),oe)),j},[n]),ft=(j,oe)=>{const Se=Xe.get(String(j));if(!Se)return null;const je={xs:12,...Se.grid,...oe||{}};return l.jsx(m.Grid,{item:!0,...je,children:Se.render?Se.render(S):Mh(Se,S)},`fld-${String(j)}`)},k=_??(e.haveId?"edit":"new"),O=k!=="onlyCars",B=k==="new"||k==="onlyCars",ce=T?.length>0,se=k==="onlyCars"?ce:e.haveId?$&&N||ce:$&&ce;return l.jsx(m.Dialog,{open:r,onClose:s,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:{xs:"100dvh",md:B?"90vw":"auto"},maxWidth:{xs:"100vw",md:B?"98vw":"50%"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:l.jsx(hw,{...S,children:l.jsxs(m.Box,{component:"form",noValidate:!0,onSubmit:ie(We),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[O&&l.jsxs(m.Box,{sx:{width:{xs:"100%",md:c?"100%":394},maxWidth:{xs:"100%",md:c?"100%":394},boxShadow:{xs:"none",md:c?"none":"2px 0px 8px #40404024"},borderRight:{xs:"none",md:c?"none":"1px solid #EBEEF0"},bgcolor:"background.paper",paddingBottom:3,mx:{xs:0,md:c?"auto":0},position:"relative"},children:[l.jsxs(m.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[l.jsx(m.Typography,{fontWeight:700,fontSize:20,children:t.title}),l.jsxs(m.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[l.jsx(m.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:t.subTitle}),l.jsx(m.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((j,oe)=>l.jsx(m.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:j.map((Se,je)=>{const R=typeof Se=="string"?{name:Se}:Se;return R.hidden?.(S)?null:ft(R.name,R.grid)})},`row-${oe}`)):l.jsx(m.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((j,oe)=>{const Se=j.grid??{xs:12,md:12};return l.jsx(m.Grid,{item:!0,...Se,children:j.render?j.render(S):Mh(j,S)},`${String(j.name)}-${oe}`)})})})]})]}),l.jsx(m.Box,{sx:{position:"absolute",zIndex:j=>j.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:l.jsx(m.Box,{display:"flex",alignItems:"center",children:l.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:l.jsx(m.Button,{type:"submit",variant:"contained",disabled:ue||!se,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:c?"160px":"100%"},children:a})})})})]}),B&&l.jsx(m.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:l.jsx(m.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[l.jsxs(m.Box,{p:3,sx:{borderBottom:1,borderBottomColor:"#D3D4D5",position:"sticky",top:0,zIndex:1,bgcolor:"#fff",flexDirection:{sm:"row",xs:"column"}},display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingTop:4,children:[l.jsx(m.TextField,{value:D,onChange:j=>C(j.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:l.jsx(m.InputAdornment,{position:"start",children:l.jsx(i1,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),l.jsx(m.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:l.jsx(m.Box,{onClick:s,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:l.jsx(Rr,{sx:{color:"#070C10",fontSize:24}})})}),_=="onlyCars"&&l.jsx(m.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:l.jsx(m.Box,{display:"flex",gap:1.5,width:"100%",children:l.jsxs(m.Button,{type:"submit",variant:"contained",disabled:ue||!se,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:"100%"},children:[l.jsx(Ch,{sx:{color:ue||!se?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),l.jsx(m.Box,{sx:{flex:1,minHeight:0,overflowY:"auto",overflowX:"auto",padding:0,height:"100%","&::-webkit-scrollbar:horizontal":{display:"none"},"&::-webkit-scrollbar:vertical":{width:8}},children:l.jsx(m.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:l.jsxs(m.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ae?.map((j,oe)=>{const Se=f?f(j):oe,je=Le(Se);return l.jsx(m.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:l.jsx(m.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:l.jsx(m.ListItemButton,{onClick:()=>Fe(Se),disableRipple:!0,sx:{padding:0},children:l.jsx(m.ListItemText,{disableTypography:!0,primary:h?h({item:j,selected:je,toggle:()=>Fe(Se),index:oe}):null})})})},`${String(Se)}`)}),!ae?.length&&l.jsx(m.Box,{p:3,children:l.jsxs(m.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",D,"”."]})})]})})}),l.jsx(m.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:l.jsx(tk,{currentPage:K,totalPages:le,onPageChange:Be,itemsPerPage:Ie,onItemsPerPageChange:Qe,itemsPerPageOptions:P,showingFrom:X,showingTo:we,totalItems:ye})})]})})})]})})})}var rs={},jh;function nk(){if(jh)return rs;jh=1;var e=ct();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var r=e(ht()),t=dt();return rs.default=(0,r.default)((0,t.jsx)("path",{d:"M16.5 6v11.5c0 2.21-1.79 4-4 4s-4-1.79-4-4V5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6H10v9.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5V5c0-2.21-1.79-4-4-4S7 2.79 7 5v12.5c0 3.04 2.46 5.5 5.5 5.5s5.5-2.46 5.5-5.5V6z"}),"AttachFile"),rs}var ok=nk();const sk=at(ok),Lc=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,Li=/[,\s;]+/g,tn=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),rn=(e,r)=>Array.from(new Set([...e,...r.map(t=>t.trim()).filter(Boolean)])),Ph=(e,r)=>r?e.filter(t=>tn(t)!==tn(r)):e,ik=(e,r)=>e.filter(t=>!r.some(n=>tn(n)===tn(t)));function _r(e,r,t){if(t)return typeof t=="function"?t(e,r):e[t]}function ak(e,r){if(r)return!e||/^https?:\/\//i.test(r)?r:e+r}function ck({open:e,onClose:r,value:t,onChange:n,onRequestSend:o,customer:s,itemsSelects:i,renderItem:a,filterFields:c=[],multiSelectAutos:u=!0,imgCorreoSrc:d,baseURLImages:f,itemProps:h,defaultItemImageSrc:y}){const g=v.useRef(null),[p,b]=v.useState("idle"),_=v.useRef(e);v.useEffect(()=>{const R=_.current;e&&!R&&b("entering"),!e&&R&&b("exiting"),_.current=e},[e]),v.useEffect(()=>{if(p==="entering"){const be=setTimeout(()=>b("idle"),320);return()=>clearTimeout(be)}if(p==="exiting"){const be=setTimeout(()=>b("idle"),220);return()=>clearTimeout(be)}},[p]);const[S,D]=v.useState(""),[C,w]=v.useState(!1),[F,E]=v.useState(!1),[T,I]=v.useState(!1),[M,U]=v.useState(""),[q,V]=v.useState([]),H=T?q:t.selectedIds,re=()=>{V([...t.selectedIds]),U(""),I(!0)},W=()=>{I(!1),V([])},$=()=>{const R=new Set(Xe.map((be,qe)=>String(_r(be,qe,h.id)))),te=q.filter(be=>R.has(String(be)));n({...t,selectedIds:te}),I(!1)},ie=(R,te)=>tn(R??"")===tn(te??"");function ue(R,te,be,qe,Ct){const Z=te?R.some(De=>ie(De,te)):!1,de=be.length>0?be.some(De=>R.some(Me=>ie(Me,De))):!1;qe(Z),Ct(de)}const N=R=>{const te=typeof R=="function"?R(t.recipients):R;n({...t,recipients:te}),ue(te,ae,X,w,E)},ee=R=>n({...t,message:R}),xe=R=>n({...t,attachments:[...t.attachments,...R]}),_e=R=>n({...t,attachments:t.attachments.filter(te=>te.name!==R)}),fe=R=>{if(T)if(u){const te=new Set(q);te.has(R)?te.delete(R):te.add(R),V(Array.from(te))}else{const te=q.includes(R);V(te?[]:[R])}else if(u){const te=new Set(t.selectedIds);te.has(R)?te.delete(R):te.add(R),n({...t,selectedIds:Array.from(te)})}else{const te=t.selectedIds.includes(R);n({...t,selectedIds:te?[]:[R]})}},ae=v.useMemo(()=>(s?.Correo??"").trim(),[s]),le=v.useMemo(()=>Array.isArray(s?.Asesores)?s.Asesores.filter(R=>R?.EmailAsesor&&R?.Activo):[],[s]),X=v.useMemo(()=>le.map(R=>(R.EmailAsesor??"").trim()).filter(Boolean),[le]),we=v.useRef(!1);v.useEffect(()=>{if(e&&!we.current){let R=[];C&&ae&&(R=rn(R,[ae])),F&&X.length&&(R=rn(R,X)),N(te=>rn(te,R)),ue(t.recipients,ae,X,w,E),D(""),we.current=!0}e||(we.current=!1)},[e,C,F,ae,X]);const ye=R=>{const te=le.find(be=>tn(be.EmailAsesor??"")===tn(R));if(te){if(te.ImgAsesor)return l.jsx(m.Avatar,{src:te.ImgAsesor,alt:te.NombreAsesor});const be=(te.NombreAsesor||"").trim(),qe=(te.ApellidosAsesor||"").trim();return l.jsx(m.Avatar,{children:`${be[0]??""}${qe[0]??""}`.toUpperCase()})}return l.jsx(m.Avatar,{children:R[0]?.toUpperCase()})},K=()=>{const R=S.trim();if(!R)return;const be=R.split(Li).filter(Boolean).filter(qe=>Lc.test(qe));be.length>0&&N(qe=>rn(qe,be)),D("")},Ie=R=>{w(R),N(te=>R&&ae?rn(te,[ae]):Ph(te,ae))},P=R=>{E(R),N(te=>R?rn(te,X):ik(te,X))},Be=R=>{const te=Array.from(R.target.files||[]);xe(te.map(be=>({name:be.name,size:be.size,file:be}))),R.target.value=""},Qe=H[0],Fe=v.useMemo(()=>!i||Qe===void 0?void 0:i.find((te,be)=>String(_r(te,be,h.id))===String(Qe)),[i,Qe,h.id]),Le=v.useMemo(()=>{if(!(!Fe||!h.distributorId))return _r(Fe,0,h.distributorId)},[Fe,h.distributorId]);console.log("lockedDisId",Le);const We=v.useMemo(()=>Fe?(h.distributorTitle?_r(Fe,0,h.distributorTitle):void 0)??(Le!=null?String(Le):void 0):void 0,[Fe,h.distributorTitle,Le]),Xe=v.useMemo(()=>{const R=i??[];return Le==null||!h.distributorId?R:R.filter((te,be)=>_r(te,be,h.distributorId)==Le)},[i,Le,h.distributorId]),ft=v.useMemo(()=>{if(!M.trim())return Xe;const R=M.toLowerCase();return Xe.filter(te=>(c??[]).some(be=>String(te?.[be]??"").toLowerCase().includes(R)))},[Xe,M,c]),k=v.useMemo(()=>{if(!i||!t.selectedIds.length)return[];const R=new Map;return i.forEach((te,be)=>{R.set(String(_r(te,be,h.id)),te)}),t.selectedIds.map(te=>R.get(String(te))).filter(Boolean)},[i,t.selectedIds,h.id]),O=R=>n({...t,selectedIds:t.selectedIds.filter(te=>String(te)!==String(R))}),B=()=>{let R=t.recipients;if(S.trim()){const Z=S.split(Li).filter(de=>Lc.test(de));R=rn(R,Z),N(R),D("")}const te=C?ae:"",be=le.find(Z=>Z?.Activo&&Z?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:R,toClient:C,toAdvisor:F,tipoInt:C&&F?2:1,correoCliente:te,correoAsesor:F?be:"",disIdLocked:Le}),r?.()},ce=v.useMemo(()=>{const te=S.split(Li).filter(Boolean).some(be=>Lc.test(be));return t.recipients.length>0||te},[t.recipients,S]),se=(t.selectedIds?.length??0)>0,j=t.message.trim().length>0,oe=ce&&se&&j,Se=m.useTheme(),je=m.useMediaQuery(Se.breakpoints.down("sm"));return l.jsxs(m.Drawer,{anchor:je?"bottom":"right",open:e,onClose:r,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!je}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:je?"up":"left",timeout:{enter:320,exit:220},easing:{enter:"cubic-bezier(0.22, 1, 0.36, 1)",exit:"cubic-bezier(0.4, 0, 1, 1)"}},PaperProps:{sx:{width:{xs:"100vw",sm:420},height:{xs:"85vh",sm:"auto"},maxHeight:{xs:"85vh",sm:"calc(100vh - 32px)"},left:{xs:0,sm:"auto"},right:{xs:0,sm:16},bottom:{xs:0,sm:16},top:{xs:"auto",sm:"auto"},borderRadius:{xs:"12px 12px 0 0",sm:2},boxShadow:6,overflow:"hidden"}},children:[l.jsxs(m.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[l.jsxs(m.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[d?l.jsx("img",{src:d,alt:"Correo",style:{width:24,height:18}}):null,l.jsxs(m.Typography,{fontWeight:700,children:["Mensaje a"," ",s?`${s.Nombre??""} ${s.ApellidoP??""} ${s.ApellidoM??""}`.trim():"—"]})]}),l.jsx(m.IconButton,{onClick:r,size:"small",children:l.jsx(Rr,{})})]}),l.jsx("div",{children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[l.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[t.recipients.map(R=>l.jsx(m.Chip,{avatar:ye(R),label:R,onDelete:()=>N(te=>Ph(te,R)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},R)),l.jsx("input",{type:"text",value:S,onChange:R=>D(R.target.value),onKeyDown:R=>{const te=R.key;te==="Enter"||te===","||te===";"||te===" "||te==="Tab"?(R.preventDefault(),K()):te==="Backspace"&&!S&&t.recipients.length&&N(qe=>qe.slice(0,-1))},onBlur:K,onPaste:R=>{const be=R.clipboardData.getData("text").split(Li).filter(Boolean);be.length>1&&(R.preventDefault(),N(qe=>rn(qe,be)),D(""))},placeholder:t.recipients.length?"":"correo@ejemplo.com",style:{flex:1,minWidth:140,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#111827",padding:"4px 0"}})]})]})}),l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:C,onChange:R=>Ie(R.target.checked),size:"small"}),label:"Cliente"}),le.length!==0&&l.jsx(m.FormControlLabel,{control:l.jsx(m.Checkbox,{checked:F,onChange:R=>P(R.target.checked),size:"small"}),label:`Asesor${le.length>1?"es":""}`})]})]}),l.jsx(m.Divider,{}),l.jsxs(m.Box,{p:2,children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:re,children:[l.jsx(m.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),We!=null&&l.jsx(m.Chip,{size:"small",label:`Distribuidora: ${We}`})]}),k.length>0?l.jsx(m.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:k.map((R,te)=>{const be=_r(R,te,h.id),qe=_r(R,te,h.title)??"",Ct=_r(R,te,h.image),Z=ak(f,Ct);return l.jsx(m.Chip,{onDelete:()=>O(be),label:l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.jsx(m.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:Z?l.jsx("img",{src:Z,alt:qe,style:{width:"100%",height:"100%",objectFit:"cover"}}):l.jsx("img",{src:y,alt:qe,style:{width:"100%",height:"100%",objectFit:"cover"}})}),l.jsx("span",{style:{fontSize:12},children:l.jsx("b",{children:qe})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(be))})}):l.jsx(m.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),l.jsx(m.Divider,{}),l.jsxs(m.Box,{sx:{p:2},children:[l.jsx(m.TextField,{placeholder:"Escribe aquí tu mensaje...",value:t.message,onChange:R=>ee(R.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),t.attachments.length>0&&l.jsx(m.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:t.attachments.map(R=>l.jsxs(m.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[l.jsx(m.ListItemText,{style:{gap:10,fontSize:15,color:"#5285F7",display:"flex",flexWrap:"wrap",flex:"none"},primary:R.name,secondary:R.size<1024?`${R.size} b`:R.size<1024*1024?`${(R.size/1024).toFixed(0)} kb`:`${(R.size/(1024*1024)).toFixed(1)} MB`,secondaryTypographyProps:{sx:{fontSize:12,color:"#64748B",fontWeight:500,mt:.25}},primaryTypographyProps:{noWrap:!0,width:"auto"}}),l.jsx(m.Tooltip,{title:"Quitar",children:l.jsx(m.IconButton,{edge:"end",onClick:()=>_e(R.name),size:"small",children:l.jsx(Rr,{fontSize:"small"})})})]},R.name))})]}),l.jsxs(m.Box,{sx:{position:{xs:"sticky",sm:"sticky"},bottom:0,bgcolor:"#fff",borderTop:"1px solid #E5E7EB",p:2,display:"flex",alignItems:"center",gap:2},children:[l.jsx("input",{ref:g,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:Be}),l.jsx(m.Button,{startIcon:l.jsx(sk,{}),variant:"text",onClick:()=>g.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),l.jsx(m.Box,{sx:{flex:1}}),l.jsx(m.Button,{variant:"contained",onClick:B,disabled:!oe,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),l.jsxs(m.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:je,open:T,onClose:W,children:[l.jsxs(m.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",l.jsx(m.IconButton,{onClick:W,size:"small",children:l.jsx(Rr,{})})]}),l.jsxs(m.DialogContent,{children:[l.jsxs(m.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.jsx(m.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:M,onChange:R=>U(R.target.value),sx:{mb:2}}),We!=null&&l.jsx(m.Chip,{size:"small",label:`Distribuidora: ${We}`})]}),l.jsxs(m.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",ft.length,")"]}),l.jsxs(m.List,{sx:{p:0},children:[ft.map((R,te)=>{const be=_r(R,te,h.id),qe=H.includes(String(be))||H.includes(be),Ct=Le==null||_r(R,te,h.distributorId)==Le;return l.jsx(m.ListItem,{disableGutters:!0,sx:{p:0,opacity:Ct?1:.5},children:l.jsx(m.Box,{onClick:()=>Ct&&fe(be),sx:{cursor:Ct?"pointer":"not-allowed",p:.5,backgroundColor:qe?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(R,te):l.jsx("pre",{style:{margin:0},children:JSON.stringify(R,null,2)})})},String(be))}),ft.length===0&&l.jsx(m.Box,{p:2,children:l.jsx(m.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),l.jsxs(m.DialogActions,{sx:{px:3,pb:2},children:[l.jsx(m.Button,{variant:"text",onClick:W,sx:{color:"#5C6372"},children:"Cancelar"}),l.jsx(m.Button,{variant:"contained",onClick:$,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}Mt.AddCliente=rk,Mt.ApiProvider=ox,Mt.AuthProvider=j1,Mt.Clientes=F3,Mt.CustomSnackbar=Ic,Mt.EventsProvider=VD,Mt.ModalCorreo=ck,Mt.MyCalendar=KD,Mt.useAuth=Ua,Mt.useAuthRepository=mi,Mt.useEventRepository=sc,Object.defineProperty(Mt,Symbol.toStringTag,{value:"Module"})}));
|