componentes-exagono 0.2.32 → 0.2.33

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.umd.js CHANGED
@@ -174,7 +174,7 @@ const theme2 = createTheme({ palette: {
174
174
  } else {
175
175
  newResult[${_}] = ${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=Fi,a=!jp.jitless,u=a&&Zw.value,d=t.catchall;let f;e._zod.parse=(h,v)=>{f??(f=n.value);const m=h.value;return i(m)?a&&u&&v?.async===!1&&v.jitless!==!0?(s||(s=o(t.shape)),h=s(h,v),d?Xp([],m,h,v,f,e):h):r(h,v):(h.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),h)}});function Jp(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 LC=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=>Vc(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 u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Jp(c,o,e,s)):Jp(a,o,e,s)}}),zC=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,u])=>eh(r,c,u)):eh(r,s,i)}});function Gc(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(Go(e)&&Go(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=Gc(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=Gc(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 eh(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=Gc(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 BC=Z("$ZodEnum",(e,t)=>{Mt.init(e,t);const r=Vw(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Gw.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}}),FC=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}}),WC=Z("$ZodTransform",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Op(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 th(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const UC=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(`^(${Vc(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=>th(s,r.value)):th(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),HC=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(`^(${Vc(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)}),VC=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=>rh(s,t)):rh(o,t)}});function rh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const YC=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))}),qC=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=>nh(s,e)):nh(o,e)}});function nh(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 ZC=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)}}),GC=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=>Ki(i,t.in,n)):Ki(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Ki(s,t.out,n)):Ki(o,t.out,n)}});function Ki(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const KC=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(oh):oh(o)}});function oh(e){return e.value=Object.freeze(e.value),e}const QC=Z("$ZodCustom",(e,t)=>{ar.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=>sh(s,r,n,e));sh(o,r,n,e)}});function sh(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(Ko(o))}}class XC{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 JC(){return new XC}const Qi=JC();function eE(e,t){return new e({type:"string",...Te(t)})}function tE(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function ih(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function rE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function nE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function oE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function sE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function iE(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function aE(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function cE(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function lE(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function uE(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function dE(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function fE(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function pE(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function hE(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function mE(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function gE(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function vE(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function yE(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function bE(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function xE(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function _E(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function wE(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function SE(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function CE(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function EE(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function DE(e,t){return new e({type:"number",checks:[],...Te(t)})}function kE(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function AE(e,t){return new e({type:"boolean",...Te(t)})}function TE(e){return new e({type:"unknown"})}function IE(e,t){return new e({type:"never",...Te(t)})}function ah(e,t){return new Yp({check:"less_than",...Te(t),value:e,inclusive:!1})}function Kc(e,t){return new Yp({check:"less_than",...Te(t),value:e,inclusive:!0})}function ch(e,t){return new qp({check:"greater_than",...Te(t),value:e,inclusive:!1})}function Qc(e,t){return new qp({check:"greater_than",...Te(t),value:e,inclusive:!0})}function lh(e,t){return new YS({check:"multiple_of",...Te(t),value:e})}function uh(e,t){return new ZS({check:"max_length",...Te(t),maximum:e})}function Xi(e,t){return new GS({check:"min_length",...Te(t),minimum:e})}function dh(e,t){return new KS({check:"length_equals",...Te(t),length:e})}function ME(e,t){return new QS({check:"string_format",format:"regex",...Te(t),pattern:e})}function PE(e){return new XS({check:"string_format",format:"lowercase",...Te(e)})}function OE(e){return new JS({check:"string_format",format:"uppercase",...Te(e)})}function jE(e,t){return new eC({check:"string_format",format:"includes",...Te(t),includes:e})}function RE(e,t){return new tC({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function NE(e,t){return new rC({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Qo(e){return new nC({check:"overwrite",tx:e})}function $E(e){return Qo(t=>t.normalize(e))}function LE(){return Qo(e=>e.trim())}function zE(){return Qo(e=>e.toLowerCase())}function BE(){return Qo(e=>e.toUpperCase())}function FE(e,t,r){return new e({type:"array",element:t,...Te(r)})}function WE(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Te(r)})}function UE(e){const t=HE(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ko(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(Ko(o))}},e(r.value,r)));return t}function HE(e,t){const r=new ar({check:"custom",...Te(t)});return r._zod.check=e,r}function fh(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function VE(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,u=c&&c[n.code];r[i]=$c(i,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function YE(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,u=c&&c[n.code];r[i]=$c(i,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function qE(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(fh(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return s.shouldUseNativeValidation&&Fc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Mp(VE(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(fh(function(){return Promise.resolve((r.mode==="sync"?aS:cS)(e,n,t)).then(function(i){return s.shouldUseNativeValidation&&Fc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof qc})(i))return{values:{},errors:Mp(YE(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 ZE=Z("ZodISODateTime",(e,t)=>{vC.init(e,t),kt.init(e,t)});function GE(e){return wE(ZE,e)}const KE=Z("ZodISODate",(e,t)=>{yC.init(e,t),kt.init(e,t)});function QE(e){return SE(KE,e)}const XE=Z("ZodISOTime",(e,t)=>{bC.init(e,t),kt.init(e,t)});function JE(e){return CE(XE,e)}const eD=Z("ZodISODuration",(e,t)=>{xC.init(e,t),kt.init(e,t)});function tD(e){return EE(eD,e)}const xr=Z("ZodError",(e,t)=>{qc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>iS(e,r)},flatten:{value:r=>sS(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Wc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Wc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),rD=Hi(xr),nD=Vi(xr),oD=Yi(xr),sD=qi(xr),iD=dS(xr),aD=fS(xr),cD=pS(xr),lD=hS(xr),uD=mS(xr),dD=gS(xr),fD=vS(xr),pD=yS(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)=>cn(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>rD(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>oD(e,r,n),e.parseAsync=async(r,n)=>nD(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>sD(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>iD(e,r,n),e.decode=(r,n)=>aD(e,r,n),e.encodeAsync=async(r,n)=>cD(e,r,n),e.decodeAsync=async(r,n)=>lD(e,r,n),e.safeEncode=(r,n)=>uD(e,r,n),e.safeDecode=(r,n)=>dD(e,r,n),e.safeEncodeAsync=async(r,n)=>fD(e,r,n),e.safeDecodeAsync=async(r,n)=>pD(e,r,n),e.refine=(r,n)=>e.check(sk(r,n)),e.superRefine=r=>e.check(ik(r)),e.overwrite=r=>e.check(Qo(r)),e.optional=()=>wh(e),e.nullable=()=>Sh(e),e.nullish=()=>wh(Sh(e)),e.nonoptional=r=>XD(e,r),e.array=()=>yh(e),e.or=r=>BD([e,r]),e.and=r=>WD(e,r),e.transform=r=>Eh(e,YD(r)),e.default=r=>GD(e,r),e.prefault=r=>QD(e,r),e.catch=r=>ek(e,r),e.pipe=r=>Eh(e,r),e.readonly=()=>nk(e),e.describe=r=>{const n=e.clone();return Qi.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Qi.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Qi.get(e);const n=e.clone();return Qi.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ph=Z("_ZodString",(e,t)=>{Zc.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(ME(...n)),e.includes=(...n)=>e.check(jE(...n)),e.startsWith=(...n)=>e.check(RE(...n)),e.endsWith=(...n)=>e.check(NE(...n)),e.min=(...n)=>e.check(Xi(...n)),e.max=(...n)=>e.check(uh(...n)),e.length=(...n)=>e.check(dh(...n)),e.nonempty=(...n)=>e.check(Xi(1,...n)),e.lowercase=n=>e.check(PE(n)),e.uppercase=n=>e.check(OE(n)),e.trim=()=>e.check(LE()),e.normalize=(...n)=>e.check($E(...n)),e.toLowerCase=()=>e.check(zE()),e.toUpperCase=()=>e.check(BE())}),hD=Z("ZodString",(e,t)=>{Zc.init(e,t),ph.init(e,t),e.email=r=>e.check(tE(mD,r)),e.url=r=>e.check(iE(gD,r)),e.jwt=r=>e.check(_E(MD,r)),e.emoji=r=>e.check(aE(vD,r)),e.guid=r=>e.check(ih(hh,r)),e.uuid=r=>e.check(rE(Ji,r)),e.uuidv4=r=>e.check(nE(Ji,r)),e.uuidv6=r=>e.check(oE(Ji,r)),e.uuidv7=r=>e.check(sE(Ji,r)),e.nanoid=r=>e.check(cE(yD,r)),e.guid=r=>e.check(ih(hh,r)),e.cuid=r=>e.check(lE(bD,r)),e.cuid2=r=>e.check(uE(xD,r)),e.ulid=r=>e.check(dE(_D,r)),e.base64=r=>e.check(yE(AD,r)),e.base64url=r=>e.check(bE(TD,r)),e.xid=r=>e.check(fE(wD,r)),e.ksuid=r=>e.check(pE(SD,r)),e.ipv4=r=>e.check(hE(CD,r)),e.ipv6=r=>e.check(mE(ED,r)),e.cidrv4=r=>e.check(gE(DD,r)),e.cidrv6=r=>e.check(vE(kD,r)),e.e164=r=>e.check(xE(ID,r)),e.datetime=r=>e.check(GE(r)),e.date=r=>e.check(QE(r)),e.time=r=>e.check(JE(r)),e.duration=r=>e.check(tD(r))});function _r(e){return eE(hD,e)}const kt=Z("ZodStringFormat",(e,t)=>{wt.init(e,t),ph.init(e,t)}),mD=Z("ZodEmail",(e,t)=>{cC.init(e,t),kt.init(e,t)}),hh=Z("ZodGUID",(e,t)=>{iC.init(e,t),kt.init(e,t)}),Ji=Z("ZodUUID",(e,t)=>{aC.init(e,t),kt.init(e,t)}),gD=Z("ZodURL",(e,t)=>{lC.init(e,t),kt.init(e,t)}),vD=Z("ZodEmoji",(e,t)=>{uC.init(e,t),kt.init(e,t)}),yD=Z("ZodNanoID",(e,t)=>{dC.init(e,t),kt.init(e,t)}),bD=Z("ZodCUID",(e,t)=>{fC.init(e,t),kt.init(e,t)}),xD=Z("ZodCUID2",(e,t)=>{pC.init(e,t),kt.init(e,t)}),_D=Z("ZodULID",(e,t)=>{hC.init(e,t),kt.init(e,t)}),wD=Z("ZodXID",(e,t)=>{mC.init(e,t),kt.init(e,t)}),SD=Z("ZodKSUID",(e,t)=>{gC.init(e,t),kt.init(e,t)}),CD=Z("ZodIPv4",(e,t)=>{_C.init(e,t),kt.init(e,t)}),ED=Z("ZodIPv6",(e,t)=>{wC.init(e,t),kt.init(e,t)}),DD=Z("ZodCIDRv4",(e,t)=>{SC.init(e,t),kt.init(e,t)}),kD=Z("ZodCIDRv6",(e,t)=>{CC.init(e,t),kt.init(e,t)}),AD=Z("ZodBase64",(e,t)=>{EC.init(e,t),kt.init(e,t)}),TD=Z("ZodBase64URL",(e,t)=>{kC.init(e,t),kt.init(e,t)}),ID=Z("ZodE164",(e,t)=>{AC.init(e,t),kt.init(e,t)}),MD=Z("ZodJWT",(e,t)=>{IC.init(e,t),kt.init(e,t)}),mh=Z("ZodNumber",(e,t)=>{Gp.init(e,t),Lt.init(e,t),e.gt=(n,o)=>e.check(ch(n,o)),e.gte=(n,o)=>e.check(Qc(n,o)),e.min=(n,o)=>e.check(Qc(n,o)),e.lt=(n,o)=>e.check(ah(n,o)),e.lte=(n,o)=>e.check(Kc(n,o)),e.max=(n,o)=>e.check(Kc(n,o)),e.int=n=>e.check(gh(n)),e.safe=n=>e.check(gh(n)),e.positive=n=>e.check(ch(0,n)),e.nonnegative=n=>e.check(Qc(0,n)),e.negative=n=>e.check(ah(0,n)),e.nonpositive=n=>e.check(Kc(0,n)),e.multipleOf=(n,o)=>e.check(lh(n,o)),e.step=(n,o)=>e.check(lh(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 ea(e){return DE(mh,e)}const PD=Z("ZodNumberFormat",(e,t)=>{MC.init(e,t),mh.init(e,t)});function gh(e){return kE(PD,e)}const OD=Z("ZodBoolean",(e,t)=>{PC.init(e,t),Lt.init(e,t)});function ta(e){return AE(OD,e)}const jD=Z("ZodUnknown",(e,t)=>{OC.init(e,t),Lt.init(e,t)});function vh(){return TE(jD)}const RD=Z("ZodNever",(e,t)=>{jC.init(e,t),Lt.init(e,t)});function ND(e){return IE(RD,e)}const $D=Z("ZodArray",(e,t)=>{RC.init(e,t),Lt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Xi(r,n)),e.nonempty=r=>e.check(Xi(1,r)),e.max=(r,n)=>e.check(uh(r,n)),e.length=(r,n)=>e.check(dh(r,n)),e.unwrap=()=>e.element});function yh(e,t){return FE($D,e,t)}const LD=Z("ZodObject",(e,t)=>{$C.init(e,t),Lt.init(e,t),gt(e,"shape",()=>t.shape),e.keyof=()=>xh(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:vh()}),e.loose=()=>e.clone({...e._zod.def,catchall:vh()}),e.strict=()=>e.clone({...e._zod.def,catchall:ND()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>eS(e,r),e.safeExtend=r=>tS(e,r),e.merge=r=>rS(e,r),e.pick=r=>Xw(e,r),e.omit=r=>Jw(e,r),e.partial=(...r)=>nS(_h,e,r[0]),e.required=(...r)=>oS(Ch,e,r[0])});function bh(e,t){const r={type:"object",get shape(){return an(this,"shape",e?qw(e):{}),this.shape},...Te(t)};return new LD(r)}const zD=Z("ZodUnion",(e,t)=>{LC.init(e,t),Lt.init(e,t),e.options=t.options});function BD(e,t){return new zD({type:"union",options:e,...Te(t)})}const FD=Z("ZodIntersection",(e,t)=>{zC.init(e,t),Lt.init(e,t)});function WD(e,t){return new FD({type:"intersection",left:e,right:t})}const Xc=Z("ZodEnum",(e,t)=>{BC.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 Xc({...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 Xc({...t,checks:[],...Te(o),entries:s})}});function xh(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Xc({type:"enum",entries:r,...Te(t)})}const UD=Z("ZodLiteral",(e,t)=>{FC.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 HD(e,t){return new UD({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}const VD=Z("ZodTransform",(e,t)=>{WC.init(e,t),Lt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Op(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ko(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(Ko(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function YD(e){return new VD({type:"transform",transform:e})}const _h=Z("ZodOptional",(e,t)=>{UC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wh(e){return new _h({type:"optional",innerType:e})}const qD=Z("ZodNullable",(e,t)=>{HC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Sh(e){return new qD({type:"nullable",innerType:e})}const ZD=Z("ZodDefault",(e,t)=>{VC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GD(e,t){return new ZD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Lp(t)}})}const KD=Z("ZodPrefault",(e,t)=>{YC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function QD(e,t){return new KD({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Lp(t)}})}const Ch=Z("ZodNonOptional",(e,t)=>{qC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function XD(e,t){return new Ch({type:"nonoptional",innerType:e,...Te(t)})}const JD=Z("ZodCatch",(e,t)=>{ZC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ek(e,t){return new JD({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const tk=Z("ZodPipe",(e,t)=>{GC.init(e,t),Lt.init(e,t),e.in=t.in,e.out=t.out});function Eh(e,t){return new tk({type:"pipe",in:e,out:t})}const rk=Z("ZodReadonly",(e,t)=>{KC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nk(e){return new rk({type:"readonly",innerType:e})}const ok=Z("ZodCustom",(e,t)=>{QC.init(e,t),Lt.init(e,t)});function sk(e,t={}){return WE(ok,e,t)}function ik(e){return UE(e)}const Dh=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,kh=(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),u=new Date(n,o,s,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},ak=bh({UsuarioID:ea().nullable().optional(),disID:ea().nullable().optional(),EsOrganizador:ta().default(!1),Correo:_r().email("Formato de correo inválido"),StatusInvitacion:xh(["PENDIENTE","CONFIRMADO","DECLINADO"]).default("PENDIENTE")}),ck=bh({titulo:_r().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:_r().min(1,"El campo fecha inicio es requerido."),horaInicio:_r().min(1,"La hora de inicio es requerida.").regex(Dh,{message:"Formato inválido"}),horaFin:_r().min(1,"La hora fin es requerida.").regex(Dh,{message:"Formato inválido"}),todoElDia:ta(),fechaFin:_r().optional(),showEndDate:ta().optional(),horaInicio2:_r().optional(),TodoElDia2:ta().optional(),client:_r().nullable().optional(),repetir:_r().optional(),link:_r().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(HD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:_r().optional(),invitados:yh(ak).optional().default([]),color:_r().optional(),solID:ea().nullable().optional(),disID:ea().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=kh(e.fechaInicio,e.horaInicio),r=kh(e.fechaFin,e.horaFin);return!t||!r||!x.isValid(t)||!x.isValid(r)?!0:!(x.isBefore(r,t)&&!x.isSameDay(r,t)||x.isSameDay(t,r)&&x.isBefore(r,t))},{message:"",path:["horaFin"]}),Ah=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"})),lk="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",uk=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"})))),Th="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",dk=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"})))),fk="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",pk=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 Xo={},Ih;function hk(){if(Ih)return Xo;Ih=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:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Xo}var mk=hk();const Mh=it(mk);var Jo={},Ph;function gk(){if(Ph)return Jo;Ph=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:"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"),Jo}var vk=gk();const yk=it(vk);var es={},Oh;function bk(){if(Oh)return es;Oh=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:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),es}var xk=bk();const _k=it(xk),wk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC";var ts={},jh;function Sk(){if(jh)return ts;jh=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:"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"),ts}var Ck=Sk();const Rh=it(Ck),Ek=e=>{const t=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],r=e.charCodeAt(0)%t.length;return t[r]},Dk=(e,t)=>{if(t)return l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[l.jsx(Rh,{sx:{fontSize:16,mr:.5}}),l.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return l.jsx(g.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return l.jsx(g.Button,{variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"});case"CONFIRMADA":return l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[l.jsx(Xf,{sx:{fontSize:16,mr:.5}}),l.jsx(g.Typography,{variant:"caption",sx:{fontWeight:600},children:"Asistiré"})]});default:return null}};function kk({open:e,handleClose:t,guests:r}){const n=r.filter(c=>c.estatus==="CONFIRMADA"||c.isHost),o=r.filter(c=>c.estatus==="PENDIENTE"&&!c.isHost),s=r.filter(c=>c.estatus==="RECHAZADA"&&!c.isHost),i=c=>l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[l.jsxs(g.Box,{sx:{position:"relative",mr:2},children:[l.jsx(g.Avatar,{sx:{bgcolor:Ek(c.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:c.iniciales}),c.estatus==="PENDIENTE"&&l.jsx(g.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:l.jsx(Tc,{sx:{fontSize:14,color:"#546E7A"}})})]}),l.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:c.nombre}),Dk(c.estatus,c.isHost)]},c.nombre),a=({title:c,count:u,badgeColor:d})=>l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[l.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:c}),d&&l.jsx(g.Box,{sx:{ml:1,bgcolor:d,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:u})]});return l.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[l.jsxs(g.Box,{sx:{p:"16px 8px"},children:[l.jsx(g.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1},children:"Lista de invitados"}),l.jsx(g.Button,{onClick:t,startIcon:l.jsx("img",{src:wk,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),l.jsx(g.IconButton,{onClick:t,sx:{position:"absolute",right:8,top:12},children:l.jsx(Ur,{})})]}),l.jsx(g.Divider,{}),l.jsxs(g.DialogContent,{sx:{p:2},children:[o.length>0&&l.jsxs(g.Box,{sx:{mb:3},children:[l.jsx(a,{title:"Invitados",count:o.length}),o.map(i)]}),n.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(g.Divider,{sx:{my:1}}),l.jsxs(g.Box,{sx:{mb:3},children:[l.jsx(a,{title:"Confirmados",count:n.length,badgeColor:"#1976D2"}),n.map(i)]})]}),s.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(g.Divider,{sx:{my:1}}),l.jsxs(g.Box,{children:[l.jsx(a,{title:"No asistirán",count:s.length,badgeColor:"#1976D2"}),s.map(i)]})]})]})]})}const Ak=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function Tk({guests:e}){const[t,r]=y.useState(!1),n=()=>r(!0),o=()=>r(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[l.jsx(g.AvatarGroup,{max:6,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((s,i)=>l.jsx(g.Tooltip,{title:s.nombre,arrow:!0,placement:"top",children:l.jsx(g.Box,{children:l.jsx(g.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:s.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:l.jsx(g.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:l.jsx("img",{src:ep})}),children:l.jsx(g.Avatar,{sx:{bgcolor:Ak(s.iniciales)},children:s.iniciales})})})},i))}),l.jsx(g.Box,{sx:{flexGrow:1}}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:n,children:[l.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),l.jsx(_k,{sx:{fontSize:18,ml:.5}})]})]}),l.jsx(kk,{open:t,handleClose:o,guests:e})]})}var rs={},Nh;function Ik(){if(Nh)return rs;Nh=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:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),rs}var Mk=Ik();const $h=it(Mk),Pk=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),Lh=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},zh=e=>e.split(":").slice(0,2).join(":"),Ok=({slot:e,onClick:t})=>l.jsxs(g.Box,{onClick:t,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #e0e0e0",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[l.jsx(g.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:l.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:Pk(e.Fecha)})}),l.jsxs(g.Box,{sx:{py:1.5},children:[l.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:500},children:Lh(e.HoraInicio)}),l.jsxs(g.Typography,{sx:{fontSize:"12px",color:"text.secondary"},children:["a ",Lh(e.HoraFin)]})]})]});function jk({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const o=r.reduce((a,c)=>{const u=c.Fecha;return a[u]||(a[u]=[]),a[u].push(c),a},{}),s=Object.keys(o),i=a=>{const c={...a,HoraInicio:zh(a.HoraInicio),HoraFin:zh(a.HoraFin)};n(c),t()};return l.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[l.jsxs(g.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[l.jsx(g.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),l.jsx(g.Box,{children:l.jsx(g.Button,{startIcon:l.jsx($h,{fontSize:"small"}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"0.85rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),l.jsx(g.Divider,{}),l.jsx(g.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:s.length===0?l.jsx(g.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):s.map((a,c)=>l.jsxs(g.Box,{sx:{mb:3},children:[l.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:c===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[c===0?"Mismo día":"Próximas fechas",c===0&&l.jsx(Rh,{sx:{ml:1,fontSize:18}})]}),l.jsx(g.Grid,{container:!0,spacing:2,children:o[a].map((u,d)=>l.jsx(g.Grid,{item:!0,xs:6,sm:4,children:l.jsx(Ok,{slot:u,onClick:()=>i(u)})},`${a}-${d}`))})]},a))})]})}const Rk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",Nk=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function $k({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=y.useState(null),[s,i]=y.useState(""),a=(u,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(u,d)=>{i(d),r(d)};return l.jsx(g.Autocomplete,{options:t,value:n,inputValue:s,getOptionLabel:u=>u.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(u,d)=>u.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:u=>l.jsx(g.TextField,{...u,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...u.InputProps,startAdornment:l.jsx(g.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:l.jsx("img",{src:Rk,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(u,d)=>y.createElement(g.Box,{component:"li",...u,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},l.jsx(g.Avatar,{sx:{bgcolor:Nk(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),l.jsx(g.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var ns={},Bh;function Lk(){if(Bh)return ns;Bh=1;var e=at();Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=void 0;var t=e(ht()),r=ut();return ns.default=(0,t.default)((0,r.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),ns}var zk=Lk();const Bk=it(zk);var os={},Fh;function Fk(){if(Fh)return os;Fh=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:"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"),os}var Wk=Fk();const Jc=it(Wk),Uk=e=>e.tieneConflicto?{icon:l.jsx(Jc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:l.jsx(Bk,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Hk=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function Vk({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return l.jsxs(g.Box,{sx:{p:1},children:[l.jsx(g.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=Uk(i),u=Hk(i.iniciales);return l.jsx(g.Chip,{label:l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[l.jsx(g.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)}),l.jsx(g.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:l.jsx(g.Avatar,{sx:{bgcolor:u,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:i.iniciales}),sx:{backgroundColor:c.fillColor,height:"32px",borderRadius:"100px",border:"1px solid rgba(0,0,0,0.04)",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{backgroundColor:c.fillColor,filter:"brightness(0.97)","& .status-icon-wrapper":{display:"none"},"& .MuiChip-deleteIcon":{display:"inline-block"}},"& .MuiChip-label":{paddingLeft:"4px",paddingRight:"8px",width:"100%",display:"flex"},"& .MuiChip-deleteIcon":{display:"none",fontSize:"18px",color:"#000000",ml:"auto",mr:"4px","&:hover":{color:"#000000"}}},onClick:()=>console.log(`Ver perfil de ${i.nombre}`),onDelete:o(i.nombre)},a)})}),t>0&&l.jsxs(g.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[l.jsx(Jc,{sx:{mr:1,fontSize:22}}),l.jsxs(g.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",l.jsxs("strong",{children:[t," invitado"]}),t!==1?"s":""]})]}),l.jsx(g.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),r()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function Yk(e,t){const[r,n]=y.useState(e);return y.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}const qk={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"},Wh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],Zk=()=>{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},Uh=[],eo=Zk(),ss=(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),u=new Date(s,o,n,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},Gk=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c})=>{const[u,d]=y.useState(!1),[f,h]=y.useState(!1),v=x.format(new Date,"yyyy-MM-dd"),[m,p]=y.useState(""),[b,w]=y.useState([]),[C,E]=y.useState(!1),S=Ac(),[_,W]=y.useState([]),[D,A]=y.useState(""),[M,I]=y.useState(Uh),[V,G]=y.useState(!1),[F,Y]=y.useState(""),[oe,U]=y.useState(!1),[N,ce]=y.useState([]),[fe,$]=y.useState([]),Q=Yk(F,300),Ce=M.filter(q=>q.tieneConflicto).length,{control:me,handleSubmit:we,reset:ae,formState:{errors:ee,isValid:le},watch:ge,setValue:ie}=Tp({resolver:qE(ck),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"HH:mm"),horaFin:x.format(x.addHours(new Date,1),"HH:mm"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[]},mode:"onChange"}),pe=ge("fechaInicio"),Re=ge("fechaFin"),j=ge("todoElDia");y.useEffect(()=>{if(m.trim()===""||!i||!c||!a){w([]),W([]),ie("solID",null),E(!1),A("");return}E(!0);const q=setTimeout(()=>{S.getClients(m,c,a,i).then(de=>{if(E(!1),de){const Ae=de.map(Fe=>Fe.solID);W([...new Set(Ae)])}else W([]);const Ee=Array.from(new Map(de.map(Ae=>[Ae.nombreCliente,Ae])).values());if(Ee.length>0)w(Ee),A("");else if(s?.client&&s.solID!==null){const Ae=[{solID:s.solID,nombreCliente:s.client}];w(Ae),A("Sin resultados")}else w([]),A("Sin resultados")}).catch(de=>{console.error("Error al buscar clientes:",de),E(!1)})},500);return()=>clearTimeout(q)},[m,i,c,a]),y.useEffect(()=>{if(pe&&Re){const q=new Date(pe),de=new Date(Re);(q===de||q>de)&&ie("fechaFin",pe)}},[pe,Re,ie]),y.useEffect(()=>{pe&&ie("fechaFin",pe)},[pe]),y.useEffect(()=>{ie("showEndDate",u)},[u,ie]),y.useEffect(()=>{if(s){const q=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(d(!q),ie("titulo",s?.titulo),ie("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),ie("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),ie("horaInicio",x.format(s.fechaInicio,"HH:mm")),ie("horaFin",x.format(s.fechaFin,"HH:mm")),ie("horaInicio2",x.format(s.fechaFin,"HH:mm")),ie("descripcion",s.descripcion),ie("link",s.link),ie("repetir","false"),ie("color",s.color),ie("todoElDia",s.todoElDia),ie("solID",s.solID),ie("client",s.client),s.invitados&&s.invitados.length>0){const de=(s?.invitados||[]).map(Ee=>{const Ae=Ee.usrNombre?.trim()||"",Fe=Ae.split(/\s+/),X=Fe.length>1?(Fe[0][0]+Fe[1][0]).toUpperCase():Ae.substring(0,2).toUpperCase();return{nombre:Ee.usrNombre||"Sin nombre",correo:Ee.correo||"",iniciales:X||"--",usrID:Ee.usuarioID??null,isHost:Ee.esOrganizador||!1,estatus:Ee.statusInvitacion,tieneConflicto:!1,disID:Ee.disID}});I(de)}else I(Uh);s.solID?h(!0):h(!1)}else{const q=o||new Date,de=new Date,Ee=new Date(q.getFullYear(),q.getMonth(),q.getDate(),de.getHours(),de.getMinutes()),Ae=x.addHours(Ee,1);ae({titulo:"",fechaInicio:x.format(Ee,"yyyy-MM-dd"),horaInicio:x.format(Ee,"HH:mm"),fechaFin:x.format(Ae,"yyyy-MM-dd"),horaFin:x.format(Ae,"HH:mm"),horaInicio2:x.format(Ae,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:Wh[0],solID:null}),d(!1),h(!1)}},[s,e,o]);const We=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==i,StatusInvitacion:"PENDIENTE",disID:c??null}),qe=we(q=>{const de=M.map(Ae=>We(Ae)),Ee={...q,invitados:de};r(Ee,s?.eventoID),t(),ae(),d(!1)},q=>{console.log("Errores de validación:",q)});y.useEffect(()=>{j&&(ie("horaInicio","00:00"),ie("horaFin","23:59"))},[j,ie,ge]);const Ze=()=>{const q=ge("fechaInicio");if(q){const de=new Date(`${q}T00:00:00`),Ee=x.addDays(de,1);ie("fechaFin",x.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=ss(Ne,Be),de=ss(vt,pt);if(!q||!de||!x.isValid(q)||!x.isValid(de))return;const Ee=x.isSameDay(q,de),Ae=Ee&&(x.isAfter(q,de)||q.getTime()===de.getTime()),Fe=x.isBefore(de,q)&&!Ee;(Ae||Fe)&&(ie("horaFin",""),ue(""))},[Be,Ne]);const O=y.useMemo(()=>{if(!Be||!Ne)return eo;const q=ss(Ne,Be),de=ss(vt,"00:00");return!q||!de||!x.isValid(q)||!x.isValid(de)||x.isBefore(de,q)&&!x.isSameDay(de,q)?eo:x.isSameDay(q,de)?eo.filter(Ee=>{const Ae=ss(vt,Ee);return Ae&&x.isAfter(Ae,q)}):(x.isAfter(de,q),eo)},[Be,Ne,vt]),ne=y.useMemo(()=>eo,[]),Se=async q=>{const de=M.some(Yt=>Yt.correo===q.correo);if(U(!0),de)return;const Ee=c,Ae=q.correo,Fe=q.usrID,X=Ne,Me=Be,ke=pt;if(!Ee||!Ae||!X||!Me||!ke){I(Yt=>[...Yt,{...q,status:"pending",isHost:!1,hasConflict:!1,usrID:Fe,name:q.nombre}]);return}let je;try{je=await S.VerificarConflicto(Ee,Ae,X,Me+":00",ke+":00")}catch{je={tieneConflicto:!1,usrMail:q.correo}}const Gt=Array.isArray(je)?je[0]:je,er={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(Gt.tieneConflicto).toLowerCase()==="true"};if(er.tieneConflicto){const Yt=await S.getDisponibilidadUsuario(c,Ae,X,"60");ce(Yt)}I(Yt=>[...Yt,er])},Oe=q=>{I(de=>de.filter(Ee=>Ee.nombre!==q))},R=()=>{G(!1)},te=q=>{const Ae=(q.usrNombre??"").split(" ").map(Fe=>Fe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:Ae,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(Ae=>Ae.usrID!==i&&!M.some(Fe=>Fe.correo===Ae.correo));$(Ee)})():$([])},[Q,M]);const _e=q=>{Y(q)},Ge=q=>{const{Fecha:de,HoraInicio:Ee,HoraFin:Ae}=q,Fe=X=>X.split(":").slice(0,2).join(":");ie("fechaInicio",de),ie("fechaFin",de),ie("horaInicio",Fe(Ee)),ie("horaFin",Fe(Ae)),d(!1),R(),console.log("Formulario actualizado con sugerencia:",{Fecha:de,HoraInicio:Ee,HoraFin:Ae})};return l.jsx(l.Fragment,{children:l.jsx(g.Modal,{open:e,onClose:t,children:l.jsx("form",{onSubmit:qe,children:l.jsxs(g.Box,{sx:qk,children:[l.jsx(g.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:l.jsx(Ur,{})}),l.jsx(g.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent?l.jsxs(l.Fragment,{children:[l.jsx(yk,{sx:{mr:1}}),s.titulo||"Evento de Google"]}):s?"Editar evento":"Agregar evento"}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(hr,{name:"titulo",control:me,render:({field:q})=>l.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"}}})})})}),l.jsxs("div",{className:`row g-2 ${u?"mb-1":"mb-2"}`,children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(hr,{name:"fechaInicio",control:me,render:({field:q})=>l.jsx(g.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!ee.fechaInicio,helperText:ee.fechaInicio?.message})})}),u?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-10 col-md-4",children:l.jsx(hr,{name:"fechaFin",control:me,render:({field:q})=>l.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&&l.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:l.jsx(g.IconButton,{onClick:()=>d(!1),sx:{fontSize:18},children:l.jsx(Ah,{})})})]}):l.jsx("div",{className:"col-md-8"})]}),u&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12 d-flex justify-content-center",children:l.jsx(Mh,{sx:{color:"#757575",my:1}})})}),l.jsxs("div",{className:"row g-2 mb-2",children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(hr,{name:"horaInicio",control:me,render:({field:{onChange:q,value:de,...Ee}})=>l.jsx(g.Autocomplete,{freeSolo:!0,options:ne,value:de||"",onChange:(Ae,Fe)=>q(Fe||""),onInputChange:(Ae,Fe)=>q(Fe),renderInput:Ae=>l.jsx(g.TextField,{...Ae,...Ee,size:"small",error:!!ee.horaInicio,helperText:ee.horaInicio?.message,InputProps:{...Ae.InputProps,endAdornment:l.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(Tc,{})})}}),disabled:se})})}),!u&&l.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:ee.horaInicio?"5px":"0px"},children:l.jsx(Mh,{sx:{color:"#757575"}})}),u&&l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(hr,{name:"horaFin",control:me,render:({field:{onChange:q,value:de,...Ee}})=>l.jsx(g.Autocomplete,{freeSolo:!0,options:O,value:de||"",onChange:(Ae,Fe)=>q(Fe||""),onInputChange:(Ae,Fe)=>q(Fe),renderInput:Ae=>l.jsx(g.TextField,{...Ae,...Ee,size:"small",error:!!ee.horaFin,helperText:ee.horaFin?.message,InputProps:{...Ae.InputProps,endAdornment:l.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(Tc,{})})}}),disabled:se})})}),!u&&l.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:l.jsx(hr,{name:"todoElDia",control:me,render:({field:q})=>l.jsx(g.FormControlLabel,{control:l.jsx(g.Checkbox,{checked:q.value,onChange:de=>q.onChange(de.target.checked)}),label:l.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!u&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(g.Button,{onClick:Ze,size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(dk,{}),"  Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&l.jsx("div",{className:"row mb-2",children:l.jsxs("div",{className:"col-12",children:[!f&&l.jsxs(g.Button,{onClick:()=>h(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(pk,{}),"  Vincular cliente"]}),f&&l.jsxs("div",{className:"row g-2",children:[l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(hr,{name:"client",control:me,render:({field:q})=>l.jsx(g.Autocomplete,{options:b,loading:C,loadingText:"Buscando coincidencias...",getOptionLabel:de=>de.nombreCliente?.trim()||"",value:b.find(de=>de.nombreCliente===q.value)||(q.value&&typeof q.value=="string"?{solID:-1,nombreCliente:q.value}:null),noOptionsText:D,onInputChange:(de,Ee)=>{p(Ee)},onChange:(de,Ee)=>{q.onChange(Ee?Ee.nombreCliente:"")},renderInput:de=>l.jsx(g.TextField,{...de,placeholder:"Buscar cliente...",size:"small",InputProps:{...de.InputProps,startAdornment:l.jsx("img",{src:Jd,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:l.jsxs(l.Fragment,{children:[C?l.jsx(g.CircularProgress,{color:"inherit",size:20}):null,de.InputProps.endAdornment]})}})})})}),l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(hr,{name:"solID",control:me,render:({field:q})=>l.jsx(g.Autocomplete,{options:_,noOptionsText:"Sin resultados",getOptionLabel:de=>de.toString(),value:q.value??null,onChange:(de,Ee)=>q.onChange(Ee),renderInput:de=>l.jsx(g.TextField,{...de,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!b.length})})}),l.jsx("div",{className:"col-2 d-flex align-items-center",children:l.jsx(g.IconButton,{onClick:()=>h(!1),sx:{fontSize:18},children:l.jsx(Ah,{})})})]})]})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(hr,{name:"link",control:me,render:({field:q})=>l.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:l.jsx("img",{src:lk,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(hr,{name:"descripcion",control:me,render:({field:q})=>l.jsx(g.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:l.jsx("img",{src:fk,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx($k,{onSelectGuest:Se,availableSuggestions:fe,onInputTextChange:_e})})}),oe&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Vk,{guests:M,conflictCount:Ce,onViewSuggestions:()=>G(!0),onDeleteGuest:Oe})})}),s?.invitados&&s?.invitados?.length>0&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(g.Box,{children:l.jsx(Tk,{guests:M})})})}),l.jsx(jk,{open:V,handleClose:R,suggestions:N,onSelectSlot:Ge}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[l.jsx(uk,{}),Wh.map(q=>l.jsx(hr,{name:"color",control:me,render:({field:de})=>l.jsx(g.IconButton,{onClick:()=>de.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:de.value===q?"2px solid":"none",borderColor:de.value===q?"primary.main":"transparent"}})},q))]})})}),l.jsx("div",{className:"row",children:l.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&l.jsx(g.Button,{onClick:n,variant:"outlined",startIcon:l.jsx("img",{src:Th,width:15}),sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),l.jsx(g.Button,{onClick:t,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),l.jsx(g.Button,{onClick:qe,variant:"contained",disabled:!le,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]})})})})},Kk={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"},Qk=({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 l.jsx(g.Modal,{open:e,onClose:t,children:l.jsxs(g.Box,{sx:Kk,children:[l.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[l.jsxs(g.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),l.jsx(g.IconButton,{onClick:t,size:"small",children:l.jsx(Ur,{})})]}),l.jsx(g.Divider,{}),l.jsx(g.List,{sx:{mt:1},children:r.map(a=>{const c=i(a);return l.jsx(g.ListItem,{disablePadding:!0,sx:{mb:1},children:l.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:l.jsxs(g.Box,{sx:{flexGrow:1},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[l.jsx(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),l.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),l.jsx(g.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"HH:mm")} - ${x.format(a.fechaFin,"HH:mm")}`})]})})},a.eventoID)})})]})})};var is={},Hh;function Xk(){if(Hh)return is;Hh=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:"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"),is}var Jk=Xk();const e3=it(Jk);var as={},Vh;function t3(){if(Vh)return as;Vh=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:"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"),as}var r3=t3();const n3=it(r3),o3="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",s3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",el=y.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=xs.useSnackbar(),s={success:{color:"#fff",icon:l.jsx("img",{width:25,src:o3,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:l.jsx(e3,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:l.jsx(n3,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:l.jsx("img",{src:Th,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:l.jsx("img",{src:s3,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[r]||s.info;return l.jsx(xs.SnackbarContent,{ref:n,children:l.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:[l.jsx(g.Box,{sx:{mr:1.5},children:i.icon}),l.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),l.jsx(g.IconButton,{size:"small",onClick:()=>o(e),children:l.jsx(Ur,{fontSize:"small"})})]})})}),Yh=y.createContext(void 0),i3=({children:e})=>{const[t,r]=y.useState([]),[n,o]=y.useState([]),[s,i]=y.useState(!1);return l.jsx(Yh.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},a3=()=>{const e=y.useContext(Yh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},c3=(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(l3(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 l3(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 u3(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 d3=(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(u3(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}},qh="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",f3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",p3=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>l.jsxs(g.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[l.jsx(g.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:l.jsx(g.IconButton,{onClick:t,size:"small",children:l.jsx(Ur,{fontSize:"small"})})}),l.jsxs(g.DialogContent,{sx:{textAlign:"center",pt:0},children:[l.jsx(g.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),l.jsx(g.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),l.jsx(g.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),l.jsxs(g.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[l.jsx(g.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),l.jsxs(g.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&l.jsx("img",{src:f3,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),h3=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o})=>{const[s,i]=y.useState(new Date),[a,c]=y.useState([]),[u,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}=xs.useSnackbar(),S=Ac(),_=Ii(),W=wc(),[D,A]=y.useState(!1),[M,I]=y.useState([]),[V,G]=y.useState(null),{session:F,sessionoutlook:Y}=cc(),{googleEvents:oe,setGoogleEvents:U,outlookEvents:N,setOutlookEvents:ce}=a3(),[fe,$]=y.useState([]),[Q,Ce]=y.useState([]),[me,we]=y.useState([]),[ae,ee]=y.useState(!1),[le,ge]=y.useState([]),[ie,pe]=y.useState(),Re=(X,Me)=>{I(X),G(Me),A(!0)},j=async()=>{if(e===void 0)return;const X=await S.getNotificacionesXUsuario(e,!1);ge(X)};y.useEffect(()=>{const X=new Date,Me=x.startOfDay(X),ke=x.endOfDay(x.addDays(Me,6)),je={start:Me,end:ke},Gt=a.filter(er=>{const Yt={start:er.fechaInicio,end:er.fechaFin};return Ud(Yt,je)}).sort((er,Yt)=>er.fechaInicio.getTime()-Yt.fechaInicio.getTime());C(Gt)},[a]),y.useEffect(()=>{const X=async()=>{try{if(e){const ke=await S.getEventsByUser(e);j(),c(ke)}}catch(ke){console.log("Error al cargar eventos locales:",ke)}};X();const Me=setInterval(X,4e3);return()=>clearInterval(Me)},[e]),y.useEffect(()=>{if(!n||!e)return;const X=[...a];if(oe.length>0&&F?.userEmail){const Me=oe.map(ke=>c3(ke,n,e));X.push(...Me)}if(N.length>0&&Y?.userEmail){const Me=N.map(ke=>d3(ke,n,e));X.push(...Me)}$(X)},[a,oe,N,n,e,F?.userEmail,Y?.userEmail]);const We=async X=>{try{if(X?.isGoogleEvent||X.isOutlookEvent)h(X),d(!0);else{const Me=await S.getEventById(X.eventoID);h(Me),d(!0)}}catch(Me){console.error(Me)}},qe=()=>{d(!1),h(null)},Ze=async(X,Me)=>{let ke,je;X.todoElDia?(ke=new Date(`${X.fechaInicio}T${X.horaInicio}`),je=new Date(`${X.fechaInicio}T${X.horaFin}`)):(ke=new Date(`${X.fechaInicio}T${X.horaInicio}`),je=X.fechaFin&&X.horaFin?new Date(`${X.fechaFin}T${X.horaFin}`):new Date(`${X.fechaInicio}T${X.horaFin}`));const Gt=x.format(ke,"yyyy-MM-dd HH:mm:ss.SSS"),er=x.format(je,"yyyy-MM-dd HH:mm:ss.SSS");if(Me){const Vr={...X,eventoID:Me,fechaInicio:Gt,fechaFin:er,solID:X.solID??null,disID:n??null,client:X.client,invitados:X.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(Vr);var Yt=a.map(wr=>wr.eventoID===Ke.eventoID?Ke:wr);c(Yt),E("El evento se ha actualizado correctamente.",{variant:"success"}),qe()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Vr={...X,fechaInicio:Gt,fechaFin:er,todoElDia:X.todoElDia,solID:X.solID??null,disID:n??null,client:X.client,invitados:X.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(Vr,e);c(wr=>[...wr,Ke]),E("El evento se ha creado con éxito",{variant:"success"}),qe()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e){const Vr=await S.getEventsByUser(e);c(Vr)}},Ne=()=>{i(X=>new Date(X.getFullYear(),X.getMonth()-1,1))},Be=()=>{i(X=>new Date(X.getFullYear(),X.getMonth()+1,1))},vt=()=>{de("ELIMINAR")},pt=()=>{de("RECHAZAR")},k=()=>{b(new Date),d(!0)},P=X=>{X&&i(X)},B=X=>{b(X),d(!0),h(null)},ue=async()=>{if(f)try{await S.deleteEvent(f.eventoID),c(a.filter(X=>X.eventoID!==f.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(X,Me)=>l.jsx(el,{id:X,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 _.getGoogleCalendars(F.userEmail,n)).map(je=>({...je,selected:!0}));Ce(Me);const ke=Me.map(je=>je.id);Oe(ke)}catch(X){console.error("Error Google Cals:",X)}finally{ee(!1)}}},O=async X=>{const Me=Q.map(je=>je.id===X?{...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 W.getOutlookCalendars(Y.userEmail,n)).map(je=>({...je,selected:!0}));we(Me);const ke=Me.map(je=>je.id);R(ke)}catch(X){console.error("Error Outlook Cals:",X)}finally{ee(!1)}}},Se=async X=>{const Me=me.map(je=>je.id===X?{...je,selected:!je.selected}:je);we(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 X=>{if(!F?.userEmail||!n)return;const Me=X||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 _.getGoogleEventsByMonth(ke);U(je)}catch(ke){console.error("Error al obtener eventos de Google:",ke)}},R=async X=>{if(!Y?.userEmail||!n)return;const Me=X||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 W.getOutlookEventsByMonth(ke);ce(je)}catch(ke){console.error("Error al obtener eventos de Outlook:",ke)}};if(n===void 0||e===void 0)return l.jsx("div",{children:"Cargando configuración de usuario..."});const te=async(X,Me)=>{await S.UpdateStatusEvento(X.evento.eventoID,e,Me)&&(await S.MarcarLeido(X.notificacionID,e),E(X?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},_e=async()=>{ie&&S.UpdateStatusEvento(ie.evento.eventoID,e,"RECHAZADA")&&(await S.MarcarLeido(ie.notificacionID,e),await S.MarcarLeido(ie.notificacionID,e),E("Haz rechazado la Invitación a "+ie?.evento?.titulo,{content:(Me,ke)=>l.jsx(el,{id:Me,message:String(ke),variant:"rechazar"})}),Ee())},Ge=async(X,Me)=>{try{if(!e)return;pe(X),Me=="RECHAZADA"?(pt(),console.log("noti",X)):te(X,Me)}catch{E("Error al procesar la invitación",{variant:"error"})}},[q,de]=y.useState(null),Ee=()=>de(null),Ae={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:l.jsxs(l.Fragment,{children:["Estás a punto de declinar la invitación de ",l.jsx("strong",{children:ie?.evento?.nombreAnfitrion})," a ",l.jsx("strong",{children:ie?.evento?.titulo})]}),icon:l.jsx("img",{src:qh}),action:()=>ie&&_e()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:l.jsx("img",{src:qh}),action:()=>ue()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ue}},Fe=q?Ae[q]:null;return l.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[l.jsx(dy,{header:l.jsx(I2,{currentDate:s,onPrevMonth:Ne,onNextMonth:Be,onAddEvent:k,onDateChange:P}),sidebar:l.jsx(lw,{onEventClick:We,upcomingEvents:w,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:k,googleCalendars:Q,outlookCalendars:me,isLoadingCalendars:ae,onToggleGoogle:O,onToggleOutlook:Se,notifications:le,unreadCount:le?.filter(X=>!X.leida).length,onAceppInvitacion:Ge}),mainContent:l.jsx(Sw,{onSeeMoreClick:Re,currentDate:s,events:fe,onDayClick:B,onEventClick:We})}),u&&l.jsx(Gk,{isVisible:u,onClose:qe,onSave:Ze,onDelete:vt,selectedDate:p,initialEvent:f,userId:e,masNombreBD:o,disId:n}),l.jsx(Qk,{isOpen:D,onClose:()=>A(!1),events:M,date:V,onEventClick:We}),Fe&&l.jsx(p3,{open:!!q,onClose:Ee,onConfirm:()=>{Fe.action()},title:Fe.title,description:Fe.description,icon:Fe.icon,confirmText:Fe.confirmText})]})},m3="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",g3="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 tl(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function v3(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 rl(e,t,r=!0){return typeof e=="function"?e(t):e??r}function y3(e){return e.replace(/[^\d]/g,"")}function b3(e,t){return t}var cs={},Zh;function x3(){if(Zh)return cs;Zh=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:"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"),cs}var _3=x3();const w3=it(_3);var ls={},Gh;function S3(){if(Gh)return ls;Gh=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:"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"),ls}var C3=S3();const E3=it(C3);var us={},Kh;function D3(){if(Kh)return us;Kh=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:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),us}var k3=D3();const A3=it(k3);var ds={},Qh;function T3(){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:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),ds}var I3=T3();const M3=it(I3);function Xh(e){return e==="right"?"end":e==="center"?"center":"start"}function Jh(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 P3=1060,nl=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function O3({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=P3,getDetailColumns:o,onRowClick:s}){function c(d){if(typeof d=="number")return d;if(!d)return 0;const f=/^(\d+)\s*px$/.exec(d.trim());return f?Number(f[1]):/fr$/i.test(d)?160:0}function u(d){const f=d.reduce((m,p)=>m+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return l.jsx(g.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:l.jsxs(g.Box,{children:[l.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=>l.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,u(p));return l.jsxs(g.Box,{children:[l.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:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[l.jsx(g.IconButton,{size:"small",disableRipple:!0,children:h?l.jsx(M3,{}):l.jsx(A3,{})}),l.jsx(g.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),l.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:nl(d,"En Proceso")}),l.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:nl(d,"Finalizadas")}),l.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:nl(d,"Último seg.")})]}),l.jsx(g.Collapse,{in:h,unmountOnExit:!0,children:l.jsxs(g.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[l.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Jh(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=>l.jsx(g.Typography,{sx:{justifySelf:Xh(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)=>l.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Jh(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 _=E.accessor?E.accessor(w,C):E.field?w[E.field]:null;return l.jsx(g.Box,{sx:{justifySelf:Xh(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof _=="string"||typeof _=="number"?l.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(_),children:_}):_},E.key??S)})},w.id??C))]})})]},d.id)})]})})}var fs={},e0;function j3(){if(e0)return fs;e0=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.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"),fs}var R3=j3();const N3=it(R3),$3=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",L3=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},z3=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ps={},t0;function B3(){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:"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"),ps}var F3=B3();const W3=it(F3),ol=({current:e=0,total:t=0,color:r="#4caf50"})=>l.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)=>l.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var hs={},r0;function U3(){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:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),hs}var H3=U3();const n0=it(H3),V3=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"}},Y3=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}},q3=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}},Z3=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 G3(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 K3(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=Fi,a=!jp.jitless,u=a&&Zw.value,d=t.catchall;let f;e._zod.parse=(h,v)=>{f??(f=n.value);const m=h.value;return i(m)?a&&u&&v?.async===!1&&v.jitless!==!0?(s||(s=o(t.shape)),h=s(h,v),d?Xp([],m,h,v,f,e):h):r(h,v):(h.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),h)}});function Jp(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 LC=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=>Vc(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 u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Jp(c,o,e,s)):Jp(a,o,e,s)}}),zC=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,u])=>eh(r,c,u)):eh(r,s,i)}});function Gc(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(Go(e)&&Go(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=Gc(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=Gc(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 eh(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=Gc(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 BC=Z("$ZodEnum",(e,t)=>{Mt.init(e,t);const r=Vw(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Gw.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}}),FC=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}}),WC=Z("$ZodTransform",(e,t)=>{Mt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Op(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 th(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const UC=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(`^(${Vc(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=>th(s,r.value)):th(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),HC=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(`^(${Vc(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)}),VC=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=>rh(s,t)):rh(o,t)}});function rh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const YC=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))}),qC=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=>nh(s,e)):nh(o,e)}});function nh(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 ZC=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)}}),GC=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=>Ki(i,t.in,n)):Ki(s,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Ki(s,t.out,n)):Ki(o,t.out,n)}});function Ki(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const KC=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(oh):oh(o)}});function oh(e){return e.value=Object.freeze(e.value),e}const QC=Z("$ZodCustom",(e,t)=>{ar.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=>sh(s,r,n,e));sh(o,r,n,e)}});function sh(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(Ko(o))}}class XC{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 JC(){return new XC}const Qi=JC();function eE(e,t){return new e({type:"string",...Te(t)})}function tE(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Te(t)})}function ih(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Te(t)})}function rE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Te(t)})}function nE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Te(t)})}function oE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Te(t)})}function sE(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Te(t)})}function iE(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Te(t)})}function aE(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Te(t)})}function cE(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Te(t)})}function lE(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Te(t)})}function uE(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Te(t)})}function dE(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Te(t)})}function fE(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Te(t)})}function pE(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Te(t)})}function hE(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Te(t)})}function mE(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Te(t)})}function gE(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Te(t)})}function vE(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Te(t)})}function yE(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Te(t)})}function bE(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Te(t)})}function xE(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Te(t)})}function _E(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Te(t)})}function wE(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Te(t)})}function SE(e,t){return new e({type:"string",format:"date",check:"string_format",...Te(t)})}function CE(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Te(t)})}function EE(e,t){return new e({type:"string",format:"duration",check:"string_format",...Te(t)})}function DE(e,t){return new e({type:"number",checks:[],...Te(t)})}function kE(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Te(t)})}function AE(e,t){return new e({type:"boolean",...Te(t)})}function TE(e){return new e({type:"unknown"})}function IE(e,t){return new e({type:"never",...Te(t)})}function ah(e,t){return new Yp({check:"less_than",...Te(t),value:e,inclusive:!1})}function Kc(e,t){return new Yp({check:"less_than",...Te(t),value:e,inclusive:!0})}function ch(e,t){return new qp({check:"greater_than",...Te(t),value:e,inclusive:!1})}function Qc(e,t){return new qp({check:"greater_than",...Te(t),value:e,inclusive:!0})}function lh(e,t){return new YS({check:"multiple_of",...Te(t),value:e})}function uh(e,t){return new ZS({check:"max_length",...Te(t),maximum:e})}function Xi(e,t){return new GS({check:"min_length",...Te(t),minimum:e})}function dh(e,t){return new KS({check:"length_equals",...Te(t),length:e})}function ME(e,t){return new QS({check:"string_format",format:"regex",...Te(t),pattern:e})}function PE(e){return new XS({check:"string_format",format:"lowercase",...Te(e)})}function OE(e){return new JS({check:"string_format",format:"uppercase",...Te(e)})}function jE(e,t){return new eC({check:"string_format",format:"includes",...Te(t),includes:e})}function RE(e,t){return new tC({check:"string_format",format:"starts_with",...Te(t),prefix:e})}function NE(e,t){return new rC({check:"string_format",format:"ends_with",...Te(t),suffix:e})}function Qo(e){return new nC({check:"overwrite",tx:e})}function $E(e){return Qo(t=>t.normalize(e))}function LE(){return Qo(e=>e.trim())}function zE(){return Qo(e=>e.toLowerCase())}function BE(){return Qo(e=>e.toUpperCase())}function FE(e,t,r){return new e({type:"array",element:t,...Te(r)})}function WE(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Te(r)})}function UE(e){const t=HE(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ko(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(Ko(o))}},e(r.value,r)));return t}function HE(e,t){const r=new ar({check:"custom",...Te(t)});return r._zod.check=e,r}function fh(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function VE(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,u=c&&c[n.code];r[i]=$c(i,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function YE(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,u=c&&c[n.code];r[i]=$c(i,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function qE(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(fh(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(i){return s.shouldUseNativeValidation&&Fc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return Array.isArray(a?.issues)})(i))return{values:{},errors:Mp(VE(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(fh(function(){return Promise.resolve((r.mode==="sync"?aS:cS)(e,n,t)).then(function(i){return s.shouldUseNativeValidation&&Fc({},s),{errors:{},values:r.raw?Object.assign({},n):i}})},function(i){if((function(a){return a instanceof qc})(i))return{values:{},errors:Mp(YE(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 ZE=Z("ZodISODateTime",(e,t)=>{vC.init(e,t),kt.init(e,t)});function GE(e){return wE(ZE,e)}const KE=Z("ZodISODate",(e,t)=>{yC.init(e,t),kt.init(e,t)});function QE(e){return SE(KE,e)}const XE=Z("ZodISOTime",(e,t)=>{bC.init(e,t),kt.init(e,t)});function JE(e){return CE(XE,e)}const eD=Z("ZodISODuration",(e,t)=>{xC.init(e,t),kt.init(e,t)});function tD(e){return EE(eD,e)}const xr=Z("ZodError",(e,t)=>{qc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>iS(e,r)},flatten:{value:r=>sS(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Wc,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Wc,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),rD=Hi(xr),nD=Vi(xr),oD=Yi(xr),sD=qi(xr),iD=dS(xr),aD=fS(xr),cD=pS(xr),lD=hS(xr),uD=mS(xr),dD=gS(xr),fD=vS(xr),pD=yS(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)=>cn(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>rD(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>oD(e,r,n),e.parseAsync=async(r,n)=>nD(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>sD(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>iD(e,r,n),e.decode=(r,n)=>aD(e,r,n),e.encodeAsync=async(r,n)=>cD(e,r,n),e.decodeAsync=async(r,n)=>lD(e,r,n),e.safeEncode=(r,n)=>uD(e,r,n),e.safeDecode=(r,n)=>dD(e,r,n),e.safeEncodeAsync=async(r,n)=>fD(e,r,n),e.safeDecodeAsync=async(r,n)=>pD(e,r,n),e.refine=(r,n)=>e.check(sk(r,n)),e.superRefine=r=>e.check(ik(r)),e.overwrite=r=>e.check(Qo(r)),e.optional=()=>wh(e),e.nullable=()=>Sh(e),e.nullish=()=>wh(Sh(e)),e.nonoptional=r=>XD(e,r),e.array=()=>yh(e),e.or=r=>BD([e,r]),e.and=r=>WD(e,r),e.transform=r=>Eh(e,YD(r)),e.default=r=>GD(e,r),e.prefault=r=>QD(e,r),e.catch=r=>ek(e,r),e.pipe=r=>Eh(e,r),e.readonly=()=>nk(e),e.describe=r=>{const n=e.clone();return Qi.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Qi.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Qi.get(e);const n=e.clone();return Qi.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ph=Z("_ZodString",(e,t)=>{Zc.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(ME(...n)),e.includes=(...n)=>e.check(jE(...n)),e.startsWith=(...n)=>e.check(RE(...n)),e.endsWith=(...n)=>e.check(NE(...n)),e.min=(...n)=>e.check(Xi(...n)),e.max=(...n)=>e.check(uh(...n)),e.length=(...n)=>e.check(dh(...n)),e.nonempty=(...n)=>e.check(Xi(1,...n)),e.lowercase=n=>e.check(PE(n)),e.uppercase=n=>e.check(OE(n)),e.trim=()=>e.check(LE()),e.normalize=(...n)=>e.check($E(...n)),e.toLowerCase=()=>e.check(zE()),e.toUpperCase=()=>e.check(BE())}),hD=Z("ZodString",(e,t)=>{Zc.init(e,t),ph.init(e,t),e.email=r=>e.check(tE(mD,r)),e.url=r=>e.check(iE(gD,r)),e.jwt=r=>e.check(_E(MD,r)),e.emoji=r=>e.check(aE(vD,r)),e.guid=r=>e.check(ih(hh,r)),e.uuid=r=>e.check(rE(Ji,r)),e.uuidv4=r=>e.check(nE(Ji,r)),e.uuidv6=r=>e.check(oE(Ji,r)),e.uuidv7=r=>e.check(sE(Ji,r)),e.nanoid=r=>e.check(cE(yD,r)),e.guid=r=>e.check(ih(hh,r)),e.cuid=r=>e.check(lE(bD,r)),e.cuid2=r=>e.check(uE(xD,r)),e.ulid=r=>e.check(dE(_D,r)),e.base64=r=>e.check(yE(AD,r)),e.base64url=r=>e.check(bE(TD,r)),e.xid=r=>e.check(fE(wD,r)),e.ksuid=r=>e.check(pE(SD,r)),e.ipv4=r=>e.check(hE(CD,r)),e.ipv6=r=>e.check(mE(ED,r)),e.cidrv4=r=>e.check(gE(DD,r)),e.cidrv6=r=>e.check(vE(kD,r)),e.e164=r=>e.check(xE(ID,r)),e.datetime=r=>e.check(GE(r)),e.date=r=>e.check(QE(r)),e.time=r=>e.check(JE(r)),e.duration=r=>e.check(tD(r))});function _r(e){return eE(hD,e)}const kt=Z("ZodStringFormat",(e,t)=>{wt.init(e,t),ph.init(e,t)}),mD=Z("ZodEmail",(e,t)=>{cC.init(e,t),kt.init(e,t)}),hh=Z("ZodGUID",(e,t)=>{iC.init(e,t),kt.init(e,t)}),Ji=Z("ZodUUID",(e,t)=>{aC.init(e,t),kt.init(e,t)}),gD=Z("ZodURL",(e,t)=>{lC.init(e,t),kt.init(e,t)}),vD=Z("ZodEmoji",(e,t)=>{uC.init(e,t),kt.init(e,t)}),yD=Z("ZodNanoID",(e,t)=>{dC.init(e,t),kt.init(e,t)}),bD=Z("ZodCUID",(e,t)=>{fC.init(e,t),kt.init(e,t)}),xD=Z("ZodCUID2",(e,t)=>{pC.init(e,t),kt.init(e,t)}),_D=Z("ZodULID",(e,t)=>{hC.init(e,t),kt.init(e,t)}),wD=Z("ZodXID",(e,t)=>{mC.init(e,t),kt.init(e,t)}),SD=Z("ZodKSUID",(e,t)=>{gC.init(e,t),kt.init(e,t)}),CD=Z("ZodIPv4",(e,t)=>{_C.init(e,t),kt.init(e,t)}),ED=Z("ZodIPv6",(e,t)=>{wC.init(e,t),kt.init(e,t)}),DD=Z("ZodCIDRv4",(e,t)=>{SC.init(e,t),kt.init(e,t)}),kD=Z("ZodCIDRv6",(e,t)=>{CC.init(e,t),kt.init(e,t)}),AD=Z("ZodBase64",(e,t)=>{EC.init(e,t),kt.init(e,t)}),TD=Z("ZodBase64URL",(e,t)=>{kC.init(e,t),kt.init(e,t)}),ID=Z("ZodE164",(e,t)=>{AC.init(e,t),kt.init(e,t)}),MD=Z("ZodJWT",(e,t)=>{IC.init(e,t),kt.init(e,t)}),mh=Z("ZodNumber",(e,t)=>{Gp.init(e,t),Lt.init(e,t),e.gt=(n,o)=>e.check(ch(n,o)),e.gte=(n,o)=>e.check(Qc(n,o)),e.min=(n,o)=>e.check(Qc(n,o)),e.lt=(n,o)=>e.check(ah(n,o)),e.lte=(n,o)=>e.check(Kc(n,o)),e.max=(n,o)=>e.check(Kc(n,o)),e.int=n=>e.check(gh(n)),e.safe=n=>e.check(gh(n)),e.positive=n=>e.check(ch(0,n)),e.nonnegative=n=>e.check(Qc(0,n)),e.negative=n=>e.check(ah(0,n)),e.nonpositive=n=>e.check(Kc(0,n)),e.multipleOf=(n,o)=>e.check(lh(n,o)),e.step=(n,o)=>e.check(lh(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 ea(e){return DE(mh,e)}const PD=Z("ZodNumberFormat",(e,t)=>{MC.init(e,t),mh.init(e,t)});function gh(e){return kE(PD,e)}const OD=Z("ZodBoolean",(e,t)=>{PC.init(e,t),Lt.init(e,t)});function ta(e){return AE(OD,e)}const jD=Z("ZodUnknown",(e,t)=>{OC.init(e,t),Lt.init(e,t)});function vh(){return TE(jD)}const RD=Z("ZodNever",(e,t)=>{jC.init(e,t),Lt.init(e,t)});function ND(e){return IE(RD,e)}const $D=Z("ZodArray",(e,t)=>{RC.init(e,t),Lt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Xi(r,n)),e.nonempty=r=>e.check(Xi(1,r)),e.max=(r,n)=>e.check(uh(r,n)),e.length=(r,n)=>e.check(dh(r,n)),e.unwrap=()=>e.element});function yh(e,t){return FE($D,e,t)}const LD=Z("ZodObject",(e,t)=>{$C.init(e,t),Lt.init(e,t),gt(e,"shape",()=>t.shape),e.keyof=()=>xh(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:vh()}),e.loose=()=>e.clone({...e._zod.def,catchall:vh()}),e.strict=()=>e.clone({...e._zod.def,catchall:ND()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>eS(e,r),e.safeExtend=r=>tS(e,r),e.merge=r=>rS(e,r),e.pick=r=>Xw(e,r),e.omit=r=>Jw(e,r),e.partial=(...r)=>nS(_h,e,r[0]),e.required=(...r)=>oS(Ch,e,r[0])});function bh(e,t){const r={type:"object",get shape(){return an(this,"shape",e?qw(e):{}),this.shape},...Te(t)};return new LD(r)}const zD=Z("ZodUnion",(e,t)=>{LC.init(e,t),Lt.init(e,t),e.options=t.options});function BD(e,t){return new zD({type:"union",options:e,...Te(t)})}const FD=Z("ZodIntersection",(e,t)=>{zC.init(e,t),Lt.init(e,t)});function WD(e,t){return new FD({type:"intersection",left:e,right:t})}const Xc=Z("ZodEnum",(e,t)=>{BC.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 Xc({...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 Xc({...t,checks:[],...Te(o),entries:s})}});function xh(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Xc({type:"enum",entries:r,...Te(t)})}const UD=Z("ZodLiteral",(e,t)=>{FC.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 HD(e,t){return new UD({type:"literal",values:Array.isArray(e)?e:[e],...Te(t)})}const VD=Z("ZodTransform",(e,t)=>{WC.init(e,t),Lt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Op(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Ko(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(Ko(i))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function YD(e){return new VD({type:"transform",transform:e})}const _h=Z("ZodOptional",(e,t)=>{UC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wh(e){return new _h({type:"optional",innerType:e})}const qD=Z("ZodNullable",(e,t)=>{HC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Sh(e){return new qD({type:"nullable",innerType:e})}const ZD=Z("ZodDefault",(e,t)=>{VC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function GD(e,t){return new ZD({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Lp(t)}})}const KD=Z("ZodPrefault",(e,t)=>{YC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function QD(e,t){return new KD({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Lp(t)}})}const Ch=Z("ZodNonOptional",(e,t)=>{qC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function XD(e,t){return new Ch({type:"nonoptional",innerType:e,...Te(t)})}const JD=Z("ZodCatch",(e,t)=>{ZC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ek(e,t){return new JD({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const tk=Z("ZodPipe",(e,t)=>{GC.init(e,t),Lt.init(e,t),e.in=t.in,e.out=t.out});function Eh(e,t){return new tk({type:"pipe",in:e,out:t})}const rk=Z("ZodReadonly",(e,t)=>{KC.init(e,t),Lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nk(e){return new rk({type:"readonly",innerType:e})}const ok=Z("ZodCustom",(e,t)=>{QC.init(e,t),Lt.init(e,t)});function sk(e,t={}){return WE(ok,e,t)}function ik(e){return UE(e)}const Dh=/^([01][0-9]|2[0-3]):[0-5][0-9]$/,kh=(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),u=new Date(n,o,s,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},ak=bh({UsuarioID:ea().nullable().optional(),disID:ea().nullable().optional(),EsOrganizador:ta().default(!1),Correo:_r().email("Formato de correo inválido"),StatusInvitacion:xh(["PENDIENTE","CONFIRMADO","DECLINADO"]).default("PENDIENTE")}),ck=bh({titulo:_r().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:_r().min(1,"El campo fecha inicio es requerido."),horaInicio:_r().min(1,"La hora de inicio es requerida.").regex(Dh,{message:"Formato inválido"}),horaFin:_r().min(1,"La hora fin es requerida.").regex(Dh,{message:"Formato inválido"}),todoElDia:ta(),fechaFin:_r().optional(),showEndDate:ta().optional(),horaInicio2:_r().optional(),TodoElDia2:ta().optional(),client:_r().nullable().optional(),repetir:_r().optional(),link:_r().trim().url("Debe ser una URL válida. Ejemplo https://meet.google.com/").or(HD("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}),descripcion:_r().optional(),invitados:yh(ak).optional().default([]),color:_r().optional(),solID:ea().nullable().optional(),disID:ea().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=kh(e.fechaInicio,e.horaInicio),r=kh(e.fechaFin,e.horaFin);return!t||!r||!x.isValid(t)||!x.isValid(r)?!0:!(x.isBefore(r,t)&&!x.isSameDay(r,t)||x.isSameDay(t,r)&&x.isBefore(r,t))},{message:"",path:["horaFin"]}),Ah=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"})),lk="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",uk=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"})))),Th="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",dk=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"})))),fk="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",pk=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 Xo={},Ih;function hk(){if(Ih)return Xo;Ih=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:"m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}),"ArrowForward"),Xo}var mk=hk();const Mh=it(mk);var Jo={},Ph;function gk(){if(Ph)return Jo;Ph=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:"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"),Jo}var vk=gk();const yk=it(vk);var es={},Oh;function bk(){if(Oh)return es;Oh=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:"M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"}),"KeyboardArrowRight"),es}var xk=bk();const _k=it(xk),wk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC";var ts={},jh;function Sk(){if(jh)return ts;jh=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:"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"),ts}var Ck=Sk();const Rh=it(Ck),Ek=e=>{const t=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],r=e.charCodeAt(0)%t.length;return t[r]},Dk=(e,t)=>{if(t)return l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[l.jsx(Rh,{sx:{fontSize:16,mr:.5}}),l.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return l.jsx(g.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return l.jsx(g.Button,{variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"});case"CONFIRMADA":return l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[l.jsx(Xf,{sx:{fontSize:16,mr:.5}}),l.jsx(g.Typography,{variant:"caption",sx:{fontWeight:600},children:"Asistiré"})]});default:return null}};function kk({open:e,handleClose:t,guests:r}){const n=r.filter(c=>c.estatus==="CONFIRMADA"||c.isHost),o=r.filter(c=>c.estatus==="PENDIENTE"&&!c.isHost),s=r.filter(c=>c.estatus==="RECHAZADA"&&!c.isHost),i=c=>l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[l.jsxs(g.Box,{sx:{position:"relative",mr:2},children:[l.jsx(g.Avatar,{sx:{bgcolor:Ek(c.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:c.iniciales}),c.estatus==="PENDIENTE"&&l.jsx(g.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:l.jsx(Tc,{sx:{fontSize:14,color:"#546E7A"}})})]}),l.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:c.nombre}),Dk(c.estatus,c.isHost)]},c.nombre),a=({title:c,count:u,badgeColor:d})=>l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[l.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:c}),d&&l.jsx(g.Box,{sx:{ml:1,bgcolor:d,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:u})]});return l.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[l.jsxs(g.Box,{sx:{p:"16px 8px"},children:[l.jsx(g.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),l.jsx(g.Button,{onClick:t,startIcon:l.jsx("img",{src:wk,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),l.jsx(g.IconButton,{onClick:t,sx:{position:"absolute",right:8,top:12},children:l.jsx(Ur,{})})]}),l.jsx(g.Divider,{sx:{backgroundColor:"black"}}),l.jsxs(g.DialogContent,{sx:{p:2},children:[o.length>0&&l.jsxs(g.Box,{sx:{mb:3},children:[l.jsx(a,{title:"Invitados",count:o.length}),o.map(i)]}),n.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(g.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(g.Box,{sx:{mb:3},children:[l.jsx(a,{title:"Confirmados",count:n.length,badgeColor:"#1976D2"}),n.map(i)]})]}),s.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(g.Divider,{sx:{my:1,backgroundColor:"black"}}),l.jsxs(g.Box,{children:[l.jsx(a,{title:"No asistirán",count:s.length,badgeColor:"#1976D2"}),s.map(i)]})]})]})]})}const Ak=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function Tk({guests:e}){const[t,r]=y.useState(!1),n=()=>r(!0),o=()=>r(!1);return l.jsxs(l.Fragment,{children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[l.jsx(g.AvatarGroup,{max:6,sx:{"& .MuiAvatar-root":{width:32,height:32,fontSize:13,fontWeight:"bold",border:"2px solid #fff",marginLeft:"-8px !important"},"& .MuiBadge-root":{borderRadius:"50%"}},children:e.map((s,i)=>l.jsx(g.Tooltip,{title:s.nombre,arrow:!0,placement:"top",children:l.jsx(g.Box,{children:l.jsx(g.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:s.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:l.jsx(g.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:l.jsx("img",{src:ep})}),children:l.jsx(g.Avatar,{sx:{bgcolor:Ak(s.iniciales)},children:s.iniciales})})})},i))}),l.jsx(g.Box,{sx:{flexGrow:1}}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:n,children:[l.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),l.jsx(_k,{sx:{fontSize:18,ml:.5}})]})]}),l.jsx(kk,{open:t,handleClose:o,guests:e})]})}var rs={},Nh;function Ik(){if(Nh)return rs;Nh=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:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack"),rs}var Mk=Ik();const $h=it(Mk),Pk=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),Lh=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},zh=e=>e.split(":").slice(0,2).join(":"),Ok=({slot:e,onClick:t})=>l.jsxs(g.Box,{onClick:t,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #e0e0e0",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[l.jsx(g.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:l.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:Pk(e.Fecha)})}),l.jsxs(g.Box,{sx:{py:1.5},children:[l.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:500},children:Lh(e.HoraInicio)}),l.jsxs(g.Typography,{sx:{fontSize:"12px",color:"text.secondary"},children:["a ",Lh(e.HoraFin)]})]})]});function jk({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const o=r.reduce((a,c)=>{const u=c.Fecha;return a[u]||(a[u]=[]),a[u].push(c),a},{}),s=Object.keys(o),i=a=>{const c={...a,HoraInicio:zh(a.HoraInicio),HoraFin:zh(a.HoraFin)};n(c),t()};return l.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[l.jsxs(g.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[l.jsx(g.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),l.jsx(g.Box,{children:l.jsx(g.Button,{startIcon:l.jsx($h,{fontSize:"small"}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"0.85rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),l.jsx(g.Divider,{}),l.jsx(g.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:s.length===0?l.jsx(g.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):s.map((a,c)=>l.jsxs(g.Box,{sx:{mb:3},children:[l.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:c===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[c===0?"Mismo día":"Próximas fechas",c===0&&l.jsx(Rh,{sx:{ml:1,fontSize:18}})]}),l.jsx(g.Grid,{container:!0,spacing:2,children:o[a].map((u,d)=>l.jsx(g.Grid,{item:!0,xs:6,sm:4,children:l.jsx(Ok,{slot:u,onClick:()=>i(u)})},`${a}-${d}`))})]},a))})]})}const Rk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",Nk=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function $k({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=y.useState(null),[s,i]=y.useState(""),a=(u,d)=>{d?(e(d),o(null),i("")):(o(null),i(""))},c=(u,d)=>{i(d),r(d)};return l.jsx(g.Autocomplete,{options:t,value:n,inputValue:s,getOptionLabel:u=>u.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(u,d)=>u.correo===d.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:u=>l.jsx(g.TextField,{...u,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...u.InputProps,startAdornment:l.jsx(g.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:l.jsx("img",{src:Rk,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(u,d)=>y.createElement(g.Box,{component:"li",...u,key:d.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},l.jsx(g.Avatar,{sx:{bgcolor:Nk(d.iniciales),mr:2,width:32,height:32,fontSize:14},children:d.iniciales}),l.jsx(g.Typography,{children:d.nombre}))},"guest-autocomplete-field")}var ns={},Bh;function Lk(){if(Bh)return ns;Bh=1;var e=at();Object.defineProperty(ns,"__esModule",{value:!0}),ns.default=void 0;var t=e(ht()),r=ut();return ns.default=(0,t.default)((0,r.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline"),ns}var zk=Lk();const Bk=it(zk);var os={},Fh;function Fk(){if(Fh)return os;Fh=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:"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"),os}var Wk=Fk();const Jc=it(Wk),Uk=e=>e.tieneConflicto?{icon:l.jsx(Jc,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:l.jsx(Bk,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Hk=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function Vk({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=i=>a=>{a.stopPropagation(),n(i)},s=i=>i?i.trim().split(/\s+/).slice(0,2).join(" "):"";return l.jsxs(g.Box,{sx:{p:1},children:[l.jsx(g.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((i,a)=>{const c=Uk(i),u=Hk(i.iniciales);return l.jsx(g.Chip,{label:l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[l.jsx(g.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:s(i?.nombre)}),l.jsx(g.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:l.jsx(g.Avatar,{sx:{bgcolor:u,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:i.iniciales}),sx:{backgroundColor:c.fillColor,height:"32px",borderRadius:"100px",border:"1px solid rgba(0,0,0,0.04)",transition:"all 0.2s ease-in-out",cursor:"pointer","&:hover":{backgroundColor:c.fillColor,filter:"brightness(0.97)","& .status-icon-wrapper":{display:"none"},"& .MuiChip-deleteIcon":{display:"inline-block"}},"& .MuiChip-label":{paddingLeft:"4px",paddingRight:"8px",width:"100%",display:"flex"},"& .MuiChip-deleteIcon":{display:"none",fontSize:"18px",color:"#000000",ml:"auto",mr:"4px","&:hover":{color:"#000000"}}},onClick:()=>console.log(`Ver perfil de ${i.nombre}`),onDelete:o(i.nombre)},a)})}),t>0&&l.jsxs(g.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[l.jsx(Jc,{sx:{mr:1,fontSize:22}}),l.jsxs(g.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",l.jsxs("strong",{children:[t," invitado"]}),t!==1?"s":""]})]}),l.jsx(g.Link,{component:"button",type:"button",variant:"body2",onClick:i=>{i.preventDefault(),i.stopPropagation(),r()},sx:{ml:4,textAlign:"left",textDecoration:"underline",fontWeight:700,fontSize:"15px",color:"#1976D2",border:"none",background:"none",padding:0,cursor:"pointer","&:hover":{color:"#1565C0"}},children:"Ver sugerencias de horario"})]})]})}function Yk(e,t){const[r,n]=y.useState(e);return y.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}const qk={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"},Wh=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],Zk=()=>{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},Uh=[],eo=Zk(),ss=(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),u=new Date(s,o,n,a,c);return isNaN(u.getTime())||!x.isValid(u)?null:u},Gk=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:s,userId:i,masNombreBD:a,disId:c})=>{const[u,d]=y.useState(!1),[f,h]=y.useState(!1),v=x.format(new Date,"yyyy-MM-dd"),[m,p]=y.useState(""),[b,w]=y.useState([]),[C,E]=y.useState(!1),S=Ac(),[_,W]=y.useState([]),[D,A]=y.useState(""),[M,I]=y.useState(Uh),[V,G]=y.useState(!1),[F,Y]=y.useState(""),[oe,U]=y.useState(!1),[N,ce]=y.useState([]),[fe,$]=y.useState([]),Q=Yk(F,300),Ce=M.filter(q=>q.tieneConflicto).length,{control:me,handleSubmit:we,reset:ae,formState:{errors:ee,isValid:le},watch:ge,setValue:ie}=Tp({resolver:qE(ck),defaultValues:{titulo:s?.titulo||"",fechaInicio:x.format(new Date,"yyyy-MM-dd"),horaInicio:x.format(new Date,"HH:mm"),horaFin:x.format(x.addHours(new Date,1),"HH:mm"),todoElDia:!1,client:s?.client||null,repetir:"No repetir",link:s?.link||"",descripcion:s?.descripcion||"",solID:s?.solID??null,invitados:[]},mode:"onChange"}),pe=ge("fechaInicio"),Re=ge("fechaFin"),j=ge("todoElDia");y.useEffect(()=>{if(m.trim()===""||!i||!c||!a){w([]),W([]),ie("solID",null),E(!1),A("");return}E(!0);const q=setTimeout(()=>{S.getClients(m,c,a,i).then(de=>{if(E(!1),de){const Ae=de.map(Fe=>Fe.solID);W([...new Set(Ae)])}else W([]);const Ee=Array.from(new Map(de.map(Ae=>[Ae.nombreCliente,Ae])).values());if(Ee.length>0)w(Ee),A("");else if(s?.client&&s.solID!==null){const Ae=[{solID:s.solID,nombreCliente:s.client}];w(Ae),A("Sin resultados")}else w([]),A("Sin resultados")}).catch(de=>{console.error("Error al buscar clientes:",de),E(!1)})},500);return()=>clearTimeout(q)},[m,i,c,a]),y.useEffect(()=>{if(pe&&Re){const q=new Date(pe),de=new Date(Re);(q===de||q>de)&&ie("fechaFin",pe)}},[pe,Re,ie]),y.useEffect(()=>{pe&&ie("fechaFin",pe)},[pe]),y.useEffect(()=>{ie("showEndDate",u)},[u,ie]),y.useEffect(()=>{if(s){const q=x.format(s.fechaInicio,"yyyy-MM-dd")===x.format(s.fechaFin,"yyyy-MM-dd");if(d(!q),ie("titulo",s?.titulo),ie("fechaInicio",x.format(s.fechaInicio,"yyyy-MM-dd")),ie("fechaFin",x.format(s.fechaFin,"yyyy-MM-dd")),ie("horaInicio",x.format(s.fechaInicio,"HH:mm")),ie("horaFin",x.format(s.fechaFin,"HH:mm")),ie("horaInicio2",x.format(s.fechaFin,"HH:mm")),ie("descripcion",s.descripcion),ie("link",s.link),ie("repetir","false"),ie("color",s.color),ie("todoElDia",s.todoElDia),ie("solID",s.solID),ie("client",s.client),s.invitados&&s.invitados.length>0){const de=(s?.invitados||[]).map(Ee=>{const Ae=Ee.usrNombre?.trim()||"",Fe=Ae.split(/\s+/),X=Fe.length>1?(Fe[0][0]+Fe[1][0]).toUpperCase():Ae.substring(0,2).toUpperCase();return{nombre:Ee.usrNombre||"Sin nombre",correo:Ee.correo||"",iniciales:X||"--",usrID:Ee.usuarioID??null,isHost:Ee.esOrganizador||!1,estatus:Ee.statusInvitacion,tieneConflicto:!1,disID:Ee.disID}});I(de)}else I(Uh);s.solID?h(!0):h(!1)}else{const q=o||new Date,de=new Date,Ee=new Date(q.getFullYear(),q.getMonth(),q.getDate(),de.getHours(),de.getMinutes()),Ae=x.addHours(Ee,1);ae({titulo:"",fechaInicio:x.format(Ee,"yyyy-MM-dd"),horaInicio:x.format(Ee,"HH:mm"),fechaFin:x.format(Ae,"yyyy-MM-dd"),horaFin:x.format(Ae,"HH:mm"),horaInicio2:x.format(Ae,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:Wh[0],solID:null}),d(!1),h(!1)}},[s,e,o]);const We=q=>({UsuarioID:q.usrID??null,Correo:q.correo,EsOrganizador:q.usrID==i,StatusInvitacion:"PENDIENTE",disID:c??null}),qe=we(q=>{const de=M.map(Ae=>We(Ae)),Ee={...q,invitados:de};r(Ee,s?.eventoID),t(),ae(),d(!1)},q=>{console.log("Errores de validación:",q)});y.useEffect(()=>{j&&(ie("horaInicio","00:00"),ie("horaFin","23:59"))},[j,ie,ge]);const Ze=()=>{const q=ge("fechaInicio");if(q){const de=new Date(`${q}T00:00:00`),Ee=x.addDays(de,1);ie("fechaFin",x.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=ss(Ne,Be),de=ss(vt,pt);if(!q||!de||!x.isValid(q)||!x.isValid(de))return;const Ee=x.isSameDay(q,de),Ae=Ee&&(x.isAfter(q,de)||q.getTime()===de.getTime()),Fe=x.isBefore(de,q)&&!Ee;(Ae||Fe)&&(ie("horaFin",""),ue(""))},[Be,Ne]);const O=y.useMemo(()=>{if(!Be||!Ne)return eo;const q=ss(Ne,Be),de=ss(vt,"00:00");return!q||!de||!x.isValid(q)||!x.isValid(de)||x.isBefore(de,q)&&!x.isSameDay(de,q)?eo:x.isSameDay(q,de)?eo.filter(Ee=>{const Ae=ss(vt,Ee);return Ae&&x.isAfter(Ae,q)}):(x.isAfter(de,q),eo)},[Be,Ne,vt]),ne=y.useMemo(()=>eo,[]),Se=async q=>{const de=M.some(Yt=>Yt.correo===q.correo);if(U(!0),de)return;const Ee=c,Ae=q.correo,Fe=q.usrID,X=Ne,Me=Be,ke=pt;if(!Ee||!Ae||!X||!Me||!ke){I(Yt=>[...Yt,{...q,status:"pending",isHost:!1,hasConflict:!1,usrID:Fe,name:q.nombre}]);return}let je;try{je=await S.VerificarConflicto(Ee,Ae,X,Me+":00",ke+":00")}catch{je={tieneConflicto:!1,usrMail:q.correo}}const Gt=Array.isArray(je)?je[0]:je,er={...q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:String(Gt.tieneConflicto).toLowerCase()==="true"};if(er.tieneConflicto){const Yt=await S.getDisponibilidadUsuario(c,Ae,X,"60");ce(Yt)}I(Yt=>[...Yt,er])},Oe=q=>{I(de=>de.filter(Ee=>Ee.nombre!==q))},R=()=>{G(!1)},te=q=>{const Ae=(q.usrNombre??"").split(" ").map(Fe=>Fe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:q.usrNombre??"",correo:q.usrMail??"",iniciales:Ae,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(Ae=>Ae.usrID!==i&&!M.some(Fe=>Fe.correo===Ae.correo));$(Ee)})():$([])},[Q,M]);const _e=q=>{Y(q)},Ge=q=>{const{Fecha:de,HoraInicio:Ee,HoraFin:Ae}=q,Fe=X=>X.split(":").slice(0,2).join(":");ie("fechaInicio",de),ie("fechaFin",de),ie("horaInicio",Fe(Ee)),ie("horaFin",Fe(Ae)),d(!1),R(),console.log("Formulario actualizado con sugerencia:",{Fecha:de,HoraInicio:Ee,HoraFin:Ae})};return l.jsx(l.Fragment,{children:l.jsx(g.Modal,{open:e,onClose:t,children:l.jsx("form",{onSubmit:qe,children:l.jsxs(g.Box,{sx:qk,children:[l.jsx(g.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:l.jsx(Ur,{})}),l.jsx(g.Typography,{variant:"h6",mb:2,children:s?.isGoogleEvent||s?.isOutlookEvent?l.jsxs(l.Fragment,{children:[l.jsx(yk,{sx:{mr:1}}),s.titulo||"Evento de Google"]}):s?"Editar evento":"Agregar evento"}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(hr,{name:"titulo",control:me,render:({field:q})=>l.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"}}})})})}),l.jsxs("div",{className:`row g-2 ${u?"mb-1":"mb-2"}`,children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(hr,{name:"fechaInicio",control:me,render:({field:q})=>l.jsx(g.TextField,{fullWidth:!0,...q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!ee.fechaInicio,helperText:ee.fechaInicio?.message})})}),u?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-10 col-md-4",children:l.jsx(hr,{name:"fechaFin",control:me,render:({field:q})=>l.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&&l.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:l.jsx(g.IconButton,{onClick:()=>d(!1),sx:{fontSize:18},children:l.jsx(Ah,{})})})]}):l.jsx("div",{className:"col-md-8"})]}),u&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12 d-flex justify-content-center",children:l.jsx(Mh,{sx:{color:"#757575",my:1}})})}),l.jsxs("div",{className:"row g-2 mb-2",children:[l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(hr,{name:"horaInicio",control:me,render:({field:{onChange:q,value:de,...Ee}})=>l.jsx(g.Autocomplete,{freeSolo:!0,options:ne,value:de||"",onChange:(Ae,Fe)=>q(Fe||""),onInputChange:(Ae,Fe)=>q(Fe),renderInput:Ae=>l.jsx(g.TextField,{...Ae,...Ee,size:"small",error:!!ee.horaInicio,helperText:ee.horaInicio?.message,InputProps:{...Ae.InputProps,endAdornment:l.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(Tc,{})})}}),disabled:se})})}),!u&&l.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:ee.horaInicio?"5px":"0px"},children:l.jsx(Mh,{sx:{color:"#757575"}})}),u&&l.jsx("div",{className:"col-md-3 d-none d-md-block"}),l.jsx("div",{className:"col-12 col-md-4",children:l.jsx(hr,{name:"horaFin",control:me,render:({field:{onChange:q,value:de,...Ee}})=>l.jsx(g.Autocomplete,{freeSolo:!0,options:O,value:de||"",onChange:(Ae,Fe)=>q(Fe||""),onInputChange:(Ae,Fe)=>q(Fe),renderInput:Ae=>l.jsx(g.TextField,{...Ae,...Ee,size:"small",error:!!ee.horaFin,helperText:ee.horaFin?.message,InputProps:{...Ae.InputProps,endAdornment:l.jsx(g.InputAdornment,{position:"end",sx:{position:"absolute",right:"10px"},children:l.jsx(Tc,{})})}}),disabled:se})})}),!u&&l.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:l.jsx(hr,{name:"todoElDia",control:me,render:({field:q})=>l.jsx(g.FormControlLabel,{control:l.jsx(g.Checkbox,{checked:q.value,onChange:de=>q.onChange(de.target.checked)}),label:l.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&!u&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(g.Button,{onClick:Ze,size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(dk,{}),"  Agregar fecha final"]})})}),(!s?.isGoogleEvent||s?.isOutlookEvent)&&l.jsx("div",{className:"row mb-2",children:l.jsxs("div",{className:"col-12",children:[!f&&l.jsxs(g.Button,{onClick:()=>h(!0),size:"small",sx:{textTransform:"none",fontSize:16},children:[l.jsx(pk,{}),"  Vincular cliente"]}),f&&l.jsxs("div",{className:"row g-2",children:[l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(hr,{name:"client",control:me,render:({field:q})=>l.jsx(g.Autocomplete,{options:b,loading:C,loadingText:"Buscando coincidencias...",getOptionLabel:de=>de.nombreCliente?.trim()||"",value:b.find(de=>de.nombreCliente===q.value)||(q.value&&typeof q.value=="string"?{solID:-1,nombreCliente:q.value}:null),noOptionsText:D,onInputChange:(de,Ee)=>{p(Ee)},onChange:(de,Ee)=>{q.onChange(Ee?Ee.nombreCliente:"")},renderInput:de=>l.jsx(g.TextField,{...de,placeholder:"Buscar cliente...",size:"small",InputProps:{...de.InputProps,startAdornment:l.jsx("img",{src:Jd,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"5px"}}),endAdornment:l.jsxs(l.Fragment,{children:[C?l.jsx(g.CircularProgress,{color:"inherit",size:20}):null,de.InputProps.endAdornment]})}})})})}),l.jsx("div",{className:"col-10 col-md-5",children:l.jsx(hr,{name:"solID",control:me,render:({field:q})=>l.jsx(g.Autocomplete,{options:_,noOptionsText:"Sin resultados",getOptionLabel:de=>de.toString(),value:q.value??null,onChange:(de,Ee)=>q.onChange(Ee),renderInput:de=>l.jsx(g.TextField,{...de,label:"#Registro",variant:"outlined",size:"small",sx:{"& .MuiInputLabel-root":{backgroundColor:"transparent !important",padding:"0 !important"}}}),disabled:!b.length})})}),l.jsx("div",{className:"col-2 d-flex align-items-center",children:l.jsx(g.IconButton,{onClick:()=>h(!1),sx:{fontSize:18},children:l.jsx(Ah,{})})})]})]})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(hr,{name:"link",control:me,render:({field:q})=>l.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:l.jsx("img",{src:lk,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(hr,{name:"descripcion",control:me,render:({field:q})=>l.jsx(g.TextField,{...q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:l.jsx("img",{src:fk,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx($k,{onSelectGuest:Se,availableSuggestions:fe,onInputTextChange:_e})})}),oe&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(Vk,{guests:M,conflictCount:Ce,onViewSuggestions:()=>G(!0),onDeleteGuest:Oe})})}),s?.invitados&&s?.invitados?.length>0&&l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsx(g.Box,{children:l.jsx(Tk,{guests:M})})})}),l.jsx(jk,{open:V,handleClose:R,suggestions:N,onSelectSlot:Ge}),l.jsx("div",{className:"row mb-2",children:l.jsx("div",{className:"col-12",children:l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[l.jsx(uk,{}),Wh.map(q=>l.jsx(hr,{name:"color",control:me,render:({field:de})=>l.jsx(g.IconButton,{onClick:()=>de.onChange(q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:q,border:de.value===q?"2px solid":"none",borderColor:de.value===q?"primary.main":"transparent"}})},q))]})})}),l.jsx("div",{className:"row",children:l.jsxs("div",{className:"col-12 d-flex gap-2",style:{width:"100%",marginTop:"20px"},children:[s&&!s?.isGoogleEvent&&!s?.isOutlookEvent&&l.jsx(g.Button,{onClick:n,variant:"outlined",startIcon:l.jsx("img",{src:Th,width:15}),sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),l.jsx(g.Button,{onClick:t,variant:"outlined",sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",color:"#1976D2",borderColor:"#1976D2","&:hover":{backgroundColor:"rgba(25, 118, 210, 0.04)",borderColor:"#115293"}},children:"Cancelar"}),l.jsx(g.Button,{onClick:qe,variant:"contained",disabled:!le,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]})})})})},Kk={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"},Qk=({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 l.jsx(g.Modal,{open:e,onClose:t,children:l.jsxs(g.Box,{sx:Kk,children:[l.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[l.jsxs(g.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),l.jsx(g.IconButton,{onClick:t,size:"small",children:l.jsx(Ur,{})})]}),l.jsx(g.Divider,{}),l.jsx(g.List,{sx:{mt:1},children:r.map(a=>{const c=i(a);return l.jsx(g.ListItem,{disablePadding:!0,sx:{mb:1},children:l.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:l.jsxs(g.Box,{sx:{flexGrow:1},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[l.jsx(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),l.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),l.jsx(g.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${x.format(a.fechaInicio,"HH:mm")} - ${x.format(a.fechaFin,"HH:mm")}`})]})})},a.eventoID)})})]})})};var is={},Hh;function Xk(){if(Hh)return is;Hh=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:"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"),is}var Jk=Xk();const e3=it(Jk);var as={},Vh;function t3(){if(Vh)return as;Vh=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:"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"),as}var r3=t3();const n3=it(r3),o3="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",s3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAALVBMVEVHcEzfEBfjCxzkChvkChvkChzkCxvlChv////96uv60dT1o6ryho/mGyvkCxypwAsrAAAACHRSTlMAECtdiKDJ5DEbuTIAAAHoSURBVHjatdlbjsMgDAVQ87JJKHf/y51pf9CIp+vJ/SzSkUloAZc2cSEkFgEAYU7RO/o+zkdBF07hO9QnwSzJq4uLgmUkGDgzGTrORHrGcZLXlmcvMkKZaJxuH/YLTwB9ZCo6AUyivb4m7uuziwxDeLtezKsnwJiwfCH2x5hgDi8mbJ+0APaI6wo0Ju4KrIBqQNyqwFqufL3qYOD1O1DqqkQZeVd+567dwJ3fuUai0Cceg5Scm9h5v3lhED9fgzk3ceTlC4Ok+YxzLzbvk+lrCRjl6sTmzSuEn80Yr9yJzZs+Q6Tp72C9/4jdRwXDCJEDTsQzD3DkcSaeeQgUcSZuvAYmnIlnHhIxVqLWAxNjKSo9CAl0YsEGBFRiwSYEhdh5dvCuBrB5GlH3UvaikOw8ncjbha0UeffV04qJwplX7jMxUjjzUM9ET+7Mw6HoiOTIOxR5ehYunXe8SfndNlpwvo2G2XWidl4nYhQ3PYpczVMfRfxqoy9QHZbWx7nm9eK9OM5RnB84h8VPTqJA6G55toj5WtYX+K8lypMXH2KYkx64PD55vbVfwJ9pEZgfo70tYm/c2FtLds/eTHu23WdvSG7jk2a6zzV17aRER4oEUXDm1r0kT18lJB5o5n8sErN8JOEUtv9U/ACrTv/qOzhclQAAAABJRU5ErkJggg==",el=y.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=xs.useSnackbar(),s={success:{color:"#fff",icon:l.jsx("img",{width:25,src:o3,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:l.jsx(e3,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:l.jsx(n3,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:l.jsx("img",{src:Th,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:l.jsx("img",{src:s3,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},i=s[r]||s.info;return l.jsx(xs.SnackbarContent,{ref:n,children:l.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:[l.jsx(g.Box,{sx:{mr:1.5},children:i.icon}),l.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),l.jsx(g.IconButton,{size:"small",onClick:()=>o(e),children:l.jsx(Ur,{fontSize:"small"})})]})})}),Yh=y.createContext(void 0),i3=({children:e})=>{const[t,r]=y.useState([]),[n,o]=y.useState([]),[s,i]=y.useState(!1);return l.jsx(Yh.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:s,setIsLoadingGoogleEvents:i},children:e})},a3=()=>{const e=y.useContext(Yh);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},c3=(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(l3(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 l3(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 u3(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 d3=(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(u3(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}},qh="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",f3="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%3e%3cpath%20fill='%23fff'%20d='M20.36%204.14H16c0-1.65-1.35-3-3-3h-2c-1.65%200-3%201.35-3%203H3.64c-.55%200-1%20.45-1%201s.45%201%201%201h1.04l.84%2013.91a3%203%200%200%200%202.99%202.82h6.98c1.58%200%202.9-1.24%203-2.82l.84-13.91h1.04c.55%200%201-.45%201-1s-.45-1-1-1zm-9.36-1h2c.55%200%201%20.45%201%201h-4c0-.55.45-1%201-1m-.39%2014.9c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201zm4.78%200c0%20.55-.45%201-1%201s-1-.45-1-1V9.99c0-.55.45-1%201-1s1%20.45%201%201z'/%3e%3c/svg%3e",p3=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:s,confirmText:i,confirmColor:a="#d32f2f",loading:c=!1})=>l.jsxs(g.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[l.jsx(g.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:l.jsx(g.IconButton,{onClick:t,size:"small",children:l.jsx(Ur,{fontSize:"small"})})}),l.jsxs(g.DialogContent,{sx:{textAlign:"center",pt:0},children:[l.jsx(g.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:s}),l.jsx(g.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),l.jsx(g.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),l.jsxs(g.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[l.jsx(g.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),l.jsxs(g.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[i=="Eliminar"&&l.jsx("img",{src:f3,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":i]})]})]})]}),h3=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o})=>{const[s,i]=y.useState(new Date),[a,c]=y.useState([]),[u,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}=xs.useSnackbar(),S=Ac(),_=Ii(),W=wc(),[D,A]=y.useState(!1),[M,I]=y.useState([]),[V,G]=y.useState(null),{session:F,sessionoutlook:Y}=cc(),{googleEvents:oe,setGoogleEvents:U,outlookEvents:N,setOutlookEvents:ce}=a3(),[fe,$]=y.useState([]),[Q,Ce]=y.useState([]),[me,we]=y.useState([]),[ae,ee]=y.useState(!1),[le,ge]=y.useState([]),[ie,pe]=y.useState(),Re=(X,Me)=>{I(X),G(Me),A(!0)},j=async()=>{if(e===void 0)return;const X=await S.getNotificacionesXUsuario(e,!1);ge(X)};y.useEffect(()=>{const X=new Date,Me=x.startOfDay(X),ke=x.endOfDay(x.addDays(Me,6)),je={start:Me,end:ke},Gt=a.filter(er=>{const Yt={start:er.fechaInicio,end:er.fechaFin};return Ud(Yt,je)}).sort((er,Yt)=>er.fechaInicio.getTime()-Yt.fechaInicio.getTime());C(Gt)},[a]),y.useEffect(()=>{const X=async()=>{try{if(e){const ke=await S.getEventsByUser(e);j(),c(ke)}}catch(ke){console.log("Error al cargar eventos locales:",ke)}};X();const Me=setInterval(X,4e3);return()=>clearInterval(Me)},[e]),y.useEffect(()=>{if(!n||!e)return;const X=[...a];if(oe.length>0&&F?.userEmail){const Me=oe.map(ke=>c3(ke,n,e));X.push(...Me)}if(N.length>0&&Y?.userEmail){const Me=N.map(ke=>d3(ke,n,e));X.push(...Me)}$(X)},[a,oe,N,n,e,F?.userEmail,Y?.userEmail]);const We=async X=>{try{if(X?.isGoogleEvent||X.isOutlookEvent)h(X),d(!0);else{const Me=await S.getEventById(X.eventoID);h(Me),d(!0)}}catch(Me){console.error(Me)}},qe=()=>{d(!1),h(null)},Ze=async(X,Me)=>{let ke,je;X.todoElDia?(ke=new Date(`${X.fechaInicio}T${X.horaInicio}`),je=new Date(`${X.fechaInicio}T${X.horaFin}`)):(ke=new Date(`${X.fechaInicio}T${X.horaInicio}`),je=X.fechaFin&&X.horaFin?new Date(`${X.fechaFin}T${X.horaFin}`):new Date(`${X.fechaInicio}T${X.horaFin}`));const Gt=x.format(ke,"yyyy-MM-dd HH:mm:ss.SSS"),er=x.format(je,"yyyy-MM-dd HH:mm:ss.SSS");if(Me){const Vr={...X,eventoID:Me,fechaInicio:Gt,fechaFin:er,solID:X.solID??null,disID:n??null,client:X.client,invitados:X.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(Vr);var Yt=a.map(wr=>wr.eventoID===Ke.eventoID?Ke:wr);c(Yt),E("El evento se ha actualizado correctamente.",{variant:"success"}),qe()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Vr={...X,fechaInicio:Gt,fechaFin:er,todoElDia:X.todoElDia,solID:X.solID??null,disID:n??null,client:X.client,invitados:X.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(Vr,e);c(wr=>[...wr,Ke]),E("El evento se ha creado con éxito",{variant:"success"}),qe()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e){const Vr=await S.getEventsByUser(e);c(Vr)}},Ne=()=>{i(X=>new Date(X.getFullYear(),X.getMonth()-1,1))},Be=()=>{i(X=>new Date(X.getFullYear(),X.getMonth()+1,1))},vt=()=>{de("ELIMINAR")},pt=()=>{de("RECHAZAR")},k=()=>{b(new Date),d(!0)},P=X=>{X&&i(X)},B=X=>{b(X),d(!0),h(null)},ue=async()=>{if(f)try{await S.deleteEvent(f.eventoID),c(a.filter(X=>X.eventoID!==f.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(X,Me)=>l.jsx(el,{id:X,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 _.getGoogleCalendars(F.userEmail,n)).map(je=>({...je,selected:!0}));Ce(Me);const ke=Me.map(je=>je.id);Oe(ke)}catch(X){console.error("Error Google Cals:",X)}finally{ee(!1)}}},O=async X=>{const Me=Q.map(je=>je.id===X?{...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 W.getOutlookCalendars(Y.userEmail,n)).map(je=>({...je,selected:!0}));we(Me);const ke=Me.map(je=>je.id);R(ke)}catch(X){console.error("Error Outlook Cals:",X)}finally{ee(!1)}}},Se=async X=>{const Me=me.map(je=>je.id===X?{...je,selected:!je.selected}:je);we(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 X=>{if(!F?.userEmail||!n)return;const Me=X||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 _.getGoogleEventsByMonth(ke);U(je)}catch(ke){console.error("Error al obtener eventos de Google:",ke)}},R=async X=>{if(!Y?.userEmail||!n)return;const Me=X||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 W.getOutlookEventsByMonth(ke);ce(je)}catch(ke){console.error("Error al obtener eventos de Outlook:",ke)}};if(n===void 0||e===void 0)return l.jsx("div",{children:"Cargando configuración de usuario..."});const te=async(X,Me)=>{await S.UpdateStatusEvento(X.evento.eventoID,e,Me)&&(await S.MarcarLeido(X.notificacionID,e),E(X?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},_e=async()=>{ie&&S.UpdateStatusEvento(ie.evento.eventoID,e,"RECHAZADA")&&(await S.MarcarLeido(ie.notificacionID,e),await S.MarcarLeido(ie.notificacionID,e),E("Haz rechazado la Invitación a "+ie?.evento?.titulo,{content:(Me,ke)=>l.jsx(el,{id:Me,message:String(ke),variant:"rechazar"})}),Ee())},Ge=async(X,Me)=>{try{if(!e)return;pe(X),Me=="RECHAZADA"?(pt(),console.log("noti",X)):te(X,Me)}catch{E("Error al procesar la invitación",{variant:"error"})}},[q,de]=y.useState(null),Ee=()=>de(null),Ae={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:l.jsxs(l.Fragment,{children:["Estás a punto de declinar la invitación de ",l.jsx("strong",{children:ie?.evento?.nombreAnfitrion})," a ",l.jsx("strong",{children:ie?.evento?.titulo})]}),icon:l.jsx("img",{src:qh}),action:()=>ie&&_e()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:l.jsx("img",{src:qh}),action:()=>ue()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>ue}},Fe=q?Ae[q]:null;return l.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[l.jsx(dy,{header:l.jsx(I2,{currentDate:s,onPrevMonth:Ne,onNextMonth:Be,onAddEvent:k,onDateChange:P}),sidebar:l.jsx(lw,{onEventClick:We,upcomingEvents:w,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:k,googleCalendars:Q,outlookCalendars:me,isLoadingCalendars:ae,onToggleGoogle:O,onToggleOutlook:Se,notifications:le,unreadCount:le?.filter(X=>!X.leida).length,onAceppInvitacion:Ge}),mainContent:l.jsx(Sw,{onSeeMoreClick:Re,currentDate:s,events:fe,onDayClick:B,onEventClick:We})}),u&&l.jsx(Gk,{isVisible:u,onClose:qe,onSave:Ze,onDelete:vt,selectedDate:p,initialEvent:f,userId:e,masNombreBD:o,disId:n}),l.jsx(Qk,{isOpen:D,onClose:()=>A(!1),events:M,date:V,onEventClick:We}),Fe&&l.jsx(p3,{open:!!q,onClose:Ee,onConfirm:()=>{Fe.action()},title:Fe.title,description:Fe.description,icon:Fe.icon,confirmText:Fe.confirmText})]})},m3="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",g3="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 tl(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function v3(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 rl(e,t,r=!0){return typeof e=="function"?e(t):e??r}function y3(e){return e.replace(/[^\d]/g,"")}function b3(e,t){return t}var cs={},Zh;function x3(){if(Zh)return cs;Zh=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:"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"),cs}var _3=x3();const w3=it(_3);var ls={},Gh;function S3(){if(Gh)return ls;Gh=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:"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"),ls}var C3=S3();const E3=it(C3);var us={},Kh;function D3(){if(Kh)return us;Kh=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:"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z"}),"KeyboardArrowDown"),us}var k3=D3();const A3=it(k3);var ds={},Qh;function T3(){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:"M7.41 15.41 12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp"),ds}var I3=T3();const M3=it(I3);function Xh(e){return e==="right"?"end":e==="center"?"center":"start"}function Jh(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 P3=1060,nl=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function O3({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=P3,getDetailColumns:o,onRowClick:s}){function c(d){if(typeof d=="number")return d;if(!d)return 0;const f=/^(\d+)\s*px$/.exec(d.trim());return f?Number(f[1]):/fr$/i.test(d)?160:0}function u(d){const f=d.reduce((m,p)=>m+c(p.width),0),h=Math.max(d.length-1,0)*16;return f+h+32}return l.jsx(g.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:l.jsxs(g.Box,{children:[l.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=>l.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,u(p));return l.jsxs(g.Box,{children:[l.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:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[l.jsx(g.IconButton,{size:"small",disableRipple:!0,children:h?l.jsx(M3,{}):l.jsx(A3,{})}),l.jsx(g.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(d.title),children:d.title})]}),l.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:nl(d,"En Proceso")}),l.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:nl(d,"Finalizadas")}),l.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:nl(d,"Último seg.")})]}),l.jsx(g.Collapse,{in:h,unmountOnExit:!0,children:l.jsxs(g.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[l.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Jh(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=>l.jsx(g.Typography,{sx:{justifySelf:Xh(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)=>l.jsx(g.Box,{sx:{minWidth:b,display:"grid",gridTemplateColumns:Jh(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 _=E.accessor?E.accessor(w,C):E.field?w[E.field]:null;return l.jsx(g.Box,{sx:{justifySelf:Xh(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof _=="string"||typeof _=="number"?l.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(_),children:_}):_},E.key??S)})},w.id??C))]})})]},d.id)})]})})}var fs={},e0;function j3(){if(e0)return fs;e0=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.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"),fs}var R3=j3();const N3=it(R3),$3=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",L3=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},z3=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var ps={},t0;function B3(){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:"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"),ps}var F3=B3();const W3=it(F3),ol=({current:e=0,total:t=0,color:r="#4caf50"})=>l.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)=>l.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var hs={},r0;function U3(){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:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),hs}var H3=U3();const n0=it(H3),V3=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"}},Y3=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}},q3=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}},Z3=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 G3(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 K3(e){return e.replace(/<br\s*\/?>/gi,`
178
178
  `).replace(/\r\n/g,`
179
179
  `).replace(/\r/g,`
180
180
  `)}const Q3={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"]},X3={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"]},J3={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function eA(e,t){switch(e){case"pruebas":return q3(t)??"—";case"servicio":return Z3(t)??"—";case"nuevos":case"seminuevos":default:return Y3(t)??"—"}}function tA({open:e,onClose:t,customer:r,fields:n=[],header:o,extraSections:s,normalTable:i,normalTableColumns:a=[],history:c=[],advisorHistory:u=[],onRequestEdit:d,searchFilter:f,urlsQA:h,solicitudesNuevos:v=[],solicitudesPrueba:m=[],solicitudesServicio:p=[],solicitudesSeminuevos:b=[],onCreateSolicitud:w,isCrmMode:C=!1,onSolicitudBaseUrl:E,onIframeClose:S,reloadInfo:_,idAdminSistemas:W}){if(!r)return null;const D=3,[A,M]=y.useState(null),I=!!A,[V,G]=y.useState(!1),[F,Y]=y.useState(null),[oe,U]=y.useState(c??[]),[N,ce]=y.useState(null),fe=y.useMemo(()=>[...u].sort((L,J)=>new Date(J.FechaAsignacion).getTime()-new Date(L.FechaAsignacion).getTime()),[u]);y.useEffect(()=>{c&&c.length&&U(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"),we=L=>{const J=L||"",be=J.split(" ").filter(Boolean);return be.length>=2?(be[0][0]+be[1][0]).toUpperCase():(J[0]||"?").toUpperCase()},ae=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(J=>{const be=ae(J);return be!=null&&String(be)===String(F)})},[ee,N,F]),ge=y.useMemo(()=>[...le].sort((L,J)=>new Date(J.fecAlta).getTime()-new Date(L.fecAlta).getTime()),[le]),[ie,pe]=y.useState(!1),Re=y.useMemo(()=>ie?ge:ge.slice(0,D),[ie,ge]),j=Math.max(ge.length-D,0),We=L=>String(L??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),qe=(L,J)=>We(JSON.stringify(L)).includes(We(J)),Ze=(L,J)=>f?f(L,J):qe(L,J),Ne=(L,J)=>{const be=We(J).split(/\s+/).filter(Boolean);return be.length?be.every(Ie=>Ze(L,Ie)):!0},[Be,vt]=y.useState(""),[pt,k]=y.useState([]);y.useMemo(()=>i??[],[i]),y.useMemo(()=>{const L=Be.trim();return L?(i??[]).filter(J=>Ne(J,L)):i??[]},[i,Be]);const P=g.useTheme(),B=g.useMediaQuery(P.breakpoints.down("md")),[ue,se]=y.useState(""),[O,ne]=y.useState(!0),[Se,Oe]=y.useState(!1),R=new Date().toISOString().slice(0,10),te=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[_e,Ge]=y.useState(te),[q,de]=y.useState(R),[Ee,Ae]=y.useState(null),Fe=!!Ee,[X,Me]=y.useState("En Proceso"),[ke,je]=y.useState("Todos"),[Gt,er]=y.useState("Todos"),Yt=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],Vr=["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),de(R),Me("Todos"),je("Todos"),er("Todos")},wr=y.useMemo(()=>(ue??"").trim()!==""||X!=="Todos"||ke!=="Todos"||O||Se||Gt!=="Todos",[ue,X,ke,O,Se,Gt]);function An(L){if(!L)return"";const J=new Date(L);if(isNaN(J.getTime()))return"";const be=String(J.getDate()).padStart(2,"0"),Ie=String(J.getMonth()+1).padStart(2,"0"),At=String(J.getFullYear()).slice(-2);return`${be}/${Ie}/${At}`}function na(L){const J=L?new Date(L):null;return J&&!isNaN(J.getTime())?J:null}function cl(L,J){let be=null;for(const Ie of L){const At=na(J(Ie));if(At){const St=At.getTime();(be===null||St>be)&&(be=St)}}return be?new Date(be):null}function ys(L){const J=cl(L,be=>be.UltimoSeguimiento||be.FechaCita);return J?An(J.toISOString()):"—"}function bs(L){const J=(L??"").toLowerCase().trim();return J==="sin venta"||J==="con venta"||J==="rechazada"||J==="rechazadas"}function oa(L){return L.filter(J=>bs(J.EstatusDescripcion)).length}function sa(L){return L.filter(J=>!bs(J.EstatusDescripcion)).length}const ll=({progress:L,color:J})=>{if(!L)return l.jsx(ol,{current:0,total:0,color:J});const be=L.split("/").map(Number);if(be.length!==2||be.some(St=>Number.isNaN(St)))return l.jsx(ol,{current:0,total:0,color:J});const[Ie,At]=be;return l.jsx(ol,{current:Ie,total:At,color:J})};function ia(L){return[{key:"fecha",header:"Fecha",accessor:J=>An(J.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:J=>l.jsx(g.Tooltip,{title:J.Vehiculo??"",placement:"top",arrow:!0,children:l.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:J.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:J=>l.jsx(g.Typography,{sx:{fontWeight:800,fontSize:13},children:eA(L,J.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:J=>{const{bg:be,color:Ie}=V3(J.NivelInteres);return l.jsx(g.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:be,color:Ie,fontSize:12,fontWeight:J.NivelInteres?800:500},children:J.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:J=>{const be=(J.Asesor??"").trim(),Ie=ul=>{if(!ul)return"";const EA=ul[0]?.toUpperCase()??"",DA=ul[1]?.toLowerCase()??"";return`${EA}${DA}`};if(!be)return l.jsx(g.Tooltip,{title:"",placement:"top",children:l.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const At=be.split(/\s+/),St=At[0]??"",Pr=At[1]??"",Sr=Ie(St),Tn=Ie(Pr),CA=`${Sr}${Tn}`||"—";return l.jsx(g.Tooltip,{title:be,placement:"top",children:l.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:CA})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:J=>J.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:J=>l.jsx(g.Tooltip,{title:J.Actividad??"",placement:"top",arrow:!0,children:l.jsxs(g.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[J.Icon&&l.jsx("span",{style:{color:"#fff",backgroundColor:J.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:l.jsx("i",{className:J.Icon})}),l.jsx(g.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(J.Actividad??"").length?"default":"inherit"},children:J.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:J=>l.jsx(ll,{progress:J.Avance,color:J.Color}),width:200,align:"left"}]}function T(L){const be=ia(L).slice(1);return[{key:"fecha",header:"Fecha",accessor:Ie=>An(Ie.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Ie=>An(Ie.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Ie=>Ie.HoraCita??"—",width:110},...be]}function re(L){const J=L.kind;switch(J){case"pruebas":case"servicio":return T(J);case"nuevos":case"seminuevos":default:return ia(J)}}function ye(L,J,be,Ie){return{id:L,kind:be,title:J,metrics:[{label:"En Proceso",value:sa(Ie)},{label:"Finalizadas",value:oa(Ie)},{label:"Último seg.",value:ys(Ie)}],rows:Ie,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(),J=(be,Ie)=>{if(L&&!(be.Vehiculo??"").toLowerCase().includes(L))return!1;const At=Se?be.FechaCita:be.Fecha;if(O&&At){const St=na(At??"");if(!St)return!1;const Pr=_e?new Date(`${_e}T00:00:00`):null,Sr=q?new Date(`${q}T00:00:00`):null;if(Sr&&Sr.setDate(Sr.getDate()+1),Pr&&St<Pr||Sr&&St>=Sr)return!1}if(X!=="Todos"){const St=(be.EstatusDescripcion??"").toLowerCase();if(!(Q3[X]??[]).some(Tn=>St===Tn.toLowerCase()))return!1}if(ke!=="Todos"){const St=(be.Actividad??"").toLowerCase();if(!(X3[ke]??[]).some(Tn=>St===Tn.toLowerCase()))return!1}if(Gt!=="Todos"){const St=(be.NivelInteres??"").toLowerCase();if(!(J3[Gt]??[]).some(Tn=>St===Tn.toLowerCase()))return!1}return!0};return Pe.map(be=>{const Ie=(be.rows??[]).filter(St=>J(St,be.kind)),At=[{label:"En Proceso",value:sa(Ie)},{label:"Finalizadas",value:oa(Ie)},{label:"Último seg.",value:ys(Ie)}];return{...be,rows:Ie,metrics:At}})},[Pe,ue,O,_e,q,Se,X,ke,Gt]),lt={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},Ye=(L,J)=>{const be=L.SolID;if(!be)return;const Ie=J.kind,At=lt[Ie]??"cotizaciones",St=h?`https://qa2.crm.netcar.com.mx/netcar/${At}/${be}`:`https://crmxs.netcar.com.mx/netcar/${At}/${be}`,Pr=E?.({row:L,section:J,slug:At,solId:be,baseUrl:St});if(!C){const Sr=Pr??St;Y(be),ce(Sr),G(!0)}},Ue=()=>{S?.(r),Y(null),ce(null),G(!1)},Ht=y.useRef(!1),mt=y.useRef(null),Pt=y.useCallback(()=>{if(!Ht.current){Ht.current=!0;return}mt.current&&window.clearTimeout(mt.current),mt.current=window.setTimeout(()=>{_?.(r)},500)},[_,r]);return y.useEffect(()=>{Ht.current=!1,mt.current&&window.clearTimeout(mt.current)},[N,F]),l.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:l.jsxs(g.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[l.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:[l.jsxs(g.Box,{children:[l.jsx(g.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:l.jsxs(g.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[l.jsx(g.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:l.jsx(g.Box,{sx:{flex:1,minWidth:0,pr:1},children:l.jsxs(g.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[Q(r)," ",l.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:l.jsx(W3,{sx:{fontSize:"1em"}})})]})})}),Ce.map((L,J)=>l.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,l.jsx(g.Typography,{variant:"body2",sx:{color:L.inLink?"#336BE1":"#070C10"},style:{},children:L.value(r)})]},J))]})}),l.jsx(g.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((L,J)=>{const be=L.label?.toLowerCase().startsWith("asesor");return l.jsxs(g.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[l.jsx(g.Box,{sx:{width:"50%"},children:l.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:L.label})}),l.jsxs(g.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[l.jsx("div",{children:L?.avatar?L.avatar(r):null}),l.jsx(g.Typography,{variant:"body2",color:"textPrimary",children:L?.value(r)}),be&&!W&&l.jsx(g.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:l.jsx(g.IconButton,{size:"small",onClick:Ie=>M(Ie.currentTarget),sx:{ml:.5},disableRipple:!0,children:l.jsx(N3,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},J)})}),l.jsx(g.Divider,{sx:{my:2}})]}),l.jsx(g.Box,{px:2.5,pb:.5,children:l.jsxs(g.Typography,{children:[l.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!N&&" por solicitud",":"]})}),l.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&&l.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),l.jsxs(g.Box,{children:[Re?.map((L,J)=>{const be=me(L),Ie=K3(L.comentario||"");return l.jsxs(g.Box,{sx:{pb:1.5},children:[l.jsxs(g.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[l.jsx(g.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:L.tipo||"Evento"}),l.jsx(g.Chip,{size:"small",label:L.auto!=null?`${L.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Ie?l.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Ie}):null,l.jsxs(g.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[L?.ImgAsesor!=null?l.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:we(be),src:L?.ImgAsesor}):l.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:we(be)}),l.jsxs(g.Stack,{spacing:0,children:[l.jsx(g.Typography,{variant:"body2",fontWeight:600,children:be}),l.jsx(g.Typography,{variant:"caption",color:"text.secondary",children:G3(L.fecAlta)})]})]}),J<Re.length-1&&l.jsx(g.Divider,{sx:{mt:1.25}})]},L.segID??J)}),ge.length>D&&l.jsx(g.Box,{sx:{mt:1},children:l.jsx(g.Button,{onClick:()=>pe(L=>!L),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:ie?"Ver menos":`Ver más (${j})`})})]})]}),l.jsx(g.Menu,{anchorEl:A,open:I,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:l.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[l.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"}),l.jsxs(g.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[fe.length===0&&l.jsx(g.Box,{sx:{px:1.5,py:1},children:l.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),fe.map((L,J)=>{const be=L3(L),Ie=$3(L.FechaBaja??L.FechaAsignacion);return l.jsx(g.Box,{sx:{px:1,py:.75},children:l.jsxs(g.Stack,{direction:"row",alignItems:"center",spacing:1,children:[l.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:L?.ImgAsesor??void 0,children:z3(be)}),l.jsx(g.Box,{sx:{flex:1,minWidth:0},children:l.jsx(g.Typography,{variant:"body2",noWrap:!0,children:be})}),l.jsx(g.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Ie})]})},J)})]})]})})]}),V?l.jsxs(g.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[l.jsx(g.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:l.jsx(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:l.jsx(g.Button,{onClick:Ue,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:l.jsx($h,{fontSize:"medium"})})})}),N&&l.jsx("iframe",{src:N,width:"100%",height:"100%",onLoad:Pt,style:{border:0}})]}):l.jsxs(g.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[l.jsx(g.Box,{sx:{mt:{xs:1.5,md:3}},children:l.jsxs(g.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[l.jsx(g.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),l.jsxs(g.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[l.jsxs(g.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[l.jsx(g.TextField,{size:"small",placeholder:"Buscar por vehículo",value:ue,onChange:L=>se(L.target.value),InputProps:{endAdornment:l.jsx(E3,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),l.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[l.jsxs(g.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[l.jsx(g.FormControlLabel,{label:l.jsx(g.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:l.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}}}),l.jsx(g.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),l.jsxs(g.Stack,{direction:"row",spacing:1,children:[l.jsx(g.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:_e,onChange:L=>Ge(L.target.value),disabled:!O,sx:{width:170}}),l.jsx(g.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:q,onChange:L=>de(L.target.value),disabled:!O,sx:{width:170}})]})]}),l.jsx(g.IconButton,{onClick:L=>Ae(L.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:l.jsx(w3,{})}),wr&&l.jsx(g.Button,{variant:"outlined",onClick:Ke,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),l.jsx(g.Tooltip,{title:wr&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!wr,children:l.jsx("span",{children:l.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:[l.jsx(n0,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!wr&&"Crear Solicitud"]})})})]}),l.jsx(O3,{sections:Qe,detailColumns:[],getDetailColumns:re,onRowClick:Ye})]})]})}),l.jsx(g.Menu,{anchorEl:Ee,open:Fe,onClose:()=>Ae(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:l.jsxs(g.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[l.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),l.jsxs(g.Box,{children:[l.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),l.jsx(g.RadioGroup,{value:X,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=>l.jsx(g.FormControlLabel,{value:L,control:l.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),l.jsxs(g.Box,{children:[l.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),l.jsx(g.RadioGroup,{value:ke,onChange:(L,J)=>je(J),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Vr].map(L=>l.jsx(g.FormControlLabel,{value:L,sx:{alignItems:"start"},control:l.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]}),l.jsxs(g.Box,{children:[l.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),l.jsx(g.RadioGroup,{value:Gt,onChange:(L,J)=>er(J),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Yt].map(L=>l.jsx(g.FormControlLabel,{value:L,control:l.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:L},L))})]})]})})]})]})})}const o0={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function s0(e,t,r){const{fields:n,order:o=["nombreCliente","email","acciones"],header:s={},cells:i={},hide:a={},actions:c}=t,u=c??{},d=u.show??{},f=u.handlers??{},h=u.accessors??{},v=u.icons??{},m=u.className??"d-flex flex-row gap-2 align-items-center ",p=u.tooltip??{},b=v.view??l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[l.jsx("path",{d:"M18.6,6.3c-3.9-3-9.3-3-13.2,0-1.9,1.5-3.2,3.5-3.9,5.7.7,2.3,2,4.3,3.9,5.7,1.9,1.5,4.2,2.3,6.6,2.3,2.4,0,4.7-.8,6.6-2.3,1.9-1.5,3.2-3.5,3.9-5.7-.7-2.3-2-4.3-3.9-5.7ZM17.2,12.1c0,2.9-2.5,5.3-5.4,5.2-2.9,0-5.3-2.5-5.2-5.4,0-2.9,2.5-5.3,5.4-5.2,2.9,0,5.3,2.4,5.2,5.3,0,0,0,0,0,0Z"}),l.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),w={nombreCliente:{key:"nombreCliente",header:s.nombreCliente??"Cliente",accessor:I=>I[n.nombreCliente],cell:i.nombreCliente,width:190},email:{key:"email",header:s.email??"Correo",accessor:I=>I[n.email],cell:i.email??(I=>{const V=String(I[n.email]??"");return V?l.jsx("a",{href:`mailto:${V}`,children:V}):l.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:i.acciones??(I=>{const V=rl(d.whatsapp,I,!0),G=rl(d.email,I,!0),F=rl(d.view,I,!0),Y=h.phone?.(I),oe=h.email?.(I),U=fe=>{if(fe.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(I);if(!Y)return;const $=h.countryCode??"52",Q=y3(String(Y));typeof window<"u"&&window.open(`https://wa.me/${$}${Q}`,"_blank")},N=fe=>{if(fe.stopPropagation(),f.onEmail)return f.onEmail(I);oe&&typeof window<"u"&&(window.location.href=`mailto:${oe}`)},ce=fe=>{fe.stopPropagation(),f.onView&&f.onView(I)};return l.jsxs("div",{className:m,children:[V&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:U,style:{width:24,height:24},children:l.jsx("img",{src:m3,alt:"WhatsApp"})}),G&&l.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:N,style:{width:24,height:24},children:l.jsx("img",{src:g3,alt:"Email"})}),F&&l.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(I=>!!I),E=(e??[]).filter(I=>!!I?.key),S=new Map;for(const I of C)S.set(String(I.key),I);for(const I of E)S.set(String(I.key),I);const _=[...C.map(I=>String(I.key)),...E.map(I=>String(I.key))],W=Array.from(new Set(o.map(I=>String(I)).filter(I=>S.has(I)))),D=_.filter(I=>!W.includes(I)),A=[...W,...D],M="acciones";if(S.has(M)){const I=A.filter(V=>V!==M);A.splice(0,A.length,...I,M)}return A.map(I=>S.get(I))}function rA(e){const{rows:t,columns:r,clientSort:n=!0,urlsQA:o=!0,defaultSort:s,minWidth:i=1100,rowKey:a=b3,haveOpenDetailFor:c=!0,defaults:u,detailConfig:d,normalTable:f,onRowClick:h,activityHistory:v,advisorHistory:m,forceOpenDetailFor:p,closeDetailFor:b,onRequestEdit:w,searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:_,solicitudesSeminuevos:W,onCreateSolicitud:D,isCrmMode:A,onSolicitudBaseUrl:M,onIframeClose:I,reloadInfo:V,idAdminSistemas:G=!1}=e,[F,Y]=y.useState(s??null),[oe,U]=y.useState({open:!1,customer:null}),[N,ce]=y.useState([]),fe=ae=>{U({open:!0,customer:ae})},$=ae=>{c&&(h?.(ae),U({open:!0,customer:ae}))},Q=()=>{U({open:!1,customer:null}),b?.()},Ce=y.useMemo(()=>u?s0(r??[],u):s0(r??[],{fields:{},order:[]}),[r,u]),me=y.useMemo(()=>{if(!n||!F)return t;const ae=Ce.find(le=>le.key===F.key);if(!ae)return t;const ee=[...t];return ee.sort((le,ge)=>{const ie=tl(ae,le,0),pe=tl(ae,ge,0),Re=v3(ie,pe);return F.direction==="asc"?Re:-Re}),ee},[t,Ce,F,n]),we=y.useMemo(()=>{const ae=d?.getCustomerId;return ee=>{const le=ae?.(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 ae=we(oe.customer);if(!ae)return;const ee=(t??[]).find(le=>we(le)===ae);ee&&ee!==oe.customer&&U(le=>({...le,customer:ee}))},[t,oe.open,oe.customer,we]),y.useEffect(()=>{p&&fe(p)},[p]),l.jsxs("div",{children:[l.jsx("div",{className:`${o0.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:l.jsx("div",{className:`${o0.tableResponsive} table-responsive`,children:l.jsxs("table",{className:"table table-hover align-middle mb-0",children:[l.jsx("thead",{children:l.jsx("tr",{children:Ce.map(ae=>l.jsx("th",{style:{fontWeight:600,width:ae.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ae.align??"left"},children:ae.header},ae.key))})}),l.jsx("tbody",{children:me.map((ae,ee)=>l.jsx("tr",{onClick:()=>$?.(ae),role:"button",tabIndex:0,onKeyDown:le=>{(le.key==="Enter"||le.key===" ")&&$?.(ae)},style:{cursor:"pointer"},children:Ce.map((le,ge)=>{const ie=le.Component?l.jsx(le.Component,{row:ae,index:ee}):le.cell?le.cell(ae,ee):(()=>{const pe=tl(le,ae,ee);return pe==null||pe===""?"":String(pe)})();return l.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:le.align??"left"},children:ie},`${String(le.key)}-${ge}`)})},a(ae,ee)))})]})})}),oe.open&&l.jsx(tA,{open:oe.open,onClose:Q,customer:oe.customer,fields:d?.dynamicFields,header:d?.header,normalTable:f,history:v,advisorHistory:m,urlsQA:o,onRequestEdit:ae=>{Q(),w?.(ae)},searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:_,solicitudesSeminuevos:W,onCreateSolicitud:D,isCrmMode:A,onSolicitudBaseUrl:M,onIframeClose:I,reloadInfo:V,idAdminSistemas:G})]})}const i0=K.forwardRef(({sx:e,...t},r)=>l.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}}));i0.displayName="SoftInput";function nA({message:e}){return e?l.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:[l.jsx(Jc,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),l.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function oA(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function sl(e,t){const r=oA(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 a0={"& .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%"},sA={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function il({label:e,errorMsg:t,helperText:r,children:n,sx:o}){return l.jsxs(g.FormControl,{fullWidth:!0,error:!!t,sx:o,className:"1- FieldWrapper",children:[l.jsx(g.FormLabel,{sx:sA,children:e}),n,l.jsx(nA,{message:t||r})]})}function iA(e,t){const{register:r,formState:{errors:n}}=t,o={...sl(e)};e.minLength&&(o.minLength={value:e.minLength,message:`El campo espera minimo ${e.minLength} caracteres`}),e.maxLength&&(o.maxLength={value:e.maxLength,message:`El campo espera maximo ${e.maxLength} caracteres`}),e.pattern&&(o.pattern={value:e.pattern,message:"Formato inválido"});const s=e.type==="email";s&&!o.pattern&&(o.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Correo electrónico inválido"});const i=/[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]/g,a=/[0-9]/g,c=new Set(["Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Tab","Home","End","Escape","Enter"]),u=S=>e.onlyNumbers?(S.match(a)??[]).join(""):e.onlyLetters?(S.match(i)??[]).join(""):S,d=(S,_)=>c.has(S)||_?!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 _=S.data??null;_!=null&&(e.onlyNumbers&&/[^0-9]/.test(_)&&S.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(_)&&S.preventDefault())},b=S=>{const _=S.clipboardData.getData("text"),W=u(_);if(W!==_){S.preventDefault();const D=S.target,A=D.selectionStart??D.value.length,M=D.selectionEnd??D.value.length;D.setRangeText(W,A,M,"end"),D.dispatchEvent(new Event("input",{bubbles:!0}))}},w=S=>{const _=u(S.target.value);_!==S.target.value&&(S.target.value=_),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 l.jsx(il,{label:e.label,errorMsg:f,helperText:e.helperText,sx:a0,children:l.jsx(i0,{placeholder:e.placeholder,type:E,inputProps:C,...h,onChange:w,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function aA(e,t){const{control:r}=t,n=!!e.multiple;return l.jsx(hr,{name:e.name,control:r,rules:sl(e,{isArray:n}),render:({field:o,fieldState:s})=>l.jsx(il,{label:e.label,errorMsg:s.error?.message,helperText:e.helperText,sx:a0,children:l.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&&l.jsx(g.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(i=>l.jsx(g.MenuItem,{value:i.value,children:i.label},String(i.value)))]})})})}function cA(e,t){return l.jsx(hr,{name:e.name,control:t.control,rules:sl(e),render:({field:r,fieldState:n})=>l.jsx(il,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:l.jsx(g.RadioGroup,{row:!0,...r,className:"3-RadioFieldRender",children:e.options.map(o=>l.jsx(g.FormControlLabel,{value:o.value,control:l.jsx(g.Radio,{}),label:o.label},String(o.value)))})})})}function c0(e,t){if(e.render)return e.render(t);switch(e.kind){case"text":return iA(e,t);case"select":return aA(e,t);case"radio":return cA(e,t);default:return null}}function lA(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,u]=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),_=S===1/0?1:Math.max(1,Math.ceil(E/S)),W=Math.min(c,_),D=S===1/0?E:W*S,A=S===1/0?0:D-S;return{currentItems:S===1/0?a:a.slice(A,D),totalPages:_,showingFrom:E===0?0:A+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));u(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),u(1),s?.()},setCurrentPage:w}}var ms={},l0;function uA(){if(l0)return ms;l0=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:"M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"}),"NavigateBefore"),ms}var dA=uA();const fA=it(dA);var gs={},u0;function pA(){if(u0)return gs;u0=1;var e=at();Object.defineProperty(gs,"__esModule",{value:!0}),gs.default=void 0;var t=e(ht()),r=ut();return gs.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"),gs}var hA=pA();const mA=it(hA),gA=({currentPage:e,totalPages:t,onPageChange:r,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:s,showingFrom:i,showingTo:a,totalItems:c})=>{const u=g.useTheme(),d=g.useMediaQuery(u.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 l.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:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[l.jsx(g.IconButton,{onClick:()=>r(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:l.jsx(fA,{fontSize:"large"})}),f().map((m,p)=>m==="..."?l.jsx(g.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):l.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}`)),l.jsx(g.IconButton,{onClick:()=>r(e+1),disabled:e>=v,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:l.jsx(mA,{fontSize:"large"})})]}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[l.jsx(g.Typography,{variant:"body2",children:"Mostrar"}),l.jsx(g.FormControl,{size:"small",sx:{minWidth:72},children:l.jsx(g.Select,{value:n,onChange:h,renderValue:m=>m==="Todos"?"Todos":String(m),children:s.map(m=>l.jsx(g.MenuItem,{value:m,children:m==="Todos"?"Todos":m},String(m)))})}),l.jsx(g.Typography,{variant:"body2",children:"por página"})]})]})};function vA(e){const{open:t,dataAdd:r,fields:n,onSubmit:o,onCancel:s,defaultValues:i,txtBtnGuardar:a,haveId:c=!1,itemsTable:u,filter:d,getId:f,renderRow:h,selectedIds:v,onSelectedChange:m,onSubmitAddData:p,initialSelectedIds:b=[],showAutosPanel:w}=e,C=Tp({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:i});y.useEffect(()=>{i&&C.reset(i)},[i,C]);const[E,S]=y.useState(""),[_,W]=y.useState(b),D=Array.isArray(v)&&!!m,A=D?v:_,M=O=>{const ne=typeof O=="function"?O(A):O;D?m(ne):W(ne)},I=y.useCallback(O=>f?f(O):O?.IdAuto,[f]),V=y.useMemo(()=>{const O=new Map;return(u??[]).forEach((ne,Se)=>O.set(I(ne),Se)),O},[u,I]),G=y.useRef(new Set),F=y.useMemo(()=>{const O=new Map;return(u??[]).forEach(ne=>O.set(f?f(ne):ne?.IdAuto,ne)),O},[u,f]),Y=y.useMemo(()=>(n??[]).filter(O=>!!O.required).map(O=>O.name),[n]),oe=dp({control:C.control,name:Y}),U=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(U)??!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()?u?.filter(O=>Ce(O,E)):u,[u,E,Ce]),we=y.useMemo(()=>{if(!me)return me;const O=G.current,ne=[...me];return ne.sort((Se,Oe)=>{const R=O.has(I(Se))?0:1,te=O.has(I(Oe))?0:1;if(R!==te)return R-te;const _e=V.get(I(Se))??0,Ge=V.get(I(Oe))??0;return _e-Ge}),ne},[me,V,I]),{currentItems:ae,totalPages:ee,showingFrom:le,showingTo:ge,totalItems:ie,currentPage:pe,itemsPerPage:Re,perPageOptions:j,goTo:We,setItemsPerPage:qe}=lA(we,{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=>A.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 Se=vt.get(String(O));if(!Se)return null;const Oe={xs:12,...Se.grid,...ne||{}};return l.jsx(g.Grid,{item:!0,...Oe,children:Se.render?Se.render(C):c0(Se,C)},`fld-${String(O)}`)},k=w??(e.haveId?"edit":"new"),P=k!=="onlyCars",B=k==="new"||k==="onlyCars",ue=A?.length>0,se=k==="onlyCars"?ue:e.haveId?N&&$||ue:N&&ue;return l.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:l.jsx(Aw,{...C,children:l.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&&l.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:[l.jsxs(g.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[l.jsx(g.Typography,{fontWeight:700,fontSize:20,children:r.title}),l.jsxs(g.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[l.jsx(g.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:r.subTitle}),l.jsx(g.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((O,ne)=>l.jsx(g.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:O.map((Se,Oe)=>{const R=typeof Se=="string"?{name:Se}:Se;return R.hidden?.(C)?null:pt(R.name,R.grid)})},`row-${ne}`)):l.jsx(g.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((O,ne)=>{const Se=O.grid??{xs:12,md:12};return l.jsx(g.Grid,{item:!0,...Se,children:O.render?O.render(C):c0(O,C)},`${String(O.name)}-${ne}`)})})})]})]}),l.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:l.jsx(g.Box,{display:"flex",alignItems:"center",children:l.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:l.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&&l.jsx(g.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:l.jsx(g.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:l.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[l.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:[l.jsx(g.TextField,{value:E,onChange:O=>S(O.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:l.jsx(g.InputAdornment,{position:"start",children:l.jsx(L2,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),l.jsx(g.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:l.jsx(g.Box,{onClick:s,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:l.jsx(Ur,{sx:{color:"#070C10",fontSize:24}})})}),w=="onlyCars"&&l.jsx(g.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:l.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",children:l.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:[l.jsx(n0,{sx:{color:fe||!se?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),l.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:l.jsx(g.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:l.jsxs(g.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ae?.map((O,ne)=>{const Se=f?f(O):ne,Oe=Ne(Se);return l.jsx(g.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:l.jsx(g.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:l.jsx(g.ListItemButton,{onClick:()=>Ze(Se),disableRipple:!0,sx:{padding:0},children:l.jsx(g.ListItemText,{disableTypography:!0,primary:h?h({item:O,selected:Oe,toggle:()=>Ze(Se),index:ne}):null})})})},`${String(Se)}`)}),!ae?.length&&l.jsx(g.Box,{p:3,children:l.jsxs(g.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",E,"”."]})})]})})}),l.jsx(g.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:l.jsx(gA,{currentPage:pe,totalPages:ee,onPageChange:We,itemsPerPage:Re,onItemsPerPageChange:qe,itemsPerPageOptions:j,showingFrom:le,showingTo:ge,totalItems:ie})})]})})})]})})})}var vs={},d0;function yA(){if(d0)return vs;d0=1;var e=at();Object.defineProperty(vs,"__esModule",{value:!0}),vs.default=void 0;var t=e(ht()),r=ut();return vs.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"),vs}var bA=yA();const xA=it(bA),al=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,ra=/[,\s;]+/g,ln=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),un=(e,t)=>Array.from(new Set([...e,...t.map(r=>r.trim()).filter(Boolean)])),f0=(e,t)=>t?e.filter(r=>ln(r)!==ln(t)):e,_A=(e,t)=>e.filter(r=>!t.some(n=>ln(n)===ln(r)));function Mr(e,t,r){if(r)return typeof r=="function"?r(e,t):e[r]}function wA(e,t){if(t)return!e||/^https?:\/\//i.test(t)?t:e+t}function SA({open:e,onClose:t,value:r,onChange:n,onRequestSend:o,customer:s,itemsSelects:i,renderItem:a,filterFields:c=[],multiSelectAutos:u=!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 _e=setTimeout(()=>b("idle"),320);return()=>clearTimeout(_e)}if(p==="exiting"){const _e=setTimeout(()=>b("idle"),220);return()=>clearTimeout(_e)}},[p]);const[C,E]=y.useState(""),[S,_]=y.useState(!1),[W,D]=y.useState(!1),[A,M]=y.useState(!1),[I,V]=y.useState(""),[G,F]=y.useState([]),Y=A?G:r.selectedIds,oe=()=>{F([...r.selectedIds]),V(""),M(!0)},U=()=>{M(!1),F([])},N=()=>{const R=new Set(vt.map((_e,Ge)=>String(Mr(_e,Ge,h.id)))),te=G.filter(_e=>R.has(String(_e)));n({...r,selectedIds:te}),M(!1)},ce=(R,te)=>ln(R??"")===ln(te??"");function fe(R,te,_e,Ge,q){const de=te?R.some(Ae=>ce(Ae,te)):!1,Ee=_e.length>0?_e.some(Ae=>R.some(Fe=>ce(Fe,Ae))):!1;Ge(de),q(Ee)}const $=R=>{const te=typeof R=="function"?R(r.recipients):R;n({...r,recipients:te}),fe(te,ae,le,_,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)}),we=R=>{if(A)if(u){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(u){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]})}},ae=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&&ae&&(R=un(R,[ae])),W&&le.length&&(R=un(R,le)),$(te=>un(te,R)),fe(r.recipients,ae,le,_,D),E(""),ge.current=!0}e||(ge.current=!1)},[e,S,W,ae,le]);const ie=R=>{const te=ee.find(_e=>ln(_e.EmailAsesor??"")===ln(R));if(te){if(te.ImgAsesor)return l.jsx(g.Avatar,{src:te.ImgAsesor,alt:te.NombreAsesor});const _e=(te.NombreAsesor||"").trim(),Ge=(te.ApellidosAsesor||"").trim();return l.jsx(g.Avatar,{children:`${_e[0]??""}${Ge[0]??""}`.toUpperCase()})}return l.jsx(g.Avatar,{children:R[0]?.toUpperCase()})},pe=()=>{const R=C.trim();if(!R)return;const _e=R.split(ra).filter(Boolean).filter(Ge=>al.test(Ge));_e.length>0&&$(Ge=>un(Ge,_e)),E("")},Re=R=>{_(R),$(te=>R&&ae?un(te,[ae]):f0(te,ae))},j=R=>{D(R),$(te=>R?un(te,le):_A(te,le))},We=R=>{const te=Array.from(R.target.files||[]);Ce(te.map(_e=>({name:_e.name,size:_e.size,file:_e}))),R.target.value=""},qe=Y[0],Ze=y.useMemo(()=>!i||qe===void 0?void 0:i.find((te,_e)=>String(Mr(te,_e,h.id))===String(qe)),[i,qe,h.id]),Ne=y.useMemo(()=>{if(!(!Ze||!h.distributorId))return Mr(Ze,0,h.distributorId)},[Ze,h.distributorId]);console.log("lockedDisId",Ne);const Be=y.useMemo(()=>Ze?(h.distributorTitle?Mr(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,_e)=>Mr(te,_e,h.distributorId)==Ne)},[i,Ne,h.distributorId]),pt=y.useMemo(()=>{if(!I.trim())return vt;const R=I.toLowerCase();return vt.filter(te=>(c??[]).some(_e=>String(te?.[_e]??"").toLowerCase().includes(R)))},[vt,I,c]),k=y.useMemo(()=>{if(!i||!r.selectedIds.length)return[];const R=new Map;return i.forEach((te,_e)=>{R.set(String(Mr(te,_e,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 de=C.split(ra).filter(Ee=>al.test(Ee));R=un(R,de),$(R),E("")}const te=S?ae:"",_e=ee.find(de=>de?.Activo&&de?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:R,toClient:S,toAdvisor:W,tipoInt:S&&W?2:1,correoCliente:te,correoAsesor:W?_e:"",disIdLocked:Ne}),t?.()},ue=y.useMemo(()=>{const te=C.split(ra).filter(Boolean).some(_e=>al.test(_e));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,Se=g.useTheme(),Oe=g.useMediaQuery(Se.breakpoints.down("sm"));return l.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:[l.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[l.jsxs(g.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[d?l.jsx("img",{src:d,alt:"Correo",style:{width:24,height:18}}):null,l.jsxs(g.Typography,{fontWeight:700,children:["Mensaje a"," ",s?`${s.Nombre??""} ${s.ApellidoP??""} ${s.ApellidoM??""}`.trim():"—"]})]}),l.jsx(g.IconButton,{onClick:t,size:"small",children:l.jsx(Ur,{})})]}),l.jsx("div",{children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[l.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[r.recipients.map(R=>l.jsx(g.Chip,{avatar:ie(R),label:R,onDelete:()=>$(te=>f0(te,R)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},R)),l.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 _e=R.clipboardData.getData("text").split(ra).filter(Boolean);_e.length>1&&(R.preventDefault(),$(Ge=>un(Ge,_e)),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"}})]})]})}),l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[l.jsx(g.FormControlLabel,{control:l.jsx(g.Checkbox,{checked:S,onChange:R=>Re(R.target.checked),size:"small"}),label:"Cliente"}),ee.length!==0&&l.jsx(g.FormControlLabel,{control:l.jsx(g.Checkbox,{checked:W,onChange:R=>j(R.target.checked),size:"small"}),label:`Asesor${ee.length>1?"es":""}`})]})]}),l.jsx(g.Divider,{}),l.jsxs(g.Box,{p:2,children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:oe,children:[l.jsx(g.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),Be!=null&&l.jsx(g.Chip,{size:"small",label:`Distribuidora: ${Be}`})]}),k.length>0?l.jsx(g.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:k.map((R,te)=>{const _e=Mr(R,te,h.id),Ge=Mr(R,te,h.title)??"",q=Mr(R,te,h.image),de=wA(f,q);return l.jsx(g.Chip,{onDelete:()=>P(_e),label:l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.jsx(g.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:de?l.jsx("img",{src:de,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}}):l.jsx("img",{src:v,alt:Ge,style:{width:"100%",height:"100%",objectFit:"cover"}})}),l.jsx("span",{style:{fontSize:12},children:l.jsx("b",{children:Ge})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(_e))})}):l.jsx(g.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),l.jsx(g.Divider,{}),l.jsxs(g.Box,{sx:{p:2},children:[l.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&&l.jsx(g.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:r.attachments.map(R=>l.jsxs(g.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[l.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"}}),l.jsx(g.Tooltip,{title:"Quitar",children:l.jsx(g.IconButton,{edge:"end",onClick:()=>me(R.name),size:"small",children:l.jsx(Ur,{fontSize:"small"})})})]},R.name))})]}),l.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:[l.jsx("input",{ref:m,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:We}),l.jsx(g.Button,{startIcon:l.jsx(xA,{}),variant:"text",onClick:()=>m.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),l.jsx(g.Box,{sx:{flex:1}}),l.jsx(g.Button,{variant:"contained",onClick:B,disabled:!ne,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),l.jsxs(g.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:Oe,open:A,onClose:U,children:[l.jsxs(g.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",l.jsx(g.IconButton,{onClick:U,size:"small",children:l.jsx(Ur,{})})]}),l.jsxs(g.DialogContent,{children:[l.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[l.jsx(g.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:I,onChange:R=>V(R.target.value),sx:{mb:2}}),Be!=null&&l.jsx(g.Chip,{size:"small",label:`Distribuidora: ${Be}`})]}),l.jsxs(g.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",pt.length,")"]}),l.jsxs(g.List,{sx:{p:0},children:[pt.map((R,te)=>{const _e=Mr(R,te,h.id),Ge=Y.includes(String(_e))||Y.includes(_e),q=Ne==null||Mr(R,te,h.distributorId)==Ne;return l.jsx(g.ListItem,{disableGutters:!0,sx:{p:0,opacity:q?1:.5},children:l.jsx(g.Box,{onClick:()=>q&&we(_e),sx:{cursor:q?"pointer":"not-allowed",p:.5,backgroundColor:Ge?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(R,te):l.jsx("pre",{style:{margin:0},children:JSON.stringify(R,null,2)})})},String(_e))}),pt.length===0&&l.jsx(g.Box,{p:2,children:l.jsx(g.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),l.jsxs(g.DialogActions,{sx:{px:3,pb:2},children:[l.jsx(g.Button,{variant:"text",onClick:U,sx:{color:"#5C6372"},children:"Cancelar"}),l.jsx(g.Button,{variant:"contained",onClick:N,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}Ot.AddCliente=vA,Ot.ApiProvider=Nx,Ot.AuthProvider=d1,Ot.Clientes=rA,Ot.CustomSnackbar=el,Ot.EventsProvider=i3,Ot.ModalCorreo=SA,Ot.MyCalendar=h3,Ot.useAuth=cc,Ot.useAuthRepository=Ii,Ot.useEventRepository=Ac,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})}));