componentes-exagono 0.2.19 → 0.2.20

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 CHANGED
@@ -20267,7 +20267,9 @@ function $I({
20267
20267
  sx: {
20268
20268
  justifySelf: zp(w.align),
20269
20269
  textAlign: w.align ?? "left",
20270
- minWidth: 0
20270
+ minWidth: 0,
20271
+ overflow: "hidden",
20272
+ maxWidth: "100%"
20271
20273
  },
20272
20274
  children: typeof y == "string" || typeof y == "number" ? /* @__PURE__ */ u.jsx(
20273
20275
  _e,
@@ -20341,8 +20343,8 @@ function VI() {
20341
20343
  }
20342
20344
  var WI = /* @__PURE__ */ VI();
20343
20345
  const YI = /* @__PURE__ */ dt(WI), Wc = ({
20344
- current: e,
20345
- total: t,
20346
+ current: e = 0,
20347
+ total: t = 0,
20346
20348
  color: r = "#4caf50"
20347
20349
  }) => /* @__PURE__ */ u.jsx(
20348
20350
  "div",
@@ -20352,7 +20354,9 @@ const YI = /* @__PURE__ */ dt(WI), Wc = ({
20352
20354
  gap: "1px",
20353
20355
  width: "100%",
20354
20356
  height: "100%",
20355
- justifyContent: "center"
20357
+ justifyContent: "center",
20358
+ overflow: "hidden",
20359
+ minWidth: 0
20356
20360
  },
20357
20361
  children: Array.from({ length: t }).map((n, o) => /* @__PURE__ */ u.jsx(
20358
20362
  "div",
@@ -20826,7 +20830,7 @@ function s5({
20826
20830
  key: "avance",
20827
20831
  header: "Avance",
20828
20832
  accessor: (X) => /* @__PURE__ */ u.jsx(lc, { progress: X.Avance, color: X.Color }),
20829
- width: "100px",
20833
+ width: 200,
20830
20834
  align: "left"
20831
20835
  }
20832
20836
  ];
@@ -21192,7 +21196,6 @@ function s5({
21192
21196
  Ne.length === 0 && /* @__PURE__ */ u.jsx(_e, { variant: "body2", color: "text.secondary", children: "Sin actividad registrada." }),
21193
21197
  /* @__PURE__ */ u.jsxs(B, { children: [
21194
21198
  Ne?.map((N, X) => {
21195
- console.log("h", N);
21196
21199
  const xe = he(N), Re = e5(N.comentario || "");
21197
21200
  return /* @__PURE__ */ u.jsxs(B, { sx: { pb: 1.5 }, children: [
21198
21201
  /* @__PURE__ */ u.jsxs(
package/dist/index.umd.js CHANGED
@@ -174,7 +174,7 @@ const theme2 = createTheme({ palette: {
174
174
  } else {
175
175
  newResult[${x}] = ${S}.value;
176
176
  }
177
- `)}v.write("payload.value = newResult;"),v.write("return payload;");const C=v.compile();return(E,S)=>C(h,E,S)};let s;const i=Bi,a=!Ip.jitless,l=a&&aw.value,d=t.catchall;let f;e._zod.parse=(h,v)=>{f??(f=n.value);const m=h.value;return i(m)?a&&l&&v?.async===!1&&v.jitless!==!0?(s||(s=o(t.shape)),h=s(h,v),d?qp([],m,h,v,f,e):h):r(h,v):(h.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),h)}});function Zp(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Jn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>kn(i,n,Dn())))}),t)}const QS=Z("$ZodUnion",(e,t)=>{Mt.init(e,t),gt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),gt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),gt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),gt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Uc(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>Zp(c,o,e,s)):Zp(a,o,e,s)}}),XS=Z("$ZodIntersection",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>Gp(r,c,l)):Gp(r,s,i)}});function Yc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(qo(e)&&qo(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=Yc(e[s],t[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(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=Yc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Gp(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Jn(e))return e;const n=Yc(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const JS=Z("$ZodEnum",(e,t)=>{Mt.init(e,t);const r=ow(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>cw.has(typeof o)).map(o=>typeof o=="string"?Xn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),eC=Z("$ZodLiteral",(e,t)=>{if(Mt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Xn(r):r?Xn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),tC=Z("$ZodTransform",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tp(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Kn;return r.value=o,r}});function Kp(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const rC=Z("$ZodOptional",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",gt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),gt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Uc(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Kp(s,r.value)):Kp(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),nC=Z("$ZodNullable",(e,t)=>{Mt.init(e,t),gt(e._zod,"optin",()=>t.innerType._zod.optin),gt(e._zod,"optout",()=>t.innerType._zod.optout),gt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Uc(r.source)}|null)$`):void 0}),gt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),oC=Z("$ZodDefault",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",gt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Qp(s,t)):Qp(o,t)}});function Qp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const sC=Z("$ZodPrefault",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",gt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),iC=Z("$ZodNonOptional",(e,t)=>{Mt.init(e,t),gt(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Xp(s,e)):Xp(o,e)}});function Xp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const aC=Z("$ZodCatch",(e,t)=>{Mt.init(e,t),gt(e._zod,"optin",()=>t.innerType._zod.optin),gt(e._zod,"optout",()=>t.innerType._zod.optout),gt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>kn(i,n,Dn()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>kn(s,n,Dn()))},input:r.value}),r.issues=[]),r)}}),cC=Z("$ZodPipe",(e,t)=>{Mt.init(e,t),gt(e._zod,"values",()=>t.in._zod.values),gt(e._zod,"optin",()=>t.in._zod.optin),gt(e._zod,"optout",()=>t.out._zod.optout),gt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Gi(i,t.in,n)):Gi(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Gi(s,t.out,n)):Gi(o,t.out,n)}});function Gi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const lC=Z("$ZodReadonly",(e,t)=>{Mt.init(e,t),gt(e._zod,"propValues",()=>t.innerType._zod.propValues),gt(e._zod,"values",()=>t.innerType._zod.values),gt(e._zod,"optin",()=>t.innerType._zod.optin),gt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Jp):Jp(o)}});function Jp(e){return e.value=Object.freeze(e.value),e}const uC=Z("$ZodCustom",(e,t)=>{cr.init(e,t),Mt.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>eh(s,r,n,e));eh(o,r,n,e)}});function eh(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Zo(o))}}class dC{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,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,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function fC(){return new dC}const Ki=fC();function pC(e,t){return new e({type:"string",...Te(t)})}function hC(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function th(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function mC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function gC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function vC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function yC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function bC(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function _C(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function xC(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function wC(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function SC(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function CC(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function EC(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function DC(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function kC(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function TC(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function IC(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function AC(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function MC(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function PC(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function OC(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function jC(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function RC(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function NC(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function $C(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function LC(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function zC(e,t){return new e({type:"number",checks:[],...Te(t)})}function BC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function FC(e,t){return new e({type:"boolean",...Te(t)})}function UC(e){return new e({type:"unknown"})}function HC(e,t){return new e({type:"never",...Te(t)})}function rh(e,t){return new Fp({check:"less_than",...Te(t),value:e,inclusive:!1})}function qc(e,t){return new Fp({check:"less_than",...Te(t),value:e,inclusive:!0})}function nh(e,t){return new Up({check:"greater_than",...Te(t),value:e,inclusive:!1})}function Zc(e,t){return new Up({check:"greater_than",...Te(t),value:e,inclusive:!0})}function oh(e,t){return new sS({check:"multiple_of",...Te(t),value:e})}function sh(e,t){return new aS({check:"max_length",...Te(t),maximum:e})}function Qi(e,t){return new cS({check:"min_length",...Te(t),minimum:e})}function ih(e,t){return new lS({check:"length_equals",...Te(t),length:e})}function VC(e,t){return new uS({check:"string_format",format:"regex",...Te(t),pattern:e})}function WC(e){return new dS({check:"string_format",format:"lowercase",...Te(e)})}function YC(e){return new fS({check:"string_format",format:"uppercase",...Te(e)})}function qC(e,t){return new pS({check:"string_format",format:"includes",...Te(t),includes:e})}function ZC(e,t){return new hS({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function GC(e,t){return new mS({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Go(e){return new gS({check:"overwrite",tx:e})}function KC(e){return Go(t=>t.normalize(e))}function QC(){return Go(e=>e.trim())}function XC(){return Go(e=>e.toLowerCase())}function JC(){return Go(e=>e.toUpperCase())}function eE(e,t,r){return new e({type:"array",element:t,...Te(r)})}function tE(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Te(r)})}function rE(e){const t=nE(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Zo(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Zo(o))}},e(r.value,r)));return t}function nE(e,t){const r=new cr({check:"custom",...Te(t)});return r._zod.check=e,r}function ah(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function oE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=jc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function sE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=jc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function iE(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(ah(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return s.shouldUseNativeValidation&&Lc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Dp(oE(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(ah(function(){return Promise.resolve((r.mode==="sync"?_w:xw)(e,n,t)).then(function(i){return s.shouldUseNativeValidation&&Lc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof Vc})(i))return{values:{},errors:Dp(sE(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 aE=Z("ZodISODateTime",(e,t)=>{AS.init(e,t),kt.init(e,t)});function cE(e){return RC(aE,e)}const lE=Z("ZodISODate",(e,t)=>{MS.init(e,t),kt.init(e,t)});function uE(e){return NC(lE,e)}const dE=Z("ZodISOTime",(e,t)=>{PS.init(e,t),kt.init(e,t)});function fE(e){return $C(dE,e)}const pE=Z("ZodISODuration",(e,t)=>{OS.init(e,t),kt.init(e,t)});function hE(e){return LC(pE,e)}const xr=Z("ZodError",(e,t)=>{Vc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>bw(e,r)},flatten:{value:r=>yw(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,zc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,zc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),mE=Hi(xr),gE=Vi(xr),vE=Wi(xr),yE=Yi(xr),bE=Cw(xr),_E=Ew(xr),xE=Dw(xr),wE=kw(xr),SE=Tw(xr),CE=Iw(xr),EE=Aw(xr),DE=Mw(xr),Lt=Z("ZodType",(e,t)=>(Mt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>ln(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>mE(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>vE(e,r,n),e.parseAsync=async(r,n)=>gE(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>yE(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>bE(e,r,n),e.decode=(r,n)=>_E(e,r,n),e.encodeAsync=async(r,n)=>xE(e,r,n),e.decodeAsync=async(r,n)=>wE(e,r,n),e.safeEncode=(r,n)=>SE(e,r,n),e.safeDecode=(r,n)=>CE(e,r,n),e.safeEncodeAsync=async(r,n)=>EE(e,r,n),e.safeDecodeAsync=async(r,n)=>DE(e,r,n),e.refine=(r,n)=>e.check(yD(r,n)),e.superRefine=r=>e.check(bD(r)),e.overwrite=r=>e.check(Go(r)),e.optional=()=>vh(e),e.nullable=()=>yh(e),e.nullish=()=>vh(yh(e)),e.nonoptional=r=>dD(e,r),e.array=()=>ph(e),e.or=r=>JE([e,r]),e.and=r=>tD(e,r),e.transform=r=>_h(e,sD(r)),e.default=r=>cD(e,r),e.prefault=r=>uD(e,r),e.catch=r=>pD(e,r),e.pipe=r=>_h(e,r),e.readonly=()=>gD(e),e.describe=r=>{const n=e.clone();return Ki.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ki.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ki.get(e);const n=e.clone();return Ki.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ch=Z("_ZodString",(e,t)=>{Wc.init(e,t),Lt.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(VC(...n)),e.includes=(...n)=>e.check(qC(...n)),e.startsWith=(...n)=>e.check(ZC(...n)),e.endsWith=(...n)=>e.check(GC(...n)),e.min=(...n)=>e.check(Qi(...n)),e.max=(...n)=>e.check(sh(...n)),e.length=(...n)=>e.check(ih(...n)),e.nonempty=(...n)=>e.check(Qi(1,...n)),e.lowercase=n=>e.check(WC(n)),e.uppercase=n=>e.check(YC(n)),e.trim=()=>e.check(QC()),e.normalize=(...n)=>e.check(KC(...n)),e.toLowerCase=()=>e.check(XC()),e.toUpperCase=()=>e.check(JC())}),kE=Z("ZodString",(e,t)=>{Wc.init(e,t),ch.init(e,t),e.email=r=>e.check(hC(TE,r)),e.url=r=>e.check(bC(IE,r)),e.jwt=r=>e.check(jC(VE,r)),e.emoji=r=>e.check(_C(AE,r)),e.guid=r=>e.check(th(lh,r)),e.uuid=r=>e.check(mC(Xi,r)),e.uuidv4=r=>e.check(gC(Xi,r)),e.uuidv6=r=>e.check(vC(Xi,r)),e.uuidv7=r=>e.check(yC(Xi,r)),e.nanoid=r=>e.check(xC(ME,r)),e.guid=r=>e.check(th(lh,r)),e.cuid=r=>e.check(wC(PE,r)),e.cuid2=r=>e.check(SC(OE,r)),e.ulid=r=>e.check(CC(jE,r)),e.base64=r=>e.check(MC(FE,r)),e.base64url=r=>e.check(PC(UE,r)),e.xid=r=>e.check(EC(RE,r)),e.ksuid=r=>e.check(DC(NE,r)),e.ipv4=r=>e.check(kC($E,r)),e.ipv6=r=>e.check(TC(LE,r)),e.cidrv4=r=>e.check(IC(zE,r)),e.cidrv6=r=>e.check(AC(BE,r)),e.e164=r=>e.check(OC(HE,r)),e.datetime=r=>e.check(cE(r)),e.date=r=>e.check(uE(r)),e.time=r=>e.check(fE(r)),e.duration=r=>e.check(hE(r))});function wr(e){return pC(kE,e)}const kt=Z("ZodStringFormat",(e,t)=>{wt.init(e,t),ch.init(e,t)}),TE=Z("ZodEmail",(e,t)=>{xS.init(e,t),kt.init(e,t)}),lh=Z("ZodGUID",(e,t)=>{bS.init(e,t),kt.init(e,t)}),Xi=Z("ZodUUID",(e,t)=>{_S.init(e,t),kt.init(e,t)}),IE=Z("ZodURL",(e,t)=>{wS.init(e,t),kt.init(e,t)}),AE=Z("ZodEmoji",(e,t)=>{SS.init(e,t),kt.init(e,t)}),ME=Z("ZodNanoID",(e,t)=>{CS.init(e,t),kt.init(e,t)}),PE=Z("ZodCUID",(e,t)=>{ES.init(e,t),kt.init(e,t)}),OE=Z("ZodCUID2",(e,t)=>{DS.init(e,t),kt.init(e,t)}),jE=Z("ZodULID",(e,t)=>{kS.init(e,t),kt.init(e,t)}),RE=Z("ZodXID",(e,t)=>{TS.init(e,t),kt.init(e,t)}),NE=Z("ZodKSUID",(e,t)=>{IS.init(e,t),kt.init(e,t)}),$E=Z("ZodIPv4",(e,t)=>{jS.init(e,t),kt.init(e,t)}),LE=Z("ZodIPv6",(e,t)=>{RS.init(e,t),kt.init(e,t)}),zE=Z("ZodCIDRv4",(e,t)=>{NS.init(e,t),kt.init(e,t)}),BE=Z("ZodCIDRv6",(e,t)=>{$S.init(e,t),kt.init(e,t)}),FE=Z("ZodBase64",(e,t)=>{LS.init(e,t),kt.init(e,t)}),UE=Z("ZodBase64URL",(e,t)=>{BS.init(e,t),kt.init(e,t)}),HE=Z("ZodE164",(e,t)=>{FS.init(e,t),kt.init(e,t)}),VE=Z("ZodJWT",(e,t)=>{HS.init(e,t),kt.init(e,t)}),uh=Z("ZodNumber",(e,t)=>{Vp.init(e,t),Lt.init(e,t),e.gt=(n,o)=>e.check(nh(n,o)),e.gte=(n,o)=>e.check(Zc(n,o)),e.min=(n,o)=>e.check(Zc(n,o)),e.lt=(n,o)=>e.check(rh(n,o)),e.lte=(n,o)=>e.check(qc(n,o)),e.max=(n,o)=>e.check(qc(n,o)),e.int=n=>e.check(dh(n)),e.safe=n=>e.check(dh(n)),e.positive=n=>e.check(nh(0,n)),e.nonnegative=n=>e.check(Zc(0,n)),e.negative=n=>e.check(rh(0,n)),e.nonpositive=n=>e.check(qc(0,n)),e.multipleOf=(n,o)=>e.check(oh(n,o)),e.step=(n,o)=>e.check(oh(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ji(e){return zC(uh,e)}const WE=Z("ZodNumberFormat",(e,t)=>{VS.init(e,t),uh.init(e,t)});function dh(e){return BC(WE,e)}const YE=Z("ZodBoolean",(e,t)=>{WS.init(e,t),Lt.init(e,t)});function ea(e){return FC(YE,e)}const qE=Z("ZodUnknown",(e,t)=>{YS.init(e,t),Lt.init(e,t)});function fh(){return UC(qE)}const ZE=Z("ZodNever",(e,t)=>{qS.init(e,t),Lt.init(e,t)});function GE(e){return HC(ZE,e)}const KE=Z("ZodArray",(e,t)=>{ZS.init(e,t),Lt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Qi(r,n)),e.nonempty=r=>e.check(Qi(1,r)),e.max=(r,n)=>e.check(sh(r,n)),e.length=(r,n)=>e.check(ih(r,n)),e.unwrap=()=>e.element});function ph(e,t){return eE(KE,e,t)}const QE=Z("ZodObject",(e,t)=>{KS.init(e,t),Lt.init(e,t),gt(e,"shape",()=>t.shape),e.keyof=()=>mh(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fh()}),e.loose=()=>e.clone({...e._zod.def,catchall:fh()}),e.strict=()=>e.clone({...e._zod.def,catchall:GE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>pw(e,r),e.safeExtend=r=>hw(e,r),e.merge=r=>mw(e,r),e.pick=r=>dw(e,r),e.omit=r=>fw(e,r),e.partial=(...r)=>gw(gh,e,r[0]),e.required=(...r)=>vw(bh,e,r[0])});function hh(e,t){const r={type:"object",get shape(){return cn(this,"shape",e?iw(e):{}),this.shape},...Te(t)};return new QE(r)}const XE=Z("ZodUnion",(e,t)=>{QS.init(e,t),Lt.init(e,t),e.options=t.options});function JE(e,t){return new XE({type:"union",options:e,...Te(t)})}const eD=Z("ZodIntersection",(e,t)=>{XS.init(e,t),Lt.init(e,t)});function tD(e,t){return new eD({type:"intersection",left:e,right:t})}const Gc=Z("ZodEnum",(e,t)=>{JS.init(e,t),Lt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Gc({...t,checks:[],...Te(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Gc({...t,checks:[],...Te(o),entries:s})}});function mh(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Gc({type:"enum",entries:r,...Te(t)})}const rD=Z("ZodLiteral",(e,t)=>{eC.init(e,t),Lt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function nD(e,t){return new rD({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}const oD=Z("ZodTransform",(e,t)=>{tC.init(e,t),Lt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tp(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Zo(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Zo(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function sD(e){return new oD({type:"transform",transform:e})}const gh=Z("ZodOptional",(e,t)=>{rC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function vh(e){return new gh({type:"optional",innerType:e})}const iD=Z("ZodNullable",(e,t)=>{nC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function yh(e){return new iD({type:"nullable",innerType:e})}const aD=Z("ZodDefault",(e,t)=>{oC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cD(e,t){return new aD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Op(t)}})}const lD=Z("ZodPrefault",(e,t)=>{sC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uD(e,t){return new lD({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Op(t)}})}const bh=Z("ZodNonOptional",(e,t)=>{iC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dD(e,t){return new bh({type:"nonoptional",innerType:e,...Te(t)})}const fD=Z("ZodCatch",(e,t)=>{aC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pD(e,t){return new fD({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const hD=Z("ZodPipe",(e,t)=>{cC.init(e,t),Lt.init(e,t),e.in=t.in,e.out=t.out});function _h(e,t){return new hD({type:"pipe",in:e,out:t})}const mD=Z("ZodReadonly",(e,t)=>{lC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gD(e){return new mD({type:"readonly",innerType:e})}const vD=Z("ZodCustom",(e,t)=>{uC.init(e,t),Lt.init(e,t)});function yD(e,t={}){return tE(vD,e,t)}function bD(e){return rE(e)}const xh=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,wh=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(n,o,s,a,c);return isNaN(l.getTime())||!_.isValid(l)?null:l},_D=hh({UsuarioID:Ji().nullable().optional(),disID:Ji().nullable().optional(),EsOrganizador:ea().default(!1),Correo:wr().email("Formato de correo inválido"),StatusInvitacion:mh(["PENDIENTE","CONFIRMADO","DECLINADO"]).default("PENDIENTE")}),xD=hh({titulo:wr().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:wr().min(1,"El campo fecha inicio es requerido."),horaInicio:wr().min(1,"La hora de inicio es requerida.").regex(xh,{message:"Formato inválido"}),horaFin:wr().min(1,"La hora fin es requerida.").regex(xh,{message:"Formato inválido"}),todoElDia:ea(),fechaFin:wr().optional(),showEndDate:ea().optional(),horaInicio2:wr().optional(),TodoElDia2:ea().optional(),client:wr().nullable().optional(),repetir:wr().optional(),link:wr().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(nD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:wr().optional(),invitados:ph(_D).optional().default([]),color:wr().optional(),solID:Ji().nullable().optional(),disID:Ji().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 t=wh(e.fechaInicio,e.horaInicio),r=wh(e.fechaFin,e.horaFin);return!t||!r||!_.isValid(t)||!_.isValid(r)?!0:!(_.isBefore(r,t)&&!_.isSameDay(r,t)||_.isSameDay(t,r)&&_.isBefore(r,t))},{message:"",path:["horaFin"]}),Sh=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.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"}),K.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"})),wD="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",SD=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{clipPath:"url(#a)"},K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),CD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23404756'%20d='M13.17%2013.68c2.06%200%204%20.8%205.46%202.27a7.7%207.7%200%200%201%202.26%205.47c0%20.79-.64%201.43-1.43%201.43l.01-.01H4.53c-.79%200-1.43-.64-1.43-1.43%200-4.27%203.46-7.73%207.72-7.73zM12%201.9c2.82%200%205.11%202.29%205.11%205.11s-2.29%205.11-5.11%205.11v-.01c-2.82%200-5.11-2.29-5.11-5.11S9.18%201.9%2012%201.9'/%3e%3c/svg%3e",ED=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},K.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"}),K.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"}),K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),DD="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",kD=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.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"}),K.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 Ko={},Ch;function TD(){if(Ch)return Ko;Ch=1;var e=at();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.default=void 0;var t=e(ht()),r=ut();return Ko.default=(0,t.default)((0,r.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Ko}var ID=TD();const Eh=it(ID);var Qo={},Dh;function AD(){if(Dh)return Qo;Dh=1;var e=at();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.default=void 0;var t=e(ht()),r=ut();return Qo.default=(0,t.default)((0,r.jsx)("path",{d:"M16.53 11.06 15.47 10l-4.88 4.88-2.12-2.12-1.06 1.06L10.59 17zM19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14z"}),"EventAvailable"),Qo}var MD=AD();const PD=it(MD);var Xo={},kh;function OD(){if(kh)return Xo;kh=1;var e=at();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var t=e(ht()),r=ut();return Xo.default=(0,t.default)((0,r.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Xo}var jD=OD();const RD=it(jD);var Jo={},Th;function ND(){if(Th)return Jo;Th=1;var e=at();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var t=e(ht()),r=ut();return Jo.default=(0,t.default)((0,r.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),Jo}var $D=ND();const Kc=it($D);var es={},Ih;function LD(){if(Ih)return es;Ih=1;var e=at();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var t=e(ht()),r=ut();return es.default=(0,t.default)((0,r.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle"),es}var zD=LD();const Qc=it(zD),BD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",FD=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]},UD=(e,t)=>{const r="#1976D2";if(t)return u.jsxs(u.Fragment,{children:[u.jsx("img",{src:BD,width:18}),u.jsx(g.Typography,{variant:"body2",sx:{color:r,fontWeight:"bold"},children:"  Anfitrión"})]});switch(e){case"PENDIENTE":return u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"grey.700"},children:[u.jsx(Oi,{fontSize:"small",sx:{mr:.5}}),u.jsx(g.Typography,{variant:"body2",children:"Pendiente"})]});case"CONFIRMADA":return u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"success.main"},children:[u.jsx(Qc,{fontSize:"small",sx:{mr:.5}}),u.jsx(g.Typography,{variant:"body2",children:"Asistiré"})]});default:return u.jsx(g.Typography,{variant:"body2",children:"No respondió"})}};function HD({open:e,handleClose:t,guests:r}){console.log("guests",r);const n=r.filter(i=>i.estatus==="CONFIRMADA"||i.isHost),o=r.filter(i=>i.estatus==="PENDIENTE"&&!i.isHost),s=i=>u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1.5},children:[u.jsx(g.Avatar,{sx:{bgcolor:FD(i.iniciales),mr:2},children:i.iniciales}),u.jsx(g.Box,{sx:{flexGrow:1},children:u.jsx(g.Typography,{variant:"body1",children:i.nombre})}),UD(i.estatus,i.isHost)]},i.nombre);return u.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",children:[u.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2},children:[u.jsx(g.IconButton,{onClick:t,children:u.jsx(Kc,{})}),u.jsx(g.Typography,{variant:"h6",children:"Lista de invitados"}),u.jsx(g.IconButton,{onClick:t,children:u.jsx(Vr,{})})]}),u.jsx(g.Divider,{}),u.jsxs(g.DialogContent,{dividers:!0,children:[o.length>0&&u.jsxs(g.Box,{sx:{mb:2},children:[u.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold"},children:["Pendiente (",o.length,")"]}),o.map(i=>s(i))]}),n.length>0&&u.jsxs(g.Box,{children:[u.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:1},children:["Confirmados (",n.length,")"]}),n.map(i=>s(i))]})]})]})}const VD=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function WD({guests:e}){const[t,r]=y.useState(!1),n=()=>r(!0),o=()=>r(!1);return u.jsxs(u.Fragment,{children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee"},children:[u.jsx(g.AvatarGroup,{max:6,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:14}},children:e.map((s,i)=>u.jsx(g.Tooltip,{title:s.nombre,arrow:!0,placement:"right",children:u.jsxs(g.Avatar,{sx:{bgcolor:VD(s.iniciales),position:"relative"},children:[s.iniciales,s.estatus==="PENDIENTE"&&u.jsx(g.Box,{sx:{position:"absolute",bottom:-1,right:1,bgcolor:"gray",borderRadius:"50%",p:.2},children:u.jsx(Oi,{sx:{fontSize:14,color:"white"}})})]})},i))}),u.jsx(g.Box,{sx:{flexGrow:1}}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"primary.main"},onClick:n,children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold"},children:"Ver invitados"}),u.jsx(RD,{fontSize:"small"})]})]}),u.jsx(HD,{open:t,handleClose:o,guests:e})]})}const YD=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),Ah=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},qD=({slot:e,onClick:t})=>u.jsxs(g.Box,{onClick:t,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #e0e0e0",textAlign:"center",transition:"0.2s","&:hover":{transform:"translateY(-3px)",boxShadow:2}},children:[u.jsx(g.Box,{sx:{bgcolor:"#333",color:"white",py:.2},children:u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold",textTransform:"capitalize"},children:YD(e.Fecha)})}),u.jsxs(g.Box,{sx:{bgcolor:"white",color:"black",py:1},children:[u.jsx(g.Typography,{variant:"body2",children:Ah(e.HoraInicio)}),u.jsxs(g.Typography,{variant:"body2",color:"text.secondary",children:["a ",Ah(e.HoraFin)]})]})]});function ZD({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const o=r.reduce((i,a)=>{const c=a.Fecha;return i[c]||(i[c]=[]),i[c].push(a),i},{}),s=Object.keys(o);return u.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",children:[u.jsxs(g.Box,{sx:{p:2},children:[u.jsx(g.Typography,{variant:"subtitle1",sx:{fontWeight:"bold"},children:"Selecciona un nuevo horario"}),u.jsx(g.Button,{startIcon:u.jsx(Kc,{}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0},children:"Volver al evento"})]}),u.jsx(g.Divider,{}),u.jsx(g.DialogContent,{sx:{px:3,py:2},children:s.map((i,a)=>u.jsxs(g.Box,{sx:{mb:4},children:[u.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:a===0?"#1976d2":"text.primary"},children:[a===0?"Mismo día":"Próximas fechas",a===0&&u.jsx(Qc,{sx:{ml:1,fontSize:18}})]}),u.jsx(g.Grid,{container:!0,spacing:2,children:o[i].map((c,l)=>u.jsx(g.Grid,{item:!0,xs:6,sm:4,children:u.jsx(qD,{slot:c,onClick:()=>n(c)})},`${i}-${l}`))})]},i))})]})}var ts={},Mh;function GD(){if(Mh)return ts;Mh=1;var e=at();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var t=e(ht()),r=ut();return ts.default=(0,t.default)((0,r.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group"),ts}var KD=GD();const QD=it(KD),XD=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function JD({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=y.useState(null),[s,i]=y.useState(""),a=(l,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(l,d)=>{i(d),r(d)};return u.jsx(g.Autocomplete,{options:t,value:n,inputValue:s,getOptionLabel:l=>l.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(l,d)=>l.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:l=>u.jsx(g.TextField,{...l,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...l.InputProps,startAdornment:u.jsx(g.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:u.jsx(QD,{color:"action"})}),disableUnderline:!0}}),renderOption:(l,d)=>y.createElement(g.Box,{component:"li",...l,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},u.jsx(g.Avatar,{sx:{bgcolor:XD(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),u.jsx(g.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var rs={},Ph;function ek(){if(Ph)return rs;Ph=1;var e=at();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var t=e(ht()),r=ut();return rs.default=(0,t.default)((0,r.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"),rs}var tk=ek();const Xc=it(tk),rk=e=>e.tieneConflicto?{icon:u.jsx(Xc,{sx:{fontSize:20}}),fillColor:"#F0A290",iconColor:"#D9981E",textColor:"#000000",variant:"filled"}:{icon:u.jsx(Qc,{sx:{fontSize:20,margin:"0px"}}),fillColor:"#F0ECEB",iconColor:"#D9981E",textColor:"#000000",variant:"filled"},nk=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function ok({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=i=>()=>{n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return u.jsxs(g.Box,{sx:{p:1},children:[u.jsx(g.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=rk(i),l=nk(i.iniciales);return u.jsx(g.Chip,{label:u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center"},children:[u.jsx(g.Typography,{variant:"body2",component:"span",sx:{color:c.textColor,margin:"5px",fontSize:"13px"},children:s(i?.nombre)}),u.jsx(g.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"flex-end",ml:.5},children:c.icon})]}),avatar:u.jsx(g.Avatar,{sx:{bgcolor:l},children:i.iniciales}),sx:{backgroundColor:c.fillColor,borderStyle:"none",paddingRight:"0px",paddingLeft:"0px","& .MuiChip-deleteIcon":{visibility:"hidden",color:c.textColor},"&:hover .MuiChip-deleteIcon":{visibility:"visible"},"& .MuiChip-avatar":{color:"white"},"& .MuiChip-label":{display:"flex",paddingLeft:"5px",paddingRight:"0px",alignItems:"center",width:"100%"},"&:hover .status-icon-wrapper":{visibility:"hidden"}},variant:c.variant,onClick:()=>console.log(`Clic en ${i.nombre}`),onDelete:o(i.nombre)},a)})}),t>0&&u.jsxs(g.Box,{sx:{mt:2,p:1},children:[u.jsxs(g.Typography,{color:"error",sx:{display:"flex",alignItems:"center",fontSize:"14px"},children:[u.jsx(Xc,{sx:{mr:1}}),"Se detectó un conflicto de agenda con ",t," invitado",t!==1?"s":""]}),u.jsx(g.Link,{component:"button",variant:"body2",onClick:r,sx:{mt:.5,textDecoration:"none"},children:"Ver sugerencias de horario"})]})]})}function sk(e,t){const[r,n]=y.useState(e);return y.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}const ik={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"},Oh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],ak=()=>{const e=[];for(let t=0;t<24;t++)for(let r=0;r<60;r+=15){const n=t.toString().padStart(2,"0"),o=r.toString().padStart(2,"0");e.push(`${n}:${o}`)}return e},jh=[],eo=ak(),ns=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(s,o,n,a,c);return isNaN(l.getTime())||!_.isValid(l)?null:l},ck=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c})=>{const[l,d]=y.useState(!1),[f,h]=y.useState(!1),v=_.format(new Date,"yyyy-MM-dd"),[m,p]=y.useState(""),[b,w]=y.useState([]),[C,E]=y.useState(!1),S=Dc(),[x,U]=y.useState([]),[D,T]=y.useState(""),[M,A]=y.useState(jh),[W,G]=y.useState(!1),[F,Y]=y.useState(""),[oe,H]=y.useState(!1),[N,ce]=y.useState([]),[fe,$]=y.useState([]),Q=sk(F,300),Ce=M.filter(q=>q.tieneConflicto).length,{control:me,handleSubmit:Se,reset:ie,formState:{errors:ee,isValid:le},watch:ge,setValue:de}=Cp({resolver:iE(xD),defaultValues:{titulo:s?.titulo||"",fechaInicio:_.format(new Date,"yyyy-MM-dd"),horaInicio:_.format(new Date,"HH:mm"),horaFin:_.format(_.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"}),pe=ge("fechaInicio"),Re=ge("fechaFin"),j=ge("todoElDia");y.useEffect(()=>{if(m.trim()===""||!i||!c||!a){w([]),U([]),de("solID",null),E(!1),T("");return}E(!0);const q=setTimeout(()=>{S.getClients(m,c,a,i).then(ae=>{if(E(!1),ae){const Ie=ae.map(He=>He.solID);U([...new Set(Ie)])}else U([]);const Ee=Array.from(new Map(ae.map(Ie=>[Ie.nombreCliente,Ie])).values());if(Ee.length>0)w(Ee),T("");else if(s?.client&&s.solID!==null){const Ie=[{solID:s.solID,nombreCliente:s.client}];w(Ie),T("Sin resultados")}else w([]),T("Sin resultados")}).catch(ae=>{console.error("Error al buscar clientes:",ae),E(!1)})},500);return()=>clearTimeout(q)},[m,i,c,a]),y.useEffect(()=>{if(pe&&Re){const q=new Date(pe),ae=new Date(Re);(q===ae||q>ae)&&de("fechaFin",pe)}},[pe,Re,de]),y.useEffect(()=>{pe&&de("fechaFin",pe)},[pe]),y.useEffect(()=>{de("showEndDate",l)},[l,de]),y.useEffect(()=>{if(s){const q=_.format(s.fechaInicio,"yyyy-MM-dd")===_.format(s.fechaFin,"yyyy-MM-dd");if(d(!q),de("titulo",s?.titulo),de("fechaInicio",_.format(s.fechaInicio,"yyyy-MM-dd")),de("fechaFin",_.format(s.fechaFin,"yyyy-MM-dd")),de("horaInicio",_.format(s.fechaInicio,"HH:mm")),de("horaFin",_.format(s.fechaFin,"HH:mm")),de("horaInicio2",_.format(s.fechaFin,"HH:mm")),de("descripcion",s.descripcion),de("link",s.link),de("repetir","false"),de("color",s.color),de("todoElDia",s.todoElDia),de("solID",s.solID),de("client",s.client),console.log("initialEvent.invitados",s.invitados),s.invitados&&s.invitados.length>0){const ae=(s?.invitados||[]).map(Ee=>{const Ie=Ee.usrNombre?.trim()||"",He=Ie.split(/\s+/),J=He.length>1?(He[0][0]+He[1][0]).toUpperCase():Ie.substring(0,2).toUpperCase();return{nombre:Ee.usrNombre||"Sin nombre",correo:Ee.correo||"",iniciales:J||"--",usrID:Ee.usuarioID??null,isHost:Ee.esOrganizador||!1,estatus:Ee.statusInvitacion==="CONFIRMADA"?"CONFIRMADA":"PENDIENTE",tieneConflicto:!1,disID:Ee.disID}});console.log("mappedGuests",ae),A(ae)}else A(jh);s.solID?h(!0):h(!1)}else{const q=o||new Date,ae=new Date,Ee=new Date(q.getFullYear(),q.getMonth(),q.getDate(),ae.getHours(),ae.getMinutes()),Ie=_.addHours(Ee,1);ie({titulo:"",fechaInicio:_.format(Ee,"yyyy-MM-dd"),horaInicio:_.format(Ee,"HH:mm"),fechaFin:_.format(Ie,"yyyy-MM-dd"),horaFin:_.format(Ie,"HH:mm"),horaInicio2:_.format(Ie,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:Oh[0],solID:null}),d(!1),h(!1)}},[s,e,o]);const Fe=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==i,StatusInvitacion:"PENDIENTE",disID:c??null}),qe=Se(q=>{const ae=M.map(Ie=>Fe(Ie)),Ee={...q,invitados:ae};r(Ee,s?.eventoID),t(),ie(),d(!1)},q=>{console.log("Errores de validación:",q)});y.useEffect(()=>{j&&(de("horaInicio","00:00"),de("horaFin","23:59"))},[j,de,ge]);const Ze=()=>{const q=ge("fechaInicio");if(q){const ae=new Date(`${q}T00:00:00`),Ee=_.addDays(ae,1);de("fechaFin",_.format(Ee,"yyyy-MM-dd"))}d(!0)},Ne=ge("fechaInicio"),Be=ge("horaInicio"),vt=ge("fechaFin"),pt=ge("horaFin"),[k,P]=y.useState(null),[B,ue]=y.useState(null);y.useEffect(()=>{(k===null||k!==Be)&&P(Be)},[Be,k]),y.useEffect(()=>{(B===null||B!==pt)&&ue(pt??"")},[pt,B]);const se=ge("todoElDia");y.useEffect(()=>{if(se||!Be||!pt||!Ne||!vt)return;const q=ns(Ne,Be),ae=ns(vt,pt);if(!q||!ae||!_.isValid(q)||!_.isValid(ae))return;const Ee=_.isSameDay(q,ae),Ie=Ee&&(_.isAfter(q,ae)||q.getTime()===ae.getTime()),He=_.isBefore(ae,q)&&!Ee;(Ie||He)&&(de("horaFin",""),ue(""))},[Be,Ne]);const O=y.useMemo(()=>{if(!Be||!Ne)return eo;const q=ns(Ne,Be),ae=ns(vt,"00:00");return!q||!ae||!_.isValid(q)||!_.isValid(ae)||_.isBefore(ae,q)&&!_.isSameDay(ae,q)?eo:_.isSameDay(q,ae)?eo.filter(Ee=>{const Ie=ns(vt,Ee);return Ie&&_.isAfter(Ie,q)}):(_.isAfter(ae,q),eo)},[Be,Ne,vt]),ne=y.useMemo(()=>eo,[]),we=async q=>{const ae=M.some(qt=>qt.correo===q.correo);if(H(!0),ae)return;const Ee=c,Ie=q.correo,He=q.usrID,J=Ne,Me=Be,ke=pt;if(!Ee||!Ie||!J||!Me||!ke){A(qt=>[...qt,{...q,status:"pending",isHost:!1,hasConflict:!1,usrID:He,name:q.nombre}]);return}let je;try{je=await S.VerificarConflicto(Ee,Ie,J,Me+":00",ke+":00")}catch{je={tieneConflicto:!1,usrMail:q.correo}}const Yt=Array.isArray(je)?je[0]:je;console.log("primerConflicto",Yt);const Kt={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(Yt.tieneConflicto).toLowerCase()==="true"};if(console.log("conflictResult",Kt),Kt.tieneConflicto){const qt=await S.getDisponibilidadUsuario(c,Ie,J,"60");ce(qt)}A(qt=>[...qt,Kt])},Oe=q=>{A(ae=>ae.filter(Ee=>Ee.nombre!==q))},R=()=>{G(!1)},te=q=>{const Ie=(q.usrNombre??"").split(" ").map(He=>He.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:Ie,usrID:q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};y.useEffect(()=>{Q.length>2&&c?(async()=>{const Ee=(await S.getUsuariosInvitados(c,Q)).map(te).filter(Ie=>Ie.usrID!==i&&!M.some(He=>He.correo===Ie.correo));$(Ee),console.log("sugerencias",Ee)})():$([])},[Q,M]);const xe=q=>{Y(q)},Ge=async q=>{try{const{Fecha:ae,HoraInicio:Ee,HoraFin:Ie}=q,He={nuevaFecha:ae,nuevaHoraInicio:Ee,nuevaHoraFin:Ie};R()}catch(ae){console.error("Error al reprogramar el evento:",ae)}};return u.jsx(u.Fragment,{children:u.jsx(g.Modal,{open:e,onClose:t,children:u.jsx("form",{onSubmit:qe,children:u.jsxs(g.Box,{sx:ik,children:[u.jsx(g.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:u.jsx(Vr,{})}),u.jsx(g.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent?u.jsxs(u.Fragment,{children:[u.jsx(PD,{sx:{mr:1}}),s.titulo||"Evento de Google"]}):s?"Editar evento":"Agregar evento"}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(mr,{name:"titulo",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!ee.titulo,helperText:ee.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"}}})})})}),u.jsxs("div",{className:`row g-2 ${l?"mb-1":"mb-2"}`,children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(mr,{name:"fechaInicio",control:me,render:({field:q})=>u.jsx(g.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!ee.fechaInicio,helperText:ee.fechaInicio?.message})})}),l?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-10 col-md-4",children:u.jsx(mr,{name:"fechaFin",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:pe||v},error:!!ee.fechaFin,helperText:ee.fechaFin?.message})})}),!s&&u.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:u.jsx(g.IconButton,{onClick:()=>d(!1),sx:{fontSize:18},children:u.jsx(Sh,{})})})]}):u.jsx("div",{className:"col-md-8"})]}),l&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12 d-flex justify-content-center",children:u.jsx(Eh,{sx:{color:"#757575",my:1}})})}),u.jsxs("div",{className:"row g-2 mb-2",children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(mr,{name:"horaInicio",control:me,render:({field:{onChange:q,value:ae,...Ee}})=>u.jsx(g.Autocomplete,{freeSolo:!0,options:ne,value:ae||"",onChange:(Ie,He)=>q(He||""),onInputChange:(Ie,He)=>q(He),renderInput:Ie=>u.jsx(g.TextField,{...Ie,...Ee,size:"small",error:!!ee.horaInicio,helperText:ee.horaInicio?.message,InputProps:{...Ie.InputProps,endAdornment:u.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Oi,{})})}}),disabled:se})})}),!l&&u.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:ee.horaInicio?"5px":"0px"},children:u.jsx(Eh,{sx:{color:"#757575"}})}),l&&u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(mr,{name:"horaFin",control:me,render:({field:{onChange:q,value:ae,...Ee}})=>u.jsx(g.Autocomplete,{freeSolo:!0,options:O,value:ae||"",onChange:(Ie,He)=>q(He||""),onInputChange:(Ie,He)=>q(He),renderInput:Ie=>u.jsx(g.TextField,{...Ie,...Ee,size:"small",error:!!ee.horaFin,helperText:ee.horaFin?.message,InputProps:{...Ie.InputProps,endAdornment:u.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Oi,{})})}}),disabled:se})})}),!l&&u.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:u.jsx(mr,{name:"todoElDia",control:me,render:({field:q})=>u.jsx(g.FormControlLabel,{control:u.jsx(g.Checkbox,{checked:q.value,onChange:ae=>q.onChange(ae.target.checked)}),label:u.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!l&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(g.Button,{onClick:Ze,size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(ED,{}),"  Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&u.jsx("div",{className:"row mb-2",children:u.jsxs("div",{className:"col-12",children:[!f&&u.jsxs(g.Button,{onClick:()=>h(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(kD,{}),"  Vincular cliente"]}),f&&u.jsxs("div",{className:"row g-2",children:[u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(mr,{name:"client",control:me,render:({field:q})=>u.jsx(g.Autocomplete,{options:b,loading:C,loadingText:"Buscando coincidencias...",getOptionLabel:ae=>ae.nombreCliente?.trim()||"",value:b.find(ae=>ae.nombreCliente===q.value)||(q.value&&typeof q.value=="string"?{solID:-1,nombreCliente:q.value}:null),noOptionsText:D,onInputChange:(ae,Ee)=>{p(Ee)},onChange:(ae,Ee)=>{q.onChange(Ee?Ee.nombreCliente:"")},renderInput:ae=>u.jsx(g.TextField,{...ae,placeholder:"Buscar cliente...",size:"small",InputProps:{...ae.InputProps,startAdornment:u.jsx("img",{src:CD,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:u.jsxs(u.Fragment,{children:[C?u.jsx(g.CircularProgress,{color:"inherit",size:20}):null,ae.InputProps.endAdornment]})}})})})}),u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(mr,{name:"solID",control:me,render:({field:q})=>u.jsx(g.Autocomplete,{options:x,noOptionsText:"Sin resultados",getOptionLabel:ae=>ae.toString(),value:q.value??null,onChange:(ae,Ee)=>q.onChange(Ee),renderInput:ae=>u.jsx(g.TextField,{...ae,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!b.length})})}),u.jsx("div",{className:"col-2 d-flex align-items-center",children:u.jsx(g.IconButton,{onClick:()=>h(!1),sx:{fontSize:18},children:u.jsx(Sh,{})})})]})]})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(mr,{name:"link",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!ee.link,helperText:ee.link?.message,InputProps:{startAdornment:u.jsx("img",{src:wD,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(mr,{name:"descripcion",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:u.jsx("img",{src:DD,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(JD,{onSelectGuest:we,availableSuggestions:fe,onInputTextChange:xe})})}),oe&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(ok,{guests:M,conflictCount:Ce,onViewSuggestions:()=>G(!0),onDeleteGuest:Oe})})}),s?.invitados&&s?.invitados?.length>0&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(g.Box,{children:u.jsx(WD,{guests:M})})})}),u.jsx(ZD,{open:W,handleClose:R,suggestions:N,onSelectSlot:Ge}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[u.jsx(SD,{}),Oh.map(q=>u.jsx(mr,{name:"color",control:me,render:({field:ae})=>u.jsx(g.IconButton,{onClick:()=>ae.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:ae.value===q?"2px solid":"none",borderColor:ae.value===q?"primary.main":"transparent"}})},q))]})})}),u.jsx("div",{className:"row",children:u.jsxs("div",{className:"col-12 d-flex justify-content-end gap-2",children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&u.jsx(g.Button,{onClick:n,variant:"outlined",color:"error",sx:{textTransform:"none"},children:"Eliminar"}),u.jsx(g.Button,{onClick:t,variant:"outlined",sx:{textTransform:"none"},children:"Cancelar"}),u.jsx(g.Button,{onClick:qe,variant:"contained",sx:{textTransform:"none"},disabled:!le,children:"Guardar"})]})})]})})})})},Rh="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",lk={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"},uk=({isOpen:e,onClose:t,events:r,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),t()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return u.jsx(g.Modal,{open:e,onClose:t,children:u.jsxs(g.Box,{sx:lk,children:[u.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[u.jsxs(g.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),u.jsx(g.IconButton,{onClick:t,size:"small",children:u.jsx(Vr,{})})]}),u.jsx(g.Divider,{}),u.jsx(g.List,{sx:{mt:1},children:r.map(a=>{const c=i(a);return u.jsx(g.ListItem,{disablePadding:!0,sx:{mb:1},children:u.jsx(g.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:u.jsxs(g.Box,{sx:{flexGrow:1},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[u.jsx(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),u.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),u.jsx(g.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${_.format(a.fechaInicio,"HH:mm")} - ${_.format(a.fechaFin,"HH:mm")}`})]})})},a.eventoID)})})]})})};var os={},Nh;function dk(){if(Nh)return os;Nh=1;var e=at();Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var t=e(ht()),r=ut();return os.default=(0,t.default)((0,r.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"),os}var fk=dk();const pk=it(fk),hk="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",mk="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",$h=y.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=ys.useSnackbar(),s={success:{color:"#fff",icon:u.jsx("img",{width:25,src:mk,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:u.jsx(Xc,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:u.jsx(pk,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:u.jsx("img",{src:hk,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})}},i=s[r]||s.info;return u.jsx(ys.SnackbarContent,{ref:n,children:u.jsxs(g.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:[u.jsx(g.Box,{sx:{mr:1.5},children:i.icon}),u.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),u.jsx(g.IconButton,{size:"small",onClick:()=>o(e),children:u.jsx(Vr,{fontSize:"small"})})]})})}),Lh=y.createContext(void 0),gk=({children:e})=>{const[t,r]=y.useState([]),[n,o]=y.useState([]),[s,i]=y.useState(!1);return u.jsx(Lh.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},vk=()=>{const e=y.useContext(Lh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},yk=(e,t,r)=>{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(bk(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:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!0}};function bk(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}function _k(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}const xk=(e,t,r)=>{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(_k(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:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},wk=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>u.jsxs(g.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[u.jsx(g.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:u.jsx(g.IconButton,{onClick:t,size:"small",children:u.jsx(Vr,{fontSize:"small"})})}),u.jsxs(g.DialogContent,{sx:{textAlign:"center",pt:0},children:[u.jsx(g.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),u.jsx(g.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),u.jsx(g.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),u.jsxs(g.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[u.jsx(g.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),u.jsx(g.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:c?"Procesando...":i})]})]})]}),Sk=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o})=>{const[s,i]=y.useState(new Date),[a,c]=y.useState([]),[l,d]=y.useState(!1),[f,h]=y.useState(null),[v,m]=y.useState(!1),[p,b]=y.useState(null),[w,C]=y.useState([]),{enqueueSnackbar:E}=ys.useSnackbar(),S=Dc(),x=Ti(),U=xc(),[D,T]=y.useState(!1),[M,A]=y.useState([]),[W,G]=y.useState(null),{session:F,sessionoutlook:Y}=ac(),{googleEvents:oe,setGoogleEvents:H,outlookEvents:N,setOutlookEvents:ce}=vk(),[fe,$]=y.useState([]),[Q,Ce]=y.useState([]),[me,Se]=y.useState([]),[ie,ee]=y.useState(!1),[le,ge]=y.useState([]),[de,pe]=y.useState(),Re=(J,Me)=>{A(J),G(Me),T(!0)},j=async()=>{if(e===void 0)return;const J=await S.getNotificacionesXUsuario(e,!1);ge(J)};y.useEffect(()=>{const J=new Date,Me=_.startOfDay(J),ke=_.endOfDay(_.addDays(Me,6)),je={start:Me,end:ke},Yt=a.filter(Kt=>{const qt={start:Kt.fechaInicio,end:Kt.fechaFin};return Fd(qt,je)}).sort((Kt,qt)=>Kt.fechaInicio.getTime()-qt.fechaInicio.getTime());C(Yt)},[a]),y.useEffect(()=>{const J=async()=>{try{if(e){const ke=await S.getEventsByUser(e);j(),c(ke)}}catch(ke){console.log("Error al cargar eventos locales:",ke)}};J();const Me=setInterval(J,4e3);return()=>clearInterval(Me)},[e]),y.useEffect(()=>{if(!n||!e)return;const J=[...a];if(oe.length>0&&F?.userEmail){const Me=oe.map(ke=>yk(ke,n,e));J.push(...Me)}if(N.length>0&&Y?.userEmail){const Me=N.map(ke=>xk(ke,n,e));J.push(...Me)}$(J)},[a,oe,N,n,e,F?.userEmail,Y?.userEmail]);const Fe=async J=>{try{if(J?.isGoogleEvent||J.isOutlookEvent)h(J),d(!0);else{const Me=await S.getEventById(J.eventoID);h(Me),d(!0)}}catch(Me){console.error(Me)}},qe=()=>{d(!1),h(null)},Ze=async(J,Me)=>{let ke,je;J.todoElDia?(ke=new Date(`${J.fechaInicio}T${J.horaInicio}`),je=new Date(`${J.fechaInicio}T${J.horaFin}`)):(ke=new Date(`${J.fechaInicio}T${J.horaInicio}`),je=J.fechaFin&&J.horaFin?new Date(`${J.fechaFin}T${J.horaFin}`):new Date(`${J.fechaInicio}T${J.horaFin}`));const Yt=_.format(ke,"yyyy-MM-dd HH:mm:ss.SSS"),Kt=_.format(je,"yyyy-MM-dd HH:mm:ss.SSS");if(Me){const Yr={...J,eventoID:Me,fechaInicio:Yt,fechaFin:Kt,solID:J.solID??null,disID:n??null,client:J.client,invitados:J.invitados.map(Ke=>({usrNombre:Ke.nombre||Ke.usrNombre,Correo:Ke.correo||Ke.Correo,EsOrganizador:Ke.isHost||Ke.EsOrganizador,StatusInvitacion:Ke.StatusInvitacion,UsuarioID:Ke.usrID||Ke.UsuarioID,disID:Ke.disID||n}))};try{const Ke=await S.updateEvent(Yr);var qt=a.map(Sr=>Sr.eventoID===Ke.eventoID?Ke:Sr);c(qt),E("El evento se ha actualizado correctamente.",{variant:"success"}),qe()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Yr={...J,fechaInicio:Yt,fechaFin:Kt,todoElDia:J.todoElDia,solID:J.solID??null,disID:n??null,client:J.client,invitados:J.invitados.map(Ke=>({usrNombre:Ke.nombre||Ke.usrNombre,Correo:Ke.correo||Ke.Correo,EsOrganizador:Ke.isHost||Ke.EsOrganizador,StatusInvitacion:Ke.StatusInvitacion,UsuarioID:Ke.usrID||Ke.UsuarioID,disID:Ke.disID||n}))};try{const Ke=await S.createEvent(Yr,e);c(Sr=>[...Sr,Ke]),E("El evento se ha creado con éxito",{variant:"success"}),qe()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e){const Yr=await S.getEventsByUser(e);c(Yr)}},Ne=()=>{i(J=>new Date(J.getFullYear(),J.getMonth()-1,1))},Be=()=>{i(J=>new Date(J.getFullYear(),J.getMonth()+1,1))},vt=()=>{ae("ELIMINAR")},pt=()=>{ae("RECHAZAR")},k=()=>{b(new Date),d(!0)},P=J=>{J&&i(J)},B=J=>{b(J),d(!0),h(null)},ue=async()=>{if(f)try{await S.deleteEvent(f.eventoID),c(a.filter(J=>J.eventoID!==f.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(J,Me)=>u.jsx($h,{id:J,message:String(Me),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{qe(),Ee()}},se=async()=>{if(!(!F?.userEmail||!n)){ee(!0);try{const Me=(await x.getGoogleCalendars(F.userEmail,n)).map(je=>({...je,selected:!0}));Ce(Me);const ke=Me.map(je=>je.id);Oe(ke)}catch(J){console.error("Error Google Cals:",J)}finally{ee(!1)}}},O=async J=>{const Me=Q.map(je=>je.id===J?{...je,selected:!je.selected}:je);Ce(Me);const ke=Me.filter(je=>je.selected).map(je=>je.id);Oe(ke)},ne=async()=>{if(!(!Y?.userEmail||!n)){ee(!0);try{const Me=(await U.getOutlookCalendars(Y.userEmail,n)).map(je=>({...je,selected:!0}));Se(Me);const ke=Me.map(je=>je.id);R(ke)}catch(J){console.error("Error Outlook Cals:",J)}finally{ee(!1)}}},we=async J=>{const Me=me.map(je=>je.id===J?{...je,selected:!je.selected}:je);Se(Me);const ke=Me.filter(je=>je.selected).map(je=>je.id);R(ke)};y.useEffect(()=>{se()},[F?.userEmail,n]),y.useEffect(()=>{ne()},[Y?.userEmail,n]);const Oe=async J=>{if(!F?.userEmail||!n)return;const Me=J||Q.filter(ke=>ke.selected).map(ke=>ke.id);try{const ke={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:F.userEmail,calendarIds:Me},je=await x.getGoogleEventsByMonth(ke);H(je)}catch(ke){console.error("Error al obtener eventos de Google:",ke)}},R=async J=>{if(!Y?.userEmail||!n)return;const Me=J||me.filter(ke=>ke.selected).map(ke=>ke.id);try{const ke={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:Y.userEmail,calendarIds:Me},je=await U.getOutlookEventsByMonth(ke);ce(je)}catch(ke){console.error("Error al obtener eventos de Outlook:",ke)}};if(n===void 0||e===void 0)return u.jsx("div",{children:"Cargando configuración de usuario..."});const te=async(J,Me)=>{await S.UpdateStatusEvento(J.evento.eventoID,e,Me)&&(await S.MarcarLeido(J.notificacionID,e),E(J?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},xe=async()=>{de&&S.UpdateStatusEvento(de.evento.eventoID,e,"RECHAZADA")&&(await S.MarcarLeido(de.notificacionID,e),E("Haz rechazado la Invitación "+de?.evento?.titulo,{variant:"success"}),Ee())},Ge=async(J,Me)=>{try{if(!e)return;pe(J),Me=="RECHAZADA"?(pt(),console.log("noti",J)):te(J,Me)}catch{E("Error al procesar la invitación",{variant:"error"})}},[q,ae]=y.useState(null),Ee=()=>ae(null),Ie={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:u.jsxs(u.Fragment,{children:["Estás a punto de declinar la invitación de ",u.jsx("strong",{children:"Enrique Sánchez"})," a ",u.jsx("strong",{children:de?.evento?.titulo})]}),icon:u.jsx("img",{src:Rh}),action:()=>de&&xe()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:u.jsx("img",{src:Rh}),action:()=>ue()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ue}},He=q?Ie[q]:null;return u.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[u.jsx(ny,{header:u.jsx(w2,{currentDate:s,onPrevMonth:Ne,onNextMonth:Be,onAddEvent:k,onDateChange:P}),sidebar:u.jsx(kx,{onEventClick:Fe,upcomingEvents:w,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:k,googleCalendars:Q,outlookCalendars:me,isLoadingCalendars:ie,onToggleGoogle:O,onToggleOutlook:we,notifications:le,unreadCount:le?.filter(J=>!J.leida).length,onAceppInvitacion:Ge}),mainContent:u.jsx(Nx,{onSeeMoreClick:Re,currentDate:s,events:fe,onDayClick:B,onEventClick:Fe})}),l&&u.jsx(ck,{isVisible:l,onClose:qe,onSave:Ze,onDelete:vt,selectedDate:p,initialEvent:f,userId:e,masNombreBD:o,disId:n}),u.jsx(uk,{isOpen:D,onClose:()=>T(!1),events:M,date:W,onEventClick:Fe}),He&&u.jsx(wk,{open:!!q,onClose:Ee,onConfirm:()=>{He.action()},title:He.title,description:He.description,icon:He.icon,confirmText:He.confirmText})]})},Ck="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",Ek="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 Jc(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function Dk(e,t){const r=e??"",n=t??"";return r instanceof Date&&n instanceof Date?r.getTime()-n.getTime():typeof r=="number"&&typeof n=="number"?r-n:typeof r=="boolean"&&typeof n=="boolean"?Number(r)-Number(n):String(r).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function el(e,t,r=!0){return typeof e=="function"?e(t):e??r}function kk(e){return e.replace(/[^\d]/g,"")}function Tk(e,t){return t}var ss={},zh;function Ik(){if(zh)return ss;zh=1;var e=at();Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;var t=e(ht()),r=ut();return ss.default=(0,t.default)((0,r.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"),ss}var Ak=Ik();const Mk=it(Ak);var is={},Bh;function Pk(){if(Bh)return is;Bh=1;var e=at();Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var t=e(ht()),r=ut();return is.default=(0,t.default)((0,r.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"),is}var Ok=Pk();const jk=it(Ok);var as={},Fh;function Rk(){if(Fh)return as;Fh=1;var e=at();Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var t=e(ht()),r=ut();return as.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),as}var Nk=Rk();const $k=it(Nk);var cs={},Uh;function Lk(){if(Uh)return cs;Uh=1;var e=at();Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var t=e(ht()),r=ut();return cs.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),cs}var zk=Lk();const Bk=it(zk);function Hh(e){return e==="right"?"end":e==="center"?"center":"start"}function Vh(e){const t=e.filter(r=>!r.width).length||1;return e.map(r=>typeof r.width=="number"?`${r.width}px`:typeof r.width=="string"?r.width:`minmax(0, ${1/t}fr)`).join(" ")}const Fk=1060,tl=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function Uk({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=Fk,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 l(d){const f=d.reduce((m,p)=>m+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return u.jsx(g.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:u.jsxs(g.Box,{children:[u.jsx(g.Box,{sx:{display:"grid",gridTemplateColumns:r.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=>u.jsx(g.Typography,{sx:{fontSize:13,fontWeight:800},children:d},d))}),e.map((d,f)=>{const[h,v]=K.useState(!!d.initiallyOpen),m=f%2===1,p=o?o(d):t,b=Math.max(n,l(p));return u.jsxs(g.Box,{children:[u.jsxs(g.Box,{sx:{display:"grid",gridTemplateColumns:r.map(w=>typeof w=="number"?`${w}px`:w).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:m?"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:()=>v(w=>!w),children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[u.jsx(g.IconButton,{size:"small",disableRipple:!0,children:h?u.jsx(Bk,{}):u.jsx($k,{})}),u.jsx(g.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),u.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tl(d,"En Proceso")}),u.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tl(d,"Finalizadas")}),u.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tl(d,"Último seg.")})]}),u.jsx(g.Collapse,{in:h,unmountOnExit:!0,children:u.jsxs(g.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[u.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Vh(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(w=>u.jsx(g.Typography,{sx:{justifySelf:Hh(w.align),textAlign:w.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.header},w.key))}),(d.rows??[]).map((w,C)=>u.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Vh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:C%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?.(w,d),children:p.map((E,S)=>{const x=E.accessor?E.accessor(w,C):E.field?w[E.field]:null;return u.jsx(g.Box,{sx:{justifySelf:Hh(E.align),textAlign:E.align??"left",minWidth:0},children:typeof x=="string"||typeof x=="number"?u.jsx(g.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(E.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(x),children:x}):x},E.key??S)})},w.id??C))]})})]},d.id)})]})})}var ls={},Wh;function Hk(){if(Wh)return ls;Wh=1;var e=at();Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=void 0;var t=e(ht()),r=ut();return ls.default=(0,t.default)((0,r.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"),ls}var Vk=Hk();const Wk=it(Vk),Yk=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",qk=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},Zk=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var us={},Yh;function Gk(){if(Yh)return us;Yh=1;var e=at();Object.defineProperty(us,"__esModule",{value:!0}),us.default=void 0;var t=e(ht()),r=ut();return us.default=(0,t.default)((0,r.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"),us}var Kk=Gk();const Qk=it(Kk),rl=({current:e,total:t,color:r="#4caf50"})=>u.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center"},children:Array.from({length:t}).map((n,o)=>u.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var ds={},qh;function Xk(){if(qh)return ds;qh=1;var e=at();Object.defineProperty(ds,"__esModule",{value:!0}),ds.default=void 0;var t=e(ht()),r=ut();return ds.default=(0,t.default)((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),ds}var Jk=Xk();const Zh=it(Jk),e3=e=>{const t=String(e??"").toLowerCase().trim();return t==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:t==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:t==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:t==="no sé"||t==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:t==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},t3=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}},r3=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}},n3=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 o3(e){const t=new Date(e),r=t.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=t.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${r.replace(".","")} • ${n}`}function s3(e){return e.replace(/<br\s*\/?>/gi,`
177
+ `)}v.write("payload.value = newResult;"),v.write("return payload;");const C=v.compile();return(E,S)=>C(h,E,S)};let s;const i=Bi,a=!Ip.jitless,l=a&&aw.value,d=t.catchall;let f;e._zod.parse=(h,v)=>{f??(f=n.value);const m=h.value;return i(m)?a&&l&&v?.async===!1&&v.jitless!==!0?(s||(s=o(t.shape)),h=s(h,v),d?qp([],m,h,v,f,e):h):r(h,v):(h.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),h)}});function Zp(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Jn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>kn(i,n,Dn())))}),t)}const QS=Z("$ZodUnion",(e,t)=>{Mt.init(e,t),gt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),gt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),gt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),gt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Uc(s.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(r)return n(o,s);let i=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>Zp(c,o,e,s)):Zp(a,o,e,s)}}),XS=Z("$ZodIntersection",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>Gp(r,c,l)):Gp(r,s,i)}});function Yc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(qo(e)&&qo(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(const s of n){const i=Yc(e[s],t[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(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],s=t[n],i=Yc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Gp(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Jn(e))return e;const n=Yc(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const JS=Z("$ZodEnum",(e,t)=>{Mt.init(e,t);const r=ow(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>cw.has(typeof o)).map(o=>typeof o=="string"?Xn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),eC=Z("$ZodLiteral",(e,t)=>{if(Mt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Xn(r):r?Xn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{const o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),tC=Z("$ZodTransform",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tp(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Kn;return r.value=o,r}});function Kp(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const rC=Z("$ZodOptional",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",gt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),gt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Uc(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Kp(s,r.value)):Kp(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),nC=Z("$ZodNullable",(e,t)=>{Mt.init(e,t),gt(e._zod,"optin",()=>t.innerType._zod.optin),gt(e._zod,"optout",()=>t.innerType._zod.optout),gt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Uc(r.source)}|null)$`):void 0}),gt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),oC=Z("$ZodDefault",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",gt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Qp(s,t)):Qp(o,t)}});function Qp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const sC=Z("$ZodPrefault",(e,t)=>{Mt.init(e,t),e._zod.optin="optional",gt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),iC=Z("$ZodNonOptional",(e,t)=>{Mt.init(e,t),gt(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Xp(s,e)):Xp(o,e)}});function Xp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const aC=Z("$ZodCatch",(e,t)=>{Mt.init(e,t),gt(e._zod,"optin",()=>t.innerType._zod.optin),gt(e._zod,"optout",()=>t.innerType._zod.optout),gt(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>kn(i,n,Dn()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>kn(s,n,Dn()))},input:r.value}),r.issues=[]),r)}}),cC=Z("$ZodPipe",(e,t)=>{Mt.init(e,t),gt(e._zod,"values",()=>t.in._zod.values),gt(e._zod,"optin",()=>t.in._zod.optin),gt(e._zod,"optout",()=>t.out._zod.optout),gt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Gi(i,t.in,n)):Gi(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Gi(s,t.out,n)):Gi(o,t.out,n)}});function Gi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const lC=Z("$ZodReadonly",(e,t)=>{Mt.init(e,t),gt(e._zod,"propValues",()=>t.innerType._zod.propValues),gt(e._zod,"values",()=>t.innerType._zod.values),gt(e._zod,"optin",()=>t.innerType._zod.optin),gt(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Jp):Jp(o)}});function Jp(e){return e.value=Object.freeze(e.value),e}const uC=Z("$ZodCustom",(e,t)=>{cr.init(e,t),Mt.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>eh(s,r,n,e));eh(o,r,n,e)}});function eh(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Zo(o))}}class dC{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,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,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function fC(){return new dC}const Ki=fC();function pC(e,t){return new e({type:"string",...Te(t)})}function hC(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function th(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function mC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function gC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function vC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function yC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function bC(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function _C(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function xC(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function wC(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function SC(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function CC(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function EC(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function DC(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function kC(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function TC(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function IC(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function AC(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function MC(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function PC(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function OC(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function jC(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function RC(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function NC(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function $C(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function LC(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function zC(e,t){return new e({type:"number",checks:[],...Te(t)})}function BC(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function FC(e,t){return new e({type:"boolean",...Te(t)})}function UC(e){return new e({type:"unknown"})}function HC(e,t){return new e({type:"never",...Te(t)})}function rh(e,t){return new Fp({check:"less_than",...Te(t),value:e,inclusive:!1})}function qc(e,t){return new Fp({check:"less_than",...Te(t),value:e,inclusive:!0})}function nh(e,t){return new Up({check:"greater_than",...Te(t),value:e,inclusive:!1})}function Zc(e,t){return new Up({check:"greater_than",...Te(t),value:e,inclusive:!0})}function oh(e,t){return new sS({check:"multiple_of",...Te(t),value:e})}function sh(e,t){return new aS({check:"max_length",...Te(t),maximum:e})}function Qi(e,t){return new cS({check:"min_length",...Te(t),minimum:e})}function ih(e,t){return new lS({check:"length_equals",...Te(t),length:e})}function VC(e,t){return new uS({check:"string_format",format:"regex",...Te(t),pattern:e})}function WC(e){return new dS({check:"string_format",format:"lowercase",...Te(e)})}function YC(e){return new fS({check:"string_format",format:"uppercase",...Te(e)})}function qC(e,t){return new pS({check:"string_format",format:"includes",...Te(t),includes:e})}function ZC(e,t){return new hS({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function GC(e,t){return new mS({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Go(e){return new gS({check:"overwrite",tx:e})}function KC(e){return Go(t=>t.normalize(e))}function QC(){return Go(e=>e.trim())}function XC(){return Go(e=>e.toLowerCase())}function JC(){return Go(e=>e.toUpperCase())}function eE(e,t,r){return new e({type:"array",element:t,...Te(r)})}function tE(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Te(r)})}function rE(e){const t=nE(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Zo(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Zo(o))}},e(r.value,r)));return t}function nE(e,t){const r=new cr({check:"custom",...Te(t)});return r._zod.check=e,r}function ah(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function oE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=jc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function sE(e,t){for(var r={};e.length;){var n=e[0],o=n.code,s=n.message,i=n.path.join(".");if(!r[i])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[i]={message:a.message,type:a.code}}else r[i]={message:s,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(d){return d.forEach(function(f){return e.push(f)})}),t){var c=r[i].types,l=c&&c[n.code];r[i]=jc(i,t,r,o,l?[].concat(l,n.message):n.message)}e.shift()}return r}function iE(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,o,s){try{return Promise.resolve(ah(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return s.shouldUseNativeValidation&&Lc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Dp(oE(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(ah(function(){return Promise.resolve((r.mode==="sync"?_w:xw)(e,n,t)).then(function(i){return s.shouldUseNativeValidation&&Lc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof Vc})(i))return{values:{},errors:Dp(sE(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 aE=Z("ZodISODateTime",(e,t)=>{AS.init(e,t),kt.init(e,t)});function cE(e){return RC(aE,e)}const lE=Z("ZodISODate",(e,t)=>{MS.init(e,t),kt.init(e,t)});function uE(e){return NC(lE,e)}const dE=Z("ZodISOTime",(e,t)=>{PS.init(e,t),kt.init(e,t)});function fE(e){return $C(dE,e)}const pE=Z("ZodISODuration",(e,t)=>{OS.init(e,t),kt.init(e,t)});function hE(e){return LC(pE,e)}const xr=Z("ZodError",(e,t)=>{Vc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>bw(e,r)},flatten:{value:r=>yw(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,zc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,zc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),mE=Hi(xr),gE=Vi(xr),vE=Wi(xr),yE=Yi(xr),bE=Cw(xr),_E=Ew(xr),xE=Dw(xr),wE=kw(xr),SE=Tw(xr),CE=Iw(xr),EE=Aw(xr),DE=Mw(xr),Lt=Z("ZodType",(e,t)=>(Mt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>ln(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>mE(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>vE(e,r,n),e.parseAsync=async(r,n)=>gE(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>yE(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>bE(e,r,n),e.decode=(r,n)=>_E(e,r,n),e.encodeAsync=async(r,n)=>xE(e,r,n),e.decodeAsync=async(r,n)=>wE(e,r,n),e.safeEncode=(r,n)=>SE(e,r,n),e.safeDecode=(r,n)=>CE(e,r,n),e.safeEncodeAsync=async(r,n)=>EE(e,r,n),e.safeDecodeAsync=async(r,n)=>DE(e,r,n),e.refine=(r,n)=>e.check(yD(r,n)),e.superRefine=r=>e.check(bD(r)),e.overwrite=r=>e.check(Go(r)),e.optional=()=>vh(e),e.nullable=()=>yh(e),e.nullish=()=>vh(yh(e)),e.nonoptional=r=>dD(e,r),e.array=()=>ph(e),e.or=r=>JE([e,r]),e.and=r=>tD(e,r),e.transform=r=>_h(e,sD(r)),e.default=r=>cD(e,r),e.prefault=r=>uD(e,r),e.catch=r=>pD(e,r),e.pipe=r=>_h(e,r),e.readonly=()=>gD(e),e.describe=r=>{const n=e.clone();return Ki.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ki.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ki.get(e);const n=e.clone();return Ki.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ch=Z("_ZodString",(e,t)=>{Wc.init(e,t),Lt.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(VC(...n)),e.includes=(...n)=>e.check(qC(...n)),e.startsWith=(...n)=>e.check(ZC(...n)),e.endsWith=(...n)=>e.check(GC(...n)),e.min=(...n)=>e.check(Qi(...n)),e.max=(...n)=>e.check(sh(...n)),e.length=(...n)=>e.check(ih(...n)),e.nonempty=(...n)=>e.check(Qi(1,...n)),e.lowercase=n=>e.check(WC(n)),e.uppercase=n=>e.check(YC(n)),e.trim=()=>e.check(QC()),e.normalize=(...n)=>e.check(KC(...n)),e.toLowerCase=()=>e.check(XC()),e.toUpperCase=()=>e.check(JC())}),kE=Z("ZodString",(e,t)=>{Wc.init(e,t),ch.init(e,t),e.email=r=>e.check(hC(TE,r)),e.url=r=>e.check(bC(IE,r)),e.jwt=r=>e.check(jC(VE,r)),e.emoji=r=>e.check(_C(AE,r)),e.guid=r=>e.check(th(lh,r)),e.uuid=r=>e.check(mC(Xi,r)),e.uuidv4=r=>e.check(gC(Xi,r)),e.uuidv6=r=>e.check(vC(Xi,r)),e.uuidv7=r=>e.check(yC(Xi,r)),e.nanoid=r=>e.check(xC(ME,r)),e.guid=r=>e.check(th(lh,r)),e.cuid=r=>e.check(wC(PE,r)),e.cuid2=r=>e.check(SC(OE,r)),e.ulid=r=>e.check(CC(jE,r)),e.base64=r=>e.check(MC(FE,r)),e.base64url=r=>e.check(PC(UE,r)),e.xid=r=>e.check(EC(RE,r)),e.ksuid=r=>e.check(DC(NE,r)),e.ipv4=r=>e.check(kC($E,r)),e.ipv6=r=>e.check(TC(LE,r)),e.cidrv4=r=>e.check(IC(zE,r)),e.cidrv6=r=>e.check(AC(BE,r)),e.e164=r=>e.check(OC(HE,r)),e.datetime=r=>e.check(cE(r)),e.date=r=>e.check(uE(r)),e.time=r=>e.check(fE(r)),e.duration=r=>e.check(hE(r))});function wr(e){return pC(kE,e)}const kt=Z("ZodStringFormat",(e,t)=>{wt.init(e,t),ch.init(e,t)}),TE=Z("ZodEmail",(e,t)=>{xS.init(e,t),kt.init(e,t)}),lh=Z("ZodGUID",(e,t)=>{bS.init(e,t),kt.init(e,t)}),Xi=Z("ZodUUID",(e,t)=>{_S.init(e,t),kt.init(e,t)}),IE=Z("ZodURL",(e,t)=>{wS.init(e,t),kt.init(e,t)}),AE=Z("ZodEmoji",(e,t)=>{SS.init(e,t),kt.init(e,t)}),ME=Z("ZodNanoID",(e,t)=>{CS.init(e,t),kt.init(e,t)}),PE=Z("ZodCUID",(e,t)=>{ES.init(e,t),kt.init(e,t)}),OE=Z("ZodCUID2",(e,t)=>{DS.init(e,t),kt.init(e,t)}),jE=Z("ZodULID",(e,t)=>{kS.init(e,t),kt.init(e,t)}),RE=Z("ZodXID",(e,t)=>{TS.init(e,t),kt.init(e,t)}),NE=Z("ZodKSUID",(e,t)=>{IS.init(e,t),kt.init(e,t)}),$E=Z("ZodIPv4",(e,t)=>{jS.init(e,t),kt.init(e,t)}),LE=Z("ZodIPv6",(e,t)=>{RS.init(e,t),kt.init(e,t)}),zE=Z("ZodCIDRv4",(e,t)=>{NS.init(e,t),kt.init(e,t)}),BE=Z("ZodCIDRv6",(e,t)=>{$S.init(e,t),kt.init(e,t)}),FE=Z("ZodBase64",(e,t)=>{LS.init(e,t),kt.init(e,t)}),UE=Z("ZodBase64URL",(e,t)=>{BS.init(e,t),kt.init(e,t)}),HE=Z("ZodE164",(e,t)=>{FS.init(e,t),kt.init(e,t)}),VE=Z("ZodJWT",(e,t)=>{HS.init(e,t),kt.init(e,t)}),uh=Z("ZodNumber",(e,t)=>{Vp.init(e,t),Lt.init(e,t),e.gt=(n,o)=>e.check(nh(n,o)),e.gte=(n,o)=>e.check(Zc(n,o)),e.min=(n,o)=>e.check(Zc(n,o)),e.lt=(n,o)=>e.check(rh(n,o)),e.lte=(n,o)=>e.check(qc(n,o)),e.max=(n,o)=>e.check(qc(n,o)),e.int=n=>e.check(dh(n)),e.safe=n=>e.check(dh(n)),e.positive=n=>e.check(nh(0,n)),e.nonnegative=n=>e.check(Zc(0,n)),e.negative=n=>e.check(rh(0,n)),e.nonpositive=n=>e.check(qc(0,n)),e.multipleOf=(n,o)=>e.check(oh(n,o)),e.step=(n,o)=>e.check(oh(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ji(e){return zC(uh,e)}const WE=Z("ZodNumberFormat",(e,t)=>{VS.init(e,t),uh.init(e,t)});function dh(e){return BC(WE,e)}const YE=Z("ZodBoolean",(e,t)=>{WS.init(e,t),Lt.init(e,t)});function ea(e){return FC(YE,e)}const qE=Z("ZodUnknown",(e,t)=>{YS.init(e,t),Lt.init(e,t)});function fh(){return UC(qE)}const ZE=Z("ZodNever",(e,t)=>{qS.init(e,t),Lt.init(e,t)});function GE(e){return HC(ZE,e)}const KE=Z("ZodArray",(e,t)=>{ZS.init(e,t),Lt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Qi(r,n)),e.nonempty=r=>e.check(Qi(1,r)),e.max=(r,n)=>e.check(sh(r,n)),e.length=(r,n)=>e.check(ih(r,n)),e.unwrap=()=>e.element});function ph(e,t){return eE(KE,e,t)}const QE=Z("ZodObject",(e,t)=>{KS.init(e,t),Lt.init(e,t),gt(e,"shape",()=>t.shape),e.keyof=()=>mh(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fh()}),e.loose=()=>e.clone({...e._zod.def,catchall:fh()}),e.strict=()=>e.clone({...e._zod.def,catchall:GE()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>pw(e,r),e.safeExtend=r=>hw(e,r),e.merge=r=>mw(e,r),e.pick=r=>dw(e,r),e.omit=r=>fw(e,r),e.partial=(...r)=>gw(gh,e,r[0]),e.required=(...r)=>vw(bh,e,r[0])});function hh(e,t){const r={type:"object",get shape(){return cn(this,"shape",e?iw(e):{}),this.shape},...Te(t)};return new QE(r)}const XE=Z("ZodUnion",(e,t)=>{QS.init(e,t),Lt.init(e,t),e.options=t.options});function JE(e,t){return new XE({type:"union",options:e,...Te(t)})}const eD=Z("ZodIntersection",(e,t)=>{XS.init(e,t),Lt.init(e,t)});function tD(e,t){return new eD({type:"intersection",left:e,right:t})}const Gc=Z("ZodEnum",(e,t)=>{JS.init(e,t),Lt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Gc({...t,checks:[],...Te(o),entries:s})},e.exclude=(n,o)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Gc({...t,checks:[],...Te(o),entries:s})}});function mh(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Gc({type:"enum",entries:r,...Te(t)})}const rD=Z("ZodLiteral",(e,t)=>{eC.init(e,t),Lt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function nD(e,t){return new rD({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}const oD=Z("ZodTransform",(e,t)=>{tC.init(e,t),Lt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tp(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Zo(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Zo(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function sD(e){return new oD({type:"transform",transform:e})}const gh=Z("ZodOptional",(e,t)=>{rC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function vh(e){return new gh({type:"optional",innerType:e})}const iD=Z("ZodNullable",(e,t)=>{nC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function yh(e){return new iD({type:"nullable",innerType:e})}const aD=Z("ZodDefault",(e,t)=>{oC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function cD(e,t){return new aD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Op(t)}})}const lD=Z("ZodPrefault",(e,t)=>{sC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uD(e,t){return new lD({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Op(t)}})}const bh=Z("ZodNonOptional",(e,t)=>{iC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dD(e,t){return new bh({type:"nonoptional",innerType:e,...Te(t)})}const fD=Z("ZodCatch",(e,t)=>{aC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pD(e,t){return new fD({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const hD=Z("ZodPipe",(e,t)=>{cC.init(e,t),Lt.init(e,t),e.in=t.in,e.out=t.out});function _h(e,t){return new hD({type:"pipe",in:e,out:t})}const mD=Z("ZodReadonly",(e,t)=>{lC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gD(e){return new mD({type:"readonly",innerType:e})}const vD=Z("ZodCustom",(e,t)=>{uC.init(e,t),Lt.init(e,t)});function yD(e,t={}){return tE(vD,e,t)}function bD(e){return rE(e)}const xh=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,wh=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(n,o,s,a,c);return isNaN(l.getTime())||!_.isValid(l)?null:l},_D=hh({UsuarioID:Ji().nullable().optional(),disID:Ji().nullable().optional(),EsOrganizador:ea().default(!1),Correo:wr().email("Formato de correo inválido"),StatusInvitacion:mh(["PENDIENTE","CONFIRMADO","DECLINADO"]).default("PENDIENTE")}),xD=hh({titulo:wr().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:wr().min(1,"El campo fecha inicio es requerido."),horaInicio:wr().min(1,"La hora de inicio es requerida.").regex(xh,{message:"Formato inválido"}),horaFin:wr().min(1,"La hora fin es requerida.").regex(xh,{message:"Formato inválido"}),todoElDia:ea(),fechaFin:wr().optional(),showEndDate:ea().optional(),horaInicio2:wr().optional(),TodoElDia2:ea().optional(),client:wr().nullable().optional(),repetir:wr().optional(),link:wr().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(nD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:wr().optional(),invitados:ph(_D).optional().default([]),color:wr().optional(),solID:Ji().nullable().optional(),disID:Ji().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 t=wh(e.fechaInicio,e.horaInicio),r=wh(e.fechaFin,e.horaFin);return!t||!r||!_.isValid(t)||!_.isValid(r)?!0:!(_.isBefore(r,t)&&!_.isSameDay(r,t)||_.isSameDay(t,r)&&_.isBefore(r,t))},{message:"",path:["horaFin"]}),Sh=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.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"}),K.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"})),wD="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",SD=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{clipPath:"url(#a)"},K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),CD="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23404756'%20d='M13.17%2013.68c2.06%200%204%20.8%205.46%202.27a7.7%207.7%200%200%201%202.26%205.47c0%20.79-.64%201.43-1.43%201.43l.01-.01H4.53c-.79%200-1.43-.64-1.43-1.43%200-4.27%203.46-7.73%207.72-7.73zM12%201.9c2.82%200%205.11%202.29%205.11%205.11s-2.29%205.11-5.11%205.11v-.01c-2.82%200-5.11-2.29-5.11-5.11S9.18%201.9%2012%201.9'/%3e%3c/svg%3e",ED=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},K.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"}),K.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"}),K.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"})),K.createElement("defs",null,K.createElement("clipPath",{id:"a"},K.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),DD="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",kD=e=>K.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},K.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"}),K.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 Ko={},Ch;function TD(){if(Ch)return Ko;Ch=1;var e=at();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.default=void 0;var t=e(ht()),r=ut();return Ko.default=(0,t.default)((0,r.jsx)("path",{d:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Ko}var ID=TD();const Eh=it(ID);var Qo={},Dh;function AD(){if(Dh)return Qo;Dh=1;var e=at();Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.default=void 0;var t=e(ht()),r=ut();return Qo.default=(0,t.default)((0,r.jsx)("path",{d:"M16.53 11.06 15.47 10l-4.88 4.88-2.12-2.12-1.06 1.06L10.59 17zM19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H5V8h14z"}),"EventAvailable"),Qo}var MD=AD();const PD=it(MD);var Xo={},kh;function OD(){if(kh)return Xo;kh=1;var e=at();Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.default=void 0;var t=e(ht()),r=ut();return Xo.default=(0,t.default)((0,r.jsx)("path",{d:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),Xo}var jD=OD();const RD=it(jD);var Jo={},Th;function ND(){if(Th)return Jo;Th=1;var e=at();Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.default=void 0;var t=e(ht()),r=ut();return Jo.default=(0,t.default)((0,r.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),Jo}var $D=ND();const Kc=it($D);var es={},Ih;function LD(){if(Ih)return es;Ih=1;var e=at();Object.defineProperty(es,"__esModule",{value:!0}),es.default=void 0;var t=e(ht()),r=ut();return es.default=(0,t.default)((0,r.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8z"}),"CheckCircle"),es}var zD=LD();const Qc=it(zD),BD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",FD=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]},UD=(e,t)=>{const r="#1976D2";if(t)return u.jsxs(u.Fragment,{children:[u.jsx("img",{src:BD,width:18}),u.jsx(g.Typography,{variant:"body2",sx:{color:r,fontWeight:"bold"},children:"  Anfitrión"})]});switch(e){case"PENDIENTE":return u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"grey.700"},children:[u.jsx(Oi,{fontSize:"small",sx:{mr:.5}}),u.jsx(g.Typography,{variant:"body2",children:"Pendiente"})]});case"CONFIRMADA":return u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"success.main"},children:[u.jsx(Qc,{fontSize:"small",sx:{mr:.5}}),u.jsx(g.Typography,{variant:"body2",children:"Asistiré"})]});default:return u.jsx(g.Typography,{variant:"body2",children:"No respondió"})}};function HD({open:e,handleClose:t,guests:r}){console.log("guests",r);const n=r.filter(i=>i.estatus==="CONFIRMADA"||i.isHost),o=r.filter(i=>i.estatus==="PENDIENTE"&&!i.isHost),s=i=>u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1.5},children:[u.jsx(g.Avatar,{sx:{bgcolor:FD(i.iniciales),mr:2},children:i.iniciales}),u.jsx(g.Box,{sx:{flexGrow:1},children:u.jsx(g.Typography,{variant:"body1",children:i.nombre})}),UD(i.estatus,i.isHost)]},i.nombre);return u.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",children:[u.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",p:2},children:[u.jsx(g.IconButton,{onClick:t,children:u.jsx(Kc,{})}),u.jsx(g.Typography,{variant:"h6",children:"Lista de invitados"}),u.jsx(g.IconButton,{onClick:t,children:u.jsx(Vr,{})})]}),u.jsx(g.Divider,{}),u.jsxs(g.DialogContent,{dividers:!0,children:[o.length>0&&u.jsxs(g.Box,{sx:{mb:2},children:[u.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold"},children:["Pendiente (",o.length,")"]}),o.map(i=>s(i))]}),n.length>0&&u.jsxs(g.Box,{children:[u.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:1},children:["Confirmados (",n.length,")"]}),n.map(i=>s(i))]})]})]})}const VD=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function WD({guests:e}){const[t,r]=y.useState(!1),n=()=>r(!0),o=()=>r(!1);return u.jsxs(u.Fragment,{children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee"},children:[u.jsx(g.AvatarGroup,{max:6,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:14}},children:e.map((s,i)=>u.jsx(g.Tooltip,{title:s.nombre,arrow:!0,placement:"right",children:u.jsxs(g.Avatar,{sx:{bgcolor:VD(s.iniciales),position:"relative"},children:[s.iniciales,s.estatus==="PENDIENTE"&&u.jsx(g.Box,{sx:{position:"absolute",bottom:-1,right:1,bgcolor:"gray",borderRadius:"50%",p:.2},children:u.jsx(Oi,{sx:{fontSize:14,color:"white"}})})]})},i))}),u.jsx(g.Box,{sx:{flexGrow:1}}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"primary.main"},onClick:n,children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold"},children:"Ver invitados"}),u.jsx(RD,{fontSize:"small"})]})]}),u.jsx(HD,{open:t,handleClose:o,guests:e})]})}const YD=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),Ah=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},qD=({slot:e,onClick:t})=>u.jsxs(g.Box,{onClick:t,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #e0e0e0",textAlign:"center",transition:"0.2s","&:hover":{transform:"translateY(-3px)",boxShadow:2}},children:[u.jsx(g.Box,{sx:{bgcolor:"#333",color:"white",py:.2},children:u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold",textTransform:"capitalize"},children:YD(e.Fecha)})}),u.jsxs(g.Box,{sx:{bgcolor:"white",color:"black",py:1},children:[u.jsx(g.Typography,{variant:"body2",children:Ah(e.HoraInicio)}),u.jsxs(g.Typography,{variant:"body2",color:"text.secondary",children:["a ",Ah(e.HoraFin)]})]})]});function ZD({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const o=r.reduce((i,a)=>{const c=a.Fecha;return i[c]||(i[c]=[]),i[c].push(a),i},{}),s=Object.keys(o);return u.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",children:[u.jsxs(g.Box,{sx:{p:2},children:[u.jsx(g.Typography,{variant:"subtitle1",sx:{fontWeight:"bold"},children:"Selecciona un nuevo horario"}),u.jsx(g.Button,{startIcon:u.jsx(Kc,{}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0},children:"Volver al evento"})]}),u.jsx(g.Divider,{}),u.jsx(g.DialogContent,{sx:{px:3,py:2},children:s.map((i,a)=>u.jsxs(g.Box,{sx:{mb:4},children:[u.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:a===0?"#1976d2":"text.primary"},children:[a===0?"Mismo día":"Próximas fechas",a===0&&u.jsx(Qc,{sx:{ml:1,fontSize:18}})]}),u.jsx(g.Grid,{container:!0,spacing:2,children:o[i].map((c,l)=>u.jsx(g.Grid,{item:!0,xs:6,sm:4,children:u.jsx(qD,{slot:c,onClick:()=>n(c)})},`${i}-${l}`))})]},i))})]})}var ts={},Mh;function GD(){if(Mh)return ts;Mh=1;var e=at();Object.defineProperty(ts,"__esModule",{value:!0}),ts.default=void 0;var t=e(ht()),r=ut();return ts.default=(0,t.default)((0,r.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group"),ts}var KD=GD();const QD=it(KD),XD=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function JD({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=y.useState(null),[s,i]=y.useState(""),a=(l,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(l,d)=>{i(d),r(d)};return u.jsx(g.Autocomplete,{options:t,value:n,inputValue:s,getOptionLabel:l=>l.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(l,d)=>l.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:l=>u.jsx(g.TextField,{...l,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...l.InputProps,startAdornment:u.jsx(g.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:u.jsx(QD,{color:"action"})}),disableUnderline:!0}}),renderOption:(l,d)=>y.createElement(g.Box,{component:"li",...l,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},u.jsx(g.Avatar,{sx:{bgcolor:XD(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),u.jsx(g.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var rs={},Ph;function ek(){if(Ph)return rs;Ph=1;var e=at();Object.defineProperty(rs,"__esModule",{value:!0}),rs.default=void 0;var t=e(ht()),r=ut();return rs.default=(0,t.default)((0,r.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"),rs}var tk=ek();const Xc=it(tk),rk=e=>e.tieneConflicto?{icon:u.jsx(Xc,{sx:{fontSize:20}}),fillColor:"#F0A290",iconColor:"#D9981E",textColor:"#000000",variant:"filled"}:{icon:u.jsx(Qc,{sx:{fontSize:20,margin:"0px"}}),fillColor:"#F0ECEB",iconColor:"#D9981E",textColor:"#000000",variant:"filled"},nk=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function ok({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=i=>()=>{n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return u.jsxs(g.Box,{sx:{p:1},children:[u.jsx(g.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=rk(i),l=nk(i.iniciales);return u.jsx(g.Chip,{label:u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center"},children:[u.jsx(g.Typography,{variant:"body2",component:"span",sx:{color:c.textColor,margin:"5px",fontSize:"13px"},children:s(i?.nombre)}),u.jsx(g.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"flex-end",ml:.5},children:c.icon})]}),avatar:u.jsx(g.Avatar,{sx:{bgcolor:l},children:i.iniciales}),sx:{backgroundColor:c.fillColor,borderStyle:"none",paddingRight:"0px",paddingLeft:"0px","& .MuiChip-deleteIcon":{visibility:"hidden",color:c.textColor},"&:hover .MuiChip-deleteIcon":{visibility:"visible"},"& .MuiChip-avatar":{color:"white"},"& .MuiChip-label":{display:"flex",paddingLeft:"5px",paddingRight:"0px",alignItems:"center",width:"100%"},"&:hover .status-icon-wrapper":{visibility:"hidden"}},variant:c.variant,onClick:()=>console.log(`Clic en ${i.nombre}`),onDelete:o(i.nombre)},a)})}),t>0&&u.jsxs(g.Box,{sx:{mt:2,p:1},children:[u.jsxs(g.Typography,{color:"error",sx:{display:"flex",alignItems:"center",fontSize:"14px"},children:[u.jsx(Xc,{sx:{mr:1}}),"Se detectó un conflicto de agenda con ",t," invitado",t!==1?"s":""]}),u.jsx(g.Link,{component:"button",variant:"body2",onClick:r,sx:{mt:.5,textDecoration:"none"},children:"Ver sugerencias de horario"})]})]})}function sk(e,t){const[r,n]=y.useState(e);return y.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}const ik={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"},Oh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],ak=()=>{const e=[];for(let t=0;t<24;t++)for(let r=0;r<60;r+=15){const n=t.toString().padStart(2,"0"),o=r.toString().padStart(2,"0");e.push(`${n}:${o}`)}return e},jh=[],eo=ak(),ns=(e,t)=>{if(!e||!t)return null;const r=e.split("-");if(r.length!==3)return null;const n=parseInt(r[0],10),o=parseInt(r[1],10)-1,s=parseInt(r[2],10),i=t.split(":");if(i.length!==2)return null;const a=parseInt(i[0],10),c=parseInt(i[1],10),l=new Date(s,o,n,a,c);return isNaN(l.getTime())||!_.isValid(l)?null:l},ck=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c})=>{const[l,d]=y.useState(!1),[f,h]=y.useState(!1),v=_.format(new Date,"yyyy-MM-dd"),[m,p]=y.useState(""),[b,w]=y.useState([]),[C,E]=y.useState(!1),S=Dc(),[x,U]=y.useState([]),[D,T]=y.useState(""),[M,A]=y.useState(jh),[W,G]=y.useState(!1),[F,Y]=y.useState(""),[oe,H]=y.useState(!1),[N,ce]=y.useState([]),[fe,$]=y.useState([]),Q=sk(F,300),Ce=M.filter(q=>q.tieneConflicto).length,{control:me,handleSubmit:Se,reset:ie,formState:{errors:ee,isValid:le},watch:ge,setValue:de}=Cp({resolver:iE(xD),defaultValues:{titulo:s?.titulo||"",fechaInicio:_.format(new Date,"yyyy-MM-dd"),horaInicio:_.format(new Date,"HH:mm"),horaFin:_.format(_.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"}),pe=ge("fechaInicio"),Re=ge("fechaFin"),j=ge("todoElDia");y.useEffect(()=>{if(m.trim()===""||!i||!c||!a){w([]),U([]),de("solID",null),E(!1),T("");return}E(!0);const q=setTimeout(()=>{S.getClients(m,c,a,i).then(ae=>{if(E(!1),ae){const Ie=ae.map(He=>He.solID);U([...new Set(Ie)])}else U([]);const Ee=Array.from(new Map(ae.map(Ie=>[Ie.nombreCliente,Ie])).values());if(Ee.length>0)w(Ee),T("");else if(s?.client&&s.solID!==null){const Ie=[{solID:s.solID,nombreCliente:s.client}];w(Ie),T("Sin resultados")}else w([]),T("Sin resultados")}).catch(ae=>{console.error("Error al buscar clientes:",ae),E(!1)})},500);return()=>clearTimeout(q)},[m,i,c,a]),y.useEffect(()=>{if(pe&&Re){const q=new Date(pe),ae=new Date(Re);(q===ae||q>ae)&&de("fechaFin",pe)}},[pe,Re,de]),y.useEffect(()=>{pe&&de("fechaFin",pe)},[pe]),y.useEffect(()=>{de("showEndDate",l)},[l,de]),y.useEffect(()=>{if(s){const q=_.format(s.fechaInicio,"yyyy-MM-dd")===_.format(s.fechaFin,"yyyy-MM-dd");if(d(!q),de("titulo",s?.titulo),de("fechaInicio",_.format(s.fechaInicio,"yyyy-MM-dd")),de("fechaFin",_.format(s.fechaFin,"yyyy-MM-dd")),de("horaInicio",_.format(s.fechaInicio,"HH:mm")),de("horaFin",_.format(s.fechaFin,"HH:mm")),de("horaInicio2",_.format(s.fechaFin,"HH:mm")),de("descripcion",s.descripcion),de("link",s.link),de("repetir","false"),de("color",s.color),de("todoElDia",s.todoElDia),de("solID",s.solID),de("client",s.client),console.log("initialEvent.invitados",s.invitados),s.invitados&&s.invitados.length>0){const ae=(s?.invitados||[]).map(Ee=>{const Ie=Ee.usrNombre?.trim()||"",He=Ie.split(/\s+/),J=He.length>1?(He[0][0]+He[1][0]).toUpperCase():Ie.substring(0,2).toUpperCase();return{nombre:Ee.usrNombre||"Sin nombre",correo:Ee.correo||"",iniciales:J||"--",usrID:Ee.usuarioID??null,isHost:Ee.esOrganizador||!1,estatus:Ee.statusInvitacion==="CONFIRMADA"?"CONFIRMADA":"PENDIENTE",tieneConflicto:!1,disID:Ee.disID}});console.log("mappedGuests",ae),A(ae)}else A(jh);s.solID?h(!0):h(!1)}else{const q=o||new Date,ae=new Date,Ee=new Date(q.getFullYear(),q.getMonth(),q.getDate(),ae.getHours(),ae.getMinutes()),Ie=_.addHours(Ee,1);ie({titulo:"",fechaInicio:_.format(Ee,"yyyy-MM-dd"),horaInicio:_.format(Ee,"HH:mm"),fechaFin:_.format(Ie,"yyyy-MM-dd"),horaFin:_.format(Ie,"HH:mm"),horaInicio2:_.format(Ie,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:Oh[0],solID:null}),d(!1),h(!1)}},[s,e,o]);const Fe=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==i,StatusInvitacion:"PENDIENTE",disID:c??null}),qe=Se(q=>{const ae=M.map(Ie=>Fe(Ie)),Ee={...q,invitados:ae};r(Ee,s?.eventoID),t(),ie(),d(!1)},q=>{console.log("Errores de validación:",q)});y.useEffect(()=>{j&&(de("horaInicio","00:00"),de("horaFin","23:59"))},[j,de,ge]);const Ze=()=>{const q=ge("fechaInicio");if(q){const ae=new Date(`${q}T00:00:00`),Ee=_.addDays(ae,1);de("fechaFin",_.format(Ee,"yyyy-MM-dd"))}d(!0)},Ne=ge("fechaInicio"),Be=ge("horaInicio"),vt=ge("fechaFin"),pt=ge("horaFin"),[k,P]=y.useState(null),[B,ue]=y.useState(null);y.useEffect(()=>{(k===null||k!==Be)&&P(Be)},[Be,k]),y.useEffect(()=>{(B===null||B!==pt)&&ue(pt??"")},[pt,B]);const se=ge("todoElDia");y.useEffect(()=>{if(se||!Be||!pt||!Ne||!vt)return;const q=ns(Ne,Be),ae=ns(vt,pt);if(!q||!ae||!_.isValid(q)||!_.isValid(ae))return;const Ee=_.isSameDay(q,ae),Ie=Ee&&(_.isAfter(q,ae)||q.getTime()===ae.getTime()),He=_.isBefore(ae,q)&&!Ee;(Ie||He)&&(de("horaFin",""),ue(""))},[Be,Ne]);const O=y.useMemo(()=>{if(!Be||!Ne)return eo;const q=ns(Ne,Be),ae=ns(vt,"00:00");return!q||!ae||!_.isValid(q)||!_.isValid(ae)||_.isBefore(ae,q)&&!_.isSameDay(ae,q)?eo:_.isSameDay(q,ae)?eo.filter(Ee=>{const Ie=ns(vt,Ee);return Ie&&_.isAfter(Ie,q)}):(_.isAfter(ae,q),eo)},[Be,Ne,vt]),ne=y.useMemo(()=>eo,[]),we=async q=>{const ae=M.some(qt=>qt.correo===q.correo);if(H(!0),ae)return;const Ee=c,Ie=q.correo,He=q.usrID,J=Ne,Me=Be,ke=pt;if(!Ee||!Ie||!J||!Me||!ke){A(qt=>[...qt,{...q,status:"pending",isHost:!1,hasConflict:!1,usrID:He,name:q.nombre}]);return}let je;try{je=await S.VerificarConflicto(Ee,Ie,J,Me+":00",ke+":00")}catch{je={tieneConflicto:!1,usrMail:q.correo}}const Yt=Array.isArray(je)?je[0]:je;console.log("primerConflicto",Yt);const Kt={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(Yt.tieneConflicto).toLowerCase()==="true"};if(console.log("conflictResult",Kt),Kt.tieneConflicto){const qt=await S.getDisponibilidadUsuario(c,Ie,J,"60");ce(qt)}A(qt=>[...qt,Kt])},Oe=q=>{A(ae=>ae.filter(Ee=>Ee.nombre!==q))},R=()=>{G(!1)},te=q=>{const Ie=(q.usrNombre??"").split(" ").map(He=>He.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:Ie,usrID:q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};y.useEffect(()=>{Q.length>2&&c?(async()=>{const Ee=(await S.getUsuariosInvitados(c,Q)).map(te).filter(Ie=>Ie.usrID!==i&&!M.some(He=>He.correo===Ie.correo));$(Ee),console.log("sugerencias",Ee)})():$([])},[Q,M]);const xe=q=>{Y(q)},Ge=async q=>{try{const{Fecha:ae,HoraInicio:Ee,HoraFin:Ie}=q,He={nuevaFecha:ae,nuevaHoraInicio:Ee,nuevaHoraFin:Ie};R()}catch(ae){console.error("Error al reprogramar el evento:",ae)}};return u.jsx(u.Fragment,{children:u.jsx(g.Modal,{open:e,onClose:t,children:u.jsx("form",{onSubmit:qe,children:u.jsxs(g.Box,{sx:ik,children:[u.jsx(g.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:u.jsx(Vr,{})}),u.jsx(g.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent?u.jsxs(u.Fragment,{children:[u.jsx(PD,{sx:{mr:1}}),s.titulo||"Evento de Google"]}):s?"Editar evento":"Agregar evento"}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(mr,{name:"titulo",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,label:"Título",fullWidth:!0,variant:"outlined",size:"small",error:!!ee.titulo,helperText:ee.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"}}})})})}),u.jsxs("div",{className:`row g-2 ${l?"mb-1":"mb-2"}`,children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(mr,{name:"fechaInicio",control:me,render:({field:q})=>u.jsx(g.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!ee.fechaInicio,helperText:ee.fechaInicio?.message})})}),l?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-10 col-md-4",children:u.jsx(mr,{name:"fechaFin",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:pe||v},error:!!ee.fechaFin,helperText:ee.fechaFin?.message})})}),!s&&u.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:u.jsx(g.IconButton,{onClick:()=>d(!1),sx:{fontSize:18},children:u.jsx(Sh,{})})})]}):u.jsx("div",{className:"col-md-8"})]}),l&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12 d-flex justify-content-center",children:u.jsx(Eh,{sx:{color:"#757575",my:1}})})}),u.jsxs("div",{className:"row g-2 mb-2",children:[u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(mr,{name:"horaInicio",control:me,render:({field:{onChange:q,value:ae,...Ee}})=>u.jsx(g.Autocomplete,{freeSolo:!0,options:ne,value:ae||"",onChange:(Ie,He)=>q(He||""),onInputChange:(Ie,He)=>q(He),renderInput:Ie=>u.jsx(g.TextField,{...Ie,...Ee,size:"small",error:!!ee.horaInicio,helperText:ee.horaInicio?.message,InputProps:{...Ie.InputProps,endAdornment:u.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Oi,{})})}}),disabled:se})})}),!l&&u.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:ee.horaInicio?"5px":"0px"},children:u.jsx(Eh,{sx:{color:"#757575"}})}),l&&u.jsx("div",{className:"col-md-3 d-none d-md-block"}),u.jsx("div",{className:"col-12 col-md-4",children:u.jsx(mr,{name:"horaFin",control:me,render:({field:{onChange:q,value:ae,...Ee}})=>u.jsx(g.Autocomplete,{freeSolo:!0,options:O,value:ae||"",onChange:(Ie,He)=>q(He||""),onInputChange:(Ie,He)=>q(He),renderInput:Ie=>u.jsx(g.TextField,{...Ie,...Ee,size:"small",error:!!ee.horaFin,helperText:ee.horaFin?.message,InputProps:{...Ie.InputProps,endAdornment:u.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:u.jsx(Oi,{})})}}),disabled:se})})}),!l&&u.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:u.jsx(mr,{name:"todoElDia",control:me,render:({field:q})=>u.jsx(g.FormControlLabel,{control:u.jsx(g.Checkbox,{checked:q.value,onChange:ae=>q.onChange(ae.target.checked)}),label:u.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!l&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(g.Button,{onClick:Ze,size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(ED,{}),"  Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&u.jsx("div",{className:"row mb-2",children:u.jsxs("div",{className:"col-12",children:[!f&&u.jsxs(g.Button,{onClick:()=>h(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[u.jsx(kD,{}),"  Vincular cliente"]}),f&&u.jsxs("div",{className:"row g-2",children:[u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(mr,{name:"client",control:me,render:({field:q})=>u.jsx(g.Autocomplete,{options:b,loading:C,loadingText:"Buscando coincidencias...",getOptionLabel:ae=>ae.nombreCliente?.trim()||"",value:b.find(ae=>ae.nombreCliente===q.value)||(q.value&&typeof q.value=="string"?{solID:-1,nombreCliente:q.value}:null),noOptionsText:D,onInputChange:(ae,Ee)=>{p(Ee)},onChange:(ae,Ee)=>{q.onChange(Ee?Ee.nombreCliente:"")},renderInput:ae=>u.jsx(g.TextField,{...ae,placeholder:"Buscar cliente...",size:"small",InputProps:{...ae.InputProps,startAdornment:u.jsx("img",{src:CD,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:u.jsxs(u.Fragment,{children:[C?u.jsx(g.CircularProgress,{color:"inherit",size:20}):null,ae.InputProps.endAdornment]})}})})})}),u.jsx("div",{className:"col-10 col-md-5",children:u.jsx(mr,{name:"solID",control:me,render:({field:q})=>u.jsx(g.Autocomplete,{options:x,noOptionsText:"Sin resultados",getOptionLabel:ae=>ae.toString(),value:q.value??null,onChange:(ae,Ee)=>q.onChange(Ee),renderInput:ae=>u.jsx(g.TextField,{...ae,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!b.length})})}),u.jsx("div",{className:"col-2 d-flex align-items-center",children:u.jsx(g.IconButton,{onClick:()=>h(!1),sx:{fontSize:18},children:u.jsx(Sh,{})})})]})]})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(mr,{name:"link",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!ee.link,helperText:ee.link?.message,InputProps:{startAdornment:u.jsx("img",{src:wD,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(mr,{name:"descripcion",control:me,render:({field:q})=>u.jsx(g.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:u.jsx("img",{src:DD,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(JD,{onSelectGuest:we,availableSuggestions:fe,onInputTextChange:xe})})}),oe&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(ok,{guests:M,conflictCount:Ce,onViewSuggestions:()=>G(!0),onDeleteGuest:Oe})})}),s?.invitados&&s?.invitados?.length>0&&u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsx(g.Box,{children:u.jsx(WD,{guests:M})})})}),u.jsx(ZD,{open:W,handleClose:R,suggestions:N,onSelectSlot:Ge}),u.jsx("div",{className:"row mb-2",children:u.jsx("div",{className:"col-12",children:u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[u.jsx(SD,{}),Oh.map(q=>u.jsx(mr,{name:"color",control:me,render:({field:ae})=>u.jsx(g.IconButton,{onClick:()=>ae.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:ae.value===q?"2px solid":"none",borderColor:ae.value===q?"primary.main":"transparent"}})},q))]})})}),u.jsx("div",{className:"row",children:u.jsxs("div",{className:"col-12 d-flex justify-content-end gap-2",children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&u.jsx(g.Button,{onClick:n,variant:"outlined",color:"error",sx:{textTransform:"none"},children:"Eliminar"}),u.jsx(g.Button,{onClick:t,variant:"outlined",sx:{textTransform:"none"},children:"Cancelar"}),u.jsx(g.Button,{onClick:qe,variant:"contained",sx:{textTransform:"none"},disabled:!le,children:"Guardar"})]})})]})})})})},Rh="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",lk={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"},uk=({isOpen:e,onClose:t,events:r,date:n,onEventClick:o})=>{if(!n)return null;const s=a=>{o(a),t()},i=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return u.jsx(g.Modal,{open:e,onClose:t,children:u.jsxs(g.Box,{sx:lk,children:[u.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[u.jsxs(g.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),u.jsx(g.IconButton,{onClick:t,size:"small",children:u.jsx(Vr,{})})]}),u.jsx(g.Divider,{}),u.jsx(g.List,{sx:{mt:1},children:r.map(a=>{const c=i(a);return u.jsx(g.ListItem,{disablePadding:!0,sx:{mb:1},children:u.jsx(g.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:u.jsxs(g.Box,{sx:{flexGrow:1},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[u.jsx(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),u.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),u.jsx(g.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${_.format(a.fechaInicio,"HH:mm")} - ${_.format(a.fechaFin,"HH:mm")}`})]})})},a.eventoID)})})]})})};var os={},Nh;function dk(){if(Nh)return os;Nh=1;var e=at();Object.defineProperty(os,"__esModule",{value:!0}),os.default=void 0;var t=e(ht()),r=ut();return os.default=(0,t.default)((0,r.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"),os}var fk=dk();const pk=it(fk),hk="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",mk="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",$h=y.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=ys.useSnackbar(),s={success:{color:"#fff",icon:u.jsx("img",{width:25,src:mk,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:u.jsx(Xc,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:u.jsx(pk,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:u.jsx("img",{src:hk,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})}},i=s[r]||s.info;return u.jsx(ys.SnackbarContent,{ref:n,children:u.jsxs(g.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:[u.jsx(g.Box,{sx:{mr:1.5},children:i.icon}),u.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),u.jsx(g.IconButton,{size:"small",onClick:()=>o(e),children:u.jsx(Vr,{fontSize:"small"})})]})})}),Lh=y.createContext(void 0),gk=({children:e})=>{const[t,r]=y.useState([]),[n,o]=y.useState([]),[s,i]=y.useState(!1);return u.jsx(Lh.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},vk=()=>{const e=y.useContext(Lh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},yk=(e,t,r)=>{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(bk(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:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!0}};function bk(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}function _k(e){let t=0;for(let r=0;r<e.length;r++){const n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t}const xk=(e,t,r)=>{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(_k(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:t,client:null,usrID:r,solicitudRelacionada:[],isGoogleEvent:!1,isOutlookEvent:!0}},wk=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>u.jsxs(g.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[u.jsx(g.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:u.jsx(g.IconButton,{onClick:t,size:"small",children:u.jsx(Vr,{fontSize:"small"})})}),u.jsxs(g.DialogContent,{sx:{textAlign:"center",pt:0},children:[u.jsx(g.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),u.jsx(g.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),u.jsx(g.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),u.jsxs(g.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[u.jsx(g.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),u.jsx(g.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:c?"Procesando...":i})]})]})]}),Sk=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o})=>{const[s,i]=y.useState(new Date),[a,c]=y.useState([]),[l,d]=y.useState(!1),[f,h]=y.useState(null),[v,m]=y.useState(!1),[p,b]=y.useState(null),[w,C]=y.useState([]),{enqueueSnackbar:E}=ys.useSnackbar(),S=Dc(),x=Ti(),U=xc(),[D,T]=y.useState(!1),[M,A]=y.useState([]),[W,G]=y.useState(null),{session:F,sessionoutlook:Y}=ac(),{googleEvents:oe,setGoogleEvents:H,outlookEvents:N,setOutlookEvents:ce}=vk(),[fe,$]=y.useState([]),[Q,Ce]=y.useState([]),[me,Se]=y.useState([]),[ie,ee]=y.useState(!1),[le,ge]=y.useState([]),[de,pe]=y.useState(),Re=(J,Me)=>{A(J),G(Me),T(!0)},j=async()=>{if(e===void 0)return;const J=await S.getNotificacionesXUsuario(e,!1);ge(J)};y.useEffect(()=>{const J=new Date,Me=_.startOfDay(J),ke=_.endOfDay(_.addDays(Me,6)),je={start:Me,end:ke},Yt=a.filter(Kt=>{const qt={start:Kt.fechaInicio,end:Kt.fechaFin};return Fd(qt,je)}).sort((Kt,qt)=>Kt.fechaInicio.getTime()-qt.fechaInicio.getTime());C(Yt)},[a]),y.useEffect(()=>{const J=async()=>{try{if(e){const ke=await S.getEventsByUser(e);j(),c(ke)}}catch(ke){console.log("Error al cargar eventos locales:",ke)}};J();const Me=setInterval(J,4e3);return()=>clearInterval(Me)},[e]),y.useEffect(()=>{if(!n||!e)return;const J=[...a];if(oe.length>0&&F?.userEmail){const Me=oe.map(ke=>yk(ke,n,e));J.push(...Me)}if(N.length>0&&Y?.userEmail){const Me=N.map(ke=>xk(ke,n,e));J.push(...Me)}$(J)},[a,oe,N,n,e,F?.userEmail,Y?.userEmail]);const Fe=async J=>{try{if(J?.isGoogleEvent||J.isOutlookEvent)h(J),d(!0);else{const Me=await S.getEventById(J.eventoID);h(Me),d(!0)}}catch(Me){console.error(Me)}},qe=()=>{d(!1),h(null)},Ze=async(J,Me)=>{let ke,je;J.todoElDia?(ke=new Date(`${J.fechaInicio}T${J.horaInicio}`),je=new Date(`${J.fechaInicio}T${J.horaFin}`)):(ke=new Date(`${J.fechaInicio}T${J.horaInicio}`),je=J.fechaFin&&J.horaFin?new Date(`${J.fechaFin}T${J.horaFin}`):new Date(`${J.fechaInicio}T${J.horaFin}`));const Yt=_.format(ke,"yyyy-MM-dd HH:mm:ss.SSS"),Kt=_.format(je,"yyyy-MM-dd HH:mm:ss.SSS");if(Me){const Yr={...J,eventoID:Me,fechaInicio:Yt,fechaFin:Kt,solID:J.solID??null,disID:n??null,client:J.client,invitados:J.invitados.map(Ke=>({usrNombre:Ke.nombre||Ke.usrNombre,Correo:Ke.correo||Ke.Correo,EsOrganizador:Ke.isHost||Ke.EsOrganizador,StatusInvitacion:Ke.StatusInvitacion,UsuarioID:Ke.usrID||Ke.UsuarioID,disID:Ke.disID||n}))};try{const Ke=await S.updateEvent(Yr);var qt=a.map(Sr=>Sr.eventoID===Ke.eventoID?Ke:Sr);c(qt),E("El evento se ha actualizado correctamente.",{variant:"success"}),qe()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Yr={...J,fechaInicio:Yt,fechaFin:Kt,todoElDia:J.todoElDia,solID:J.solID??null,disID:n??null,client:J.client,invitados:J.invitados.map(Ke=>({usrNombre:Ke.nombre||Ke.usrNombre,Correo:Ke.correo||Ke.Correo,EsOrganizador:Ke.isHost||Ke.EsOrganizador,StatusInvitacion:Ke.StatusInvitacion,UsuarioID:Ke.usrID||Ke.UsuarioID,disID:Ke.disID||n}))};try{const Ke=await S.createEvent(Yr,e);c(Sr=>[...Sr,Ke]),E("El evento se ha creado con éxito",{variant:"success"}),qe()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e){const Yr=await S.getEventsByUser(e);c(Yr)}},Ne=()=>{i(J=>new Date(J.getFullYear(),J.getMonth()-1,1))},Be=()=>{i(J=>new Date(J.getFullYear(),J.getMonth()+1,1))},vt=()=>{ae("ELIMINAR")},pt=()=>{ae("RECHAZAR")},k=()=>{b(new Date),d(!0)},P=J=>{J&&i(J)},B=J=>{b(J),d(!0),h(null)},ue=async()=>{if(f)try{await S.deleteEvent(f.eventoID),c(a.filter(J=>J.eventoID!==f.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(J,Me)=>u.jsx($h,{id:J,message:String(Me),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{qe(),Ee()}},se=async()=>{if(!(!F?.userEmail||!n)){ee(!0);try{const Me=(await x.getGoogleCalendars(F.userEmail,n)).map(je=>({...je,selected:!0}));Ce(Me);const ke=Me.map(je=>je.id);Oe(ke)}catch(J){console.error("Error Google Cals:",J)}finally{ee(!1)}}},O=async J=>{const Me=Q.map(je=>je.id===J?{...je,selected:!je.selected}:je);Ce(Me);const ke=Me.filter(je=>je.selected).map(je=>je.id);Oe(ke)},ne=async()=>{if(!(!Y?.userEmail||!n)){ee(!0);try{const Me=(await U.getOutlookCalendars(Y.userEmail,n)).map(je=>({...je,selected:!0}));Se(Me);const ke=Me.map(je=>je.id);R(ke)}catch(J){console.error("Error Outlook Cals:",J)}finally{ee(!1)}}},we=async J=>{const Me=me.map(je=>je.id===J?{...je,selected:!je.selected}:je);Se(Me);const ke=Me.filter(je=>je.selected).map(je=>je.id);R(ke)};y.useEffect(()=>{se()},[F?.userEmail,n]),y.useEffect(()=>{ne()},[Y?.userEmail,n]);const Oe=async J=>{if(!F?.userEmail||!n)return;const Me=J||Q.filter(ke=>ke.selected).map(ke=>ke.id);try{const ke={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:F.userEmail,calendarIds:Me},je=await x.getGoogleEventsByMonth(ke);H(je)}catch(ke){console.error("Error al obtener eventos de Google:",ke)}},R=async J=>{if(!Y?.userEmail||!n)return;const Me=J||me.filter(ke=>ke.selected).map(ke=>ke.id);try{const ke={disID:n,year:s.getFullYear(),month:s.getMonth()+1,usrMail:Y.userEmail,calendarIds:Me},je=await U.getOutlookEventsByMonth(ke);ce(je)}catch(ke){console.error("Error al obtener eventos de Outlook:",ke)}};if(n===void 0||e===void 0)return u.jsx("div",{children:"Cargando configuración de usuario..."});const te=async(J,Me)=>{await S.UpdateStatusEvento(J.evento.eventoID,e,Me)&&(await S.MarcarLeido(J.notificacionID,e),E(J?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},xe=async()=>{de&&S.UpdateStatusEvento(de.evento.eventoID,e,"RECHAZADA")&&(await S.MarcarLeido(de.notificacionID,e),E("Haz rechazado la Invitación "+de?.evento?.titulo,{variant:"success"}),Ee())},Ge=async(J,Me)=>{try{if(!e)return;pe(J),Me=="RECHAZADA"?(pt(),console.log("noti",J)):te(J,Me)}catch{E("Error al procesar la invitación",{variant:"error"})}},[q,ae]=y.useState(null),Ee=()=>ae(null),Ie={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:u.jsxs(u.Fragment,{children:["Estás a punto de declinar la invitación de ",u.jsx("strong",{children:"Enrique Sánchez"})," a ",u.jsx("strong",{children:de?.evento?.titulo})]}),icon:u.jsx("img",{src:Rh}),action:()=>de&&xe()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:u.jsx("img",{src:Rh}),action:()=>ue()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ue}},He=q?Ie[q]:null;return u.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[u.jsx(ny,{header:u.jsx(w2,{currentDate:s,onPrevMonth:Ne,onNextMonth:Be,onAddEvent:k,onDateChange:P}),sidebar:u.jsx(kx,{onEventClick:Fe,upcomingEvents:w,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:k,googleCalendars:Q,outlookCalendars:me,isLoadingCalendars:ie,onToggleGoogle:O,onToggleOutlook:we,notifications:le,unreadCount:le?.filter(J=>!J.leida).length,onAceppInvitacion:Ge}),mainContent:u.jsx(Nx,{onSeeMoreClick:Re,currentDate:s,events:fe,onDayClick:B,onEventClick:Fe})}),l&&u.jsx(ck,{isVisible:l,onClose:qe,onSave:Ze,onDelete:vt,selectedDate:p,initialEvent:f,userId:e,masNombreBD:o,disId:n}),u.jsx(uk,{isOpen:D,onClose:()=>T(!1),events:M,date:W,onEventClick:Fe}),He&&u.jsx(wk,{open:!!q,onClose:Ee,onConfirm:()=>{He.action()},title:He.title,description:He.description,icon:He.icon,confirmText:He.confirmText})]})},Ck="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",Ek="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 Jc(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function Dk(e,t){const r=e??"",n=t??"";return r instanceof Date&&n instanceof Date?r.getTime()-n.getTime():typeof r=="number"&&typeof n=="number"?r-n:typeof r=="boolean"&&typeof n=="boolean"?Number(r)-Number(n):String(r).localeCompare(String(n),void 0,{numeric:!0,sensitivity:"base"})}function el(e,t,r=!0){return typeof e=="function"?e(t):e??r}function kk(e){return e.replace(/[^\d]/g,"")}function Tk(e,t){return t}var ss={},zh;function Ik(){if(zh)return ss;zh=1;var e=at();Object.defineProperty(ss,"__esModule",{value:!0}),ss.default=void 0;var t=e(ht()),r=ut();return ss.default=(0,t.default)((0,r.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"),ss}var Ak=Ik();const Mk=it(Ak);var is={},Bh;function Pk(){if(Bh)return is;Bh=1;var e=at();Object.defineProperty(is,"__esModule",{value:!0}),is.default=void 0;var t=e(ht()),r=ut();return is.default=(0,t.default)((0,r.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"),is}var Ok=Pk();const jk=it(Ok);var as={},Fh;function Rk(){if(Fh)return as;Fh=1;var e=at();Object.defineProperty(as,"__esModule",{value:!0}),as.default=void 0;var t=e(ht()),r=ut();return as.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),as}var Nk=Rk();const $k=it(Nk);var cs={},Uh;function Lk(){if(Uh)return cs;Uh=1;var e=at();Object.defineProperty(cs,"__esModule",{value:!0}),cs.default=void 0;var t=e(ht()),r=ut();return cs.default=(0,t.default)((0,r.jsx)("path",{d:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),cs}var zk=Lk();const Bk=it(zk);function Hh(e){return e==="right"?"end":e==="center"?"center":"start"}function Vh(e){const t=e.filter(r=>!r.width).length||1;return e.map(r=>typeof r.width=="number"?`${r.width}px`:typeof r.width=="string"?r.width:`minmax(0, ${1/t}fr)`).join(" ")}const Fk=1060,tl=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function Uk({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=Fk,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 l(d){const f=d.reduce((m,p)=>m+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return u.jsx(g.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:u.jsxs(g.Box,{children:[u.jsx(g.Box,{sx:{display:"grid",gridTemplateColumns:r.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=>u.jsx(g.Typography,{sx:{fontSize:13,fontWeight:800},children:d},d))}),e.map((d,f)=>{const[h,v]=K.useState(!!d.initiallyOpen),m=f%2===1,p=o?o(d):t,b=Math.max(n,l(p));return u.jsxs(g.Box,{children:[u.jsxs(g.Box,{sx:{display:"grid",gridTemplateColumns:r.map(w=>typeof w=="number"?`${w}px`:w).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:m?"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:()=>v(w=>!w),children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[u.jsx(g.IconButton,{size:"small",disableRipple:!0,children:h?u.jsx(Bk,{}):u.jsx($k,{})}),u.jsx(g.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),u.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tl(d,"En Proceso")}),u.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tl(d,"Finalizadas")}),u.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tl(d,"Último seg.")})]}),u.jsx(g.Collapse,{in:h,unmountOnExit:!0,children:u.jsxs(g.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[u.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Vh(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(w=>u.jsx(g.Typography,{sx:{justifySelf:Hh(w.align),textAlign:w.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:w.header},w.key))}),(d.rows??[]).map((w,C)=>u.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Vh(p),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:C%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?.(w,d),children:p.map((E,S)=>{const x=E.accessor?E.accessor(w,C):E.field?w[E.field]:null;return u.jsx(g.Box,{sx:{justifySelf:Hh(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof x=="string"||typeof x=="number"?u.jsx(g.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(E.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(x),children:x}):x},E.key??S)})},w.id??C))]})})]},d.id)})]})})}var ls={},Wh;function Hk(){if(Wh)return ls;Wh=1;var e=at();Object.defineProperty(ls,"__esModule",{value:!0}),ls.default=void 0;var t=e(ht()),r=ut();return ls.default=(0,t.default)((0,r.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"),ls}var Vk=Hk();const Wk=it(Vk),Yk=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",qk=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},Zk=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var us={},Yh;function Gk(){if(Yh)return us;Yh=1;var e=at();Object.defineProperty(us,"__esModule",{value:!0}),us.default=void 0;var t=e(ht()),r=ut();return us.default=(0,t.default)((0,r.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"),us}var Kk=Gk();const Qk=it(Kk),rl=({current:e=0,total:t=0,color:r="#4caf50"})=>u.jsx("div",{style:{display:"flex",gap:"1px",width:"100%",height:"100%",justifyContent:"center",overflow:"hidden",minWidth:0},children:Array.from({length:t}).map((n,o)=>u.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var ds={},qh;function Xk(){if(qh)return ds;qh=1;var e=at();Object.defineProperty(ds,"__esModule",{value:!0}),ds.default=void 0;var t=e(ht()),r=ut();return ds.default=(0,t.default)((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),ds}var Jk=Xk();const Zh=it(Jk),e3=e=>{const t=String(e??"").toLowerCase().trim();return t==="muy interesado"?{bg:"#E53935",color:"#FFFFFF"}:t==="interesado"?{bg:"#FB8C00",color:"#FFFFFF"}:t==="venta definitiva"?{bg:"#2E7D32",color:"#FFFFFF"}:t==="no sé"||t==="no se"?{bg:"#9E9E9E",color:"#FFFFFF"}:t==="algo interesado"?{bg:"#FFEB3B",color:"#000000"}:{bg:"transparent",color:"#2c2c2c"}},t3=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}},r3=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}},n3=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 o3(e){const t=new Date(e),r=t.toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}),n=t.toLocaleTimeString("es-MX",{hour:"2-digit",minute:"2-digit"});return`${r.replace(".","")} • ${n}`}function s3(e){return e.replace(/<br\s*\/?>/gi,`
178
178
  `).replace(/\r\n/g,`
179
179
  `).replace(/\r/g,`
180
- `)}const i3={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"]},a3={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"]},c3={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function l3(e,t){switch(e){case"pruebas":return r3(t)??"—";case"servicio":return n3(t)??"—";case"nuevos":case"seminuevos":default:return t3(t)??"—"}}function u3({open:e,onClose:t,customer:r,fields:n=[],header:o,extraSections:s,normalTable:i,normalTableColumns:a=[],history:c=[],advisorHistory:l=[],onRequestEdit:d,searchFilter:f,urlsQA:h,solicitudesNuevos:v=[],solicitudesPrueba:m=[],solicitudesServicio:p=[],solicitudesSeminuevos:b=[],onCreateSolicitud:w,isCrmMode:C=!1,onSolicitudBaseUrl:E,onIframeClose:S,reloadInfo:x,idAdminSistemas:U}){if(!r)return null;const D=3,[T,M]=y.useState(null),A=!!T,[W,G]=y.useState(!1),[F,Y]=y.useState(null),[oe,H]=y.useState(c??[]),[N,ce]=y.useState(null),fe=y.useMemo(()=>[...l].sort((L,X)=>new Date(X.FechaAsignacion).getTime()-new Date(L.FechaAsignacion).getTime()),[l]);y.useEffect(()=>{c&&c.length&&H(c)},[c]);const $=c?.length?c:oe,Q=o?.title??(L=>L?.Nombre||L?.name||"Sin título"),Ce=o?.infoItems??[],me=L=>L.nombreAsesor?.trim()||(L.Email?L.Email:"Sistema"),Se=L=>{const X=L||"",_e=X.split(" ").filter(Boolean);return _e.length>=2?(_e[0][0]+_e[1][0]).toUpperCase():(X[0]||"?").toUpperCase()},ie=L=>L?.SolID??L?.solID??L?.SolId??L?.SOLID??null,ee=y.useMemo(()=>{const L=$??[];return Array.isArray(L?.[0])?L.flat():L},[$]),le=y.useMemo(()=>{const L=ee;return!N||F==null?L:L.filter(X=>{const _e=ie(X);return _e!=null&&String(_e)===String(F)})},[ee,N,F]),ge=y.useMemo(()=>[...le].sort((L,X)=>new Date(X.fecAlta).getTime()-new Date(L.fecAlta).getTime()),[le]),[de,pe]=y.useState(!1),Re=y.useMemo(()=>de?ge:ge.slice(0,D),[de,ge]),j=Math.max(ge.length-D,0),Fe=L=>String(L??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),qe=(L,X)=>Fe(JSON.stringify(L)).includes(Fe(X)),Ze=(L,X)=>f?f(L,X):qe(L,X),Ne=(L,X)=>{const _e=Fe(X).split(/\s+/).filter(Boolean);return _e.length?_e.every(Ae=>Ze(L,Ae)):!0},[Be,vt]=y.useState(""),[pt,k]=y.useState([]);y.useMemo(()=>i??[],[i]),y.useMemo(()=>{const L=Be.trim();return L?(i??[]).filter(X=>Ne(X,L)):i??[]},[i,Be]);const P=g.useTheme(),B=g.useMediaQuery(P.breakpoints.down("md")),[ue,se]=y.useState(""),[O,ne]=y.useState(!0),[we,Oe]=y.useState(!1),R=new Date().toISOString().slice(0,10),te=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[xe,Ge]=y.useState(te),[q,ae]=y.useState(R),[Ee,Ie]=y.useState(null),He=!!Ee,[J,Me]=y.useState("En Proceso"),[ke,je]=y.useState("Todos"),[Yt,Kt]=y.useState("Todos"),qt=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],Yr=["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"],Ke=()=>{se(""),ne(!1),Oe(!1),Ge(te),ae(R),Me("Todos"),je("Todos"),Kt("Todos")},Sr=y.useMemo(()=>(ue??"").trim()!==""||J!=="Todos"||ke!=="Todos"||O||we||Yt!=="Todos",[ue,J,ke,O,we,Yt]);function Tn(L){if(!L)return"";const X=new Date(L);if(isNaN(X.getTime()))return"";const _e=String(X.getDate()).padStart(2,"0"),Ae=String(X.getMonth()+1).padStart(2,"0"),Tt=String(X.getFullYear()).slice(-2);return`${_e}/${Ae}/${Tt}`}function ra(L){const X=L?new Date(L):null;return X&&!isNaN(X.getTime())?X:null}function il(L,X){let _e=null;for(const Ae of L){const Tt=ra(X(Ae));if(Tt){const St=Tt.getTime();(_e===null||St>_e)&&(_e=St)}}return _e?new Date(_e):null}function gs(L){const X=il(L,_e=>_e.UltimoSeguimiento||_e.FechaCita);return X?Tn(X.toISOString()):"—"}function vs(L){const X=(L??"").toLowerCase().trim();return X==="sin venta"||X==="con venta"||X==="rechazada"||X==="rechazadas"}function na(L){return L.filter(X=>vs(X.EstatusDescripcion)).length}function oa(L){return L.filter(X=>!vs(X.EstatusDescripcion)).length}const al=({progress:L,color:X})=>{if(!L)return u.jsx(rl,{current:0,total:0,color:X});const _e=L.split("/").map(Number);if(_e.length!==2||_e.some(St=>Number.isNaN(St)))return u.jsx(rl,{current:0,total:0,color:X});const[Ae,Tt]=_e;return u.jsx(rl,{current:Ae,total:Tt,color:X})};function sa(L){return[{key:"fecha",header:"Fecha",accessor:X=>Tn(X.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:X=>u.jsx(g.Tooltip,{title:X.Vehiculo??"",placement:"top",arrow:!0,children:u.jsx(g.Typography,{component:"span",sx:{fontSize:13,fontWeight:500,display:"block",maxWidth:260,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:"default"},children:X.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:X=>u.jsx(g.Typography,{sx:{fontWeight:800,fontSize:13},children:l3(L,X.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:X=>{const{bg:_e,color:Ae}=e3(X.NivelInteres);return u.jsx(g.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:_e,color:Ae,fontSize:12,fontWeight:X.NivelInteres?800:500},children:X.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:X=>{const _e=(X.Asesor??"").trim(),Ae=cl=>{if(!cl)return"";const $3=cl[0]?.toUpperCase()??"",L3=cl[1]?.toLowerCase()??"";return`${$3}${L3}`};if(!_e)return u.jsx(g.Tooltip,{title:"",placement:"top",children:u.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const Tt=_e.split(/\s+/),St=Tt[0]??"",Or=Tt[1]??"",Cr=Ae(St),In=Ae(Or),N3=`${Cr}${In}`||"—";return u.jsx(g.Tooltip,{title:_e,placement:"top",children:u.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:N3})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:X=>X.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:X=>u.jsx(g.Tooltip,{title:X.Actividad??"",placement:"top",arrow:!0,children:u.jsxs(g.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[X.Icon&&u.jsx("span",{style:{color:"#fff",backgroundColor:X.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:u.jsx("i",{className:X.Icon})}),u.jsx(g.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(X.Actividad??"").length?"default":"inherit"},children:X.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:X=>u.jsx(al,{progress:X.Avance,color:X.Color}),width:"100px",align:"left"}]}function I(L){const _e=sa(L).slice(1);return[{key:"fecha",header:"Fecha",accessor:Ae=>Tn(Ae.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Ae=>Tn(Ae.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Ae=>Ae.HoraCita??"—",width:110},..._e]}function re(L){const X=L.kind;switch(X){case"pruebas":case"servicio":return I(X);case"nuevos":case"seminuevos":default:return sa(X)}}function ye(L,X,_e,Ae){return{id:L,kind:_e,title:X,metrics:[{label:"En Proceso",value:oa(Ae)},{label:"Finalizadas",value:na(Ae)},{label:"Último seg.",value:gs(Ae)}],rows:Ae,initiallyOpen:!1}}const Pe=[ye("n-1","Cotización de nuevos","nuevos",v),ye("p-1","Prueba de Manejo","pruebas",m),ye("s-1","Cita de Servicio","servicio",p),ye("sn-1","Cotización para Seminuevos","seminuevos",b)],Qe=y.useMemo(()=>{const L=(ue??"").trim().toLowerCase(),X=(_e,Ae)=>{if(L&&!(_e.Vehiculo??"").toLowerCase().includes(L))return!1;const Tt=we?_e.FechaCita:_e.Fecha;if(O&&Tt){const St=ra(Tt??"");if(!St)return!1;const Or=xe?new Date(`${xe}T00:00:00`):null,Cr=q?new Date(`${q}T00:00:00`):null;if(Cr&&Cr.setDate(Cr.getDate()+1),Or&&St<Or||Cr&&St>=Cr)return!1}if(J!=="Todos"){const St=(_e.EstatusDescripcion??"").toLowerCase();if(!(i3[J]??[]).some(In=>St===In.toLowerCase()))return!1}if(ke!=="Todos"){const St=(_e.Actividad??"").toLowerCase();if(!(a3[ke]??[]).some(In=>St===In.toLowerCase()))return!1}if(Yt!=="Todos"){const St=(_e.NivelInteres??"").toLowerCase();if(!(c3[Yt]??[]).some(In=>St===In.toLowerCase()))return!1}return!0};return Pe.map(_e=>{const Ae=(_e.rows??[]).filter(St=>X(St,_e.kind)),Tt=[{label:"En Proceso",value:oa(Ae)},{label:"Finalizadas",value:na(Ae)},{label:"Último seg.",value:gs(Ae)}];return{..._e,rows:Ae,metrics:Tt}})},[Pe,ue,O,xe,q,we,J,ke,Yt]),lt={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},Ye=(L,X)=>{const _e=L.SolID;if(!_e)return;const Ae=X.kind,Tt=lt[Ae]??"cotizaciones",St=h?`https://qa2.crm.netcar.com.mx/netcar/${Tt}/${_e}`:`https://crmxs.netcar.com.mx/netcar/${Tt}/${_e}`,Or=E?.({row:L,section:X,slug:Tt,solId:_e,baseUrl:St});if(!C){const Cr=Or??St;Y(_e),ce(Cr),G(!0)}},Ue=()=>{S?.(r),Y(null),ce(null),G(!1)},Vt=y.useRef(!1),mt=y.useRef(null),Pt=y.useCallback(()=>{if(!Vt.current){Vt.current=!0;return}mt.current&&window.clearTimeout(mt.current),mt.current=window.setTimeout(()=>{x?.(r)},500)},[x,r]);return y.useEffect(()=>{Vt.current=!1,mt.current&&window.clearTimeout(mt.current)},[N,F]),u.jsx(g.Dialog,{open:e,onClose:t,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:u.jsxs(g.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[u.jsxs(g.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:[u.jsxs(g.Box,{children:[u.jsx(g.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:u.jsxs(g.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[u.jsx(g.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:u.jsx(g.Box,{sx:{flex:1,minWidth:0,pr:1},children:u.jsxs(g.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[Q(r)," ",u.jsx(g.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{t?.(),r&&d?.(r)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:u.jsx(Qk,{sx:{fontSize:"1em"}})})]})})}),Ce.map((L,X)=>u.jsxs(g.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:L.onClick?"pointer":"default"},onClick:()=>{L.onClick&&L.onClick(r)},children:[L.icon,u.jsx(g.Typography,{variant:"body2",sx:{color:L.inLink?"#336BE1":"#070C10"},style:{},children:L.value(r)})]},X))]})}),u.jsx(g.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((L,X)=>{const _e=L.label?.toLowerCase().startsWith("asesor");return u.jsxs(g.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[u.jsx(g.Box,{sx:{width:"50%"},children:u.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:L.label})}),u.jsxs(g.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[u.jsx("div",{children:L?.avatar?L.avatar(r):null}),u.jsx(g.Typography,{variant:"body2",color:"textPrimary",children:L?.value(r)}),_e&&!U&&u.jsx(g.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:u.jsx(g.IconButton,{size:"small",onClick:Ae=>M(Ae.currentTarget),sx:{ml:.5},disableRipple:!0,children:u.jsx(Wk,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},X)})}),u.jsx(g.Divider,{sx:{my:2}})]}),u.jsx(g.Box,{px:2.5,pb:.5,children:u.jsxs(g.Typography,{children:[u.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!N&&" por solicitud",":"]})}),u.jsxs(g.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:[Re.length===0&&u.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),u.jsxs(g.Box,{children:[Re?.map((L,X)=>{console.log("h",L);const _e=me(L),Ae=s3(L.comentario||"");return u.jsxs(g.Box,{sx:{pb:1.5},children:[u.jsxs(g.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[u.jsx(g.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:L.tipo||"Evento"}),u.jsx(g.Chip,{size:"small",label:L.auto!=null?`${L.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Ae?u.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Ae}):null,u.jsxs(g.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[L?.ImgAsesor!=null?u.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:Se(_e),src:L?.ImgAsesor}):u.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:Se(_e)}),u.jsxs(g.Stack,{spacing:0,children:[u.jsx(g.Typography,{variant:"body2",fontWeight:600,children:_e}),u.jsx(g.Typography,{variant:"caption",color:"text.secondary",children:o3(L.fecAlta)})]})]}),X<Re.length-1&&u.jsx(g.Divider,{sx:{mt:1.25}})]},L.segID??X)}),ge.length>D&&u.jsx(g.Box,{sx:{mt:1},children:u.jsx(g.Button,{onClick:()=>pe(L=>!L),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:de?"Ver menos":`Ver más (${j})`})})]})]}),u.jsx(g.Menu,{anchorEl:T,open:A,onClose:()=>M(null),TransitionComponent:g.Fade,MenuListProps:{disablePadding:!0},PaperProps:{sx:{width:320,p:0,overflow:"hidden"}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[u.jsx(g.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"}),u.jsxs(g.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[fe.length===0&&u.jsx(g.Box,{sx:{px:1.5,py:1},children:u.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),fe.map((L,X)=>{const _e=qk(L),Ae=Yk(L.FechaBaja??L.FechaAsignacion);return u.jsx(g.Box,{sx:{px:1,py:.75},children:u.jsxs(g.Stack,{direction:"row",alignItems:"center",spacing:1,children:[u.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:L?.ImgAsesor??void 0,children:Zk(_e)}),u.jsx(g.Box,{sx:{flex:1,minWidth:0},children:u.jsx(g.Typography,{variant:"body2",noWrap:!0,children:_e})}),u.jsx(g.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Ae})]})},X)})]})]})})]}),W?u.jsxs(g.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[u.jsx(g.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:u.jsx(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:u.jsx(g.Button,{onClick:Ue,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:u.jsx(Kc,{fontSize:"medium"})})})}),N&&u.jsx("iframe",{src:N,width:"100%",height:"100%",onLoad:Pt,style:{border:0}})]}):u.jsxs(g.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[u.jsx(g.Box,{sx:{mt:{xs:1.5,md:3}},children:u.jsxs(g.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[u.jsx(g.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),u.jsxs(g.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[u.jsxs(g.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[u.jsx(g.TextField,{size:"small",placeholder:"Buscar por vehículo",value:ue,onChange:L=>se(L.target.value),InputProps:{endAdornment:u.jsx(jk,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[u.jsxs(g.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[u.jsx(g.FormControlLabel,{label:u.jsx(g.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:u.jsx(g.Checkbox,{checked:O,onChange:L=>ne(L.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),u.jsx(g.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),u.jsxs(g.Stack,{direction:"row",spacing:1,children:[u.jsx(g.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:xe,onChange:L=>Ge(L.target.value),disabled:!O,sx:{width:170}}),u.jsx(g.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:q,onChange:L=>ae(L.target.value),disabled:!O,sx:{width:170}})]})]}),u.jsx(g.IconButton,{onClick:L=>Ie(L.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:u.jsx(Mk,{})}),Sr&&u.jsx(g.Button,{variant:"outlined",onClick:Ke,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),u.jsx(g.Tooltip,{title:Sr&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!Sr,children:u.jsx("span",{children:u.jsxs(g.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{w?.(r)},disableRipple:!0,children:[u.jsx(Zh,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!Sr&&"Crear Solicitud"]})})})]}),u.jsx(Uk,{sections:Qe,detailColumns:[],getDetailColumns:re,onRowClick:Ye})]})]})}),u.jsx(g.Menu,{anchorEl:Ee,open:He,onClose:()=>Ie(null),TransitionComponent:g.Fade,PaperProps:{sx:{p:1.5,width:260,borderRadius:2,boxShadow:3}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:u.jsxs(g.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[u.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),u.jsxs(g.Box,{children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),u.jsx(g.RadioGroup,{value:J,onChange:L=>Me(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=>u.jsx(g.FormControlLabel,{value:L,control:u.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),u.jsxs(g.Box,{children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),u.jsx(g.RadioGroup,{value:ke,onChange:(L,X)=>je(X),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Yr].map(L=>u.jsx(g.FormControlLabel,{value:L,sx:{alignItems:"start"},control:u.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),u.jsxs(g.Box,{children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),u.jsx(g.RadioGroup,{value:Yt,onChange:(L,X)=>Kt(X),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...qt].map(L=>u.jsx(g.FormControlLabel,{value:L,control:u.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]})]})})]})]})})}const Gh={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function Kh(e,t,r){const{fields:n,order:o=["nombreCliente","email","acciones"],header:s={},cells:i={},hide:a={},actions:c}=t,l=c??{},d=l.show??{},f=l.handlers??{},h=l.accessors??{},v=l.icons??{},m=l.className??"d-flex flex-row gap-2 align-items-center ",p=l.tooltip??{},b=v.view??u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[u.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"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),w={nombreCliente:{key:"nombreCliente",header:s.nombreCliente??"Cliente",accessor:A=>A[n.nombreCliente],cell:i.nombreCliente,width:190},email:{key:"email",header:s.email??"Correo",accessor:A=>A[n.email],cell:i.email??(A=>{const W=String(A[n.email]??"");return W?u.jsx("a",{href:`mailto:${W}`,children:W}):u.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:i.acciones??(A=>{const W=el(d.whatsapp,A,!0),G=el(d.email,A,!0),F=el(d.view,A,!0),Y=h.phone?.(A),oe=h.email?.(A),H=fe=>{if(fe.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(A);if(!Y)return;const $=h.countryCode??"52",Q=kk(String(Y));typeof window<"u"&&window.open(`https://wa.me/${$}${Q}`,"_blank")},N=fe=>{if(fe.stopPropagation(),f.onEmail)return f.onEmail(A);oe&&typeof window<"u"&&(window.location.href=`mailto:${oe}`)},ce=fe=>{fe.stopPropagation(),f.onView&&f.onView(A)};return u.jsxs("div",{className:m,children:[W&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:H,style:{width:24,height:24},children:u.jsx("img",{src:Ck,alt:"WhatsApp"})}),G&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:N,style:{width:24,height:24},children:u.jsx("img",{src:Ek,alt:"Email"})}),F&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:ce,style:{width:24,height:24},children:b})]})}),width:120}},C=Object.values(w).filter(A=>!!A),E=(e??[]).filter(A=>!!A?.key),S=new Map;for(const A of C)S.set(String(A.key),A);for(const A of E)S.set(String(A.key),A);const x=[...C.map(A=>String(A.key)),...E.map(A=>String(A.key))],U=Array.from(new Set(o.map(A=>String(A)).filter(A=>S.has(A)))),D=x.filter(A=>!U.includes(A)),T=[...U,...D],M="acciones";if(S.has(M)){const A=T.filter(W=>W!==M);T.splice(0,T.length,...A,M)}return T.map(A=>S.get(A))}function d3(e){const{rows:t,columns:r,clientSort:n=!0,urlsQA:o=!0,defaultSort:s,minWidth:i=1100,rowKey:a=Tk,haveOpenDetailFor:c=!0,defaults:l,detailConfig:d,normalTable:f,onRowClick:h,activityHistory:v,advisorHistory:m,forceOpenDetailFor:p,closeDetailFor:b,onRequestEdit:w,searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:x,solicitudesSeminuevos:U,onCreateSolicitud:D,isCrmMode:T,onSolicitudBaseUrl:M,onIframeClose:A,reloadInfo:W,idAdminSistemas:G=!1}=e,[F,Y]=y.useState(s??null),[oe,H]=y.useState({open:!1,customer:null}),[N,ce]=y.useState([]),fe=ie=>{H({open:!0,customer:ie})},$=ie=>{c&&(h?.(ie),H({open:!0,customer:ie}))},Q=()=>{H({open:!1,customer:null}),b?.()},Ce=y.useMemo(()=>l?Kh(r??[],l):Kh(r??[],{fields:{},order:[]}),[r,l]),me=y.useMemo(()=>{if(!n||!F)return t;const ie=Ce.find(le=>le.key===F.key);if(!ie)return t;const ee=[...t];return ee.sort((le,ge)=>{const de=Jc(ie,le,0),pe=Jc(ie,ge,0),Re=Dk(de,pe);return F.direction==="asc"?Re:-Re}),ee},[t,Ce,F,n]),Se=y.useMemo(()=>{const ie=d?.getCustomerId;return ee=>{const le=ie?.(ee)??ee?.Id_cliente??ee?.CliID??ee?.id??ee?.ID??ee?.Id??"";return String(le)}},[d]);return y.useEffect(()=>{if(!oe.open||!oe.customer)return;const ie=Se(oe.customer);if(!ie)return;const ee=(t??[]).find(le=>Se(le)===ie);ee&&ee!==oe.customer&&H(le=>({...le,customer:ee}))},[t,oe.open,oe.customer,Se]),y.useEffect(()=>{p&&fe(p)},[p]),u.jsxs("div",{children:[u.jsx("div",{className:`${Gh.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:u.jsx("div",{className:`${Gh.tableResponsive} table-responsive`,children:u.jsxs("table",{className:"table table-hover align-middle mb-0",children:[u.jsx("thead",{children:u.jsx("tr",{children:Ce.map(ie=>u.jsx("th",{style:{fontWeight:600,width:ie.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ie.align??"left"},children:ie.header},ie.key))})}),u.jsx("tbody",{children:me.map((ie,ee)=>u.jsx("tr",{onClick:()=>$?.(ie),role:"button",tabIndex:0,onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&$?.(ie)},style:{cursor:"pointer"},children:Ce.map((le,ge)=>{const de=le.Component?u.jsx(le.Component,{row:ie,index:ee}):le.cell?le.cell(ie,ee):(()=>{const pe=Jc(le,ie,ee);return pe==null||pe===""?"":String(pe)})();return u.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:le.align??"left"},children:de},`${String(le.key)}-${ge}`)})},a(ie,ee)))})]})})}),oe.open&&u.jsx(u3,{open:oe.open,onClose:Q,customer:oe.customer,fields:d?.dynamicFields,header:d?.header,normalTable:f,history:v,advisorHistory:m,urlsQA:o,onRequestEdit:ie=>{Q(),w?.(ie)},searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:x,solicitudesSeminuevos:U,onCreateSolicitud:D,isCrmMode:T,onSolicitudBaseUrl:M,onIframeClose:A,reloadInfo:W,idAdminSistemas:G})]})}const Qh=K.forwardRef(({sx:e,...t},r)=>u.jsx(g.InputBase,{inputRef:r,...t,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}}));Qh.displayName="SoftInput";var fs={},Xh;function f3(){if(Xh)return fs;Xh=1;var e=at();Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=void 0;var t=e(ht()),r=ut();return fs.default=(0,t.default)((0,r.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"),fs}var p3=f3();const h3=it(p3);function m3({message:e}){return e?u.jsxs(g.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:[u.jsx(h3,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),u.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function g3(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function nl(e,t){const r=g3(e);return r?t?.isArray?{required:r,validate:n=>Array.isArray(n)&&n.length>0||r}:{required:r,validate:n=>n!==""&&n!==null&&n!==void 0||r}:{}}const Jh={"& .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%"},v3={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function ol({label:e,errorMsg:t,helperText:r,children:n,sx:o}){return u.jsxs(g.FormControl,{fullWidth:!0,error:!!t,sx:o,className:"1- FieldWrapper",children:[u.jsx(g.FormLabel,{sx:v3,children:e}),n,u.jsx(m3,{message:t||r})]})}function y3(e,t){const{register:r,formState:{errors:n}}=t,o={...nl(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"]),l=S=>e.onlyNumbers?(S.match(a)??[]).join(""):e.onlyLetters?(S.match(i)??[]).join(""):S,d=(S,x)=>c.has(S)||x?!0:e.onlyNumbers?/^[0-9]$/.test(S):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(S):!0,f=n[e.name]?.message,h=r(e.name,o),v=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,m=S=>{d(S.key,S.ctrlKey||S.metaKey)||S.preventDefault()},p=S=>{const x=S.data??null;x!=null&&(e.onlyNumbers&&/[^0-9]/.test(x)&&S.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(x)&&S.preventDefault())},b=S=>{const x=S.clipboardData.getData("text"),U=l(x);if(U!==x){S.preventDefault();const D=S.target,T=D.selectionStart??D.value.length,M=D.selectionEnd??D.value.length;D.setRangeText(U,T,M,"end"),D.dispatchEvent(new Event("input",{bubbles:!0}))}},w=S=>{const x=l(S.target.value);x!==S.target.value&&(S.target.value=x),v&&S.target.value.length>v&&(S.target.value=S.target.value.slice(0,v)),h.onChange(S)},C={...e.inputProps,...s?{inputMode:"email",autoComplete:"email"}:{},maxLength:v,onKeyDown:m,onBeforeInput:p,onPaste:b,onInvalid:S=>S.preventDefault()},E=e.onlyNumbers||s?"text":e.type??"text";return u.jsx(ol,{label:e.label,errorMsg:f,helperText:e.helperText,sx:Jh,children:u.jsx(Qh,{placeholder:e.placeholder,type:E,inputProps:C,...h,onChange:w,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function b3(e,t){const{control:r}=t,n=!!e.multiple;return u.jsx(mr,{name:e.name,control:r,rules:nl(e,{isArray:n}),render:({field:o,fieldState:s})=>u.jsx(ol,{label:e.label,errorMsg:s.error?.message,helperText:e.helperText,sx:Jh,children:u.jsxs(g.Select,{...o,multiple:n,displayEmpty:!0,sx:{height:48,backgroundColor:"#EBEEF0","& .MuiSelect-select":{display:"flex",alignItems:"center",py:0}},className:"2-SoftInputData",children:[!n&&u.jsx(g.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(i=>u.jsx(g.MenuItem,{value:i.value,children:i.label},String(i.value)))]})})})}function _3(e,t){return u.jsx(mr,{name:e.name,control:t.control,rules:nl(e),render:({field:r,fieldState:n})=>u.jsx(ol,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:u.jsx(g.RadioGroup,{row:!0,...r,className:"3-RadioFieldRender",children:e.options.map(o=>u.jsx(g.FormControlLabel,{value:o.value,control:u.jsx(g.Radio,{}),label:o.label},String(o.value)))})})})}function e0(e,t){if(e.render)return e.render(t);switch(e.kind){case"text":return y3(e,t);case"select":return b3(e,t);case"radio":return _3(e,t);default:return null}}function x3(e,{initialPerPage:t=25,perPageOptions:r=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:s,deps:i=[]}={}){const a=Array.isArray(e)?e:[],[c,l]=y.useState(1),[d,f]=y.useState(t),{currentItems:h,totalPages:v,showingFrom:m,showingTo:p,totalItems:b}=y.useMemo(()=>{const E=a.length,S=d==="Todos"?1/0:Number(d),x=S===1/0?1:Math.max(1,Math.ceil(E/S)),U=Math.min(c,x),D=S===1/0?E:U*S,T=S===1/0?0:D-S;return{currentItems:S===1/0?a:a.slice(T,D),totalPages:x,showingFrom:E===0?0:T+1,showingTo:S===1/0?E:Math.min(D,E),totalItems:E}},[a,c,d]),w=E=>{const S=Math.max(1,Math.min(E,v||1));l(S),n?.(S),s?.()};return{currentItems:h,totalPages:v,showingFrom:m,showingTo:p,totalItems:b,currentPage:c,itemsPerPage:d,perPageOptions:r,goTo:w,next:()=>w(c+1),prev:()=>w(c-1),setItemsPerPage:E=>{f(E),o?.(E),l(1),s?.()},setCurrentPage:w}}var ps={},t0;function w3(){if(t0)return ps;t0=1;var e=at();Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=void 0;var t=e(ht()),r=ut();return ps.default=(0,t.default)((0,r.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),ps}var S3=w3();const C3=it(S3);var hs={},r0;function E3(){if(r0)return hs;r0=1;var e=at();Object.defineProperty(hs,"__esModule",{value:!0}),hs.default=void 0;var t=e(ht()),r=ut();return hs.default=(0,t.default)((0,r.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),hs}var D3=E3();const k3=it(D3),T3=({currentPage:e,totalPages:t,onPageChange:r,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:s,showingFrom:i,showingTo:a,totalItems:c})=>{const l=g.useTheme(),d=g.useMediaQuery(l.breakpoints.down("sm")),f=()=>{if(t<=1)return[1];const m=d?0:2,p=[],b=1,w=t,C=Math.max(b+1,e-m),E=Math.min(w-1,e+m);p.push(b),C>b+1&&p.push("...");for(let S=C;S<=E;S++)S>=b+1&&S<=w-1&&p.push(S);return E<w-1&&p.push("..."),p.push(w),p},h=m=>{const p=m.target.value;o(p)},v=Math.max(1,t);return u.jsxs(g.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:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[u.jsx(g.IconButton,{onClick:()=>r(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:u.jsx(C3,{fontSize:"large"})}),f().map((m,p)=>m==="..."?u.jsx(g.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):u.jsx(g.Button,{onClick:()=>r(m),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===m?"primary.main":"transparent",fontWeight:e===m?700:400,color:e===m?"#fff":"#5C6372","&:hover":{backgroundColor:e===m?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:m},`p-${m}`)),u.jsx(g.IconButton,{onClick:()=>r(e+1),disabled:e>=v,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:u.jsx(k3,{fontSize:"large"})})]}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[u.jsx(g.Typography,{variant:"body2",children:"Mostrar"}),u.jsx(g.FormControl,{size:"small",sx:{minWidth:72},children:u.jsx(g.Select,{value:n,onChange:h,renderValue:m=>m==="Todos"?"Todos":String(m),children:s.map(m=>u.jsx(g.MenuItem,{value:m,children:m==="Todos"?"Todos":m},String(m)))})}),u.jsx(g.Typography,{variant:"body2",children:"por página"})]})]})};function I3(e){const{open:t,dataAdd:r,fields:n,onSubmit:o,onCancel:s,defaultValues:i,txtBtnGuardar:a,haveId:c=!1,itemsTable:l,filter:d,getId:f,renderRow:h,selectedIds:v,onSelectedChange:m,onSubmitAddData:p,initialSelectedIds:b=[],showAutosPanel:w}=e,C=Cp({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:i});y.useEffect(()=>{i&&C.reset(i)},[i,C]);const[E,S]=y.useState(""),[x,U]=y.useState(b),D=Array.isArray(v)&&!!m,T=D?v:x,M=O=>{const ne=typeof O=="function"?O(T):O;D?m(ne):U(ne)},A=y.useCallback(O=>f?f(O):O?.IdAuto,[f]),W=y.useMemo(()=>{const O=new Map;return(l??[]).forEach((ne,we)=>O.set(A(ne),we)),O},[l,A]),G=y.useRef(new Set),F=y.useMemo(()=>{const O=new Map;return(l??[]).forEach(ne=>O.set(f?f(ne):ne?.IdAuto,ne)),O},[l,f]),Y=y.useMemo(()=>(n??[]).filter(O=>!!O.required).map(O=>O.name),[n]),oe=ip({control:C.control,name:Y}),H=O=>O==null?!1:typeof O=="string"?O.trim().length>0:Array.isArray(O)?O.length>0:typeof O=="number"?!Number.isNaN(O):typeof O=="object"?Object.keys(O).length>0:!0,N=y.useMemo(()=>Y.length?oe?.every(H)??!1:!0,[oe,Y]),{handleSubmit:ce,formState:{isSubmitting:fe,isDirty:$,isValid:Q}}=C,Ce=d??((O,ne)=>JSON.stringify(O).toLowerCase().includes(ne.toLowerCase())),me=y.useMemo(()=>E.trim()?l?.filter(O=>Ce(O,E)):l,[l,E,Ce]),Se=y.useMemo(()=>{if(!me)return me;const O=G.current,ne=[...me];return ne.sort((we,Oe)=>{const R=O.has(A(we))?0:1,te=O.has(A(Oe))?0:1;if(R!==te)return R-te;const xe=W.get(A(we))??0,Ge=W.get(A(Oe))??0;return xe-Ge}),ne},[me,W,A]),{currentItems:ie,totalPages:ee,showingFrom:le,showingTo:ge,totalItems:de,currentPage:pe,itemsPerPage:Re,perPageOptions:j,goTo:Fe,setItemsPerPage:qe}=x3(Se,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[E],scrollTop:()=>{}}),Ze=O=>{const ne=F.get(O)??null;M([O]),p?.({items:ne})},Ne=O=>T.includes(O),Be=async O=>{try{await o?.(O),C.reset(C.getValues())}catch(ne){console.error("Error al enviar AddCliente:",ne)}},vt=y.useMemo(()=>{const O=new Map;return(n??[]).forEach(ne=>O.set(String(ne.name),ne)),O},[n]),pt=(O,ne)=>{const we=vt.get(String(O));if(!we)return null;const Oe={xs:12,...we.grid,...ne||{}};return u.jsx(g.Grid,{item:!0,...Oe,children:we.render?we.render(C):e0(we,C)},`fld-${String(O)}`)},k=w??(e.haveId?"edit":"new"),P=k!=="onlyCars",B=k==="new"||k==="onlyCars",ue=T?.length>0,se=k==="onlyCars"?ue:e.haveId?N&&$||ue:N&&ue;return u.jsx(g.Dialog,{open:t,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:u.jsx(Fx,{...C,children:u.jsxs(g.Box,{component:"form",noValidate:!0,onSubmit:ce(Be),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[P&&u.jsxs(g.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:[u.jsxs(g.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[u.jsx(g.Typography,{fontWeight:700,fontSize:20,children:r.title}),u.jsxs(g.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[u.jsx(g.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:r.subTitle}),u.jsx(g.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((O,ne)=>u.jsx(g.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:O.map((we,Oe)=>{const R=typeof we=="string"?{name:we}:we;return R.hidden?.(C)?null:pt(R.name,R.grid)})},`row-${ne}`)):u.jsx(g.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((O,ne)=>{const we=O.grid??{xs:12,md:12};return u.jsx(g.Grid,{item:!0,...we,children:O.render?O.render(C):e0(O,C)},`${String(O.name)}-${ne}`)})})})]})]}),u.jsx(g.Box,{sx:{position:"absolute",zIndex:O=>O.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:u.jsx(g.Box,{display:"flex",alignItems:"center",children:u.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:u.jsx(g.Button,{type:"submit",variant:"contained",disabled:fe||!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&&u.jsx(g.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:u.jsx(g.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[u.jsxs(g.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:[u.jsx(g.TextField,{value:E,onChange:O=>S(O.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:u.jsx(g.InputAdornment,{position:"start",children:u.jsx(A2,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),u.jsx(g.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:u.jsx(g.Box,{onClick:s,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:u.jsx(Vr,{sx:{color:"#070C10",fontSize:24}})})}),w=="onlyCars"&&u.jsx(g.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:u.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",children:u.jsxs(g.Button,{type:"submit",variant:"contained",disabled:fe||!se,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:"100%"},children:[u.jsx(Zh,{sx:{color:fe||!se?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),u.jsx(g.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:u.jsx(g.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:u.jsxs(g.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ie?.map((O,ne)=>{const we=f?f(O):ne,Oe=Ne(we);return u.jsx(g.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:u.jsx(g.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:u.jsx(g.ListItemButton,{onClick:()=>Ze(we),disableRipple:!0,sx:{padding:0},children:u.jsx(g.ListItemText,{disableTypography:!0,primary:h?h({item:O,selected:Oe,toggle:()=>Ze(we),index:ne}):null})})})},`${String(we)}`)}),!ie?.length&&u.jsx(g.Box,{p:3,children:u.jsxs(g.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",E,"”."]})})]})})}),u.jsx(g.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:u.jsx(T3,{currentPage:pe,totalPages:ee,onPageChange:Fe,itemsPerPage:Re,onItemsPerPageChange:qe,itemsPerPageOptions:j,showingFrom:le,showingTo:ge,totalItems:de})})]})})})]})})})}var ms={},n0;function A3(){if(n0)return ms;n0=1;var e=at();Object.defineProperty(ms,"__esModule",{value:!0}),ms.default=void 0;var t=e(ht()),r=ut();return ms.default=(0,t.default)((0,r.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"),ms}var M3=A3();const P3=it(M3),sl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,ta=/[,\s;]+/g,un=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),dn=(e,t)=>Array.from(new Set([...e,...t.map(r=>r.trim()).filter(Boolean)])),o0=(e,t)=>t?e.filter(r=>un(r)!==un(t)):e,O3=(e,t)=>e.filter(r=>!t.some(n=>un(n)===un(r)));function Pr(e,t,r){if(r)return typeof r=="function"?r(e,t):e[r]}function j3(e,t){if(t)return!e||/^https?:\/\//i.test(t)?t:e+t}function R3({open:e,onClose:t,value:r,onChange:n,onRequestSend:o,customer:s,itemsSelects:i,renderItem:a,filterFields:c=[],multiSelectAutos:l=!0,imgCorreoSrc:d,baseURLImages:f,itemProps:h,defaultItemImageSrc:v}){const m=y.useRef(null),[p,b]=y.useState("idle"),w=y.useRef(e);y.useEffect(()=>{const R=w.current;e&&!R&&b("entering"),!e&&R&&b("exiting"),w.current=e},[e]),y.useEffect(()=>{if(p==="entering"){const xe=setTimeout(()=>b("idle"),320);return()=>clearTimeout(xe)}if(p==="exiting"){const xe=setTimeout(()=>b("idle"),220);return()=>clearTimeout(xe)}},[p]);const[C,E]=y.useState(""),[S,x]=y.useState(!1),[U,D]=y.useState(!1),[T,M]=y.useState(!1),[A,W]=y.useState(""),[G,F]=y.useState([]),Y=T?G:r.selectedIds,oe=()=>{F([...r.selectedIds]),W(""),M(!0)},H=()=>{M(!1),F([])},N=()=>{const R=new Set(vt.map((xe,Ge)=>String(Pr(xe,Ge,h.id)))),te=G.filter(xe=>R.has(String(xe)));n({...r,selectedIds:te}),M(!1)},ce=(R,te)=>un(R??"")===un(te??"");function fe(R,te,xe,Ge,q){const ae=te?R.some(Ie=>ce(Ie,te)):!1,Ee=xe.length>0?xe.some(Ie=>R.some(He=>ce(He,Ie))):!1;Ge(ae),q(Ee)}const $=R=>{const te=typeof R=="function"?R(r.recipients):R;n({...r,recipients:te}),fe(te,ie,le,x,D)},Q=R=>n({...r,message:R}),Ce=R=>n({...r,attachments:[...r.attachments,...R]}),me=R=>n({...r,attachments:r.attachments.filter(te=>te.name!==R)}),Se=R=>{if(T)if(l){const te=new Set(G);te.has(R)?te.delete(R):te.add(R),F(Array.from(te))}else{const te=G.includes(R);F(te?[]:[R])}else if(l){const te=new Set(r.selectedIds);te.has(R)?te.delete(R):te.add(R),n({...r,selectedIds:Array.from(te)})}else{const te=r.selectedIds.includes(R);n({...r,selectedIds:te?[]:[R]})}},ie=y.useMemo(()=>(s?.Correo??"").trim(),[s]),ee=y.useMemo(()=>Array.isArray(s?.Asesores)?s.Asesores.filter(R=>R?.EmailAsesor&&R?.Activo):[],[s]),le=y.useMemo(()=>ee.map(R=>(R.EmailAsesor??"").trim()).filter(Boolean),[ee]),ge=y.useRef(!1);y.useEffect(()=>{if(e&&!ge.current){let R=[];S&&ie&&(R=dn(R,[ie])),U&&le.length&&(R=dn(R,le)),$(te=>dn(te,R)),fe(r.recipients,ie,le,x,D),E(""),ge.current=!0}e||(ge.current=!1)},[e,S,U,ie,le]);const de=R=>{const te=ee.find(xe=>un(xe.EmailAsesor??"")===un(R));if(te){if(te.ImgAsesor)return u.jsx(g.Avatar,{src:te.ImgAsesor,alt:te.NombreAsesor});const xe=(te.NombreAsesor||"").trim(),Ge=(te.ApellidosAsesor||"").trim();return u.jsx(g.Avatar,{children:`${xe[0]??""}${Ge[0]??""}`.toUpperCase()})}return u.jsx(g.Avatar,{children:R[0]?.toUpperCase()})},pe=()=>{const R=C.trim();if(!R)return;const xe=R.split(ta).filter(Boolean).filter(Ge=>sl.test(Ge));xe.length>0&&$(Ge=>dn(Ge,xe)),E("")},Re=R=>{x(R),$(te=>R&&ie?dn(te,[ie]):o0(te,ie))},j=R=>{D(R),$(te=>R?dn(te,le):O3(te,le))},Fe=R=>{const te=Array.from(R.target.files||[]);Ce(te.map(xe=>({name:xe.name,size:xe.size,file:xe}))),R.target.value=""},qe=Y[0],Ze=y.useMemo(()=>!i||qe===void 0?void 0:i.find((te,xe)=>String(Pr(te,xe,h.id))===String(qe)),[i,qe,h.id]),Ne=y.useMemo(()=>{if(!(!Ze||!h.distributorId))return Pr(Ze,0,h.distributorId)},[Ze,h.distributorId]);console.log("lockedDisId",Ne);const Be=y.useMemo(()=>Ze?(h.distributorTitle?Pr(Ze,0,h.distributorTitle):void 0)??(Ne!=null?String(Ne):void 0):void 0,[Ze,h.distributorTitle,Ne]),vt=y.useMemo(()=>{const R=i??[];return Ne==null||!h.distributorId?R:R.filter((te,xe)=>Pr(te,xe,h.distributorId)==Ne)},[i,Ne,h.distributorId]),pt=y.useMemo(()=>{if(!A.trim())return vt;const R=A.toLowerCase();return vt.filter(te=>(c??[]).some(xe=>String(te?.[xe]??"").toLowerCase().includes(R)))},[vt,A,c]),k=y.useMemo(()=>{if(!i||!r.selectedIds.length)return[];const R=new Map;return i.forEach((te,xe)=>{R.set(String(Pr(te,xe,h.id)),te)}),r.selectedIds.map(te=>R.get(String(te))).filter(Boolean)},[i,r.selectedIds,h.id]),P=R=>n({...r,selectedIds:r.selectedIds.filter(te=>String(te)!==String(R))}),B=()=>{let R=r.recipients;if(C.trim()){const ae=C.split(ta).filter(Ee=>sl.test(Ee));R=dn(R,ae),$(R),E("")}const te=S?ie:"",xe=ee.find(ae=>ae?.Activo&&ae?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:R,toClient:S,toAdvisor:U,tipoInt:S&&U?2:1,correoCliente:te,correoAsesor:U?xe:"",disIdLocked:Ne}),t?.()},ue=y.useMemo(()=>{const te=C.split(ta).filter(Boolean).some(xe=>sl.test(xe));return r.recipients.length>0||te},[r.recipients,C]),se=(r.selectedIds?.length??0)>0,O=r.message.trim().length>0,ne=ue&&se&&O,we=g.useTheme(),Oe=g.useMediaQuery(we.breakpoints.down("sm"));return u.jsxs(g.Drawer,{anchor:Oe?"bottom":"right",open:e,onClose:t,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!Oe}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:Oe?"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:[u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[u.jsxs(g.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[d?u.jsx("img",{src:d,alt:"Correo",style:{width:24,height:18}}):null,u.jsxs(g.Typography,{fontWeight:700,children:["Mensaje a"," ",s?`${s.Nombre??""} ${s.ApellidoP??""} ${s.ApellidoM??""}`.trim():"—"]})]}),u.jsx(g.IconButton,{onClick:t,size:"small",children:u.jsx(Vr,{})})]}),u.jsx("div",{children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[u.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[r.recipients.map(R=>u.jsx(g.Chip,{avatar:de(R),label:R,onDelete:()=>$(te=>o0(te,R)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},R)),u.jsx("input",{type:"text",value:C,onChange:R=>E(R.target.value),onKeyDown:R=>{const te=R.key;te==="Enter"||te===","||te===";"||te===" "||te==="Tab"?(R.preventDefault(),pe()):te==="Backspace"&&!C&&r.recipients.length&&$(Ge=>Ge.slice(0,-1))},onBlur:pe,onPaste:R=>{const xe=R.clipboardData.getData("text").split(ta).filter(Boolean);xe.length>1&&(R.preventDefault(),$(Ge=>dn(Ge,xe)),E(""))},placeholder:r.recipients.length?"":"correo@ejemplo.com",style:{flex:1,minWidth:140,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#111827",padding:"4px 0"}})]})]})}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[u.jsx(g.FormControlLabel,{control:u.jsx(g.Checkbox,{checked:S,onChange:R=>Re(R.target.checked),size:"small"}),label:"Cliente"}),ee.length!==0&&u.jsx(g.FormControlLabel,{control:u.jsx(g.Checkbox,{checked:U,onChange:R=>j(R.target.checked),size:"small"}),label:`Asesor${ee.length>1?"es":""}`})]})]}),u.jsx(g.Divider,{}),u.jsxs(g.Box,{p:2,children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:oe,children:[u.jsx(g.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),Be!=null&&u.jsx(g.Chip,{size:"small",label:`Distribuidora: ${Be}`})]}),k.length>0?u.jsx(g.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:k.map((R,te)=>{const xe=Pr(R,te,h.id),Ge=Pr(R,te,h.title)??"",q=Pr(R,te,h.image),ae=j3(f,q);return u.jsx(g.Chip,{onDelete:()=>P(xe),label:u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.jsx(g.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:ae?u.jsx("img",{src:ae,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}}):u.jsx("img",{src:v,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}})}),u.jsx("span",{style:{fontSize:12},children:u.jsx("b",{children:Ge})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(xe))})}):u.jsx(g.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),u.jsx(g.Divider,{}),u.jsxs(g.Box,{sx:{p:2},children:[u.jsx(g.TextField,{placeholder:"Escribe aquí tu mensaje...",value:r.message,onChange:R=>Q(R.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),r.attachments.length>0&&u.jsx(g.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:r.attachments.map(R=>u.jsxs(g.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[u.jsx(g.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"}}),u.jsx(g.Tooltip,{title:"Quitar",children:u.jsx(g.IconButton,{edge:"end",onClick:()=>me(R.name),size:"small",children:u.jsx(Vr,{fontSize:"small"})})})]},R.name))})]}),u.jsxs(g.Box,{sx:{position:{xs:"sticky",sm:"sticky"},bottom:0,bgcolor:"#fff",borderTop:"1px solid #E5E7EB",p:2,display:"flex",alignItems:"center",gap:2},children:[u.jsx("input",{ref:m,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:Fe}),u.jsx(g.Button,{startIcon:u.jsx(P3,{}),variant:"text",onClick:()=>m.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),u.jsx(g.Box,{sx:{flex:1}}),u.jsx(g.Button,{variant:"contained",onClick:B,disabled:!ne,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),u.jsxs(g.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:Oe,open:T,onClose:H,children:[u.jsxs(g.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",u.jsx(g.IconButton,{onClick:H,size:"small",children:u.jsx(Vr,{})})]}),u.jsxs(g.DialogContent,{children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.jsx(g.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:A,onChange:R=>W(R.target.value),sx:{mb:2}}),Be!=null&&u.jsx(g.Chip,{size:"small",label:`Distribuidora: ${Be}`})]}),u.jsxs(g.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",pt.length,")"]}),u.jsxs(g.List,{sx:{p:0},children:[pt.map((R,te)=>{const xe=Pr(R,te,h.id),Ge=Y.includes(String(xe))||Y.includes(xe),q=Ne==null||Pr(R,te,h.distributorId)==Ne;return u.jsx(g.ListItem,{disableGutters:!0,sx:{p:0,opacity:q?1:.5},children:u.jsx(g.Box,{onClick:()=>q&&Se(xe),sx:{cursor:q?"pointer":"not-allowed",p:.5,backgroundColor:Ge?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(R,te):u.jsx("pre",{style:{margin:0},children:JSON.stringify(R,null,2)})})},String(xe))}),pt.length===0&&u.jsx(g.Box,{p:2,children:u.jsx(g.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),u.jsxs(g.DialogActions,{sx:{px:3,pb:2},children:[u.jsx(g.Button,{variant:"text",onClick:H,sx:{color:"#5C6372"},children:"Cancelar"}),u.jsx(g.Button,{variant:"contained",onClick:N,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}Ot.AddCliente=I3,Ot.ApiProvider=T_,Ot.AuthProvider=n1,Ot.Clientes=d3,Ot.CustomSnackbar=$h,Ot.EventsProvider=gk,Ot.ModalCorreo=R3,Ot.MyCalendar=Sk,Ot.useAuth=ac,Ot.useAuthRepository=Ti,Ot.useEventRepository=Dc,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})}));
180
+ `)}const i3={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"]},a3={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"]},c3={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function l3(e,t){switch(e){case"pruebas":return r3(t)??"—";case"servicio":return n3(t)??"—";case"nuevos":case"seminuevos":default:return t3(t)??"—"}}function u3({open:e,onClose:t,customer:r,fields:n=[],header:o,extraSections:s,normalTable:i,normalTableColumns:a=[],history:c=[],advisorHistory:l=[],onRequestEdit:d,searchFilter:f,urlsQA:h,solicitudesNuevos:v=[],solicitudesPrueba:m=[],solicitudesServicio:p=[],solicitudesSeminuevos:b=[],onCreateSolicitud:w,isCrmMode:C=!1,onSolicitudBaseUrl:E,onIframeClose:S,reloadInfo:x,idAdminSistemas:U}){if(!r)return null;const D=3,[T,M]=y.useState(null),A=!!T,[W,G]=y.useState(!1),[F,Y]=y.useState(null),[oe,H]=y.useState(c??[]),[N,ce]=y.useState(null),fe=y.useMemo(()=>[...l].sort((L,X)=>new Date(X.FechaAsignacion).getTime()-new Date(L.FechaAsignacion).getTime()),[l]);y.useEffect(()=>{c&&c.length&&H(c)},[c]);const $=c?.length?c:oe,Q=o?.title??(L=>L?.Nombre||L?.name||"Sin título"),Ce=o?.infoItems??[],me=L=>L.nombreAsesor?.trim()||(L.Email?L.Email:"Sistema"),Se=L=>{const X=L||"",_e=X.split(" ").filter(Boolean);return _e.length>=2?(_e[0][0]+_e[1][0]).toUpperCase():(X[0]||"?").toUpperCase()},ie=L=>L?.SolID??L?.solID??L?.SolId??L?.SOLID??null,ee=y.useMemo(()=>{const L=$??[];return Array.isArray(L?.[0])?L.flat():L},[$]),le=y.useMemo(()=>{const L=ee;return!N||F==null?L:L.filter(X=>{const _e=ie(X);return _e!=null&&String(_e)===String(F)})},[ee,N,F]),ge=y.useMemo(()=>[...le].sort((L,X)=>new Date(X.fecAlta).getTime()-new Date(L.fecAlta).getTime()),[le]),[de,pe]=y.useState(!1),Re=y.useMemo(()=>de?ge:ge.slice(0,D),[de,ge]),j=Math.max(ge.length-D,0),Fe=L=>String(L??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),qe=(L,X)=>Fe(JSON.stringify(L)).includes(Fe(X)),Ze=(L,X)=>f?f(L,X):qe(L,X),Ne=(L,X)=>{const _e=Fe(X).split(/\s+/).filter(Boolean);return _e.length?_e.every(Ae=>Ze(L,Ae)):!0},[Be,vt]=y.useState(""),[pt,k]=y.useState([]);y.useMemo(()=>i??[],[i]),y.useMemo(()=>{const L=Be.trim();return L?(i??[]).filter(X=>Ne(X,L)):i??[]},[i,Be]);const P=g.useTheme(),B=g.useMediaQuery(P.breakpoints.down("md")),[ue,se]=y.useState(""),[O,ne]=y.useState(!0),[we,Oe]=y.useState(!1),R=new Date().toISOString().slice(0,10),te=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[xe,Ge]=y.useState(te),[q,ae]=y.useState(R),[Ee,Ie]=y.useState(null),He=!!Ee,[J,Me]=y.useState("En Proceso"),[ke,je]=y.useState("Todos"),[Yt,Kt]=y.useState("Todos"),qt=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],Yr=["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"],Ke=()=>{se(""),ne(!1),Oe(!1),Ge(te),ae(R),Me("Todos"),je("Todos"),Kt("Todos")},Sr=y.useMemo(()=>(ue??"").trim()!==""||J!=="Todos"||ke!=="Todos"||O||we||Yt!=="Todos",[ue,J,ke,O,we,Yt]);function Tn(L){if(!L)return"";const X=new Date(L);if(isNaN(X.getTime()))return"";const _e=String(X.getDate()).padStart(2,"0"),Ae=String(X.getMonth()+1).padStart(2,"0"),Tt=String(X.getFullYear()).slice(-2);return`${_e}/${Ae}/${Tt}`}function ra(L){const X=L?new Date(L):null;return X&&!isNaN(X.getTime())?X:null}function il(L,X){let _e=null;for(const Ae of L){const Tt=ra(X(Ae));if(Tt){const St=Tt.getTime();(_e===null||St>_e)&&(_e=St)}}return _e?new Date(_e):null}function gs(L){const X=il(L,_e=>_e.UltimoSeguimiento||_e.FechaCita);return X?Tn(X.toISOString()):"—"}function vs(L){const X=(L??"").toLowerCase().trim();return X==="sin venta"||X==="con venta"||X==="rechazada"||X==="rechazadas"}function na(L){return L.filter(X=>vs(X.EstatusDescripcion)).length}function oa(L){return L.filter(X=>!vs(X.EstatusDescripcion)).length}const al=({progress:L,color:X})=>{if(!L)return u.jsx(rl,{current:0,total:0,color:X});const _e=L.split("/").map(Number);if(_e.length!==2||_e.some(St=>Number.isNaN(St)))return u.jsx(rl,{current:0,total:0,color:X});const[Ae,Tt]=_e;return u.jsx(rl,{current:Ae,total:Tt,color:X})};function sa(L){return[{key:"fecha",header:"Fecha",accessor:X=>Tn(X.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:X=>u.jsx(g.Tooltip,{title:X.Vehiculo??"",placement:"top",arrow:!0,children:u.jsx(g.Typography,{component:"span",sx:{fontSize:13,fontWeight:500,display:"block",maxWidth:260,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:"default"},children:X.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:X=>u.jsx(g.Typography,{sx:{fontWeight:800,fontSize:13},children:l3(L,X.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:X=>{const{bg:_e,color:Ae}=e3(X.NivelInteres);return u.jsx(g.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:_e,color:Ae,fontSize:12,fontWeight:X.NivelInteres?800:500},children:X.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:X=>{const _e=(X.Asesor??"").trim(),Ae=cl=>{if(!cl)return"";const $3=cl[0]?.toUpperCase()??"",L3=cl[1]?.toLowerCase()??"";return`${$3}${L3}`};if(!_e)return u.jsx(g.Tooltip,{title:"",placement:"top",children:u.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const Tt=_e.split(/\s+/),St=Tt[0]??"",Or=Tt[1]??"",Cr=Ae(St),In=Ae(Or),N3=`${Cr}${In}`||"—";return u.jsx(g.Tooltip,{title:_e,placement:"top",children:u.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:N3})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:X=>X.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:X=>u.jsx(g.Tooltip,{title:X.Actividad??"",placement:"top",arrow:!0,children:u.jsxs(g.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[X.Icon&&u.jsx("span",{style:{color:"#fff",backgroundColor:X.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:u.jsx("i",{className:X.Icon})}),u.jsx(g.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(X.Actividad??"").length?"default":"inherit"},children:X.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:X=>u.jsx(al,{progress:X.Avance,color:X.Color}),width:200,align:"left"}]}function I(L){const _e=sa(L).slice(1);return[{key:"fecha",header:"Fecha",accessor:Ae=>Tn(Ae.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Ae=>Tn(Ae.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Ae=>Ae.HoraCita??"—",width:110},..._e]}function re(L){const X=L.kind;switch(X){case"pruebas":case"servicio":return I(X);case"nuevos":case"seminuevos":default:return sa(X)}}function ye(L,X,_e,Ae){return{id:L,kind:_e,title:X,metrics:[{label:"En Proceso",value:oa(Ae)},{label:"Finalizadas",value:na(Ae)},{label:"Último seg.",value:gs(Ae)}],rows:Ae,initiallyOpen:!1}}const Pe=[ye("n-1","Cotización de nuevos","nuevos",v),ye("p-1","Prueba de Manejo","pruebas",m),ye("s-1","Cita de Servicio","servicio",p),ye("sn-1","Cotización para Seminuevos","seminuevos",b)],Qe=y.useMemo(()=>{const L=(ue??"").trim().toLowerCase(),X=(_e,Ae)=>{if(L&&!(_e.Vehiculo??"").toLowerCase().includes(L))return!1;const Tt=we?_e.FechaCita:_e.Fecha;if(O&&Tt){const St=ra(Tt??"");if(!St)return!1;const Or=xe?new Date(`${xe}T00:00:00`):null,Cr=q?new Date(`${q}T00:00:00`):null;if(Cr&&Cr.setDate(Cr.getDate()+1),Or&&St<Or||Cr&&St>=Cr)return!1}if(J!=="Todos"){const St=(_e.EstatusDescripcion??"").toLowerCase();if(!(i3[J]??[]).some(In=>St===In.toLowerCase()))return!1}if(ke!=="Todos"){const St=(_e.Actividad??"").toLowerCase();if(!(a3[ke]??[]).some(In=>St===In.toLowerCase()))return!1}if(Yt!=="Todos"){const St=(_e.NivelInteres??"").toLowerCase();if(!(c3[Yt]??[]).some(In=>St===In.toLowerCase()))return!1}return!0};return Pe.map(_e=>{const Ae=(_e.rows??[]).filter(St=>X(St,_e.kind)),Tt=[{label:"En Proceso",value:oa(Ae)},{label:"Finalizadas",value:na(Ae)},{label:"Último seg.",value:gs(Ae)}];return{..._e,rows:Ae,metrics:Tt}})},[Pe,ue,O,xe,q,we,J,ke,Yt]),lt={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},Ye=(L,X)=>{const _e=L.SolID;if(!_e)return;const Ae=X.kind,Tt=lt[Ae]??"cotizaciones",St=h?`https://qa2.crm.netcar.com.mx/netcar/${Tt}/${_e}`:`https://crmxs.netcar.com.mx/netcar/${Tt}/${_e}`,Or=E?.({row:L,section:X,slug:Tt,solId:_e,baseUrl:St});if(!C){const Cr=Or??St;Y(_e),ce(Cr),G(!0)}},Ue=()=>{S?.(r),Y(null),ce(null),G(!1)},Vt=y.useRef(!1),mt=y.useRef(null),Pt=y.useCallback(()=>{if(!Vt.current){Vt.current=!0;return}mt.current&&window.clearTimeout(mt.current),mt.current=window.setTimeout(()=>{x?.(r)},500)},[x,r]);return y.useEffect(()=>{Vt.current=!1,mt.current&&window.clearTimeout(mt.current)},[N,F]),u.jsx(g.Dialog,{open:e,onClose:t,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:u.jsxs(g.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[u.jsxs(g.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:[u.jsxs(g.Box,{children:[u.jsx(g.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:u.jsxs(g.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[u.jsx(g.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:u.jsx(g.Box,{sx:{flex:1,minWidth:0,pr:1},children:u.jsxs(g.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[Q(r)," ",u.jsx(g.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{t?.(),r&&d?.(r)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:u.jsx(Qk,{sx:{fontSize:"1em"}})})]})})}),Ce.map((L,X)=>u.jsxs(g.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:L.onClick?"pointer":"default"},onClick:()=>{L.onClick&&L.onClick(r)},children:[L.icon,u.jsx(g.Typography,{variant:"body2",sx:{color:L.inLink?"#336BE1":"#070C10"},style:{},children:L.value(r)})]},X))]})}),u.jsx(g.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((L,X)=>{const _e=L.label?.toLowerCase().startsWith("asesor");return u.jsxs(g.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[u.jsx(g.Box,{sx:{width:"50%"},children:u.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:L.label})}),u.jsxs(g.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[u.jsx("div",{children:L?.avatar?L.avatar(r):null}),u.jsx(g.Typography,{variant:"body2",color:"textPrimary",children:L?.value(r)}),_e&&!U&&u.jsx(g.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:u.jsx(g.IconButton,{size:"small",onClick:Ae=>M(Ae.currentTarget),sx:{ml:.5},disableRipple:!0,children:u.jsx(Wk,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},X)})}),u.jsx(g.Divider,{sx:{my:2}})]}),u.jsx(g.Box,{px:2.5,pb:.5,children:u.jsxs(g.Typography,{children:[u.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!N&&" por solicitud",":"]})}),u.jsxs(g.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:[Re.length===0&&u.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),u.jsxs(g.Box,{children:[Re?.map((L,X)=>{const _e=me(L),Ae=s3(L.comentario||"");return u.jsxs(g.Box,{sx:{pb:1.5},children:[u.jsxs(g.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[u.jsx(g.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:L.tipo||"Evento"}),u.jsx(g.Chip,{size:"small",label:L.auto!=null?`${L.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Ae?u.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Ae}):null,u.jsxs(g.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[L?.ImgAsesor!=null?u.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:Se(_e),src:L?.ImgAsesor}):u.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:Se(_e)}),u.jsxs(g.Stack,{spacing:0,children:[u.jsx(g.Typography,{variant:"body2",fontWeight:600,children:_e}),u.jsx(g.Typography,{variant:"caption",color:"text.secondary",children:o3(L.fecAlta)})]})]}),X<Re.length-1&&u.jsx(g.Divider,{sx:{mt:1.25}})]},L.segID??X)}),ge.length>D&&u.jsx(g.Box,{sx:{mt:1},children:u.jsx(g.Button,{onClick:()=>pe(L=>!L),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:de?"Ver menos":`Ver más (${j})`})})]})]}),u.jsx(g.Menu,{anchorEl:T,open:A,onClose:()=>M(null),TransitionComponent:g.Fade,MenuListProps:{disablePadding:!0},PaperProps:{sx:{width:320,p:0,overflow:"hidden"}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[u.jsx(g.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"}),u.jsxs(g.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[fe.length===0&&u.jsx(g.Box,{sx:{px:1.5,py:1},children:u.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),fe.map((L,X)=>{const _e=qk(L),Ae=Yk(L.FechaBaja??L.FechaAsignacion);return u.jsx(g.Box,{sx:{px:1,py:.75},children:u.jsxs(g.Stack,{direction:"row",alignItems:"center",spacing:1,children:[u.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:L?.ImgAsesor??void 0,children:Zk(_e)}),u.jsx(g.Box,{sx:{flex:1,minWidth:0},children:u.jsx(g.Typography,{variant:"body2",noWrap:!0,children:_e})}),u.jsx(g.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Ae})]})},X)})]})]})})]}),W?u.jsxs(g.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[u.jsx(g.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:u.jsx(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:u.jsx(g.Button,{onClick:Ue,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:u.jsx(Kc,{fontSize:"medium"})})})}),N&&u.jsx("iframe",{src:N,width:"100%",height:"100%",onLoad:Pt,style:{border:0}})]}):u.jsxs(g.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[u.jsx(g.Box,{sx:{mt:{xs:1.5,md:3}},children:u.jsxs(g.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[u.jsx(g.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),u.jsxs(g.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[u.jsxs(g.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[u.jsx(g.TextField,{size:"small",placeholder:"Buscar por vehículo",value:ue,onChange:L=>se(L.target.value),InputProps:{endAdornment:u.jsx(jk,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[u.jsxs(g.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[u.jsx(g.FormControlLabel,{label:u.jsx(g.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:u.jsx(g.Checkbox,{checked:O,onChange:L=>ne(L.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),u.jsx(g.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),u.jsxs(g.Stack,{direction:"row",spacing:1,children:[u.jsx(g.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:xe,onChange:L=>Ge(L.target.value),disabled:!O,sx:{width:170}}),u.jsx(g.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:q,onChange:L=>ae(L.target.value),disabled:!O,sx:{width:170}})]})]}),u.jsx(g.IconButton,{onClick:L=>Ie(L.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:u.jsx(Mk,{})}),Sr&&u.jsx(g.Button,{variant:"outlined",onClick:Ke,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),u.jsx(g.Tooltip,{title:Sr&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!Sr,children:u.jsx("span",{children:u.jsxs(g.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{w?.(r)},disableRipple:!0,children:[u.jsx(Zh,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!Sr&&"Crear Solicitud"]})})})]}),u.jsx(Uk,{sections:Qe,detailColumns:[],getDetailColumns:re,onRowClick:Ye})]})]})}),u.jsx(g.Menu,{anchorEl:Ee,open:He,onClose:()=>Ie(null),TransitionComponent:g.Fade,PaperProps:{sx:{p:1.5,width:260,borderRadius:2,boxShadow:3}},anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},children:u.jsxs(g.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[u.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),u.jsxs(g.Box,{children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),u.jsx(g.RadioGroup,{value:J,onChange:L=>Me(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=>u.jsx(g.FormControlLabel,{value:L,control:u.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),u.jsxs(g.Box,{children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),u.jsx(g.RadioGroup,{value:ke,onChange:(L,X)=>je(X),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Yr].map(L=>u.jsx(g.FormControlLabel,{value:L,sx:{alignItems:"start"},control:u.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),u.jsxs(g.Box,{children:[u.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),u.jsx(g.RadioGroup,{value:Yt,onChange:(L,X)=>Kt(X),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...qt].map(L=>u.jsx(g.FormControlLabel,{value:L,control:u.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]})]})})]})]})})}const Gh={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function Kh(e,t,r){const{fields:n,order:o=["nombreCliente","email","acciones"],header:s={},cells:i={},hide:a={},actions:c}=t,l=c??{},d=l.show??{},f=l.handlers??{},h=l.accessors??{},v=l.icons??{},m=l.className??"d-flex flex-row gap-2 align-items-center ",p=l.tooltip??{},b=v.view??u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[u.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"}),u.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),w={nombreCliente:{key:"nombreCliente",header:s.nombreCliente??"Cliente",accessor:A=>A[n.nombreCliente],cell:i.nombreCliente,width:190},email:{key:"email",header:s.email??"Correo",accessor:A=>A[n.email],cell:i.email??(A=>{const W=String(A[n.email]??"");return W?u.jsx("a",{href:`mailto:${W}`,children:W}):u.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:i.acciones??(A=>{const W=el(d.whatsapp,A,!0),G=el(d.email,A,!0),F=el(d.view,A,!0),Y=h.phone?.(A),oe=h.email?.(A),H=fe=>{if(fe.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(A);if(!Y)return;const $=h.countryCode??"52",Q=kk(String(Y));typeof window<"u"&&window.open(`https://wa.me/${$}${Q}`,"_blank")},N=fe=>{if(fe.stopPropagation(),f.onEmail)return f.onEmail(A);oe&&typeof window<"u"&&(window.location.href=`mailto:${oe}`)},ce=fe=>{fe.stopPropagation(),f.onView&&f.onView(A)};return u.jsxs("div",{className:m,children:[W&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:H,style:{width:24,height:24},children:u.jsx("img",{src:Ck,alt:"WhatsApp"})}),G&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:N,style:{width:24,height:24},children:u.jsx("img",{src:Ek,alt:"Email"})}),F&&u.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:ce,style:{width:24,height:24},children:b})]})}),width:120}},C=Object.values(w).filter(A=>!!A),E=(e??[]).filter(A=>!!A?.key),S=new Map;for(const A of C)S.set(String(A.key),A);for(const A of E)S.set(String(A.key),A);const x=[...C.map(A=>String(A.key)),...E.map(A=>String(A.key))],U=Array.from(new Set(o.map(A=>String(A)).filter(A=>S.has(A)))),D=x.filter(A=>!U.includes(A)),T=[...U,...D],M="acciones";if(S.has(M)){const A=T.filter(W=>W!==M);T.splice(0,T.length,...A,M)}return T.map(A=>S.get(A))}function d3(e){const{rows:t,columns:r,clientSort:n=!0,urlsQA:o=!0,defaultSort:s,minWidth:i=1100,rowKey:a=Tk,haveOpenDetailFor:c=!0,defaults:l,detailConfig:d,normalTable:f,onRowClick:h,activityHistory:v,advisorHistory:m,forceOpenDetailFor:p,closeDetailFor:b,onRequestEdit:w,searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:x,solicitudesSeminuevos:U,onCreateSolicitud:D,isCrmMode:T,onSolicitudBaseUrl:M,onIframeClose:A,reloadInfo:W,idAdminSistemas:G=!1}=e,[F,Y]=y.useState(s??null),[oe,H]=y.useState({open:!1,customer:null}),[N,ce]=y.useState([]),fe=ie=>{H({open:!0,customer:ie})},$=ie=>{c&&(h?.(ie),H({open:!0,customer:ie}))},Q=()=>{H({open:!1,customer:null}),b?.()},Ce=y.useMemo(()=>l?Kh(r??[],l):Kh(r??[],{fields:{},order:[]}),[r,l]),me=y.useMemo(()=>{if(!n||!F)return t;const ie=Ce.find(le=>le.key===F.key);if(!ie)return t;const ee=[...t];return ee.sort((le,ge)=>{const de=Jc(ie,le,0),pe=Jc(ie,ge,0),Re=Dk(de,pe);return F.direction==="asc"?Re:-Re}),ee},[t,Ce,F,n]),Se=y.useMemo(()=>{const ie=d?.getCustomerId;return ee=>{const le=ie?.(ee)??ee?.Id_cliente??ee?.CliID??ee?.id??ee?.ID??ee?.Id??"";return String(le)}},[d]);return y.useEffect(()=>{if(!oe.open||!oe.customer)return;const ie=Se(oe.customer);if(!ie)return;const ee=(t??[]).find(le=>Se(le)===ie);ee&&ee!==oe.customer&&H(le=>({...le,customer:ee}))},[t,oe.open,oe.customer,Se]),y.useEffect(()=>{p&&fe(p)},[p]),u.jsxs("div",{children:[u.jsx("div",{className:`${Gh.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:u.jsx("div",{className:`${Gh.tableResponsive} table-responsive`,children:u.jsxs("table",{className:"table table-hover align-middle mb-0",children:[u.jsx("thead",{children:u.jsx("tr",{children:Ce.map(ie=>u.jsx("th",{style:{fontWeight:600,width:ie.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ie.align??"left"},children:ie.header},ie.key))})}),u.jsx("tbody",{children:me.map((ie,ee)=>u.jsx("tr",{onClick:()=>$?.(ie),role:"button",tabIndex:0,onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&$?.(ie)},style:{cursor:"pointer"},children:Ce.map((le,ge)=>{const de=le.Component?u.jsx(le.Component,{row:ie,index:ee}):le.cell?le.cell(ie,ee):(()=>{const pe=Jc(le,ie,ee);return pe==null||pe===""?"":String(pe)})();return u.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:le.align??"left"},children:de},`${String(le.key)}-${ge}`)})},a(ie,ee)))})]})})}),oe.open&&u.jsx(u3,{open:oe.open,onClose:Q,customer:oe.customer,fields:d?.dynamicFields,header:d?.header,normalTable:f,history:v,advisorHistory:m,urlsQA:o,onRequestEdit:ie=>{Q(),w?.(ie)},searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:x,solicitudesSeminuevos:U,onCreateSolicitud:D,isCrmMode:T,onSolicitudBaseUrl:M,onIframeClose:A,reloadInfo:W,idAdminSistemas:G})]})}const Qh=K.forwardRef(({sx:e,...t},r)=>u.jsx(g.InputBase,{inputRef:r,...t,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}}));Qh.displayName="SoftInput";var fs={},Xh;function f3(){if(Xh)return fs;Xh=1;var e=at();Object.defineProperty(fs,"__esModule",{value:!0}),fs.default=void 0;var t=e(ht()),r=ut();return fs.default=(0,t.default)((0,r.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"),fs}var p3=f3();const h3=it(p3);function m3({message:e}){return e?u.jsxs(g.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:[u.jsx(h3,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),u.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function g3(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function nl(e,t){const r=g3(e);return r?t?.isArray?{required:r,validate:n=>Array.isArray(n)&&n.length>0||r}:{required:r,validate:n=>n!==""&&n!==null&&n!==void 0||r}:{}}const Jh={"& .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%"},v3={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function ol({label:e,errorMsg:t,helperText:r,children:n,sx:o}){return u.jsxs(g.FormControl,{fullWidth:!0,error:!!t,sx:o,className:"1- FieldWrapper",children:[u.jsx(g.FormLabel,{sx:v3,children:e}),n,u.jsx(m3,{message:t||r})]})}function y3(e,t){const{register:r,formState:{errors:n}}=t,o={...nl(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"]),l=S=>e.onlyNumbers?(S.match(a)??[]).join(""):e.onlyLetters?(S.match(i)??[]).join(""):S,d=(S,x)=>c.has(S)||x?!0:e.onlyNumbers?/^[0-9]$/.test(S):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(S):!0,f=n[e.name]?.message,h=r(e.name,o),v=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,m=S=>{d(S.key,S.ctrlKey||S.metaKey)||S.preventDefault()},p=S=>{const x=S.data??null;x!=null&&(e.onlyNumbers&&/[^0-9]/.test(x)&&S.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(x)&&S.preventDefault())},b=S=>{const x=S.clipboardData.getData("text"),U=l(x);if(U!==x){S.preventDefault();const D=S.target,T=D.selectionStart??D.value.length,M=D.selectionEnd??D.value.length;D.setRangeText(U,T,M,"end"),D.dispatchEvent(new Event("input",{bubbles:!0}))}},w=S=>{const x=l(S.target.value);x!==S.target.value&&(S.target.value=x),v&&S.target.value.length>v&&(S.target.value=S.target.value.slice(0,v)),h.onChange(S)},C={...e.inputProps,...s?{inputMode:"email",autoComplete:"email"}:{},maxLength:v,onKeyDown:m,onBeforeInput:p,onPaste:b,onInvalid:S=>S.preventDefault()},E=e.onlyNumbers||s?"text":e.type??"text";return u.jsx(ol,{label:e.label,errorMsg:f,helperText:e.helperText,sx:Jh,children:u.jsx(Qh,{placeholder:e.placeholder,type:E,inputProps:C,...h,onChange:w,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function b3(e,t){const{control:r}=t,n=!!e.multiple;return u.jsx(mr,{name:e.name,control:r,rules:nl(e,{isArray:n}),render:({field:o,fieldState:s})=>u.jsx(ol,{label:e.label,errorMsg:s.error?.message,helperText:e.helperText,sx:Jh,children:u.jsxs(g.Select,{...o,multiple:n,displayEmpty:!0,sx:{height:48,backgroundColor:"#EBEEF0","& .MuiSelect-select":{display:"flex",alignItems:"center",py:0}},className:"2-SoftInputData",children:[!n&&u.jsx(g.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(i=>u.jsx(g.MenuItem,{value:i.value,children:i.label},String(i.value)))]})})})}function _3(e,t){return u.jsx(mr,{name:e.name,control:t.control,rules:nl(e),render:({field:r,fieldState:n})=>u.jsx(ol,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:u.jsx(g.RadioGroup,{row:!0,...r,className:"3-RadioFieldRender",children:e.options.map(o=>u.jsx(g.FormControlLabel,{value:o.value,control:u.jsx(g.Radio,{}),label:o.label},String(o.value)))})})})}function e0(e,t){if(e.render)return e.render(t);switch(e.kind){case"text":return y3(e,t);case"select":return b3(e,t);case"radio":return _3(e,t);default:return null}}function x3(e,{initialPerPage:t=25,perPageOptions:r=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:s,deps:i=[]}={}){const a=Array.isArray(e)?e:[],[c,l]=y.useState(1),[d,f]=y.useState(t),{currentItems:h,totalPages:v,showingFrom:m,showingTo:p,totalItems:b}=y.useMemo(()=>{const E=a.length,S=d==="Todos"?1/0:Number(d),x=S===1/0?1:Math.max(1,Math.ceil(E/S)),U=Math.min(c,x),D=S===1/0?E:U*S,T=S===1/0?0:D-S;return{currentItems:S===1/0?a:a.slice(T,D),totalPages:x,showingFrom:E===0?0:T+1,showingTo:S===1/0?E:Math.min(D,E),totalItems:E}},[a,c,d]),w=E=>{const S=Math.max(1,Math.min(E,v||1));l(S),n?.(S),s?.()};return{currentItems:h,totalPages:v,showingFrom:m,showingTo:p,totalItems:b,currentPage:c,itemsPerPage:d,perPageOptions:r,goTo:w,next:()=>w(c+1),prev:()=>w(c-1),setItemsPerPage:E=>{f(E),o?.(E),l(1),s?.()},setCurrentPage:w}}var ps={},t0;function w3(){if(t0)return ps;t0=1;var e=at();Object.defineProperty(ps,"__esModule",{value:!0}),ps.default=void 0;var t=e(ht()),r=ut();return ps.default=(0,t.default)((0,r.jsx)("path",{d:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),ps}var S3=w3();const C3=it(S3);var hs={},r0;function E3(){if(r0)return hs;r0=1;var e=at();Object.defineProperty(hs,"__esModule",{value:!0}),hs.default=void 0;var t=e(ht()),r=ut();return hs.default=(0,t.default)((0,r.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"NavigateNext"),hs}var D3=E3();const k3=it(D3),T3=({currentPage:e,totalPages:t,onPageChange:r,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:s,showingFrom:i,showingTo:a,totalItems:c})=>{const l=g.useTheme(),d=g.useMediaQuery(l.breakpoints.down("sm")),f=()=>{if(t<=1)return[1];const m=d?0:2,p=[],b=1,w=t,C=Math.max(b+1,e-m),E=Math.min(w-1,e+m);p.push(b),C>b+1&&p.push("...");for(let S=C;S<=E;S++)S>=b+1&&S<=w-1&&p.push(S);return E<w-1&&p.push("..."),p.push(w),p},h=m=>{const p=m.target.value;o(p)},v=Math.max(1,t);return u.jsxs(g.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:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[u.jsx(g.IconButton,{onClick:()=>r(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:u.jsx(C3,{fontSize:"large"})}),f().map((m,p)=>m==="..."?u.jsx(g.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):u.jsx(g.Button,{onClick:()=>r(m),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===m?"primary.main":"transparent",fontWeight:e===m?700:400,color:e===m?"#fff":"#5C6372","&:hover":{backgroundColor:e===m?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:m},`p-${m}`)),u.jsx(g.IconButton,{onClick:()=>r(e+1),disabled:e>=v,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:u.jsx(k3,{fontSize:"large"})})]}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[u.jsx(g.Typography,{variant:"body2",children:"Mostrar"}),u.jsx(g.FormControl,{size:"small",sx:{minWidth:72},children:u.jsx(g.Select,{value:n,onChange:h,renderValue:m=>m==="Todos"?"Todos":String(m),children:s.map(m=>u.jsx(g.MenuItem,{value:m,children:m==="Todos"?"Todos":m},String(m)))})}),u.jsx(g.Typography,{variant:"body2",children:"por página"})]})]})};function I3(e){const{open:t,dataAdd:r,fields:n,onSubmit:o,onCancel:s,defaultValues:i,txtBtnGuardar:a,haveId:c=!1,itemsTable:l,filter:d,getId:f,renderRow:h,selectedIds:v,onSelectedChange:m,onSubmitAddData:p,initialSelectedIds:b=[],showAutosPanel:w}=e,C=Cp({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:i});y.useEffect(()=>{i&&C.reset(i)},[i,C]);const[E,S]=y.useState(""),[x,U]=y.useState(b),D=Array.isArray(v)&&!!m,T=D?v:x,M=O=>{const ne=typeof O=="function"?O(T):O;D?m(ne):U(ne)},A=y.useCallback(O=>f?f(O):O?.IdAuto,[f]),W=y.useMemo(()=>{const O=new Map;return(l??[]).forEach((ne,we)=>O.set(A(ne),we)),O},[l,A]),G=y.useRef(new Set),F=y.useMemo(()=>{const O=new Map;return(l??[]).forEach(ne=>O.set(f?f(ne):ne?.IdAuto,ne)),O},[l,f]),Y=y.useMemo(()=>(n??[]).filter(O=>!!O.required).map(O=>O.name),[n]),oe=ip({control:C.control,name:Y}),H=O=>O==null?!1:typeof O=="string"?O.trim().length>0:Array.isArray(O)?O.length>0:typeof O=="number"?!Number.isNaN(O):typeof O=="object"?Object.keys(O).length>0:!0,N=y.useMemo(()=>Y.length?oe?.every(H)??!1:!0,[oe,Y]),{handleSubmit:ce,formState:{isSubmitting:fe,isDirty:$,isValid:Q}}=C,Ce=d??((O,ne)=>JSON.stringify(O).toLowerCase().includes(ne.toLowerCase())),me=y.useMemo(()=>E.trim()?l?.filter(O=>Ce(O,E)):l,[l,E,Ce]),Se=y.useMemo(()=>{if(!me)return me;const O=G.current,ne=[...me];return ne.sort((we,Oe)=>{const R=O.has(A(we))?0:1,te=O.has(A(Oe))?0:1;if(R!==te)return R-te;const xe=W.get(A(we))??0,Ge=W.get(A(Oe))??0;return xe-Ge}),ne},[me,W,A]),{currentItems:ie,totalPages:ee,showingFrom:le,showingTo:ge,totalItems:de,currentPage:pe,itemsPerPage:Re,perPageOptions:j,goTo:Fe,setItemsPerPage:qe}=x3(Se,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[E],scrollTop:()=>{}}),Ze=O=>{const ne=F.get(O)??null;M([O]),p?.({items:ne})},Ne=O=>T.includes(O),Be=async O=>{try{await o?.(O),C.reset(C.getValues())}catch(ne){console.error("Error al enviar AddCliente:",ne)}},vt=y.useMemo(()=>{const O=new Map;return(n??[]).forEach(ne=>O.set(String(ne.name),ne)),O},[n]),pt=(O,ne)=>{const we=vt.get(String(O));if(!we)return null;const Oe={xs:12,...we.grid,...ne||{}};return u.jsx(g.Grid,{item:!0,...Oe,children:we.render?we.render(C):e0(we,C)},`fld-${String(O)}`)},k=w??(e.haveId?"edit":"new"),P=k!=="onlyCars",B=k==="new"||k==="onlyCars",ue=T?.length>0,se=k==="onlyCars"?ue:e.haveId?N&&$||ue:N&&ue;return u.jsx(g.Dialog,{open:t,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:u.jsx(Fx,{...C,children:u.jsxs(g.Box,{component:"form",noValidate:!0,onSubmit:ce(Be),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[P&&u.jsxs(g.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:[u.jsxs(g.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[u.jsx(g.Typography,{fontWeight:700,fontSize:20,children:r.title}),u.jsxs(g.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[u.jsx(g.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:r.subTitle}),u.jsx(g.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((O,ne)=>u.jsx(g.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:O.map((we,Oe)=>{const R=typeof we=="string"?{name:we}:we;return R.hidden?.(C)?null:pt(R.name,R.grid)})},`row-${ne}`)):u.jsx(g.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((O,ne)=>{const we=O.grid??{xs:12,md:12};return u.jsx(g.Grid,{item:!0,...we,children:O.render?O.render(C):e0(O,C)},`${String(O.name)}-${ne}`)})})})]})]}),u.jsx(g.Box,{sx:{position:"absolute",zIndex:O=>O.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:u.jsx(g.Box,{display:"flex",alignItems:"center",children:u.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:u.jsx(g.Button,{type:"submit",variant:"contained",disabled:fe||!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&&u.jsx(g.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:u.jsx(g.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[u.jsxs(g.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:[u.jsx(g.TextField,{value:E,onChange:O=>S(O.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:u.jsx(g.InputAdornment,{position:"start",children:u.jsx(A2,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),u.jsx(g.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:u.jsx(g.Box,{onClick:s,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:u.jsx(Vr,{sx:{color:"#070C10",fontSize:24}})})}),w=="onlyCars"&&u.jsx(g.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:u.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",children:u.jsxs(g.Button,{type:"submit",variant:"contained",disabled:fe||!se,sx:{backgroundColor:"#336BE1",color:"#fff",borderColor:"transparent",height:48,fontSize:15,textTransform:"none",fontWeight:"400",paddingX:5,width:"100%"},children:[u.jsx(Zh,{sx:{color:fe||!se?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),u.jsx(g.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:u.jsx(g.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:u.jsxs(g.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ie?.map((O,ne)=>{const we=f?f(O):ne,Oe=Ne(we);return u.jsx(g.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:u.jsx(g.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:u.jsx(g.ListItemButton,{onClick:()=>Ze(we),disableRipple:!0,sx:{padding:0},children:u.jsx(g.ListItemText,{disableTypography:!0,primary:h?h({item:O,selected:Oe,toggle:()=>Ze(we),index:ne}):null})})})},`${String(we)}`)}),!ie?.length&&u.jsx(g.Box,{p:3,children:u.jsxs(g.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",E,"”."]})})]})})}),u.jsx(g.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:u.jsx(T3,{currentPage:pe,totalPages:ee,onPageChange:Fe,itemsPerPage:Re,onItemsPerPageChange:qe,itemsPerPageOptions:j,showingFrom:le,showingTo:ge,totalItems:de})})]})})})]})})})}var ms={},n0;function A3(){if(n0)return ms;n0=1;var e=at();Object.defineProperty(ms,"__esModule",{value:!0}),ms.default=void 0;var t=e(ht()),r=ut();return ms.default=(0,t.default)((0,r.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"),ms}var M3=A3();const P3=it(M3),sl=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,ta=/[,\s;]+/g,un=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),dn=(e,t)=>Array.from(new Set([...e,...t.map(r=>r.trim()).filter(Boolean)])),o0=(e,t)=>t?e.filter(r=>un(r)!==un(t)):e,O3=(e,t)=>e.filter(r=>!t.some(n=>un(n)===un(r)));function Pr(e,t,r){if(r)return typeof r=="function"?r(e,t):e[r]}function j3(e,t){if(t)return!e||/^https?:\/\//i.test(t)?t:e+t}function R3({open:e,onClose:t,value:r,onChange:n,onRequestSend:o,customer:s,itemsSelects:i,renderItem:a,filterFields:c=[],multiSelectAutos:l=!0,imgCorreoSrc:d,baseURLImages:f,itemProps:h,defaultItemImageSrc:v}){const m=y.useRef(null),[p,b]=y.useState("idle"),w=y.useRef(e);y.useEffect(()=>{const R=w.current;e&&!R&&b("entering"),!e&&R&&b("exiting"),w.current=e},[e]),y.useEffect(()=>{if(p==="entering"){const xe=setTimeout(()=>b("idle"),320);return()=>clearTimeout(xe)}if(p==="exiting"){const xe=setTimeout(()=>b("idle"),220);return()=>clearTimeout(xe)}},[p]);const[C,E]=y.useState(""),[S,x]=y.useState(!1),[U,D]=y.useState(!1),[T,M]=y.useState(!1),[A,W]=y.useState(""),[G,F]=y.useState([]),Y=T?G:r.selectedIds,oe=()=>{F([...r.selectedIds]),W(""),M(!0)},H=()=>{M(!1),F([])},N=()=>{const R=new Set(vt.map((xe,Ge)=>String(Pr(xe,Ge,h.id)))),te=G.filter(xe=>R.has(String(xe)));n({...r,selectedIds:te}),M(!1)},ce=(R,te)=>un(R??"")===un(te??"");function fe(R,te,xe,Ge,q){const ae=te?R.some(Ie=>ce(Ie,te)):!1,Ee=xe.length>0?xe.some(Ie=>R.some(He=>ce(He,Ie))):!1;Ge(ae),q(Ee)}const $=R=>{const te=typeof R=="function"?R(r.recipients):R;n({...r,recipients:te}),fe(te,ie,le,x,D)},Q=R=>n({...r,message:R}),Ce=R=>n({...r,attachments:[...r.attachments,...R]}),me=R=>n({...r,attachments:r.attachments.filter(te=>te.name!==R)}),Se=R=>{if(T)if(l){const te=new Set(G);te.has(R)?te.delete(R):te.add(R),F(Array.from(te))}else{const te=G.includes(R);F(te?[]:[R])}else if(l){const te=new Set(r.selectedIds);te.has(R)?te.delete(R):te.add(R),n({...r,selectedIds:Array.from(te)})}else{const te=r.selectedIds.includes(R);n({...r,selectedIds:te?[]:[R]})}},ie=y.useMemo(()=>(s?.Correo??"").trim(),[s]),ee=y.useMemo(()=>Array.isArray(s?.Asesores)?s.Asesores.filter(R=>R?.EmailAsesor&&R?.Activo):[],[s]),le=y.useMemo(()=>ee.map(R=>(R.EmailAsesor??"").trim()).filter(Boolean),[ee]),ge=y.useRef(!1);y.useEffect(()=>{if(e&&!ge.current){let R=[];S&&ie&&(R=dn(R,[ie])),U&&le.length&&(R=dn(R,le)),$(te=>dn(te,R)),fe(r.recipients,ie,le,x,D),E(""),ge.current=!0}e||(ge.current=!1)},[e,S,U,ie,le]);const de=R=>{const te=ee.find(xe=>un(xe.EmailAsesor??"")===un(R));if(te){if(te.ImgAsesor)return u.jsx(g.Avatar,{src:te.ImgAsesor,alt:te.NombreAsesor});const xe=(te.NombreAsesor||"").trim(),Ge=(te.ApellidosAsesor||"").trim();return u.jsx(g.Avatar,{children:`${xe[0]??""}${Ge[0]??""}`.toUpperCase()})}return u.jsx(g.Avatar,{children:R[0]?.toUpperCase()})},pe=()=>{const R=C.trim();if(!R)return;const xe=R.split(ta).filter(Boolean).filter(Ge=>sl.test(Ge));xe.length>0&&$(Ge=>dn(Ge,xe)),E("")},Re=R=>{x(R),$(te=>R&&ie?dn(te,[ie]):o0(te,ie))},j=R=>{D(R),$(te=>R?dn(te,le):O3(te,le))},Fe=R=>{const te=Array.from(R.target.files||[]);Ce(te.map(xe=>({name:xe.name,size:xe.size,file:xe}))),R.target.value=""},qe=Y[0],Ze=y.useMemo(()=>!i||qe===void 0?void 0:i.find((te,xe)=>String(Pr(te,xe,h.id))===String(qe)),[i,qe,h.id]),Ne=y.useMemo(()=>{if(!(!Ze||!h.distributorId))return Pr(Ze,0,h.distributorId)},[Ze,h.distributorId]);console.log("lockedDisId",Ne);const Be=y.useMemo(()=>Ze?(h.distributorTitle?Pr(Ze,0,h.distributorTitle):void 0)??(Ne!=null?String(Ne):void 0):void 0,[Ze,h.distributorTitle,Ne]),vt=y.useMemo(()=>{const R=i??[];return Ne==null||!h.distributorId?R:R.filter((te,xe)=>Pr(te,xe,h.distributorId)==Ne)},[i,Ne,h.distributorId]),pt=y.useMemo(()=>{if(!A.trim())return vt;const R=A.toLowerCase();return vt.filter(te=>(c??[]).some(xe=>String(te?.[xe]??"").toLowerCase().includes(R)))},[vt,A,c]),k=y.useMemo(()=>{if(!i||!r.selectedIds.length)return[];const R=new Map;return i.forEach((te,xe)=>{R.set(String(Pr(te,xe,h.id)),te)}),r.selectedIds.map(te=>R.get(String(te))).filter(Boolean)},[i,r.selectedIds,h.id]),P=R=>n({...r,selectedIds:r.selectedIds.filter(te=>String(te)!==String(R))}),B=()=>{let R=r.recipients;if(C.trim()){const ae=C.split(ta).filter(Ee=>sl.test(Ee));R=dn(R,ae),$(R),E("")}const te=S?ie:"",xe=ee.find(ae=>ae?.Activo&&ae?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:R,toClient:S,toAdvisor:U,tipoInt:S&&U?2:1,correoCliente:te,correoAsesor:U?xe:"",disIdLocked:Ne}),t?.()},ue=y.useMemo(()=>{const te=C.split(ta).filter(Boolean).some(xe=>sl.test(xe));return r.recipients.length>0||te},[r.recipients,C]),se=(r.selectedIds?.length??0)>0,O=r.message.trim().length>0,ne=ue&&se&&O,we=g.useTheme(),Oe=g.useMediaQuery(we.breakpoints.down("sm"));return u.jsxs(g.Drawer,{anchor:Oe?"bottom":"right",open:e,onClose:t,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!Oe}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:Oe?"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:[u.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[u.jsxs(g.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[d?u.jsx("img",{src:d,alt:"Correo",style:{width:24,height:18}}):null,u.jsxs(g.Typography,{fontWeight:700,children:["Mensaje a"," ",s?`${s.Nombre??""} ${s.ApellidoP??""} ${s.ApellidoM??""}`.trim():"—"]})]}),u.jsx(g.IconButton,{onClick:t,size:"small",children:u.jsx(Vr,{})})]}),u.jsx("div",{children:u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[u.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[r.recipients.map(R=>u.jsx(g.Chip,{avatar:de(R),label:R,onDelete:()=>$(te=>o0(te,R)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},R)),u.jsx("input",{type:"text",value:C,onChange:R=>E(R.target.value),onKeyDown:R=>{const te=R.key;te==="Enter"||te===","||te===";"||te===" "||te==="Tab"?(R.preventDefault(),pe()):te==="Backspace"&&!C&&r.recipients.length&&$(Ge=>Ge.slice(0,-1))},onBlur:pe,onPaste:R=>{const xe=R.clipboardData.getData("text").split(ta).filter(Boolean);xe.length>1&&(R.preventDefault(),$(Ge=>dn(Ge,xe)),E(""))},placeholder:r.recipients.length?"":"correo@ejemplo.com",style:{flex:1,minWidth:140,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#111827",padding:"4px 0"}})]})]})}),u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[u.jsx(g.FormControlLabel,{control:u.jsx(g.Checkbox,{checked:S,onChange:R=>Re(R.target.checked),size:"small"}),label:"Cliente"}),ee.length!==0&&u.jsx(g.FormControlLabel,{control:u.jsx(g.Checkbox,{checked:U,onChange:R=>j(R.target.checked),size:"small"}),label:`Asesor${ee.length>1?"es":""}`})]})]}),u.jsx(g.Divider,{}),u.jsxs(g.Box,{p:2,children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:oe,children:[u.jsx(g.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),Be!=null&&u.jsx(g.Chip,{size:"small",label:`Distribuidora: ${Be}`})]}),k.length>0?u.jsx(g.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:k.map((R,te)=>{const xe=Pr(R,te,h.id),Ge=Pr(R,te,h.title)??"",q=Pr(R,te,h.image),ae=j3(f,q);return u.jsx(g.Chip,{onDelete:()=>P(xe),label:u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.jsx(g.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:ae?u.jsx("img",{src:ae,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}}):u.jsx("img",{src:v,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}})}),u.jsx("span",{style:{fontSize:12},children:u.jsx("b",{children:Ge})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(xe))})}):u.jsx(g.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),u.jsx(g.Divider,{}),u.jsxs(g.Box,{sx:{p:2},children:[u.jsx(g.TextField,{placeholder:"Escribe aquí tu mensaje...",value:r.message,onChange:R=>Q(R.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),r.attachments.length>0&&u.jsx(g.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:r.attachments.map(R=>u.jsxs(g.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[u.jsx(g.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"}}),u.jsx(g.Tooltip,{title:"Quitar",children:u.jsx(g.IconButton,{edge:"end",onClick:()=>me(R.name),size:"small",children:u.jsx(Vr,{fontSize:"small"})})})]},R.name))})]}),u.jsxs(g.Box,{sx:{position:{xs:"sticky",sm:"sticky"},bottom:0,bgcolor:"#fff",borderTop:"1px solid #E5E7EB",p:2,display:"flex",alignItems:"center",gap:2},children:[u.jsx("input",{ref:m,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:Fe}),u.jsx(g.Button,{startIcon:u.jsx(P3,{}),variant:"text",onClick:()=>m.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),u.jsx(g.Box,{sx:{flex:1}}),u.jsx(g.Button,{variant:"contained",onClick:B,disabled:!ne,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),u.jsxs(g.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:Oe,open:T,onClose:H,children:[u.jsxs(g.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",u.jsx(g.IconButton,{onClick:H,size:"small",children:u.jsx(Vr,{})})]}),u.jsxs(g.DialogContent,{children:[u.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[u.jsx(g.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:A,onChange:R=>W(R.target.value),sx:{mb:2}}),Be!=null&&u.jsx(g.Chip,{size:"small",label:`Distribuidora: ${Be}`})]}),u.jsxs(g.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",pt.length,")"]}),u.jsxs(g.List,{sx:{p:0},children:[pt.map((R,te)=>{const xe=Pr(R,te,h.id),Ge=Y.includes(String(xe))||Y.includes(xe),q=Ne==null||Pr(R,te,h.distributorId)==Ne;return u.jsx(g.ListItem,{disableGutters:!0,sx:{p:0,opacity:q?1:.5},children:u.jsx(g.Box,{onClick:()=>q&&Se(xe),sx:{cursor:q?"pointer":"not-allowed",p:.5,backgroundColor:Ge?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(R,te):u.jsx("pre",{style:{margin:0},children:JSON.stringify(R,null,2)})})},String(xe))}),pt.length===0&&u.jsx(g.Box,{p:2,children:u.jsx(g.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),u.jsxs(g.DialogActions,{sx:{px:3,pb:2},children:[u.jsx(g.Button,{variant:"text",onClick:H,sx:{color:"#5C6372"},children:"Cancelar"}),u.jsx(g.Button,{variant:"contained",onClick:N,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}Ot.AddCliente=I3,Ot.ApiProvider=T_,Ot.AuthProvider=n1,Ot.Clientes=d3,Ot.CustomSnackbar=$h,Ot.EventsProvider=gk,Ot.ModalCorreo=R3,Ot.MyCalendar=Sk,Ot.useAuth=ac,Ot.useAuthRepository=Ti,Ot.useEventRepository=Dc,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "componentes-exagono",
3
3
  "private": false,
4
- "version": "0.2.19",
4
+ "version": "0.2.20",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",