componentes-exagono 0.2.104 → 0.2.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +3 -2
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -20105,7 +20105,8 @@ function pO({ onSelectGuest: e, availableSuggestions: t, onInputTextChange: r })
|
|
|
20105
20105
|
options: t,
|
|
20106
20106
|
value: n,
|
|
20107
20107
|
inputValue: a,
|
|
20108
|
-
getOptionLabel: (u) => u.correo
|
|
20108
|
+
getOptionLabel: (u) => `${u.nombre} (${u.correo})`,
|
|
20109
|
+
filterOptions: (u) => u,
|
|
20109
20110
|
onChange: s,
|
|
20110
20111
|
onInputChange: c,
|
|
20111
20112
|
isOptionEqualToValue: (u, l) => u.correo === l.correo,
|
|
@@ -20911,7 +20912,7 @@ const CO = /* @__PURE__ */ dt(EO), DO = "data:image/png;base64,iVBORw0KGgoAAAANS
|
|
|
20911
20912
|
{
|
|
20912
20913
|
name: "fechaInicio",
|
|
20913
20914
|
control: fe,
|
|
20914
|
-
render: ({ field: K }) => /* @__PURE__ */ d.jsx(cr, { fullWidth: !0, ...K, type: "date", placeholder: "Fecha de inicio", size: "small", InputLabelProps: { shrink: !0 }, error: !!I.fechaInicio, helperText: I.fechaInicio?.message })
|
|
20915
|
+
render: ({ field: K }) => /* @__PURE__ */ d.jsx(cr, { fullWidth: !0, ...K, type: "date", placeholder: "Fecha de inicio", size: "small", InputLabelProps: { shrink: !0 }, inputProps: { min: g }, error: !!I.fechaInicio, helperText: I.fechaInicio?.message })
|
|
20915
20916
|
}
|
|
20916
20917
|
) }),
|
|
20917
20918
|
h ? /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
package/dist/index.umd.js
CHANGED
|
@@ -165,7 +165,7 @@ const theme2 = createTheme({ palette: {
|
|
|
165
165
|
} else {
|
|
166
166
|
newResult[${x}] = ${S}.value;
|
|
167
167
|
}
|
|
168
|
-
`)}m.write("payload.value = newResult;"),m.write("return payload;");const C=m.compile();return(E,S)=>C(h,E,S)};let i;const s=ba,a=!Eh.jitless,u=a&&LC.value,l=t.catchall;let f;e._zod.parse=(h,m)=>{f??(f=n.value);const v=h.value;return s(v)?a&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(t.shape)),h=i(h,m),l?Wh([],v,h,m,f,e):h):r(h,m):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function Uh(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!bo(i));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(i=>i.issues.map(s=>zn(s,n,Ln())))}),t)}const kD=X("$ZodUnion",(e,t)=>{Tt.init(e,t),mt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Tl(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>Uh(c,o,e,i)):Uh(a,o,e,i)}}),TD=X("$ZodIntersection",(e,t)=>{Tt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>Yh(r,c,u)):Yh(r,i,s)}});function Il(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(_i(e)&&_i(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const s=Il(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.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],i=t[n],s=Il(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Yh(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),bo(e))return e;const n=Il(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 OD=X("$ZodEnum",(e,t)=>{Tt.init(e,t);const r=RC(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>zC.has(typeof o)).map(o=>typeof o=="string"?yo(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),MD=X("$ZodLiteral",(e,t)=>{if(Tt.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"?yo(r):r?yo(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}}),PD=X("$ZodTransform",(e,t)=>{Tt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ch(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new go;return r.value=o,r}});function Hh(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ID=X("$ZodOptional",(e,t)=>{Tt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Tl(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(i=>Hh(i,r.value)):Hh(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),jD=X("$ZodNullable",(e,t)=>{Tt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Tl(r.source)}|null)$`):void 0}),mt(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)}),RD=X("$ZodDefault",(e,t)=>{Tt.init(e,t),e._zod.optin="optional",mt(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(i=>qh(i,t)):qh(o,t)}});function qh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ND=X("$ZodPrefault",(e,t)=>{Tt.init(e,t),e._zod.optin="optional",mt(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))}),$D=X("$ZodNonOptional",(e,t)=>{Tt.init(e,t),mt(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(i=>Zh(i,e)):Zh(o,e)}});function Zh(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 LD=X("$ZodCatch",(e,t)=>{Tt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(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(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>zn(s,n,Ln()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>zn(i,n,Ln()))},input:r.value}),r.issues=[]),r)}}),zD=X("$ZodPipe",(e,t)=>{Tt.init(e,t),mt(e._zod,"values",()=>t.in._zod.values),mt(e._zod,"optin",()=>t.in._zod.optin),mt(e._zod,"optout",()=>t.out._zod.optout),mt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>ka(s,t.in,n)):ka(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ka(i,t.out,n)):ka(o,t.out,n)}});function ka(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const BD=X("$ZodReadonly",(e,t)=>{Tt.init(e,t),mt(e._zod,"propValues",()=>t.innerType._zod.propValues),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(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(Gh):Gh(o)}});function Gh(e){return e.value=Object.freeze(e.value),e}const FD=X("$ZodCustom",(e,t)=>{sr.init(e,t),Tt.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(i=>Kh(i,r,n,e));Kh(o,r,n,e)}});function Kh(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(Si(o))}}class VD{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 WD(){return new VD}const Ta=WD();function UD(e,t){return new e({type:"string",...je(t)})}function YD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...je(t)})}function Qh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...je(t)})}function HD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...je(t)})}function qD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...je(t)})}function ZD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...je(t)})}function GD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...je(t)})}function KD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...je(t)})}function QD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...je(t)})}function XD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...je(t)})}function JD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...je(t)})}function eA(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...je(t)})}function tA(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...je(t)})}function rA(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...je(t)})}function nA(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...je(t)})}function oA(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...je(t)})}function iA(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...je(t)})}function sA(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...je(t)})}function aA(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...je(t)})}function cA(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...je(t)})}function lA(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...je(t)})}function uA(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...je(t)})}function dA(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...je(t)})}function fA(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...je(t)})}function pA(e,t){return new e({type:"string",format:"date",check:"string_format",...je(t)})}function hA(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...je(t)})}function mA(e,t){return new e({type:"string",format:"duration",check:"string_format",...je(t)})}function gA(e,t){return new e({type:"number",checks:[],...je(t)})}function vA(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...je(t)})}function yA(e,t){return new e({type:"boolean",...je(t)})}function bA(e){return new e({type:"unknown"})}function xA(e,t){return new e({type:"never",...je(t)})}function Xh(e,t){return new $h({check:"less_than",...je(t),value:e,inclusive:!1})}function jl(e,t){return new $h({check:"less_than",...je(t),value:e,inclusive:!0})}function Jh(e,t){return new Lh({check:"greater_than",...je(t),value:e,inclusive:!1})}function Rl(e,t){return new Lh({check:"greater_than",...je(t),value:e,inclusive:!0})}function e0(e,t){return new NE({check:"multiple_of",...je(t),value:e})}function t0(e,t){return new LE({check:"max_length",...je(t),maximum:e})}function Oa(e,t){return new zE({check:"min_length",...je(t),minimum:e})}function r0(e,t){return new BE({check:"length_equals",...je(t),length:e})}function wA(e,t){return new FE({check:"string_format",format:"regex",...je(t),pattern:e})}function _A(e){return new VE({check:"string_format",format:"lowercase",...je(e)})}function SA(e){return new WE({check:"string_format",format:"uppercase",...je(e)})}function CA(e,t){return new UE({check:"string_format",format:"includes",...je(t),includes:e})}function EA(e,t){return new YE({check:"string_format",format:"starts_with",...je(t),prefix:e})}function DA(e,t){return new HE({check:"string_format",format:"ends_with",...je(t),suffix:e})}function Ci(e){return new qE({check:"overwrite",tx:e})}function AA(e){return Ci(t=>t.normalize(e))}function kA(){return Ci(e=>e.trim())}function TA(){return Ci(e=>e.toLowerCase())}function OA(){return Ci(e=>e.toUpperCase())}function MA(e,t,r){return new e({type:"array",element:t,...je(r)})}function PA(e,t,r){return new e({type:"custom",check:"custom",fn:t,...je(r)})}function IA(e){const t=jA(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Si(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(Si(o))}},e(r.value,r)));return t}function jA(e,t){const r=new sr({check:"custom",...je(t)});return r._zod.check=e,r}const RA=X("ZodISODateTime",(e,t)=>{aD.init(e,t),Et.init(e,t)});function NA(e){return fA(RA,e)}const $A=X("ZodISODate",(e,t)=>{cD.init(e,t),Et.init(e,t)});function LA(e){return pA($A,e)}const zA=X("ZodISOTime",(e,t)=>{lD.init(e,t),Et.init(e,t)});function BA(e){return hA(zA,e)}const FA=X("ZodISODuration",(e,t)=>{uD.init(e,t),Et.init(e,t)});function VA(e){return mA(FA,e)}const Er=X("ZodError",(e,t)=>{Ml.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>KC(e,r)},flatten:{value:r=>GC(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Dl,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Dl,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),WA=_a(Er),UA=Sa(Er),YA=Ca(Er),HA=Ea(Er),qA=tE(Er),ZA=rE(Er),GA=nE(Er),KA=oE(Er),QA=iE(Er),XA=sE(Er),JA=aE(Er),ek=cE(Er),Nt=X("ZodType",(e,t)=>(Tt.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)=>bn(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>WA(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>YA(e,r,n),e.parseAsync=async(r,n)=>UA(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>HA(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qA(e,r,n),e.decode=(r,n)=>ZA(e,r,n),e.encodeAsync=async(r,n)=>GA(e,r,n),e.decodeAsync=async(r,n)=>KA(e,r,n),e.safeEncode=(r,n)=>QA(e,r,n),e.safeDecode=(r,n)=>XA(e,r,n),e.safeEncodeAsync=async(r,n)=>JA(e,r,n),e.safeDecodeAsync=async(r,n)=>ek(e,r,n),e.refine=(r,n)=>e.check(Hk(r,n)),e.superRefine=r=>e.check(qk(r)),e.overwrite=r=>e.check(Ci(r)),e.optional=()=>f0(e),e.nullable=()=>p0(e),e.nullish=()=>f0(p0(e)),e.nonoptional=r=>zk(e,r),e.array=()=>c0(e),e.or=r=>Ak([e,r]),e.and=r=>Tk(e,r),e.transform=r=>m0(e,Ik(r)),e.default=r=>Nk(e,r),e.prefault=r=>Lk(e,r),e.catch=r=>Fk(e,r),e.pipe=r=>m0(e,r),e.readonly=()=>Uk(e),e.describe=r=>{const n=e.clone();return Ta.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ta.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ta.get(e);const n=e.clone();return Ta.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),n0=X("_ZodString",(e,t)=>{Pl.init(e,t),Nt.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(wA(...n)),e.includes=(...n)=>e.check(CA(...n)),e.startsWith=(...n)=>e.check(EA(...n)),e.endsWith=(...n)=>e.check(DA(...n)),e.min=(...n)=>e.check(Oa(...n)),e.max=(...n)=>e.check(t0(...n)),e.length=(...n)=>e.check(r0(...n)),e.nonempty=(...n)=>e.check(Oa(1,...n)),e.lowercase=n=>e.check(_A(n)),e.uppercase=n=>e.check(SA(n)),e.trim=()=>e.check(kA()),e.normalize=(...n)=>e.check(AA(...n)),e.toLowerCase=()=>e.check(TA()),e.toUpperCase=()=>e.check(OA())}),tk=X("ZodString",(e,t)=>{Pl.init(e,t),n0.init(e,t),e.email=r=>e.check(YD(rk,r)),e.url=r=>e.check(KD(nk,r)),e.jwt=r=>e.check(dA(yk,r)),e.emoji=r=>e.check(QD(ok,r)),e.guid=r=>e.check(Qh(o0,r)),e.uuid=r=>e.check(HD(Ma,r)),e.uuidv4=r=>e.check(qD(Ma,r)),e.uuidv6=r=>e.check(ZD(Ma,r)),e.uuidv7=r=>e.check(GD(Ma,r)),e.nanoid=r=>e.check(XD(ik,r)),e.guid=r=>e.check(Qh(o0,r)),e.cuid=r=>e.check(JD(sk,r)),e.cuid2=r=>e.check(eA(ak,r)),e.ulid=r=>e.check(tA(ck,r)),e.base64=r=>e.check(cA(mk,r)),e.base64url=r=>e.check(lA(gk,r)),e.xid=r=>e.check(rA(lk,r)),e.ksuid=r=>e.check(nA(uk,r)),e.ipv4=r=>e.check(oA(dk,r)),e.ipv6=r=>e.check(iA(fk,r)),e.cidrv4=r=>e.check(sA(pk,r)),e.cidrv6=r=>e.check(aA(hk,r)),e.e164=r=>e.check(uA(vk,r)),e.datetime=r=>e.check(NA(r)),e.date=r=>e.check(LA(r)),e.time=r=>e.check(BA(r)),e.duration=r=>e.check(VA(r))});function Dr(e){return UD(tk,e)}const Et=X("ZodStringFormat",(e,t)=>{_t.init(e,t),n0.init(e,t)}),rk=X("ZodEmail",(e,t)=>{XE.init(e,t),Et.init(e,t)}),o0=X("ZodGUID",(e,t)=>{KE.init(e,t),Et.init(e,t)}),Ma=X("ZodUUID",(e,t)=>{QE.init(e,t),Et.init(e,t)}),nk=X("ZodURL",(e,t)=>{JE.init(e,t),Et.init(e,t)}),ok=X("ZodEmoji",(e,t)=>{eD.init(e,t),Et.init(e,t)}),ik=X("ZodNanoID",(e,t)=>{tD.init(e,t),Et.init(e,t)}),sk=X("ZodCUID",(e,t)=>{rD.init(e,t),Et.init(e,t)}),ak=X("ZodCUID2",(e,t)=>{nD.init(e,t),Et.init(e,t)}),ck=X("ZodULID",(e,t)=>{oD.init(e,t),Et.init(e,t)}),lk=X("ZodXID",(e,t)=>{iD.init(e,t),Et.init(e,t)}),uk=X("ZodKSUID",(e,t)=>{sD.init(e,t),Et.init(e,t)}),dk=X("ZodIPv4",(e,t)=>{dD.init(e,t),Et.init(e,t)}),fk=X("ZodIPv6",(e,t)=>{fD.init(e,t),Et.init(e,t)}),pk=X("ZodCIDRv4",(e,t)=>{pD.init(e,t),Et.init(e,t)}),hk=X("ZodCIDRv6",(e,t)=>{hD.init(e,t),Et.init(e,t)}),mk=X("ZodBase64",(e,t)=>{mD.init(e,t),Et.init(e,t)}),gk=X("ZodBase64URL",(e,t)=>{vD.init(e,t),Et.init(e,t)}),vk=X("ZodE164",(e,t)=>{yD.init(e,t),Et.init(e,t)}),yk=X("ZodJWT",(e,t)=>{xD.init(e,t),Et.init(e,t)}),i0=X("ZodNumber",(e,t)=>{Bh.init(e,t),Nt.init(e,t),e.gt=(n,o)=>e.check(Jh(n,o)),e.gte=(n,o)=>e.check(Rl(n,o)),e.min=(n,o)=>e.check(Rl(n,o)),e.lt=(n,o)=>e.check(Xh(n,o)),e.lte=(n,o)=>e.check(jl(n,o)),e.max=(n,o)=>e.check(jl(n,o)),e.int=n=>e.check(s0(n)),e.safe=n=>e.check(s0(n)),e.positive=n=>e.check(Jh(0,n)),e.nonnegative=n=>e.check(Rl(0,n)),e.negative=n=>e.check(Xh(0,n)),e.nonpositive=n=>e.check(jl(0,n)),e.multipleOf=(n,o)=>e.check(e0(n,o)),e.step=(n,o)=>e.check(e0(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 Pa(e){return gA(i0,e)}const bk=X("ZodNumberFormat",(e,t)=>{wD.init(e,t),i0.init(e,t)});function s0(e){return vA(bk,e)}const xk=X("ZodBoolean",(e,t)=>{_D.init(e,t),Nt.init(e,t)});function Ei(e){return yA(xk,e)}const wk=X("ZodUnknown",(e,t)=>{SD.init(e,t),Nt.init(e,t)});function a0(){return bA(wk)}const _k=X("ZodNever",(e,t)=>{CD.init(e,t),Nt.init(e,t)});function Sk(e){return xA(_k,e)}const Ck=X("ZodArray",(e,t)=>{ED.init(e,t),Nt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Oa(r,n)),e.nonempty=r=>e.check(Oa(1,r)),e.max=(r,n)=>e.check(t0(r,n)),e.length=(r,n)=>e.check(r0(r,n)),e.unwrap=()=>e.element});function c0(e,t){return MA(Ck,e,t)}const Ek=X("ZodObject",(e,t)=>{AD.init(e,t),Nt.init(e,t),mt(e,"shape",()=>t.shape),e.keyof=()=>u0(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:a0()}),e.loose=()=>e.clone({...e._zod.def,catchall:a0()}),e.strict=()=>e.clone({...e._zod.def,catchall:Sk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>UC(e,r),e.safeExtend=r=>YC(e,r),e.merge=r=>HC(e,r),e.pick=r=>VC(e,r),e.omit=r=>WC(e,r),e.partial=(...r)=>qC(d0,e,r[0]),e.required=(...r)=>ZC(h0,e,r[0])});function l0(e,t){const r={type:"object",get shape(){return yn(this,"shape",e?$C(e):{}),this.shape},...je(t)};return new Ek(r)}const Dk=X("ZodUnion",(e,t)=>{kD.init(e,t),Nt.init(e,t),e.options=t.options});function Ak(e,t){return new Dk({type:"union",options:e,...je(t)})}const kk=X("ZodIntersection",(e,t)=>{TD.init(e,t),Nt.init(e,t)});function Tk(e,t){return new kk({type:"intersection",left:e,right:t})}const Nl=X("ZodEnum",(e,t)=>{OD.init(e,t),Nt.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 i={};for(const s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Nl({...t,checks:[],...je(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Nl({...t,checks:[],...je(o),entries:i})}});function u0(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Nl({type:"enum",entries:r,...je(t)})}const Ok=X("ZodLiteral",(e,t)=>{MD.init(e,t),Nt.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 Mk(e,t){return new Ok({type:"literal",values:Array.isArray(e)?e:[e],...je(t)})}const Pk=X("ZodTransform",(e,t)=>{PD.init(e,t),Nt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ch(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Si(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Si(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Ik(e){return new Pk({type:"transform",transform:e})}const d0=X("ZodOptional",(e,t)=>{ID.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function f0(e){return new d0({type:"optional",innerType:e})}const jk=X("ZodNullable",(e,t)=>{jD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function p0(e){return new jk({type:"nullable",innerType:e})}const Rk=X("ZodDefault",(e,t)=>{RD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Nk(e,t){return new Rk({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Th(t)}})}const $k=X("ZodPrefault",(e,t)=>{ND.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Lk(e,t){return new $k({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Th(t)}})}const h0=X("ZodNonOptional",(e,t)=>{$D.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zk(e,t){return new h0({type:"nonoptional",innerType:e,...je(t)})}const Bk=X("ZodCatch",(e,t)=>{LD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fk(e,t){return new Bk({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vk=X("ZodPipe",(e,t)=>{zD.init(e,t),Nt.init(e,t),e.in=t.in,e.out=t.out});function m0(e,t){return new Vk({type:"pipe",in:e,out:t})}const Wk=X("ZodReadonly",(e,t)=>{BD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Uk(e){return new Wk({type:"readonly",innerType:e})}const Yk=X("ZodCustom",(e,t)=>{FD.init(e,t),Nt.init(e,t)});function Hk(e,t={}){return PA(Yk,e,t)}function qk(e){return IA(e)}const $l=()=>{const{calendarApiUrl:e}=cl(),t=async(p,y)=>{try{return(await vt.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${p}/${y}`)).data.map(C=>{const E=new Date(C.fechaInicio),S=new Date(C.fechaFin),x=C?.solicitudRelacionada?.[0]?.nombreCliente??null;return{...C,fechaInicio:E,fechaFin:S,client:x}})}catch(_){return console.error("Error events:",_),[]}},r=async(p,y)=>{try{const _=await vt.post(`${e}/api/Calendario/v1/local/InsertarEvento/${y}`,p);return{..._.data,fechaInicio:new Date(_.data.fechaInicio),fechaFin:new Date(_.data.fechaFin)}}catch(_){throw console.log("Error creating event:",_),_}},n=async p=>{try{const y=await vt.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${p.eventoID}`,p);return{eventoID:y.data.eventoID,titulo:y.data.titulo,descripcion:y.data.descripcion,fechaInicio:new Date(y.data.fechaInicio),fechaFin:new Date(y.data.fechaFin),todoElDia:y.data.todoElDia,color:y.data.color,repetir:y.data.repetir,link:y.data.link,solID:y.data.solID,disID:y.data.disID,client:y.data.client,esOrganizador:y.data.esOrganizador}}catch(y){throw console.log("Error updating event:",y),y}},o=async p=>{try{const y=await vt.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${p}`);console.log("response",y);const _=y.data[0]?.solicitudRelacionada?.[0]?.nombreCliente||null;return{...y.data[0],fechaInicio:y.data[0]?.fechaInicio,fechaFin:y.data[0]?.fechaFin,client:_}}catch(y){throw console.error(`Error fetching event with ID ${p}:`,y),y}},i=async p=>{try{await vt.post(`${e}/api/Calendario/v1/local/EliminarEvento/${p}`)}catch(y){throw console.log(`Error ID ${p}:`,y),y}},s=b.useCallback(async(p,y,_,C,E)=>{try{const S={masNombreBD:_,usrID:C,disID:y,nombreCliente:p,tiposSolicitud:E},I=(await vt.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,S)).data?.data;return Array.isArray(I)?I.map(D=>({clienteID:D.clienteID,solID:D.solID,marca:D?.marca,modelo:D?.modelo,nombreCliente:D?.nombreCliente,email:D?.email,tel:D?.tel})):[]}catch(S){return console.error("Error clientes:",S),[]}},[e]),a=async(p,y)=>{try{const _={disID:p,usrMail:y},E=(await vt.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,_)).data?.data;return Array.isArray(E)?E.map(S=>({usrID:S.usrID,usrNombre:S.usrNombre,usrMail:S?.usrMail,disID:S?.disID})):[]}catch(_){return console.error("Error usuarios:",_),[]}},c=async(p,y,_,C,E)=>{const S={tieneConflicto:!1,usrMail:""};try{const x={disID:p,usrMail:y,startDate:_,horaInicio:C,horaFin:E};return(await vt.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,x)).data?.data}catch(x){return console.error("Error al verificar conflicto:",x),S}},u=async(p,y,_,C)=>{try{const E={disID:p,usrMail:y,startDate:_,DuracionEvento:C},S=await vt.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,E);console.log("response",S);const x=S.data?.data;return Array.isArray(x)?x.map(I=>({Fecha:I.fecha,HoraInicio:I.horaInicio,HoraFin:I.horaFin})):[]}catch(E){return console.error("Error usuarios:",E),[]}},l=b.useCallback(async(p,y)=>{try{return(await vt.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${p}/${y}?soloNoLeidas=true`)).data}catch(_){return console.error("Error usuarios:",_),[]}},[e]);return{getEventsByUser:t,createEvent:r,updateEvent:n,getEventById:o,deleteEvent:i,getClients:s,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:u,getNotificacionesXUsuario:l,UpdateStatusEvento:async(p,y,_)=>{try{const C={EventoID:p,UsuarioID:y,status:_};return(await vt.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,C)).data}catch(C){return C?.response?.data?C.response.data:(console.error("Error Actualizar estatus:",C),{success:!1,message:"Error al procesar la solicitud"})}},MarcarLeido:async(p,y)=>{try{return(await vt.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${p}?usuarioId=${y}&marcarComoLeida=true`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},ReenviarNotificacion:async(p,y)=>{try{return(await vt.post(`${e}/api/Calendario/v1/local/ReenviarNotificacion/${y}/${p}`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},insertarEventoGoogle:async(p,y,_,C)=>{try{const E=`api/Calendario/v1/google/InsertarEvento?disID=${p}&usrMail=${y}&incluirMeet=${_}`;return(await vt.post(`${e}/${E}`,C)).data}catch(E){throw console.error("Error al insertar evento en Google:",E),E}}}};var Di={},g0;function Zk(){if(g0)return Di;g0=1;var e=ct();Object.defineProperty(Di,"__esModule",{value:!0}),Di.default=void 0;var t=e(ht()),r=pt();return Di.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 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,r.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Di}var Gk=Zk();const Ll=st(Gk);var Ai=e=>e.type==="checkbox",Bn=e=>e instanceof Date,er=e=>e==null;const v0=e=>typeof e=="object";var $t=e=>!er(e)&&!Array.isArray(e)&&v0(e)&&!Bn(e),y0=e=>$t(e)&&e.target?Ai(e.target)?e.target.checked:e.target.value:e,Kk=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,b0=(e,t)=>e.has(Kk(t)),Qk=e=>{const t=e.constructor&&e.constructor.prototype;return $t(t)&&t.hasOwnProperty("isPrototypeOf")},zl=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Wt(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(zl&&(e instanceof Blob||n))&&(r||$t(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!Qk(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Wt(e[o]));else return e;return t}var Ia=e=>/^\w*$/.test(e),Lt=e=>e===void 0,Bl=e=>Array.isArray(e)?e.filter(Boolean):[],Fl=e=>Bl(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ye=(e,t,r)=>{if(!t||!$t(e))return r;const n=(Ia(t)?[t]:Fl(t)).reduce((o,i)=>er(o)?o:o[i],e);return Lt(n)||n===e?Lt(e[t])?r:e[t]:n},pr=e=>typeof e=="boolean",at=(e,t,r)=>{let n=-1;const o=Ia(t)?[t]:Fl(t),i=o.length,s=i-1;for(;++n<i;){const a=o[n];let c=r;if(n!==s){const u=e[a];c=$t(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const ja={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Mr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},an={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Vl=b.createContext(null);Vl.displayName="HookFormContext";const Wl=()=>b.useContext(Vl),Xk=e=>{const{children:t,...r}=e;return b.createElement(Vl.Provider,{value:r},t)};var x0=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Mr.all&&(t._proxyFormState[s]=!n||Mr.all),r&&(r[s]=!0),e[s]}});return o};const Ul=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Jk(e){const t=Wl(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,a]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ul(()=>r._subscribe({name:o,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u})}}),[o,n,i]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>x0(s,r,c.current,!1),[s,r])}var Kr=e=>typeof e=="string",w0=(e,t,r,n,o)=>Kr(e)?(n&&t.watch.add(e),ye(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),ye(r,i))):(n&&(t.watchAll=!0),r),Yl=e=>er(e)||!v0(e);function cn(e,t,r=new WeakSet){if(Yl(e)||Yl(t))return e===t;if(Bn(e)&&Bn(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const i of n){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Bn(s)&&Bn(a)||$t(s)&&$t(a)||Array.isArray(s)&&Array.isArray(a)?!cn(s,a,r):s!==a)return!1}}return!0}function _0(e){const t=Wl(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:a}=e||{},c=b.useRef(o),u=b.useRef(a),l=b.useRef(void 0);u.current=a;const f=b.useMemo(()=>r._getWatch(n,c.current),[r,n]),[h,m]=b.useState(u.current?u.current(f):f);return Ul(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:v=>{if(!i){const p=w0(n,r._names,v.values||r._formValues,!1,c.current);if(u.current){const y=u.current(p);cn(y,l.current)||(m(y),l.current=y)}else m(p)}}}),[r,i,n,s]),b.useEffect(()=>r._removeUnmounted()),h}function e3(e){const t=Wl(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s}=e,a=b0(o._names.array,r),c=b.useMemo(()=>ye(o._formValues,r,ye(o._defaultValues,r,s)),[o,r,s]),u=_0({control:o,name:r,defaultValue:c,exact:!0}),l=Jk({control:o,name:r,exact:!0}),f=b.useRef(e),h=b.useRef(o.register(r,{...e.rules,value:u,...pr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const m=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ye(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!ye(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ye(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ye(l.validatingFields,r)},error:{enumerable:!0,get:()=>ye(l.errors,r)}}),[l,r]),v=b.useCallback(C=>h.current.onChange({target:{value:y0(C),name:r},type:ja.CHANGE}),[r]),p=b.useCallback(()=>h.current.onBlur({target:{value:ye(o._formValues,r),name:r},type:ja.BLUR}),[r,o._formValues]),y=b.useCallback(C=>{const E=ye(o._fields,r);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,r]),_=b.useMemo(()=>({name:r,value:u,...pr(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:v,onBlur:p,ref:y}),[r,n,l.disabled,v,p,y,u]);return b.useEffect(()=>{const C=o._options.shouldUnregister||i;o.register(r,{...f.current.rules,...pr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,x)=>{const I=ye(o._fields,S);I&&I._f&&(I._f.mount=x)};if(E(r,!0),C){const S=Wt(ye(o._options.defaultValues,r));at(o._defaultValues,r,S),Lt(ye(o._formValues,r))&&at(o._formValues,r,S)}return!a&&o.register(r),()=>{(a?C&&!o._state.action:C)?o.unregister(r):E(r,!1)}},[r,o,a,i]),b.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),b.useMemo(()=>({field:_,formState:l,fieldState:m}),[_,l,m])}const Pr=e=>e.render(e3(e));var Hl=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},ki=e=>Array.isArray(e)?e:[e],S0=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}},ar=e=>$t(e)&&!Object.keys(e).length,ql=e=>e.type==="file",Ir=e=>typeof e=="function",Ra=e=>{if(!zl)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},C0=e=>e.type==="select-multiple",Zl=e=>e.type==="radio",t3=e=>Zl(e)||Ai(e),Gl=e=>Ra(e)&&e.isConnected;function r3(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Lt(e)?n++:e[t[n++]];return e}function n3(e){for(const t in e)if(e.hasOwnProperty(t)&&!Lt(e[t]))return!1;return!0}function Vt(e,t){const r=Array.isArray(t)?t:Ia(t)?[t]:Fl(t),n=r.length===1?e:r3(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&($t(n)&&ar(n)||Array.isArray(n)&&n3(n))&&Vt(e,r.slice(0,-1)),e}var E0=e=>{for(const t in e)if(Ir(e[t]))return!0;return!1};function Na(e,t={}){const r=Array.isArray(e);if($t(e)||r)for(const n in e)Array.isArray(e[n])||$t(e[n])&&!E0(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Na(e[n],t[n])):er(e[n])||(t[n]=!0);return t}function D0(e,t,r){const n=Array.isArray(e);if($t(e)||n)for(const o in e)Array.isArray(e[o])||$t(e[o])&&!E0(e[o])?Lt(t)||Yl(r[o])?r[o]=Array.isArray(e[o])?Na(e[o],[]):{...Na(e[o])}:D0(e[o],er(t)?{}:t[o],r[o]):r[o]=!cn(e[o],t[o]);return r}var Ti=(e,t)=>D0(e,t,Na(t));const A0={value:!1,isValid:!1},k0={value:!0,isValid:!0};var T0=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Lt(e[0].attributes.value)?Lt(e[0].value)||e[0].value===""?k0:{value:e[0].value,isValid:!0}:k0:A0}return A0},O0=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Lt(e)?e:t?e===""?NaN:e&&+e:r&&Kr(e)?new Date(e):n?n(e):e;const M0={isValid:!1,value:null};var P0=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,M0):M0;function I0(e){const t=e.ref;return ql(t)?t.files:Zl(t)?P0(e.refs).value:C0(t)?[...t.selectedOptions].map(({value:r})=>r):Ai(t)?T0(e.refs).value:O0(Lt(t.value)?e.ref.value:t.value,e)}var o3=(e,t,r,n)=>{const o={};for(const i of e){const s=ye(t,i);s&&at(o,i,s._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},$a=e=>e instanceof RegExp,Oi=e=>Lt(e)?e:$a(e)?e.source:$t(e)?$a(e.value)?e.value.source:e.value:e,j0=e=>({isOnSubmit:!e||e===Mr.onSubmit,isOnBlur:e===Mr.onBlur,isOnChange:e===Mr.onChange,isOnAll:e===Mr.all,isOnTouch:e===Mr.onTouched});const R0="AsyncFunction";var i3=e=>!!e&&!!e.validate&&!!(Ir(e.validate)&&e.validate.constructor.name===R0||$t(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===R0)),s3=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),N0=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Mi=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=ye(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Mi(a,t))break}else if($t(a)&&Mi(a,t))break}}};function $0(e,t,r){const n=ye(e,r);if(n||Ia(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),s=ye(t,i),a=ye(e,i);if(s&&!Array.isArray(s)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:r}}var a3=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return ar(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!n||Mr.all))},c3=(e,t,r)=>!e||!t||e===t||ki(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),l3=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,u3=(e,t)=>!Bl(ye(e,t)).length&&Vt(e,t),d3=(e,t,r)=>{const n=ki(ye(e,r));return at(n,"root",t[r]),at(e,r,n),e},La=e=>Kr(e);function L0(e,t,r="validate"){if(La(e)||Array.isArray(e)&&e.every(La)||pr(e)&&!e)return{type:r,message:La(e)?e:"",ref:t}}var xo=e=>$t(e)&&!$a(e)?e:{value:e,message:""},z0=async(e,t,r,n,o,i)=>{const{ref:s,refs:a,required:c,maxLength:u,minLength:l,min:f,max:h,pattern:m,validate:v,name:p,valueAsNumber:y,mount:_}=e._f,C=ye(r,p);if(!_||t.has(p))return{};const E=a?a[0]:s,S=Y=>{o&&E.reportValidity&&(E.setCustomValidity(pr(Y)?"":Y||""),E.reportValidity())},x={},I=Zl(s),D=Ai(s),k=I||D,P=(y||ql(s))&&Lt(s.value)&&Lt(C)||Ra(s)&&s.value===""||C===""||Array.isArray(C)&&!C.length,O=Hl.bind(null,p,n,x),q=(Y,L,U,K=an.maxLength,F=an.minLength)=>{const G=Y?L:U;x[p]={type:Y?K:F,message:G,ref:s,...O(Y?K:F,G)}};if(i?!Array.isArray(C)||!C.length:c&&(!k&&(P||er(C))||pr(C)&&!C||D&&!T0(a).isValid||I&&!P0(a).isValid)){const{value:Y,message:L}=La(c)?{value:!!c,message:c}:xo(c);if(Y&&(x[p]={type:an.required,message:L,ref:E,...O(an.required,L)},!n))return S(L),x}if(!P&&(!er(f)||!er(h))){let Y,L;const U=xo(h),K=xo(f);if(!er(C)&&!isNaN(C)){const F=s.valueAsNumber||C&&+C;er(U.value)||(Y=F>U.value),er(K.value)||(L=F<K.value)}else{const F=s.valueAsDate||new Date(C),G=V=>new Date(new Date().toDateString()+" "+V),ie=s.type=="time",fe=s.type=="week";Kr(U.value)&&C&&(Y=ie?G(C)>G(U.value):fe?C>U.value:F>new Date(U.value)),Kr(K.value)&&C&&(L=ie?G(C)<G(K.value):fe?C<K.value:F<new Date(K.value))}if((Y||L)&&(q(!!Y,U.message,K.message,an.max,an.min),!n))return S(x[p].message),x}if((u||l)&&!P&&(Kr(C)||i&&Array.isArray(C))){const Y=xo(u),L=xo(l),U=!er(Y.value)&&C.length>+Y.value,K=!er(L.value)&&C.length<+L.value;if((U||K)&&(q(U,Y.message,L.message),!n))return S(x[p].message),x}if(m&&!P&&Kr(C)){const{value:Y,message:L}=xo(m);if($a(Y)&&!C.match(Y)&&(x[p]={type:an.pattern,message:L,ref:s,...O(an.pattern,L)},!n))return S(L),x}if(v){if(Ir(v)){const Y=await v(C,r),L=L0(Y,E);if(L&&(x[p]={...L,...O(an.validate,L.message)},!n))return S(L.message),x}else if($t(v)){let Y={};for(const L in v){if(!ar(Y)&&!n)break;const U=L0(await v[L](C,r),E,L);U&&(Y={...U,...O(L,U.message)},S(U.message),n&&(x[p]=Y))}if(!ar(Y)&&(x[p]={ref:E,...Y},!n))return x}}return S(!0),x};const f3={mode:Mr.onSubmit,reValidateMode:Mr.onChange,shouldFocusError:!0};function p3(e={}){let t={...f3,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ir(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=$t(t.defaultValues)||$t(t.values)?Wt(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Wt(o),s={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const l={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...l};const h={array:S0(),state:S0()},m=t.criteriaMode===Mr.all,v=T=>N=>{clearTimeout(u),u=setTimeout(T,N)},p=async T=>{if(!t.disabled&&(l.isValid||f.isValid||T)){const N=t.resolver?ar((await D()).errors):await P(n,!0);N!==r.isValid&&h.state.next({isValid:N})}},y=(T,N)=>{!t.disabled&&(l.isValidating||l.validatingFields||f.isValidating||f.validatingFields)&&((T||Array.from(a.mount)).forEach(z=>{z&&(N?at(r.validatingFields,z,N):Vt(r.validatingFields,z))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ar(r.validatingFields)}))},_=(T,N=[],z,te,se=!0,j=!0)=>{if(te&&z&&!t.disabled){if(s.action=!0,j&&Array.isArray(ye(n,T))){const re=z(ye(n,T),te.argA,te.argB);se&&at(n,T,re)}if(j&&Array.isArray(ye(r.errors,T))){const re=z(ye(r.errors,T),te.argA,te.argB);se&&at(r.errors,T,re),u3(r.errors,T)}if((l.touchedFields||f.touchedFields)&&j&&Array.isArray(ye(r.touchedFields,T))){const re=z(ye(r.touchedFields,T),te.argA,te.argB);se&&at(r.touchedFields,T,re)}(l.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Ti(o,i)),h.state.next({name:T,isDirty:q(T,N),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else at(i,T,N)},C=(T,N)=>{at(r.errors,T,N),h.state.next({errors:r.errors})},E=T=>{r.errors=T,h.state.next({errors:r.errors,isValid:!1})},S=(T,N,z,te)=>{const se=ye(n,T);if(se){const j=ye(i,T,Lt(z)?ye(o,T):z);Lt(j)||te&&te.defaultChecked||N?at(i,T,N?j:I0(se._f)):U(T,j),s.mount&&p()}},x=(T,N,z,te,se)=>{let j=!1,re=!1;const Ce={name:T};if(!t.disabled){if(!z||te){(l.isDirty||f.isDirty)&&(re=r.isDirty,r.isDirty=Ce.isDirty=q(),j=re!==Ce.isDirty);const $e=cn(ye(o,T),N);re=!!ye(r.dirtyFields,T),$e?Vt(r.dirtyFields,T):at(r.dirtyFields,T,!0),Ce.dirtyFields=r.dirtyFields,j=j||(l.dirtyFields||f.dirtyFields)&&re!==!$e}if(z){const $e=ye(r.touchedFields,T);$e||(at(r.touchedFields,T,z),Ce.touchedFields=r.touchedFields,j=j||(l.touchedFields||f.touchedFields)&&$e!==z)}j&&se&&h.state.next(Ce)}return j?Ce:{}},I=(T,N,z,te)=>{const se=ye(r.errors,T),j=(l.isValid||f.isValid)&&pr(N)&&r.isValid!==N;if(t.delayError&&z?(c=v(()=>C(T,z)),c(t.delayError)):(clearTimeout(u),c=null,z?at(r.errors,T,z):Vt(r.errors,T)),(z?!cn(se,z):se)||!ar(te)||j){const re={...te,...j&&pr(N)?{isValid:N}:{},errors:r.errors,name:T};r={...r,...re},h.state.next(re)}},D=async T=>{y(T,!0);const N=await t.resolver(i,t.context,o3(T||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return y(T),N},k=async T=>{const{errors:N}=await D(T);if(T)for(const z of T){const te=ye(N,z);te?at(r.errors,z,te):Vt(r.errors,z)}else r.errors=N;return N},P=async(T,N,z={valid:!0})=>{for(const te in T){const se=T[te];if(se){const{_f:j,...re}=se;if(j){const Ce=a.array.has(j.name),$e=se._f&&i3(se._f);$e&&l.validatingFields&&y([te],!0);const W=await z0(se,a.disabled,i,m,t.shouldUseNativeValidation&&!N,Ce);if($e&&l.validatingFields&&y([te]),W[j.name]&&(z.valid=!1,N))break;!N&&(ye(W,j.name)?Ce?d3(r.errors,W,j.name):at(r.errors,j.name,W[j.name]):Vt(r.errors,j.name))}!ar(re)&&await P(re,N,z)}}return z.valid},O=()=>{for(const T of a.unMount){const N=ye(n,T);N&&(N._f.refs?N._f.refs.every(z=>!Gl(z)):!Gl(N._f.ref))&&ue(T)}a.unMount=new Set},q=(T,N)=>!t.disabled&&(T&&N&&at(i,T,N),!cn(V(),o)),Y=(T,N,z)=>w0(T,a,{...s.mount?i:Lt(N)?o:Kr(T)?{[T]:N}:N},z,N),L=T=>Bl(ye(s.mount?i:o,T,t.shouldUnregister?ye(o,T,[]):[])),U=(T,N,z={})=>{const te=ye(n,T);let se=N;if(te){const j=te._f;j&&(!j.disabled&&at(i,T,O0(N,j)),se=Ra(j.ref)&&er(N)?"":N,C0(j.ref)?[...j.ref.options].forEach(re=>re.selected=se.includes(re.value)):j.refs?Ai(j.ref)?j.refs.forEach(re=>{(!re.defaultChecked||!re.disabled)&&(Array.isArray(se)?re.checked=!!se.find(Ce=>Ce===re.value):re.checked=se===re.value||!!se)}):j.refs.forEach(re=>re.checked=re.value===se):ql(j.ref)?j.ref.value="":(j.ref.value=se,j.ref.type||h.state.next({name:T,values:Wt(i)})))}(z.shouldDirty||z.shouldTouch)&&x(T,se,z.shouldTouch,z.shouldDirty,!0),z.shouldValidate&&fe(T)},K=(T,N,z)=>{for(const te in N){if(!N.hasOwnProperty(te))return;const se=N[te],j=T+"."+te,re=ye(n,j);(a.array.has(T)||$t(se)||re&&!re._f)&&!Bn(se)?K(j,se,z):U(j,se,z)}},F=(T,N,z={})=>{const te=ye(n,T),se=a.array.has(T),j=Wt(N);at(i,T,j),se?(h.array.next({name:T,values:Wt(i)}),(l.isDirty||l.dirtyFields||f.isDirty||f.dirtyFields)&&z.shouldDirty&&h.state.next({name:T,dirtyFields:Ti(o,i),isDirty:q(T,j)})):te&&!te._f&&!er(j)?K(T,j,z):U(T,j,z),N0(T,a)&&h.state.next({...r,name:T}),h.state.next({name:s.mount?T:void 0,values:Wt(i)})},G=async T=>{s.mount=!0;const N=T.target;let z=N.name,te=!0;const se=ye(n,z),j=$e=>{te=Number.isNaN($e)||Bn($e)&&isNaN($e.getTime())||cn($e,ye(i,z,$e))},re=j0(t.mode),Ce=j0(t.reValidateMode);if(se){let $e,W;const ee=N.type?I0(se._f):y0(T),Ee=T.type===ja.BLUR||T.type===ja.FOCUS_OUT,Fe=!s3(se._f)&&!t.resolver&&!ye(r.errors,z)&&!se._f.deps||l3(Ee,ye(r.touchedFields,z),r.isSubmitted,Ce,re),ft=N0(z,a,Ee);at(i,z,ee),Ee?(!N||!N.readOnly)&&(se._f.onBlur&&se._f.onBlur(T),c&&c(0)):se._f.onChange&&se._f.onChange(T);const yt=x(z,ee,Ee),zt=!ar(yt)||ft;if(!Ee&&h.state.next({name:z,type:T.type,values:Wt(i)}),Fe)return(l.isValid||f.isValid)&&(t.mode==="onBlur"?Ee&&p():Ee||p()),zt&&h.state.next({name:z,...ft?{}:yt});if(!Ee&&ft&&h.state.next({...r}),t.resolver){const{errors:Ot}=await D([z]);if(j(ee),te){const Q=$0(r.errors,n,z),he=$0(Ot,n,Q.name||z);$e=he.error,z=he.name,W=ar(Ot)}}else y([z],!0),$e=(await z0(se,a.disabled,i,m,t.shouldUseNativeValidation))[z],y([z]),j(ee),te&&($e?W=!1:(l.isValid||f.isValid)&&(W=await P(n,!0)));te&&(se._f.deps&&fe(se._f.deps),I(z,W,$e,yt))}},ie=(T,N)=>{if(ye(r.errors,N)&&T.focus)return T.focus(),1},fe=async(T,N={})=>{let z,te;const se=ki(T);if(t.resolver){const j=await k(Lt(T)?T:se);z=ar(j),te=T?!se.some(re=>ye(j,re)):z}else T?(te=(await Promise.all(se.map(async j=>{const re=ye(n,j);return await P(re&&re._f?{[j]:re}:re)}))).every(Boolean),!(!te&&!r.isValid)&&p()):te=z=await P(n);return h.state.next({...!Kr(T)||(l.isValid||f.isValid)&&z!==r.isValid?{}:{name:T},...t.resolver||!T?{isValid:z}:{},errors:r.errors}),N.shouldFocus&&!te&&Mi(n,ie,T?se:a.mount),te},V=T=>{const N={...s.mount?i:o};return Lt(T)?N:Kr(T)?ye(N,T):T.map(z=>ye(N,z))},J=(T,N)=>({invalid:!!ye((N||r).errors,T),isDirty:!!ye((N||r).dirtyFields,T),error:ye((N||r).errors,T),isValidating:!!ye(r.validatingFields,T),isTouched:!!ye((N||r).touchedFields,T)}),De=T=>{T&&ki(T).forEach(N=>Vt(r.errors,N)),h.state.next({errors:T?r.errors:{}})},_e=(T,N,z)=>{const te=(ye(n,T,{_f:{}})._f||{}).ref,se=ye(r.errors,T)||{},{ref:j,message:re,type:Ce,...$e}=se;at(r.errors,T,{...$e,...N,ref:te}),h.state.next({name:T,errors:r.errors,isValid:!1}),z&&z.shouldFocus&&te&&te.focus&&te.focus()},xe=(T,N)=>Ir(T)?h.state.subscribe({next:z=>"values"in z&&T(Y(void 0,N),z)}):Y(T,N,!0),ne=T=>h.state.subscribe({next:N=>{c3(T.name,N.name,T.exact)&&a3(N,T.formState||l,He,T.reRenderRoot)&&T.callback({values:{...i},...r,...N,defaultValues:o})}}).unsubscribe,le=T=>(s.mount=!0,f={...f,...T.formState},ne({...T,formState:f})),ue=(T,N={})=>{for(const z of T?ki(T):a.mount)a.mount.delete(z),a.array.delete(z),N.keepValue||(Vt(n,z),Vt(i,z)),!N.keepError&&Vt(r.errors,z),!N.keepDirty&&Vt(r.dirtyFields,z),!N.keepTouched&&Vt(r.touchedFields,z),!N.keepIsValidating&&Vt(r.validatingFields,z),!t.shouldUnregister&&!N.keepDefaultValue&&Vt(o,z);h.state.next({values:Wt(i)}),h.state.next({...r,...N.keepDirty?{isDirty:q()}:{}}),!N.keepIsValid&&p()},me=({disabled:T,name:N})=>{(pr(T)&&s.mount||T||a.disabled.has(N))&&(T?a.disabled.add(N):a.disabled.delete(N))},pe=(T,N={})=>{let z=ye(n,T);const te=pr(N.disabled)||pr(t.disabled);return at(n,T,{...z||{},_f:{...z&&z._f?z._f:{ref:{name:T}},name:T,mount:!0,...N}}),a.mount.add(T),z?me({disabled:pr(N.disabled)?N.disabled:t.disabled,name:T}):S(T,!0,N.value),{...te?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:Oi(N.min),max:Oi(N.max),minLength:Oi(N.minLength),maxLength:Oi(N.maxLength),pattern:Oi(N.pattern)}:{},name:T,onChange:G,onBlur:G,ref:se=>{if(se){pe(T,N),z=ye(n,T);const j=Lt(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,re=t3(j),Ce=z._f.refs||[];if(re?Ce.find($e=>$e===j):j===z._f.ref)return;at(n,T,{_f:{...z._f,...re?{refs:[...Ce.filter(Gl),j,...Array.isArray(ye(o,T))?[{}]:[]],ref:{type:j.type,name:T}}:{ref:j}}}),S(T,!1,void 0,j)}else z=ye(n,T,{}),z._f&&(z._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(b0(a.array,T)&&s.action)&&a.unMount.add(T)}}},ve=()=>t.shouldFocusError&&Mi(n,ie,a.mount),Pe=T=>{pr(T)&&(h.state.next({disabled:T}),Mi(n,(N,z)=>{const te=ye(n,z);te&&(N.disabled=te._f.disabled||T,Array.isArray(te._f.refs)&&te._f.refs.forEach(se=>{se.disabled=te._f.disabled||T}))},0,!1))},$=(T,N)=>async z=>{let te;z&&(z.preventDefault&&z.preventDefault(),z.persist&&z.persist());let se=Wt(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:j,values:re}=await D();r.errors=j,se=Wt(re)}else await P(n);if(a.disabled.size)for(const j of a.disabled)Vt(se,j);if(Vt(r.errors,"root"),ar(r.errors)){h.state.next({errors:{}});try{await T(se,z)}catch(j){te=j}}else N&&await N({...r.errors},z),ve(),setTimeout(ve);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ar(r.errors)&&!te,submitCount:r.submitCount+1,errors:r.errors}),te)throw te},ze=(T,N={})=>{ye(n,T)&&(Lt(N.defaultValue)?F(T,Wt(ye(o,T))):(F(T,N.defaultValue),at(o,T,Wt(N.defaultValue))),N.keepTouched||Vt(r.touchedFields,T),N.keepDirty||(Vt(r.dirtyFields,T),r.isDirty=N.defaultValue?q(T,Wt(ye(o,T))):q()),N.keepError||(Vt(r.errors,T),l.isValid&&p()),h.state.next({...r}))},Me=(T,N={})=>{const z=T?Wt(T):o,te=Wt(z),se=ar(T),j=se?o:te;if(N.keepDefaultValues||(o=z),!N.keepValues){if(N.keepDirtyValues){const re=new Set([...a.mount,...Object.keys(Ti(o,i))]);for(const Ce of Array.from(re))ye(r.dirtyFields,Ce)?at(j,Ce,ye(i,Ce)):F(Ce,ye(j,Ce))}else{if(zl&&Lt(T))for(const re of a.mount){const Ce=ye(n,re);if(Ce&&Ce._f){const $e=Array.isArray(Ce._f.refs)?Ce._f.refs[0]:Ce._f.ref;if(Ra($e)){const W=$e.closest("form");if(W){W.reset();break}}}}if(N.keepFieldsRef)for(const re of a.mount)F(re,ye(j,re));else n={}}i=t.shouldUnregister?N.keepDefaultValues?Wt(o):{}:Wt(j),h.array.next({values:{...j}}),h.state.next({values:{...j}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!l.isValid||!!N.keepIsValid||!!N.keepDirtyValues,s.watch=!!t.shouldUnregister,h.state.next({submitCount:N.keepSubmitCount?r.submitCount:0,isDirty:se?!1:N.keepDirty?r.isDirty:!!(N.keepDefaultValues&&!cn(T,o)),isSubmitted:N.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:N.keepDirtyValues?N.keepDefaultValues&&i?Ti(o,i):r.dirtyFields:N.keepDefaultValues&&T?Ti(o,T):N.keepDirty?r.dirtyFields:{},touchedFields:N.keepTouched?r.touchedFields:{},errors:N.keepErrors?r.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ge=(T,N)=>Me(Ir(T)?T(i):T,N),Re=(T,N={})=>{const z=ye(n,T),te=z&&z._f;if(te){const se=te.refs?te.refs[0]:te.ref;se.focus&&(se.focus(),N.shouldSelect&&Ir(se.select)&&se.select())}},He=T=>{r={...r,...T}},dt={control:{register:pe,unregister:ue,getFieldState:J,handleSubmit:$,setError:_e,_subscribe:ne,_runSchema:D,_focusError:ve,_getWatch:Y,_getDirty:q,_setValid:p,_setFieldArray:_,_setDisabledField:me,_setErrors:E,_getFieldArray:L,_reset:Me,_resetDefaultValues:()=>Ir(t.defaultValues)&&t.defaultValues().then(T=>{ge(T,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:Pe,_subjects:h,_proxyFormState:l,get _fields(){return n},get _formValues(){return i},get _state(){return s},set _state(T){s=T},get _defaultValues(){return o},get _names(){return a},set _names(T){a=T},get _formState(){return r},get _options(){return t},set _options(T){t={...t,...T}}},subscribe:le,trigger:fe,register:pe,handleSubmit:$,watch:xe,setValue:F,getValues:V,reset:ge,resetField:ze,clearErrors:De,unregister:ue,setError:_e,setFocus:Re,getFieldState:J};return{...dt,formControl:dt}}function B0(e={}){const t=b.useRef(void 0),r=b.useRef(void 0),[n,o]=b.useState({isDirty:!1,isValidating:!1,isLoading:Ir(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ir(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ir(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=p3(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,Ul(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),b.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),b.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),b.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),b.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),b.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==n.isDirty&&i._subjects.state.next({isDirty:s})}},[i,n.isDirty]),b.useEffect(()=>{e.values&&!cn(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),r.current=e.values,o(s=>({...s}))):i._resetDefaultValues()},[i,e.values]),b.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=x0(n,i),t.current}const F0=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ye(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Kl=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?F0(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>F0(o,r,e))}},V0=(e,t)=>{t.shouldUseNativeValidation&&Kl(e,t);const r={};for(const n in e){const o=ye(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(h3(t.names||Object.keys(e),n)){const s=Object.assign({},ye(r,n));at(s,"root",i),at(r,n,s)}else at(r,n,i)}return r},h3=(e,t)=>{const r=W0(t);return e.some(n=>W0(n).match(`^${r}\\.\\d+`))};function W0(e){return e.replace(/\]|\[/g,"")}function U0(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function m3(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(l){return l.errors.forEach(function(f){return e.push(f)})}),t){var c=r[s].types,u=c&&c[n.code];r[s]=Hl(s,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function g3(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(l){return l.forEach(function(f){return e.push(f)})}),t){var c=r[s].types,u=c&&c[n.code];r[s]=Hl(s,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function v3(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,i){try{return Promise.resolve(U0(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(s){return i.shouldUseNativeValidation&&Kl({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return Array.isArray(a?.issues)})(s))return{values:{},errors:V0(m3(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,i){try{return Promise.resolve(U0(function(){return Promise.resolve((r.mode==="sync"?QC:XC)(e,n,t)).then(function(s){return i.shouldUseNativeValidation&&Kl({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return a instanceof Ml})(s))return{values:{},errors:V0(g3(s.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}const Y0=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s?([AaPp]\.?[Mm]\.?))|^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,H0=(e,t)=>{if(!e||!t)return null;const r=t.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=r.includes("pm"),o=r.includes("am"),i=r.replace(/[a-z]/g,""),[s,a]=i.split(":");if(!s||!a)return null;let c=parseInt(s,10);const u=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[l,f,h]=e.split("-").map(Number),m=new Date(l,f-1,h,c,u);return w.isValid(m)?m:null},y3=l0({UsuarioID:Pa().nullable().optional(),disID:Pa().nullable().optional(),EsOrganizador:Ei().default(!1),Correo:Dr().email("Formato de correo inválido"),StatusInvitacion:u0(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),b3=l0({titulo:Dr().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:Dr().min(1,"El campo fecha inicio es requerido."),horaInicio:Dr().min(1,"La hora de inicio es requerida.").regex(Y0,{message:"Formato inválido (ej: 10:30am o 13:30)"}),horaFin:Dr().min(1,"La hora fin es requerida.").regex(Y0,{message:"Formato inválido"}),todoElDia:Ei(),fechaFin:Dr().optional(),showEndDate:Ei().optional(),horaInicio2:Dr().optional(),TodoElDia2:Ei().optional(),client:Dr().nullable().optional(),repetir:Dr().optional(),incluirMeet:Ei().default(!1),link:Dr().trim().url("Debe ser una URL válida de Google Meet, Zoom o Microsoft Teams. Ejemplo: https://meet.google.com/abc-defg-hij").or(Mk("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}).refine(e=>{if(!e)return!0;const t=e.toLowerCase();return t.includes("meet.google.com")||t.includes("zoom.us")||t.includes("zoom.com")||t.includes("teams.microsoft.com")||t.includes("teams.live.com")},{message:"El enlace debe pertenecer a las plataformas de Google Meet, Zoom o Microsoft Teams."}),descripcion:Dr().optional(),invitados:c0(y3).optional().default([]),color:Dr().optional(),solID:Pa().nullable().optional(),disID:Pa().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=H0(e.fechaInicio,e.horaInicio),r=H0(e.fechaFin,e.horaFin);return!t||!r?!1:w.isAfter(r,t)},{message:"",path:["horaFin"]}),x3=e=>B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},B.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"}),B.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"})),w3="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",_3=e=>B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},B.createElement("g",{clipPath:"url(#a)"},B.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"})),B.createElement("defs",null,B.createElement("clipPath",{id:"a"},B.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),q0="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",S3=e=>B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},B.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},B.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"}),B.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"}),B.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"})),B.createElement("defs",null,B.createElement("clipPath",{id:"a"},B.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),C3="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";var Pi={},Z0;function E3(){if(Z0)return Pi;Z0=1;var e=ct();Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.default=void 0;var t=e(ht()),r=pt();return Pi.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"),Pi}var D3=E3();const G0=st(D3);var Ii={},K0;function A3(){if(K0)return Ii;K0=1;var e=ct();Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.default=void 0;var t=e(ht()),r=pt();return Ii.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"),Ii}var k3=A3();const T3=st(k3),Q0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",X0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",O3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",M3=e=>{const t=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],r=e.charCodeAt(0)%t.length;return t[r]},P3=(e,t,r,n,o,i)=>{if(t)return d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[d.jsx("img",{src:X0,width:15,style:{marginRight:"5px"}}),d.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return d.jsx(g.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return i?d.jsx(g.Button,{onClick:()=>{n(r),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"}):null;case"CONFIRMADA":return d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[d.jsx("img",{src:O3,width:15,style:{marginRight:"5px"}}),d.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function I3({open:e,handleClose:t,guests:r,onReenviar:n,esOrganizador:o}){const i=r.filter(l=>l.estatus==="CONFIRMADA"||l.isHost),s=r.filter(l=>l.estatus==="PENDIENTE"&&!l.isHost),a=r.filter(l=>l.estatus==="RECHAZADA"&&!l.isHost),c=l=>d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[d.jsxs(g.Box,{sx:{position:"relative",mr:2},children:[d.jsx(g.Avatar,{sx:{bgcolor:M3(l.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:l.iniciales}),l.estatus==="PENDIENTE"&&d.jsx(g.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:d.jsx(Ll,{sx:{fontSize:14,color:"#546E7A"}})})]}),d.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:l.nombre}),P3(l.estatus,l.isHost,l.usrID,n,t,o)]},l.nombre),u=({title:l,count:f,badgeColor:h})=>d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[d.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:l}),h&&d.jsx(g.Box,{sx:{ml:1,bgcolor:h,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:f})]});return d.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[d.jsxs(g.Box,{sx:{p:"16px 8px"},children:[d.jsx(g.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),d.jsx(g.Button,{onClick:t,startIcon:d.jsx("img",{src:Q0,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),d.jsx(g.IconButton,{onClick:t,sx:{position:"absolute",right:8,top:12},children:d.jsx(yr,{})})]}),d.jsxs(g.DialogContent,{sx:{p:2},children:[s.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(g.Divider,{sx:{backgroundColor:"black"}}),d.jsxs(g.Box,{sx:{mb:3},children:[d.jsx(u,{title:"Invitados",count:s.length}),s.map(c)]})]}),i.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(g.Divider,{sx:{my:1,backgroundColor:"black"}}),d.jsxs(g.Box,{sx:{mb:3},children:[d.jsx(u,{title:"Confirmados",count:i.length,badgeColor:"#1976D2"}),i.map(c)]})]}),a.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(g.Divider,{sx:{my:1,backgroundColor:"black"}}),d.jsxs(g.Box,{children:[d.jsx(u,{title:"No asistirán",count:a.length,badgeColor:"#1976D2"}),a.map(c)]})]})]})]})}const j3=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function R3({guests:e,onReenviar:t,esOrganizador:r}){const[n,o]=b.useState(!1),i=()=>o(!0),s=()=>o(!1);return d.jsxs(d.Fragment,{children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[d.jsx(g.AvatarGroup,{max:9,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((a,c)=>d.jsx(g.Tooltip,{title:a.nombre,arrow:!0,placement:"top",children:d.jsx(g.Box,{children:d.jsx(g.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:a.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:d.jsx(g.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:d.jsx("img",{src:qp})}),children:d.jsx(g.Avatar,{sx:{bgcolor:j3(a.iniciales)},children:a.iniciales})})})},c))}),d.jsx(g.Box,{sx:{flexGrow:1}}),d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:i,children:[d.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),d.jsx(T3,{sx:{fontSize:18,ml:.5}})]})]}),d.jsx(I3,{open:n,handleClose:s,guests:e,onReenviar:t,esOrganizador:r})]})}var ji={},J0;function N3(){if(J0)return ji;J0=1;var e=ct();Object.defineProperty(ji,"__esModule",{value:!0}),ji.default=void 0;var t=e(ht()),r=pt();return ji.default=(0,t.default)((0,r.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),ji}var $3=N3();const L3=st($3),z3=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),em=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},tm=e=>e.split(":").slice(0,2).join(":"),B3=({slot:e,onClick:t})=>d.jsxs(g.Box,{onClick:t,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[d.jsx(g.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:d.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:z3(e.Fecha)})}),d.jsxs(g.Box,{sx:{py:1.5},children:[d.jsx(g.Typography,{sx:{fontSize:"12px"},children:em(e.HoraInicio)}),d.jsxs(g.Typography,{sx:{fontSize:"12px"},children:["a ",em(e.HoraFin)]})]})]});function F3({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const[o,i]=b.useState(16),a=r.slice(0,o).reduce((l,f)=>{const h=f.Fecha;return l[h]||(l[h]=[]),l[h].push(f),l},{}),c=Object.keys(a),u=l=>{const f={...l,HoraInicio:tm(l.HoraInicio),HoraFin:tm(l.HoraFin)};n(f),t()};return b.useEffect(()=>{i(16)},[e]),d.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[d.jsxs(g.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[d.jsx(g.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),d.jsx(g.Box,{children:d.jsx(g.Button,{startIcon:d.jsx("img",{src:Q0,width:20}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),d.jsx(g.Divider,{sx:{backgroundColor:"black"}}),d.jsx(g.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?d.jsx(g.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):d.jsxs(d.Fragment,{children:[c.map((l,f)=>d.jsxs(b.Fragment,{children:[" ",d.jsxs(g.Box,{sx:{mb:3},children:[d.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:f===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[f===0?"Mismo día ":"Próximas fechas",f===0&&d.jsx("img",{src:X0,width:15,style:{marginLeft:5}})]}),d.jsx(g.Grid,{container:!0,spacing:2,children:a[l].map((h,m)=>d.jsx(g.Grid,{item:!0,xs:6,sm:3,children:d.jsx(B3,{slot:h,onClick:()=>u(h)})},`${l}-${m}`))})]}),f===0&&c.length>1&&d.jsx(g.Divider,{sx:{mb:4,mt:1,borderBottomWidth:2,backgroundColor:"#000000"}})]},l)),r.length>o&&d.jsx(g.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:d.jsx(g.Button,{onClick:()=>i(l=>l+12),startIcon:d.jsx(L3,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const V3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",W3=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function U3({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=b.useState(null),[i,s]=b.useState(""),a=(u,l)=>{l?(e(l),o(null),s("")):(o(null),s(""))},c=(u,l)=>{s(l),r(l)};return d.jsx(g.Autocomplete,{options:t,value:n,inputValue:i,getOptionLabel:u=>u.correo,onChange:a,onInputChange:c,isOptionEqualToValue:(u,l)=>u.correo===l.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:u=>d.jsx(g.TextField,{...u,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...u.InputProps,startAdornment:d.jsx(g.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:d.jsx("img",{src:V3,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(u,l)=>b.createElement(g.Box,{component:"li",...u,key:l.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},d.jsx(g.Avatar,{sx:{bgcolor:W3(l.iniciales),mr:2,width:32,height:32,fontSize:14},children:l.iniciales}),d.jsx(g.Typography,{children:l.nombre}))},"guest-autocomplete-field")}var Ri={},rm;function Y3(){if(rm)return Ri;rm=1;var e=ct();Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.default=void 0;var t=e(ht()),r=pt();return Ri.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"),Ri}var H3=Y3();const q3=st(H3);var Ni={},nm;function Z3(){if(nm)return Ni;nm=1;var e=ct();Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.default=void 0;var t=e(ht()),r=pt();return Ni.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"),Ni}var G3=Z3();const Ql=st(G3),K3=e=>e.tieneConflicto?{icon:d.jsx(Ql,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:d.jsx(q3,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Q3=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function X3({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=s=>a=>{a.stopPropagation(),n(s)},i=s=>s?s.trim().split(/\s+/).slice(0,2).join(" "):"";return d.jsxs(g.Box,{sx:{p:1},children:[d.jsx(g.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((s,a)=>{const c=K3(s),u=Q3(s.iniciales),l=s.email||s.correo||s.nombre;return d.jsx(g.Chip,{label:d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[d.jsx(g.Tooltip,{title:l,arrow:!0,placement:"top",children:d.jsx(g.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:i(s?.nombre)})}),d.jsx(g.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:d.jsx(g.Avatar,{sx:{bgcolor:u,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:s.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"}}},onDelete:o(s.nombre)},a)})}),t>0&&d.jsxs(g.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[d.jsx(Ql,{sx:{mr:1,fontSize:22}}),d.jsxs(g.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",d.jsxs("strong",{children:[t," invitado"]}),t!==1?"s":""]})]}),d.jsx(g.Link,{component:"button",type:"button",variant:"body2",onClick:s=>{s.preventDefault(),s.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 J3(e,t){const[r,n]=b.useState(e);return b.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}var $i={},om;function eT(){if(om)return $i;om=1;var e=ct();Object.defineProperty($i,"__esModule",{value:!0}),$i.default=void 0;var t=e(ht()),r=pt();return $i.default=(0,t.default)((0,r.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-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"}),"Search"),$i}var tT=eT();const rT=st(tT),nT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAMwSURBVFhH7ZZdSFRpGMd/1TrIHNZxglqYymLaDdmLscWBOBIzEUowN97owvZBElKbWLM4smNUSESkhG3SbvQh7S5rX4xI3sxFSWBEXqREc2FaroTuDrUik8YRG7G6aEbnPDPnDEFsXfiDF+Z9/s8Zfry873vOkslXr9/ymbBUFj4lizJGLMoYsShjRFaZ+LMemoK11B7pIKLJ9OOyxOzS0wavcaQxzMhcopBXQsPZ/ahzA4Su3ufFG/EAQO4KXN4teNbbZJIVQ5k0kSQJoeLxDoLBrvQ8gd3r57cDbhQZmJBRxlAkSVJoLMzFO1F9FntKz8MocayUHb1AbZE+NiNdZqKbYM2fDBqJJMkr5fil3biWyQB6z+yi6R4opYe4+uO3MjYkbQNHOkNCxIpT9aKut6YWYaqbK7cm9bUEqloCgNb7gIgMTRAyUYYeT+tLBT4CgWoaDlXhWWXFkhINDj1NmaVQtJHiZYB2n5sdvdy9N8CLWdmUTtrK6FhXzi/N5awGyFcJtDbyfYFsykCuG9UFME3/9XO0nDnJ3mPdxGSf4AtZWMBB5cEKnDlRbp9o5cqohj1f4Z9R2ddHS0Urd2VZMhMnLmsCk5Wxsjwv+XsWbWKSkb+jWf8wE05fDc0/+/hKBgITmWHCncNoOCg7fJpQezOBrQ7dnjHCkmfDnp8zP5+1rqVwpa4lIyYyMBY+RpW/jZuPxonnOvDUNHN0mzhVKSheP6EbfxG6/Ct/tNXgSdTHnou7yABTGYD4vz38fryOHaf6iAMu10bZMk/hd0VYkvfOjMaHvspMZZzbfmCnz4uquin3fIMFiI3/J9vm6T+7j6p9te9HdRv9siELJjIOist8VO6ppiHgZ+cmG/FnYU53DsvGBeZmiU1Mvh8zMsyOiUyUUP0uKuu7GAEY7aCu/hqRKdn38RDvpiihuiDt4i6xb3CzZqqPyHN9nc1+un4qQns5rT/yfZeoOv9I9LlTOzIiVkZByXBYYk8yiACKYgVyUPJt2FPHlx/y4bCAkLHh27ub4pULd4QRloJSGrYbvJFXr6UwNznJwfm1Q58bkP4J8Qkx2cD/P4syRnxWMu8A780N97kmJqMAAAAASUVORK5CYII=",oT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAbCAYAAABr/T8RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAP4SURBVEhLxZZdSJtXGMd/XZYgCUYdJErmZpc668Qtg2QXcaO2UBFCIUESpO0KWpCWaS/W2SrMKm1F6srcZA66TlzH3KRL6QeygCiIZZus0wtlqOuqa+oHflxYLSmtEraL9zV5c/JGLYzud3XO8z/v+eecPOc8Z8fKo6f/8D/wghh4Xux4lhWvra4w8/cYM4+AZAtvvmYhzagVh22LrY0fBum9fgV/7z0W1kUR0JrILXJzrKQQa6ooJiaxcXiF0asXOX89yJqoqaLFWlJNfWkeaRpRi0fdOHSPznNN+CflJSZZcHo8eN6zYc3QowNgndB8kOGff+LHm0NMP5GG6na5OV/vJdegmE+FeOPwHP6aGjrvs/1ViLuz08uXzW4yN/kmLqtHO87Kpnrslc18dmgLUwBNCm8daqSt0oYB4P41TneMiaNiiDWevcXlnscAvOJtoH6fKUbeivR91XzitQAQ6vkW/6w4IkqM8Wh3gGkAs4uTPmmCZyXT9wEeM8AcN7oTrzpqHB6it19arcHxDlaV7V2bH6StpoqyY1WU1bRze17lfGmyyM2RmqH+AQbD4gCJaHJNdlFWE2AZQGPC6XNTkCHlLwCLd+i4OsSyciJNCs7SwxSYo6Gn83fw+4dYCAOk4Gluo3yX4huZqPFgK+5Ph0RdQI+9opHa4lSWe1r58OsRQuIQAedH31HrFKOKrZ6ZnYtVVHmbomITOrSkF+/FLsoqJJo3Ypz58kYymSg61cKV9jYuN1VT7somPXId/8XohPS/hn77neGNsNaCveQg9U3yd6cKSZel6LyxvBhpJadiAELoycwykZYKpNrw5NjwHAnirztL5+QSgbqj9Bm1rK1KP8CQf5DGj11YlbUiyyKdZ/SkJSviCqJZnb2TXACCjI4L2arNwtdUjcsodTdMMbtoPCOYAmvjY0wB8DrW7Fhtg6hxUgF7HVJzuLdXym4lmjzKj9hiQvZSr8qxm+NW94jUdLxLYZKoSyguEC17DuyXtuhuF1/IZ1qJ7o08rJFeNg5bfC0O9f9A5wMAPa4DTrmgxBN7Zeb7OOHUAzB8qYlvJgTzDDOZkY5ZygMFoYku6i5JqzU4K3g/P1ZXIhQJPc7jFewxAuEgNxtOc6FvaRv1eJ2FvlYqGwJMhQFjASeOO+QEUye+LAIsDnCutp3hVamrM2ez3+Wj0PQrLRcHWADAgutMBc7pX/g+MMDEopxwRhtVF6opUtxmaqgbIz0G/C2f0zmyIioJSbN5qT3p3vIRwKbGMst/BPiq4xqDD1QKgozuVQeHj5bhyU8RpYRsaRzhyWOm/hxhZmmR8bsPeSknh3STBfvuLAwJjsxmbN/4Pybu6fO8+BfHjFz+tNVn6wAAAABJRU5ErkJggg==",iT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAXCAYAAAAcP/9qAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJJSURBVEhL5ZVPSJNhHMc/NuZBo7VkLCJT1ogRoYm7TF7oMi+7uMMGMwixQ1EYLfpDRiSkkIJm0i7rZNQhyMvoVhcVcYcMDKKQYGzNoiG19y0Uaow6vHPvu2dr72CUhz6n5/k+3/f98vs9z/O+Dcr3H7/YAXaJwr/i/wtuMN7jHJmlGNFn8yRkca2c3bbjeENB/Mcs4lIJBsFbxO9fY3xBERcMcYQmmA4cEOUi1YOTc5y5EiMDWI+4cR9sFh1lfF1b5tXHHOBkMDqCv0V0qFQNTjwa4lJMgRYf09F+HKKhEvm3RE7f4cUmtIYmiPyh6iqHK8XCktpiq9RTWyiA6SjdXeowvfySdXG9QHlwbousrJB9PU/8C0ATnq420VUVj6dHHXxYJZ5UyMpb/MyXeoRWp3g8dJOnn3WOZi+jDwfo0EmG5FeYOjnDoj7MNcDsmBdrYSoErzAVmGFRE8Bkxrq3Sa/UxKasCFX2cH3uHJ7CTAjOkXgyye3n78l+y2lynTTuseDqu8Fon3bQhD024wgNM+azlcp1YveVhlIerJJe/1QYWei9fJfZyAi3wv34Dldvub2zj8HweUYnIzy44Gb71mvv06gYrNGM/ZAN634n3ZKPs8NBXKKlSCfBqwH8koeOdgt2Zzv7RIsOg2CZd29S6vWSFTJrSbKipcgGibWNojexskpatOio+OWK3zvF+JKo1oF0kVjYXSIZVPz32LHg2lpdoVXVqOX5Hau4YnCrs43G7YnJQq/UWWowoFs6gdW0PTPjcJb/Gn8DgFjOhT2aaY4AAAAASUVORK5CYII=",sT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJrSURBVEhLxZVLSFRRGIA/tRGZC02XiEAdCRUXIW2apTSbHtimTQPZgzFSgkpULCyZEEqUIWkWNplopDC0aeNA6qIhEypJciGIuUnKRDAZrpPcS3obbHGd8T7GV4P07c45//m/c/5z7rkZseWVNfaYTHPHXvAfJfIUr5728WbWPKBHYfp1H13D8+YBC6klkyOE3kYIj22VYIqB3giDz8KMm4dMZCQP/udnQt39RGaXQFWQfqmQ40AUzFMSqMhRhVVsCAftZOccwnXKw6Xyo4hZxkhNEo3QeKOP6bhxcLcIrioCd9wcNkkyARbev0tbILpr6b5rFZCQqKpq7t8VheeaCda4EAB+K0iyMV/qg98xdo5d8xO4UowAyJ86qfRep9J7iwfDi8moNCR2jt9s4WF5LgDSaCfVjz4ixQEUxoM+uia1yH36ac4Lfp6c1ybthoXhduqDE8iGXoWZHzEodaSzE43UAsguqqDmtAPSKxfMDbWlFAilXgKtZ8lfv2n/LJkL+6h/PmUVuKoI3D+ZFGA+k62Qv40Q6hlkdFGGuIK0ZL32QlktwRqX5Yvf0U7mhtqovt3D4PQ8UjS2qaC7zipgR5JohI5ea1n0iG5NsNkzt61EGvuQfHLEkmIKD9iMAUUV+BNf+yZsK5FlBdZXG2xtJtDTgidPF6CqWItnxCj5Y2gBkO88gvPMvY23KQ7o616QR76umYqM2PLK2upIO56OCbDZEfdr5RBLPDTUubUEiaTxefqbfLz4mlh7Lp7Hfi4XJNKlJhMgu+wiV4ts2s8qGkOKxpgZfcnAF51A/U6osXFDkOXgREPTtgKAv71g3h2chXDUAAAAAElFTkSuQmCC",aT=({open:e,onClose:t,clientOptions:r,isClientsLoading:n,setClientSearchTerm:o,onSelectClient:i,setFiltroPadre:s})=>{const[a,c]=b.useState("COT"),u=f=>{c(f),s(f)},l=[{id:"COT",label:"Nuevo",icon:iT},{id:"SEMI",label:"Seminuevo",icon:nT},{id:"PM",label:"Prueba de manejo",icon:oT},{id:"SER",label:"Cita de servicio",icon:sT}];return d.jsx(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh",position:"relative"}},children:d.jsxs(g.DialogContent,{sx:{p:0,display:"flex",flexDirection:"column"},children:[d.jsxs(g.Box,{sx:{p:2,pb:1},children:[d.jsx(g.Typography,{variant:"h6",fontWeight:"bold",sx:{mb:1,fontSize:"1.1rem"},children:"Vincular cliente"}),d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",mb:2,width:"fit-content","&:hover":{opacity:.7}},onClick:t,children:[d.jsx(Ac,{sx:{color:"#666",ml:-1}}),d.jsx(g.Typography,{variant:"body2",color:"text.secondary",fontWeight:"500",children:"Volver al evento"})]}),d.jsx(g.TextField,{fullWidth:!0,placeholder:"Buscar cliente, correo electrónico, teléfono...",size:"small",onChange:f=>o(f.target.value),InputProps:{startAdornment:d.jsx(g.InputAdornment,{position:"start",children:d.jsx(rT,{sx:{color:"#999"}})}),endAdornment:n&&d.jsx(g.InputAdornment,{position:"end",children:d.jsx(g.CircularProgress,{size:20,color:"inherit"})}),sx:{borderRadius:"8px",backgroundColor:"#f5f5f5","& fieldset":{border:"none"}}}}),d.jsx(g.Box,{sx:{display:"flex",gap:1,mt:2,pb:1,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:l.map(f=>{const h=a===f.id;return d.jsx(g.Chip,{label:f.label,icon:d.jsx("img",{src:f.icon,alt:f.label,style:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"cover"}}),onClick:()=>u(String(f.id)),sx:{borderRadius:"16px",fontSize:"13px",transition:"all 0.2s",backgroundColor:h?"#1976d2":"#f0f2f5",color:h?"#fff !important":"#5f6368",fontWeight:h?"bold":"normal",border:"none","&:hover":{backgroundColor:h?"#1565c0":"#e0e2e5"},"& .MuiChip-icon":{color:h?"#fff":"inherit"}}},f.id)})})]}),d.jsxs(g.Box,{sx:{flexGrow:1,overflowY:"auto",minHeight:"300px"},children:[r.map((f,h)=>d.jsxs(g.Box,{onClick:()=>{i(f,a),t()},sx:{p:"14px 20px",borderTop:"1px solid #f0f0f0",cursor:"pointer",transition:"background-color 0.2s","&:hover":{backgroundColor:"#f9f9f9"},"&:active":{backgroundColor:"#f0f0f0"}},children:[d.jsx(g.Typography,{fontWeight:"600",sx:{fontSize:"14px",color:"#333"},children:f.nombreCliente||"Sin nombre registrado"}),d.jsxs(g.Typography,{variant:"body2",sx:{fontSize:"12px",color:"#666",mt:.5},children:[f.email||"Sin correo"," • ",f.tel||"Sin teléfono"]})]},f.clienteID||h)),!n&&r.length===0&&d.jsx(g.Box,{sx:{p:4,textAlign:"center"},children:d.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"No se encontraron resultados para tu búsqueda."})})]})]})})},cT={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"},im=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],lT=()=>{const e=[];for(let t=0;t<24;t++)for(let r=0;r<60;r+=15){const n=new Date;n.setHours(t,r),e.push(w.format(n,"h:mmaaaa"))}return e},sm=[],za=lT(),xn=(e,t)=>{if(!e||!t)return null;const r=t.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=r.includes("pm"),o=r.includes("am"),i=r.replace(/[a-z]/g,""),[s,a]=i.split(":");if(!s||!a)return null;let c=parseInt(s,10);const u=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[l,f,h]=e.split("-").map(Number),m=new Date(l,f-1,h,c,u);return w.isValid(m)?m:null},uT=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:i,userId:s,masNombreBD:a,disId:c,gmail:u,onReenviar:l,onNavigate:f})=>{const[h,m]=b.useState(!1),v=w.format(new Date,"yyyy-MM-dd"),[p,y]=b.useState(""),[_,C]=b.useState([]),[E,S]=b.useState(!1),x=$l(),[I,D]=b.useState(sm),[k,P]=b.useState(!1),[O,q]=b.useState(""),[Y,L]=b.useState(!1),[U,K]=b.useState([]),[F,G]=b.useState(!1),[ie,fe]=b.useState(null),V=(Q,he)=>{fe(Q),ge("client",Q.nombreCliente||""),ge("solID",null),G(!1)},[J,De]=b.useState([]),_e=J3(O,300),xe=I.filter(Q=>Q.tieneConflicto).length,[ne,le]=b.useState(!1),[ue,me]=b.useState("COT"),{control:pe,handleSubmit:ve,reset:Pe,formState:{errors:$,isValid:ze},watch:Me,setValue:ge}=B0({resolver:v3(b3),defaultValues:{titulo:i?.titulo||"",fechaInicio:w.format(new Date,"yyyy-MM-dd"),horaInicio:w.format(new Date,"h:mmaaaa"),horaFin:w.format(w.addHours(new Date,1),"h:mmaaaa"),todoElDia:!1,client:i?.client||null,repetir:"No repetir",link:i?.link||"",descripcion:i?.descripcion||"",solID:i?.solID??null,invitados:[],incluirMeet:!1},mode:"onChange"}),Re=Me("fechaInicio"),He=Me("fechaFin"),We=Me("todoElDia");b.useEffect(()=>{if(p.trim()===""||!s||!c||!a){C([]),ge("solID",null),S(!1);return}S(!0);const Q=setTimeout(()=>{x.getClients(p,c,a,s,ue).then(he=>{S(!1);const Oe=Array.from(new Map(he.map(R=>[R.nombreCliente,R])).values());if(Oe.length>0)C(Oe);else if(i?.client&&i.solID!==null){const R=[{solID:i.solID,nombreCliente:i.client}];C(R)}else C([])}).catch(he=>{console.error("Error al buscar clientes:",he),S(!1)})},500);return()=>clearTimeout(Q)},[p,s,c,a,ue]),b.useEffect(()=>{if(i){const Q=i?.solicitudRelacionada&&i?.solicitudRelacionada[0];if(Q){const he={nombreCliente:i?.client||"",tel:Q.tel||"",email:Q.email||"",marca:Q.marca||"",modelo:Q.modelo||"",solID:Number(Q.solID)};fe(he),C([he]),ge("client",Q.nombreCliente),ge("solID",Q?.solID)}}},[i]),b.useEffect(()=>{if(Re&&He){const Q=new Date(Re),he=new Date(He);(Q===he||Q>he)&&ge("fechaFin",Re)}},[Re,He,ge]),b.useEffect(()=>{Re&&ge("fechaFin",Re)},[Re]),b.useEffect(()=>{ge("showEndDate",h)},[h,ge]),b.useEffect(()=>{if(i){const Q=w.format(i.fechaInicio,"yyyy-MM-dd")===w.format(i.fechaFin,"yyyy-MM-dd");if(m(!Q),ge("titulo",i?.titulo),ge("fechaInicio",w.format(i.fechaInicio,"yyyy-MM-dd")),ge("fechaFin",w.format(i.fechaFin,"yyyy-MM-dd")),ge("horaInicio",w.format(i.fechaInicio,"h:mmaaaa")),ge("horaFin",w.format(i.fechaFin,"h:mmaaaa")),ge("horaInicio2",w.format(i.fechaFin,"h:mmaaaa")),ge("descripcion",i.descripcion),ge("link",i.link),ge("repetir","false"),ge("color",i.color),ge("todoElDia",i.todoElDia),ge("solID",i.solID),ge("client",i.client),i.invitados&&i.invitados.length>0){const he=(i?.invitados||[]).map(R=>{const oe=R.usrNombre?.trim()||"",de=oe.split(/\s+/),ke=de.length>1?(de[0][0]+de[1][0]).toUpperCase():oe.substring(0,2).toUpperCase();return{nombre:R.usrNombre||"Sin nombre",correo:R.correo||"",iniciales:ke||"--",usrID:R.usuarioID??null,isHost:R.esOrganizador||!1,estatus:R.statusInvitacion,tieneConflicto:!1,disID:R.disID}}),Oe={nombre:i?.nombreAnfitrion?i?.nombreAnfitrion:"Anfitrion",correo:"",iniciales:(i?.nombreAnfitrion?i?.nombreAnfitrion:"Anfitrion").substring(0,2).toUpperCase(),usrID:s??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};D([Oe,...he])}else D(sm)}else{const Q=o||new Date,he=new Date,Oe=new Date(Q.getFullYear(),Q.getMonth(),Q.getDate(),he.getHours(),he.getMinutes()),R=w.addHours(Oe,1);Pe({titulo:"",fechaInicio:w.format(Oe,"yyyy-MM-dd"),fechaFin:w.format(R,"yyyy-MM-dd"),horaFin:w.format(R,"h:mmaaaa"),horaInicio:w.format(Oe,"h:mmaaaa"),horaInicio2:w.format(R,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:im[0],solID:null}),m(!1)}},[i,e,o]);const dt=Q=>({UsuarioID:Q.usrID??null,Correo:Q.correo,EsOrganizador:Q.usrID==s,StatusInvitacion:Q.estatus,disID:c??null}),T=ve(Q=>{const he=I.map(R=>dt(R)),Oe={...Q,invitados:he};r(Oe,i?.eventoID),t(),Pe(),m(!1)},Q=>{});b.useEffect(()=>{We&&(ge("horaInicio","00:00"),ge("horaFin","23:59"))},[We,ge,Me]);const N=()=>{const Q=Me("fechaInicio");if(Q){const he=new Date(`${Q}T00:00:00`),Oe=w.addDays(he,1);ge("fechaFin",w.format(Oe,"yyyy-MM-dd"))}m(!0)},z=Me("fechaInicio"),te=Me("horaInicio"),se=Me("fechaFin"),j=Me("horaFin"),re=Me("todoElDia");b.useEffect(()=>{if(re||!te||!j||!z||!se)return;const Q=xn(z,te),he=xn(se,j);if(!Q||!he||!w.isValid(Q)||!w.isValid(he))return;const Oe=w.isSameDay(Q,he),R=Oe&&(w.isAfter(Q,he)||Q.getTime()===he.getTime()),oe=w.isBefore(he,Q)&&!Oe;(R||oe)&&ge("horaFin","")},[te,z]);const Ce=b.useMemo(()=>{if(!te||!z)return za;const Q=xn(z,te);return Q?za.map(he=>{const Oe=xn(se||z,he);if(Oe&&w.isAfter(Oe,Q)){const R=(Oe.getTime()-Q.getTime())/6e4,oe=Math.floor(R/60),de=R%60,ke=oe>0?`${oe} h${de>0?` ${de} min`:""}`:`${de} min`;return{value:he,label:`${he} (${ke})`}}return he}).filter(he=>{const Oe=typeof he=="string"?he:he.value,R=xn(se||z,Oe);return R?w.isAfter(R,Q):!1}):za},[te,z,se]),$e=b.useMemo(()=>za,[]);b.useEffect(()=>{if(!i&&te&&z){const Q=xn(z,te);if(Q){const he=w.addMinutes(Q,15),Oe=te.toLowerCase(),R=Oe.includes("pm")||Oe.includes("p.m."),oe=Oe.includes(".");let de=w.format(he,"h:mm"),ke=R?"pm":"am";oe&&(ke=R?"p.m.":"a.m.");const Mt=`${de}${ke}`,Pt=(j||"").toLowerCase();(j!==Mt||R&&(Pt.includes("am")||Pt.includes("a.m.")))&&ge("horaFin",Mt,{shouldValidate:!0})}}},[te,ge,z]);const W=async Q=>{const he=Me("fechaInicio"),Oe=Me("horaInicio"),R=Me("horaFin");if(!c||!he||!Oe||!R||Q.length===0)return;const oe=await Promise.all(Q.map(async de=>{if(de.isHost||!de.correo)return de;try{const ke=await x.VerificarConflicto(c,de.correo,he,Oe,R),Mt=Array.isArray(ke)?ke[0]:ke;if(Mt){const Pt=await x.getDisponibilidadUsuario(c,de.correo,he,"60");K(Pt)}return{...de,tieneConflicto:String(Mt.tieneConflicto).toLowerCase()==="true"}}catch{return{...de,tieneConflicto:!1}}}));D(oe)};b.useEffect(()=>{I.filter(he=>!he.isHost).length>0&&z&&te&&j&&W(I)},[z,te,j]);const ee=async Q=>{if(I.some(de=>de.correo===Q.correo))return;L(!0);const Oe=Me("fechaInicio"),R=Me("horaInicio"),oe=Me("horaFin");if(!c||!Q.correo||!Oe||!R||!oe){D(de=>[...de,{...Q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:!1}]);return}try{const de=await x.VerificarConflicto(c,Q.correo,Oe,R,oe),ke=Array.isArray(de)?de[0]:de,Mt=String(ke?.tieneConflicto).toLowerCase()==="true",Pt={...Q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:Mt};if(Mt){const Qt=await x.getDisponibilidadUsuario(c,Q.correo,Oe,"60");K(Qt)}D(Qt=>[...Qt,Pt])}catch(de){console.error("Error al verificar conflicto:",de),D(ke=>[...ke,{...Q,tieneConflicto:!1,isHost:!1}])}},Ee=Q=>{D(he=>he.filter(Oe=>Oe.nombre!==Q))},Fe=()=>{P(!1)},ft=Q=>{const R=(Q.usrNombre??"").split(" ").map(oe=>oe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:Q.usrNombre??"",correo:Q.usrMail??"",iniciales:R,usrID:Q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};b.useEffect(()=>{_e.length>0&&c?(async()=>{const Oe=(await x.getUsuariosInvitados(c,_e)).map(ft).filter(R=>R.usrID!==s&&!I.some(oe=>oe.correo===R.correo));De(Oe)})():De([])},[_e,I]);const yt=Q=>{q(Q)},zt=Q=>{const{Fecha:he,HoraInicio:Oe,HoraFin:R}=Q,oe=de=>de.split(":").slice(0,2).join(":");ge("fechaInicio",he),ge("fechaFin",he),ge("horaInicio",oe(Oe)),ge("horaFin",oe(R)),m(!1),Fe()},Ot=async()=>{const Q=Me(),he=xn(Q.fechaInicio,Q.horaInicio),Oe=xn(Q.fechaFin||Q.fechaInicio,Q.horaFin);if(!he||!Oe)return;if(!c||!u){console.error("Faltan datos requeridos (disId, userMail o calendarId)");return}le(!0);const R={summary:Q.titulo||"Sin título",description:Q.descripcion||"",start:{dateTime:w.format(he,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"},end:{dateTime:w.format(Oe,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"}};try{const oe=await x.insertarEventoGoogle(c,u,!0,R);oe?.hangoutLink&&(ge("link",oe.hangoutLink),ge("incluirMeet",!1))}catch(oe){console.error("Error al generar Meet",oe)}finally{le(!1)}};return d.jsx(d.Fragment,{children:d.jsx(g.Modal,{open:e,onClose:t,children:d.jsxs("form",{onSubmit:T,children:[d.jsxs(g.Box,{sx:cT,children:[d.jsx(g.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:d.jsx(yr,{})}),d.jsx(g.Typography,{style:{fontSize:18,fontWeight:600},mb:2,children:i?.client&&i?.solicitudRelacionada?.[0]?d.jsxs(d.Fragment,{children:["Evento para el cliente:"," ",d.jsx(g.Link,{component:"button",variant:"inherit",type:"button",onClick:()=>{const Q=i?.solicitudRelacionada?.[0];if(Q&&Q.tipoSol){const he=Q?.tipoSol,R={COT:{url:"/netcar/cotizaciones/",pag:10,tipo:"COT"},SEMI:{url:"/netcar/seminuevos/",pag:12,tipo:"SEMI"},SER:{url:"/netcar/servicio/",pag:14,tipo:"SER"},PM:{url:"/netcar/pruebademanejo/",pag:16,tipo:"PM"}}[he];R&&f(`${R.url}${Q?.solID}`,{replace:!0,state:{tipoSOL:R.tipo,pag:R.pag,modulo:"Consulta"}})}},sx:{color:"#1976d2",cursor:"pointer",fontWeight:700,textDecoration:"underline",verticalAlign:"baseline",p:0,border:"none",backgroundColor:"transparent",fontSize:"14px"},children:`${i.client} / ${i?.solicitudRelacionada[0].marca} ${i?.solicitudRelacionada[0].modelo}`})]}):i?"Editar Evento":"Agregar Evento"}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(Pr,{name:"titulo",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,label:"Título",fullWidth:!0,variant:"outlined",multiline:!0,maxRows:4,size:"small",error:!!$.titulo,helperText:$.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"}}})})})}),d.jsxs("div",{className:`row g-2 ${h?"mb-1":"mb-2"}`,children:[d.jsx("div",{className:"col-12 col-md-4",children:d.jsx(Pr,{name:"fechaInicio",control:pe,render:({field:Q})=>d.jsx(g.TextField,{fullWidth:!0,...Q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},error:!!$.fechaInicio,helperText:$.fechaInicio?.message})})}),h?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"col-md-3 d-none d-md-block"}),d.jsx("div",{className:"col-10 col-md-4",children:d.jsx(Pr,{name:"fechaFin",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Re||v},error:!!$.fechaFin,helperText:$.fechaFin?.message})})}),!i&&d.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:d.jsx(g.IconButton,{onClick:()=>m(!1),sx:{fontSize:18},children:d.jsx(x3,{})})})]}):d.jsx("div",{className:"col-md-8"})]}),h&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12 d-flex justify-content-center",children:d.jsx(G0,{sx:{color:"#757575",my:1}})})}),d.jsxs("div",{className:"row g-2 mb-2",children:[d.jsx("div",{className:"col-12 col-md-4",children:d.jsx(Pr,{name:"horaInicio",control:pe,render:({field:{onChange:Q,value:he,...Oe}})=>d.jsx(g.Autocomplete,{freeSolo:!0,options:$e,value:he||"",getOptionLabel:R=>typeof R=="string"?R:R.value,onChange:(R,oe)=>{const de=typeof oe=="string"?oe:oe?.value;if(de){const ke=de.split(" (")[0].trim();Q(ke)}else Q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},onInputChange:(R,oe)=>Q(oe),renderInput:R=>d.jsx(g.TextField,{...R,...Oe,size:"small",error:!!$.horaInicio,helperText:$.horaInicio?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...R.InputProps}}),popupIcon:d.jsx(Ll,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:re})})}),!h&&d.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:$.horaInicio?"5px":"0px"},children:d.jsx(G0,{sx:{color:"#757575"}})}),h&&d.jsx("div",{className:"col-md-3 d-none d-md-block"}),d.jsx("div",{className:"col-12 col-md-4",children:d.jsx(Pr,{name:"horaFin",control:pe,render:({field:{onChange:Q,value:he,...Oe}})=>d.jsx(g.Autocomplete,{freeSolo:!0,options:Ce,getOptionLabel:R=>typeof R=="string"?R:R.value,value:he||"",onChange:(R,oe)=>{const de=typeof oe=="string"?oe:oe?.value;if(de){const ke=de.split(" (")[0].trim();Q(ke)}else Q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},renderOption:(R,oe)=>b.createElement(g.Box,{component:"li",...R,key:typeof oe=="string"?oe:oe.value},d.jsx(g.Typography,{children:typeof oe=="string"?oe:oe.label})),onInputChange:(R,oe)=>Q(oe),renderInput:R=>d.jsx(g.TextField,{...R,...Oe,size:"small",error:!!$.horaFin,helperText:$.horaFin?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...R.InputProps}}),popupIcon:d.jsx(Ll,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:re})})}),!h&&d.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:d.jsx(Pr,{name:"todoElDia",control:pe,render:({field:Q})=>d.jsx(g.FormControlLabel,{control:d.jsx(g.Checkbox,{checked:Q.value,onChange:he=>Q.onChange(he.target.checked)}),label:d.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!i?.isGoogleEvent||i?.isOutlookEvent)&&!h&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsxs(g.Button,{onClick:N,size:"small",sx:{textTransform:"none",fontSize:16},children:[d.jsx(S3,{})," Agregar fecha final"]})})}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(Pr,{name:"link",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!$.link,helperText:$.link?.message,InputProps:{startAdornment:d.jsx("img",{src:w3,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(Pr,{name:"descripcion",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:d.jsx("img",{src:C3,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),!i?.solicitudRelacionada&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(U3,{onSelectGuest:ee,availableSuggestions:J,onInputTextChange:yt})})}),(Y||xe>0)&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(X3,{guests:I,conflictCount:xe,onViewSuggestions:()=>P(!0),onDeleteGuest:Ee})})}),i?.invitados&&i?.invitados?.length>0&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(g.Box,{children:d.jsx(R3,{guests:I,onReenviar:l,esOrganizador:i?.esOrganizador})})})}),d.jsx(F3,{open:k,handleClose:Fe,suggestions:U,onSelectSlot:zt})]}),d.jsxs(g.Box,{sx:{display:"none",alignItems:"center",mt:1,mb:1,px:0},children:[d.jsx(g.Box,{sx:{minWidth:40,display:"flex",justifyContent:"flex-start"},children:d.jsx("img",{src:"https://fonts.gstatic.com/s/i/productlogos/meet_2020q4/v1/web-512dp/logo_meet_2020q4_color_2x_web_512dp.png",alt:"Meet",style:{width:22,height:22}})}),d.jsx(g.Box,{sx:{flex:1},children:!Me("link")&&!Me("incluirMeet")?d.jsx(g.Button,{fullWidth:!0,disabled:ne||!c||!u,onClick:Ot,sx:{justifyContent:"flex-start",textTransform:"none",bgcolor:"#f1f3f4",color:"#3c4043","&:hover":{bgcolor:"#e8eaed",boxShadow:"none"},borderRadius:"4px",fontWeight:400,fontSize:"14px",py:1,px:2,border:"none",boxShadow:"none"},children:ne?d.jsxs(d.Fragment,{children:[d.jsx(g.CircularProgress,{size:18,sx:{mr:1.5,color:"#5f6368"}}),d.jsx(g.Typography,{variant:"body2",sx:{fontSize:"14px",color:"#5f6368"},children:"Generando enlace..."})]}):"Añadir videoconferencia de Google Meet"}):d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#f1f3f4",p:"6px 12px",borderRadius:"4px",border:"1px solid #dadce0"},children:[d.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[d.jsx(g.Typography,{variant:"body2",sx:{color:"#1a73e8",fontWeight:500,cursor:Me("link")?"pointer":"default",textDecoration:"none","&:hover":{textDecoration:Me("link")?"underline":"none"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:()=>Me("link")&&window.open(Me("link"),"_blank"),children:Me("link")?Me("link"):"Se añadirá Google Meet al guardar"}),d.jsx(g.Typography,{variant:"caption",sx:{color:"#70757a"},children:"Google Meet"})]}),d.jsx(g.IconButton,{size:"small",onClick:()=>{ge("incluirMeet",!1),ge("link","")},sx:{color:"#5f6368"},children:d.jsx(yr,{sx:{fontSize:18}})})]})})]}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[d.jsx(_3,{}),im.map(Q=>d.jsx(Pr,{name:"color",control:pe,render:({field:he})=>d.jsx(g.IconButton,{onClick:()=>he.onChange(Q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:Q,border:he.value===Q?"2px solid":"none",borderColor:he.value===Q?"primary.main":"transparent"}})},Q))]})})}),d.jsx("div",{className:"row",children:d.jsxs("div",{className:"col-12 d-flex flex-column flex-sm-row gap-2",style:{width:"100%",marginTop:"20px"},children:[i&&!i?.isGoogleEvent&&!i?.isOutlookEvent&&d.jsx(g.Button,{onClick:n,variant:"outlined",startIcon:d.jsx("img",{src:q0,width:15}),hidden:i?i?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),d.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"}),d.jsx(g.Button,{onClick:T,variant:"contained",disabled:!ze,hidden:i?i?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]}),d.jsx(aT,{open:F,onClose:()=>G(!1),clientOptions:_,isClientsLoading:E,setClientSearchTerm:y,onSelectClient:V,setFiltroPadre:me})]})})})},dT={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"},fT=({isOpen:e,onClose:t,events:r,date:n,onEventClick:o})=>{if(!n)return null;const i=a=>{o(a),t()},s=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return d.jsx(g.Modal,{open:e,onClose:t,children:d.jsxs(g.Box,{sx:dT,children:[d.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[d.jsxs(g.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),d.jsx(g.IconButton,{onClick:t,size:"small",children:d.jsx(yr,{})})]}),d.jsx(g.Divider,{}),d.jsx(g.List,{sx:{mt:1},children:r.map(a=>{const c=s(a);return d.jsx(g.ListItem,{disablePadding:!0,sx:{mb:1},children:d.jsx(g.ListItemButton,{onClick:()=>i(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:d.jsxs(g.Box,{sx:{flexGrow:1},children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[d.jsx(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),d.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),d.jsx(g.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${w.format(a.fechaInicio,"hh:mm aa").toLowerCase()} - ${w.format(a.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},a.eventoID)})})]})})};var Li={},am;function pT(){if(am)return Li;am=1;var e=ct();Object.defineProperty(Li,"__esModule",{value:!0}),Li.default=void 0;var t=e(ht()),r=pt();return Li.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"),Li}var hT=pT();const mT=st(hT);var zi={},cm;function gT(){if(cm)return zi;cm=1;var e=ct();Object.defineProperty(zi,"__esModule",{value:!0}),zi.default=void 0;var t=e(ht()),r=pt();return zi.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"),zi}var vT=gT();const yT=st(vT),bT="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",xT="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==",Xl=b.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=Ji.useSnackbar(),i={success:{color:"#fff",icon:d.jsx("img",{width:25,src:bT,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:d.jsx(mT,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:d.jsx(yT,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:d.jsx("img",{src:q0,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:d.jsx("img",{src:xT,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},s=i[r]||i.info;return d.jsx(Ji.SnackbarContent,{ref:n,children:d.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 ${s.color}`},children:[d.jsx(g.Box,{sx:{mr:1.5},children:s.icon}),d.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),d.jsx(g.IconButton,{size:"small",onClick:()=>o(e),children:d.jsx(yr,{fontSize:"small"})})]})})}),lm=b.createContext(void 0),wT=({children:e})=>{const[t,r]=b.useState([]),[n,o]=b.useState([]),[i,s]=b.useState(!1);return d.jsx(lm.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:i,setIsLoadingGoogleEvents:s},children:e})},_T=()=>{const e=b.useContext(lm);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},ST=(e,t,r)=>{const n=(s,a)=>a?new Date(a):s?new Date(s.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let i=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&i.setDate(i.getDate()-1),{eventoID:Math.abs(CT(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:i,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 CT(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 ET(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 DT=(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(ET(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}},um="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",AT="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",kT=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:i,confirmText:s,confirmColor:a="#d32f2f",loading:c=!1})=>d.jsxs(g.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[d.jsx(g.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:d.jsx(g.IconButton,{onClick:t,size:"small",children:d.jsx(yr,{fontSize:"small"})})}),d.jsxs(g.DialogContent,{sx:{textAlign:"center",pt:0},children:[d.jsx(g.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:i}),d.jsx(g.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),d.jsx(g.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),d.jsxs(g.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[d.jsx(g.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),d.jsxs(g.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[s=="Eliminar"&&d.jsx("img",{src:AT,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":s]})]})]})]}),Ba=(e,t)=>{if(!e||!t)return null;const r=t.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=r.includes("pm"),o=r.includes("am"),i=r.replace(/[a-z]/g,""),[s,a]=i.split(":");if(!s||!a)return null;let c=parseInt(s,10);const u=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[l,f,h]=e.split("-").map(Number),m=new Date(l,f-1,h,c,u);return w.isValid(m)?m:null},TT=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o,usrNombre:i,onNavigate:s})=>{const[a,c]=b.useState(new Date),[u,l]=b.useState([]),[f,h]=b.useState(!1),[m,v]=b.useState(null),[p,y]=b.useState(null),[_,C]=b.useState([]),{enqueueSnackbar:E}=Ji.useSnackbar(),S=$l(),x=ll(),I=Wp(),[D,k]=b.useState(!1),[P,O]=b.useState([]),[q,Y]=b.useState(null),{session:L,sessionoutlook:U}=Gc(),{googleEvents:K,setGoogleEvents:F,outlookEvents:G,setOutlookEvents:ie}=_T(),[fe,V]=b.useState([]),[J,De]=b.useState([]),[_e,xe]=b.useState([]),[ne,le]=b.useState(!1),[ue,me]=b.useState([]),[pe,ve]=b.useState(),Pe=(R,oe)=>{O(R),Y(oe),k(!0)},$=async()=>{if(e===void 0||n===void 0)return;const R=await S.getNotificacionesXUsuario(e,n);i?localStorage.setItem("nombreAnfitrion",i):localStorage.setItem("nombreAnfitrion","Anfitrion"),me(R)};b.useEffect(()=>{const R=new Date,oe=w.startOfDay(R),de=w.endOfDay(w.addDays(oe,6)),ke={start:oe,end:de},Mt=u.filter(Pt=>{const Qt={start:Pt.fechaInicio,end:Pt.fechaFin};return qf(Qt,ke)}).sort((Pt,Qt)=>Pt.fechaInicio.getTime()-Qt.fechaInicio.getTime());C(Mt)},[u]),b.useEffect(()=>{const R=async()=>{try{if(e&&n){const de=await S.getEventsByUser(e,n);$(),l(de)}}catch(de){console.log("Error al cargar eventos locales:",de)}};R();const oe=setInterval(R,4e3);return()=>clearInterval(oe)},[e]),b.useEffect(()=>{if(!n||!e)return;const R=[...u];if(K.length>0&&L?.userEmail){const oe=K.map(de=>ST(de,n,e));R.push(...oe)}if(G.length>0&&U?.userEmail){const oe=G.map(de=>DT(de,n,e));R.push(...oe)}V(R)},[u,K,G,n,e,L?.userEmail,U?.userEmail]);const ze=async R=>{try{if(R?.isGoogleEvent||R.isOutlookEvent)v(R),h(!0);else{const oe=await S.getEventById(R.eventoID);v(oe),h(!0)}}catch(oe){console.error(oe)}},Me=()=>{h(!1),v(null)},ge=async(R,oe)=>{let de,ke;if(R.todoElDia)de=Ba(R.fechaInicio,R.horaInicio),ke=Ba(R.fechaInicio,R.horaFin);else{de=Ba(R.fechaInicio,R.horaInicio);const Ht=R.fechaFin||R.fechaInicio;ke=Ba(Ht,R.horaFin)}if(!de||!ke){console.error("No se pudieron procesar las fechas. Revisa el formato de hora:",{inicio:R.horaInicio,fin:R.horaFin});return}const Mt=w.format(de,"yyyy-MM-dd HH:mm:ss.SSS"),Pt=w.format(ke,"yyyy-MM-dd HH:mm:ss.SSS");if(oe){const Ht={...R,eventoID:oe,fechaInicio:Mt,fechaFin:Pt,solID:R.solID??null,disID:n??null,client:R.client,invitados:R.invitados.map(Ue=>({usrNombre:Ue.nombre||Ue.usrNombre,Correo:Ue.correo||Ue.Correo,EsOrganizador:Ue.isHost||Ue.EsOrganizador,StatusInvitacion:Ue.StatusInvitacion,UsuarioID:Ue.usrID||Ue.UsuarioID,disID:Ue.disID||n}))};try{const Ue=await S.updateEvent(Ht);var Qt=u.map(hr=>hr.eventoID===Ue.eventoID?Ue:hr);l(Qt),E("El evento se ha actualizado correctamente.",{variant:"success"}),Me()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Ht={...R,fechaInicio:Mt,fechaFin:Pt,todoElDia:R.todoElDia,solID:R.solID??null,disID:n??null,client:R.client,invitados:R.invitados.map(Ue=>({usrNombre:Ue.nombre||Ue.usrNombre,Correo:Ue.correo||Ue.Correo,EsOrganizador:Ue.isHost||Ue.EsOrganizador,StatusInvitacion:Ue.StatusInvitacion,UsuarioID:Ue.usrID||Ue.UsuarioID,disID:Ue.disID||n}))};try{const Ue=await S.createEvent(Ht,e);l(hr=>[...hr,Ue]),E("El evento se ha creado con éxito",{variant:"success"}),Me()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e&&n){const Ht=await S.getEventsByUser(e,n);l(Ht)}},Re=()=>{c(R=>new Date(R.getFullYear(),R.getMonth()-1,1))},He=()=>{c(R=>new Date(R.getFullYear(),R.getMonth()+1,1))},We=()=>{Ot("ELIMINAR")},dt=()=>{Ot("RECHAZAR")},T=()=>{y(new Date),h(!0)},N=R=>{R&&c(R)},z=R=>{y(R),h(!0),v(null)},te=async()=>{if(m)try{await S.deleteEvent(m.eventoID),l(u.filter(R=>R.eventoID!==m.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(R,oe)=>d.jsx(Xl,{id:R,message:String(oe),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{Me(),Q()}},se=async()=>{if(!(!L?.userEmail||!n)){le(!0);try{const oe=(await x.getGoogleCalendars(L.userEmail,n)).map(ke=>({...ke,selected:!0}));De(oe);const de=oe.map(ke=>ke.id);$e(de)}catch(R){console.error("Error Google Cals:",R)}finally{le(!1)}}},j=async R=>{const oe=J.map(ke=>ke.id===R?{...ke,selected:!ke.selected}:ke);De(oe);const de=oe.filter(ke=>ke.selected).map(ke=>ke.id);$e(de)},re=async()=>{if(!(!U?.userEmail||!n)){le(!0);try{const oe=(await I.getOutlookCalendars(U.userEmail,n)).map(ke=>({...ke,selected:!0}));xe(oe);const de=oe.map(ke=>ke.id);W(de)}catch(R){console.error("Error Outlook Cals:",R)}finally{le(!1)}}},Ce=async R=>{const oe=_e.map(ke=>ke.id===R?{...ke,selected:!ke.selected}:ke);xe(oe);const de=oe.filter(ke=>ke.selected).map(ke=>ke.id);W(de)};b.useEffect(()=>{se()},[L?.userEmail,n]),b.useEffect(()=>{re()},[U?.userEmail,n]);const $e=async R=>{if(!L?.userEmail||!n)return;const oe=R||J.filter(de=>de.selected).map(de=>de.id);try{const de={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:L.userEmail,calendarIds:oe},ke=await x.getGoogleEventsByMonth(de);F(ke)}catch(de){console.error("Error al obtener eventos de Google:",de)}},W=async R=>{if(!U?.userEmail||!n)return;const oe=R||_e.filter(de=>de.selected).map(de=>de.id);try{const de={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:U.userEmail,calendarIds:oe},ke=await I.getOutlookEventsByMonth(de);ie(ke)}catch(de){console.error("Error al obtener eventos de Outlook:",de)}};if(n===void 0||e===void 0)return d.jsx("div",{children:"Cargando configuración de usuario..."});const ee=async(R,oe)=>{const de=await S.UpdateStatusEvento(R.evento.eventoID,e,oe);if(de?.success===!1){E(de?.message||"No se pudo procesar la invitación",{variant:"error"});return}de&&(await S.MarcarLeido(R.notificacionID,e),me(ke=>ke.filter(Mt=>Mt.notificacionID!==R.notificacionID)),E(R?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},Ee=async()=>{if(!pe)return;const R=await S.UpdateStatusEvento(pe.evento.eventoID,e,"RECHAZADA");if(R?.success===!1){E(R?.message||"No se pudo procesar la invitación",{variant:"error"}),Q();return}R&&(await S.MarcarLeido(pe.notificacionID,e),me(oe=>oe.filter(de=>de.notificacionID!==pe.notificacionID)),E("Haz rechazado la Invitación a "+pe?.evento?.titulo,{content:(oe,de)=>d.jsx(Xl,{id:oe,message:String(de),variant:"rechazar"})}),Q())},Fe=async(R,oe)=>{try{if(!e)return;ve(R),oe=="RECHAZADA"?dt():ee(R,oe)}catch{E("Error al procesar la invitación",{variant:"error"})}},ft=async R=>{if(e)try{await S.MarcarLeido(R,e),me(oe=>oe.filter(de=>de.notificacionID!==R))}catch{E("Error al marcar como leída",{variant:"error"})}},yt=async R=>{try{if(!m)return;await S.ReenviarNotificacion(m?.eventoID,R),E("Invitación enviada con éxito",{variant:"success"})}catch(oe){console.error("Error al conectar con la API",oe)}},[zt,Ot]=b.useState(null),Q=()=>Ot(null),he={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:d.jsxs(d.Fragment,{children:["Estás a punto de declinar la invitación de ",d.jsx("strong",{children:pe?.evento?.nombreAnfitrion})," a ",d.jsx("strong",{children:pe?.evento?.titulo})]}),icon:d.jsx("img",{src:um}),action:()=>pe&&Ee()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:d.jsx("img",{src:um}),action:()=>te()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>te}},Oe=zt?he[zt]:null;return d.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[d.jsx(Eb,{header:d.jsx(U2,{currentDate:a,onPrevMonth:Re,onNextMonth:He,onAddEvent:T,onDateChange:N}),sidebar:d.jsx(R_,{onEventClick:ze,upcomingEvents:_,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:T,googleCalendars:J,outlookCalendars:_e,isLoadingCalendars:ne,onToggleGoogle:j,onToggleOutlook:Ce,notifications:ue,unreadCount:ue?.filter(R=>!R.leida).length,onAceppInvitacion:Fe,onMarkAsRead:ft}),mainContent:d.jsx(jC,{onSeeMoreClick:Pe,currentDate:a,events:fe,onDayClick:z,onEventClick:ze})}),f&&d.jsx(uT,{isVisible:f,onClose:Me,onSave:ge,onDelete:We,selectedDate:p,initialEvent:m,userId:e,masNombreBD:o,disId:n,gmail:"llopez@exagono.net",onReenviar:yt,onNavigate:s}),d.jsx(fT,{isOpen:D,onClose:()=>k(!1),events:P,date:q,onEventClick:ze}),Oe&&d.jsx(kT,{open:!!zt,onClose:Q,onConfirm:()=>{Oe.action()},title:Oe.title,description:Oe.description,icon:Oe.icon,confirmText:Oe.confirmText})]})},OT="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",MT="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 Jl(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function PT(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 eu(e,t,r=!0){return typeof e=="function"?e(t):e??r}function IT(e){return e.replace(/[^\d]/g,"")}function jT(e,t){return t}var Bi={},dm;function RT(){if(dm)return Bi;dm=1;var e=ct();Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.default=void 0;var t=e(ht()),r=pt();return Bi.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"),Bi}var NT=RT();const $T=st(NT);var Fi={},fm;function LT(){if(fm)return Fi;fm=1;var e=ct();Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.default=void 0;var t=e(ht()),r=pt();return Fi.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"),Fi}var zT=LT();const BT=st(zT);var Vi={},pm;function FT(){if(pm)return Vi;pm=1;var e=ct();Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.default=void 0;var t=e(ht()),r=pt();return Vi.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"),Vi}var VT=FT();const WT=st(VT);var Wi={},hm;function UT(){if(hm)return Wi;hm=1;var e=ct();Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.default=void 0;var t=e(ht()),r=pt();return Wi.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"),Wi}var YT=UT();const HT=st(YT);function mm(e){return e==="right"?"end":e==="center"?"center":"start"}function gm(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 qT=1060,tu=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function ZT({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=qT,getDetailColumns:o,onRowClick:i}){function c(l){if(typeof l=="number")return l;if(!l)return 0;const f=/^(\d+)\s*px$/.exec(l.trim());return f?Number(f[1]):/fr$/i.test(l)?160:0}function u(l){const f=l.reduce((v,p)=>v+c(p.width),0),h=Math.max(l.length-1,0)*16;return f+h+32}return d.jsx(g.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:d.jsxs(g.Box,{children:[d.jsx(g.Box,{sx:{display:"grid",gridTemplateColumns:r.map(l=>typeof l=="number"?`${l}px`:l).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(l=>d.jsx(g.Typography,{sx:{fontSize:13,fontWeight:800},children:l},l))}),e.map((l,f)=>{const[h,m]=B.useState(!!l.initiallyOpen),v=f%2===1,p=o?o(l):t,y=Math.max(n,u(p));return d.jsxs(g.Box,{children:[d.jsxs(g.Box,{sx:{display:"grid",gridTemplateColumns:r.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:v?"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:()=>m(_=>!_),children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[d.jsx(g.IconButton,{size:"small",disableRipple:!0,children:h?d.jsx(HT,{}):d.jsx(WT,{})}),d.jsx(g.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(l.title),children:l.title})]}),d.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tu(l,"En Proceso")}),d.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tu(l,"Finalizadas")}),d.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tu(l,"Último seg.")})]}),d.jsx(g.Collapse,{in:h,unmountOnExit:!0,children:d.jsxs(g.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[d.jsx(g.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:gm(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(_=>d.jsx(g.Typography,{sx:{justifySelf:mm(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(l.rows??[]).map((_,C)=>d.jsx(g.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:gm(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:()=>i?.(_,l),children:p.map((E,S)=>{const x=E.accessor?E.accessor(_,C):E.field?_[E.field]:null;return d.jsx(g.Box,{sx:{justifySelf:mm(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof x=="string"||typeof x=="number"?d.jsx(g.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(E.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(x),children:x}):x},E.key??S)})},_.id??C))]})})]},l.id)})]})})}var Ui={},vm;function GT(){if(vm)return Ui;vm=1;var e=ct();Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.default=void 0;var t=e(ht()),r=pt();return Ui.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"),Ui}var KT=GT();const QT=st(KT),XT=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",JT=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},e5=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var Yi={},ym;function t5(){if(ym)return Yi;ym=1;var e=ct();Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.default=void 0;var t=e(ht()),r=pt();return Yi.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"),Yi}var r5=t5();const n5=st(r5),ru=({current:e=0,total:t=0,color:r="#4caf50"})=>d.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)=>d.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var Hi={},bm;function o5(){if(bm)return Hi;bm=1;var e=ct();Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.default=void 0;var t=e(ht()),r=pt();return Hi.default=(0,t.default)((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),Hi}var i5=o5();const xm=st(i5);var qi={},wm;function s5(){if(wm)return qi;wm=1;var e=ct();Object.defineProperty(qi,"__esModule",{value:!0}),qi.default=void 0;var t=e(ht()),r=pt();return qi.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"),qi}var a5=s5();const c5=st(a5),l5=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"}},u5=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}},d5=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}},f5=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 p5(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 h5(e){return e.replace(/<br\s*\/?>/gi,`
|
|
168
|
+
`)}m.write("payload.value = newResult;"),m.write("return payload;");const C=m.compile();return(E,S)=>C(h,E,S)};let i;const s=ba,a=!Eh.jitless,u=a&&LC.value,l=t.catchall;let f;e._zod.parse=(h,m)=>{f??(f=n.value);const v=h.value;return s(v)?a&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(t.shape)),h=i(h,m),l?Wh([],v,h,m,f,e):h):r(h,m):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function Uh(e,t,r,n){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!bo(i));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(i=>i.issues.map(s=>zn(s,n,Ln())))}),t)}const kD=X("$ZodUnion",(e,t)=>{Tt.init(e,t),mt(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),mt(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),mt(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),mt(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Tl(i.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>Uh(c,o,e,i)):Uh(a,o,e,i)}}),TD=X("$ZodIntersection",(e,t)=>{Tt.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>Yh(r,c,u)):Yh(r,i,s)}});function Il(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(_i(e)&&_i(t)){const r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(const i of n){const s=Il(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.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],i=t[n],s=Il(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Yh(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),bo(e))return e;const n=Il(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 OD=X("$ZodEnum",(e,t)=>{Tt.init(e,t);const r=RC(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>zC.has(typeof o)).map(o=>typeof o=="string"?yo(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),MD=X("$ZodLiteral",(e,t)=>{if(Tt.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"?yo(r):r?yo(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}}),PD=X("$ZodTransform",(e,t)=>{Tt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ch(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new go;return r.value=o,r}});function Hh(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ID=X("$ZodOptional",(e,t)=>{Tt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",mt(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),mt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Tl(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(i=>Hh(i,r.value)):Hh(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),jD=X("$ZodNullable",(e,t)=>{Tt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Tl(r.source)}|null)$`):void 0}),mt(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)}),RD=X("$ZodDefault",(e,t)=>{Tt.init(e,t),e._zod.optin="optional",mt(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(i=>qh(i,t)):qh(o,t)}});function qh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ND=X("$ZodPrefault",(e,t)=>{Tt.init(e,t),e._zod.optin="optional",mt(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))}),$D=X("$ZodNonOptional",(e,t)=>{Tt.init(e,t),mt(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(i=>Zh(i,e)):Zh(o,e)}});function Zh(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 LD=X("$ZodCatch",(e,t)=>{Tt.init(e,t),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(e._zod,"optout",()=>t.innerType._zod.optout),mt(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(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(s=>zn(s,n,Ln()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>zn(i,n,Ln()))},input:r.value}),r.issues=[]),r)}}),zD=X("$ZodPipe",(e,t)=>{Tt.init(e,t),mt(e._zod,"values",()=>t.in._zod.values),mt(e._zod,"optin",()=>t.in._zod.optin),mt(e._zod,"optout",()=>t.out._zod.optout),mt(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const i=t.out._zod.run(r,n);return i instanceof Promise?i.then(s=>ka(s,t.in,n)):ka(i,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ka(i,t.out,n)):ka(o,t.out,n)}});function ka(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const BD=X("$ZodReadonly",(e,t)=>{Tt.init(e,t),mt(e._zod,"propValues",()=>t.innerType._zod.propValues),mt(e._zod,"values",()=>t.innerType._zod.values),mt(e._zod,"optin",()=>t.innerType._zod.optin),mt(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(Gh):Gh(o)}});function Gh(e){return e.value=Object.freeze(e.value),e}const FD=X("$ZodCustom",(e,t)=>{sr.init(e,t),Tt.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(i=>Kh(i,r,n,e));Kh(o,r,n,e)}});function Kh(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(Si(o))}}class VD{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 WD(){return new VD}const Ta=WD();function UD(e,t){return new e({type:"string",...je(t)})}function YD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...je(t)})}function Qh(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...je(t)})}function HD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...je(t)})}function qD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...je(t)})}function ZD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...je(t)})}function GD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...je(t)})}function KD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...je(t)})}function QD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...je(t)})}function XD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...je(t)})}function JD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...je(t)})}function eA(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...je(t)})}function tA(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...je(t)})}function rA(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...je(t)})}function nA(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...je(t)})}function oA(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...je(t)})}function iA(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...je(t)})}function sA(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...je(t)})}function aA(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...je(t)})}function cA(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...je(t)})}function lA(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...je(t)})}function uA(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...je(t)})}function dA(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...je(t)})}function fA(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...je(t)})}function pA(e,t){return new e({type:"string",format:"date",check:"string_format",...je(t)})}function hA(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...je(t)})}function mA(e,t){return new e({type:"string",format:"duration",check:"string_format",...je(t)})}function gA(e,t){return new e({type:"number",checks:[],...je(t)})}function vA(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...je(t)})}function yA(e,t){return new e({type:"boolean",...je(t)})}function bA(e){return new e({type:"unknown"})}function xA(e,t){return new e({type:"never",...je(t)})}function Xh(e,t){return new $h({check:"less_than",...je(t),value:e,inclusive:!1})}function jl(e,t){return new $h({check:"less_than",...je(t),value:e,inclusive:!0})}function Jh(e,t){return new Lh({check:"greater_than",...je(t),value:e,inclusive:!1})}function Rl(e,t){return new Lh({check:"greater_than",...je(t),value:e,inclusive:!0})}function e0(e,t){return new NE({check:"multiple_of",...je(t),value:e})}function t0(e,t){return new LE({check:"max_length",...je(t),maximum:e})}function Oa(e,t){return new zE({check:"min_length",...je(t),minimum:e})}function r0(e,t){return new BE({check:"length_equals",...je(t),length:e})}function wA(e,t){return new FE({check:"string_format",format:"regex",...je(t),pattern:e})}function _A(e){return new VE({check:"string_format",format:"lowercase",...je(e)})}function SA(e){return new WE({check:"string_format",format:"uppercase",...je(e)})}function CA(e,t){return new UE({check:"string_format",format:"includes",...je(t),includes:e})}function EA(e,t){return new YE({check:"string_format",format:"starts_with",...je(t),prefix:e})}function DA(e,t){return new HE({check:"string_format",format:"ends_with",...je(t),suffix:e})}function Ci(e){return new qE({check:"overwrite",tx:e})}function AA(e){return Ci(t=>t.normalize(e))}function kA(){return Ci(e=>e.trim())}function TA(){return Ci(e=>e.toLowerCase())}function OA(){return Ci(e=>e.toUpperCase())}function MA(e,t,r){return new e({type:"array",element:t,...je(r)})}function PA(e,t,r){return new e({type:"custom",check:"custom",fn:t,...je(r)})}function IA(e){const t=jA(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Si(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(Si(o))}},e(r.value,r)));return t}function jA(e,t){const r=new sr({check:"custom",...je(t)});return r._zod.check=e,r}const RA=X("ZodISODateTime",(e,t)=>{aD.init(e,t),Et.init(e,t)});function NA(e){return fA(RA,e)}const $A=X("ZodISODate",(e,t)=>{cD.init(e,t),Et.init(e,t)});function LA(e){return pA($A,e)}const zA=X("ZodISOTime",(e,t)=>{lD.init(e,t),Et.init(e,t)});function BA(e){return hA(zA,e)}const FA=X("ZodISODuration",(e,t)=>{uD.init(e,t),Et.init(e,t)});function VA(e){return mA(FA,e)}const Er=X("ZodError",(e,t)=>{Ml.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>KC(e,r)},flatten:{value:r=>GC(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Dl,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Dl,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),WA=_a(Er),UA=Sa(Er),YA=Ca(Er),HA=Ea(Er),qA=tE(Er),ZA=rE(Er),GA=nE(Er),KA=oE(Er),QA=iE(Er),XA=sE(Er),JA=aE(Er),ek=cE(Er),Nt=X("ZodType",(e,t)=>(Tt.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)=>bn(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>WA(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>YA(e,r,n),e.parseAsync=async(r,n)=>UA(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>HA(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qA(e,r,n),e.decode=(r,n)=>ZA(e,r,n),e.encodeAsync=async(r,n)=>GA(e,r,n),e.decodeAsync=async(r,n)=>KA(e,r,n),e.safeEncode=(r,n)=>QA(e,r,n),e.safeDecode=(r,n)=>XA(e,r,n),e.safeEncodeAsync=async(r,n)=>JA(e,r,n),e.safeDecodeAsync=async(r,n)=>ek(e,r,n),e.refine=(r,n)=>e.check(Hk(r,n)),e.superRefine=r=>e.check(qk(r)),e.overwrite=r=>e.check(Ci(r)),e.optional=()=>f0(e),e.nullable=()=>p0(e),e.nullish=()=>f0(p0(e)),e.nonoptional=r=>zk(e,r),e.array=()=>c0(e),e.or=r=>Ak([e,r]),e.and=r=>Tk(e,r),e.transform=r=>m0(e,Ik(r)),e.default=r=>Nk(e,r),e.prefault=r=>Lk(e,r),e.catch=r=>Fk(e,r),e.pipe=r=>m0(e,r),e.readonly=()=>Uk(e),e.describe=r=>{const n=e.clone();return Ta.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ta.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ta.get(e);const n=e.clone();return Ta.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),n0=X("_ZodString",(e,t)=>{Pl.init(e,t),Nt.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(wA(...n)),e.includes=(...n)=>e.check(CA(...n)),e.startsWith=(...n)=>e.check(EA(...n)),e.endsWith=(...n)=>e.check(DA(...n)),e.min=(...n)=>e.check(Oa(...n)),e.max=(...n)=>e.check(t0(...n)),e.length=(...n)=>e.check(r0(...n)),e.nonempty=(...n)=>e.check(Oa(1,...n)),e.lowercase=n=>e.check(_A(n)),e.uppercase=n=>e.check(SA(n)),e.trim=()=>e.check(kA()),e.normalize=(...n)=>e.check(AA(...n)),e.toLowerCase=()=>e.check(TA()),e.toUpperCase=()=>e.check(OA())}),tk=X("ZodString",(e,t)=>{Pl.init(e,t),n0.init(e,t),e.email=r=>e.check(YD(rk,r)),e.url=r=>e.check(KD(nk,r)),e.jwt=r=>e.check(dA(yk,r)),e.emoji=r=>e.check(QD(ok,r)),e.guid=r=>e.check(Qh(o0,r)),e.uuid=r=>e.check(HD(Ma,r)),e.uuidv4=r=>e.check(qD(Ma,r)),e.uuidv6=r=>e.check(ZD(Ma,r)),e.uuidv7=r=>e.check(GD(Ma,r)),e.nanoid=r=>e.check(XD(ik,r)),e.guid=r=>e.check(Qh(o0,r)),e.cuid=r=>e.check(JD(sk,r)),e.cuid2=r=>e.check(eA(ak,r)),e.ulid=r=>e.check(tA(ck,r)),e.base64=r=>e.check(cA(mk,r)),e.base64url=r=>e.check(lA(gk,r)),e.xid=r=>e.check(rA(lk,r)),e.ksuid=r=>e.check(nA(uk,r)),e.ipv4=r=>e.check(oA(dk,r)),e.ipv6=r=>e.check(iA(fk,r)),e.cidrv4=r=>e.check(sA(pk,r)),e.cidrv6=r=>e.check(aA(hk,r)),e.e164=r=>e.check(uA(vk,r)),e.datetime=r=>e.check(NA(r)),e.date=r=>e.check(LA(r)),e.time=r=>e.check(BA(r)),e.duration=r=>e.check(VA(r))});function Dr(e){return UD(tk,e)}const Et=X("ZodStringFormat",(e,t)=>{_t.init(e,t),n0.init(e,t)}),rk=X("ZodEmail",(e,t)=>{XE.init(e,t),Et.init(e,t)}),o0=X("ZodGUID",(e,t)=>{KE.init(e,t),Et.init(e,t)}),Ma=X("ZodUUID",(e,t)=>{QE.init(e,t),Et.init(e,t)}),nk=X("ZodURL",(e,t)=>{JE.init(e,t),Et.init(e,t)}),ok=X("ZodEmoji",(e,t)=>{eD.init(e,t),Et.init(e,t)}),ik=X("ZodNanoID",(e,t)=>{tD.init(e,t),Et.init(e,t)}),sk=X("ZodCUID",(e,t)=>{rD.init(e,t),Et.init(e,t)}),ak=X("ZodCUID2",(e,t)=>{nD.init(e,t),Et.init(e,t)}),ck=X("ZodULID",(e,t)=>{oD.init(e,t),Et.init(e,t)}),lk=X("ZodXID",(e,t)=>{iD.init(e,t),Et.init(e,t)}),uk=X("ZodKSUID",(e,t)=>{sD.init(e,t),Et.init(e,t)}),dk=X("ZodIPv4",(e,t)=>{dD.init(e,t),Et.init(e,t)}),fk=X("ZodIPv6",(e,t)=>{fD.init(e,t),Et.init(e,t)}),pk=X("ZodCIDRv4",(e,t)=>{pD.init(e,t),Et.init(e,t)}),hk=X("ZodCIDRv6",(e,t)=>{hD.init(e,t),Et.init(e,t)}),mk=X("ZodBase64",(e,t)=>{mD.init(e,t),Et.init(e,t)}),gk=X("ZodBase64URL",(e,t)=>{vD.init(e,t),Et.init(e,t)}),vk=X("ZodE164",(e,t)=>{yD.init(e,t),Et.init(e,t)}),yk=X("ZodJWT",(e,t)=>{xD.init(e,t),Et.init(e,t)}),i0=X("ZodNumber",(e,t)=>{Bh.init(e,t),Nt.init(e,t),e.gt=(n,o)=>e.check(Jh(n,o)),e.gte=(n,o)=>e.check(Rl(n,o)),e.min=(n,o)=>e.check(Rl(n,o)),e.lt=(n,o)=>e.check(Xh(n,o)),e.lte=(n,o)=>e.check(jl(n,o)),e.max=(n,o)=>e.check(jl(n,o)),e.int=n=>e.check(s0(n)),e.safe=n=>e.check(s0(n)),e.positive=n=>e.check(Jh(0,n)),e.nonnegative=n=>e.check(Rl(0,n)),e.negative=n=>e.check(Xh(0,n)),e.nonpositive=n=>e.check(jl(0,n)),e.multipleOf=(n,o)=>e.check(e0(n,o)),e.step=(n,o)=>e.check(e0(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 Pa(e){return gA(i0,e)}const bk=X("ZodNumberFormat",(e,t)=>{wD.init(e,t),i0.init(e,t)});function s0(e){return vA(bk,e)}const xk=X("ZodBoolean",(e,t)=>{_D.init(e,t),Nt.init(e,t)});function Ei(e){return yA(xk,e)}const wk=X("ZodUnknown",(e,t)=>{SD.init(e,t),Nt.init(e,t)});function a0(){return bA(wk)}const _k=X("ZodNever",(e,t)=>{CD.init(e,t),Nt.init(e,t)});function Sk(e){return xA(_k,e)}const Ck=X("ZodArray",(e,t)=>{ED.init(e,t),Nt.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Oa(r,n)),e.nonempty=r=>e.check(Oa(1,r)),e.max=(r,n)=>e.check(t0(r,n)),e.length=(r,n)=>e.check(r0(r,n)),e.unwrap=()=>e.element});function c0(e,t){return MA(Ck,e,t)}const Ek=X("ZodObject",(e,t)=>{AD.init(e,t),Nt.init(e,t),mt(e,"shape",()=>t.shape),e.keyof=()=>u0(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:a0()}),e.loose=()=>e.clone({...e._zod.def,catchall:a0()}),e.strict=()=>e.clone({...e._zod.def,catchall:Sk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>UC(e,r),e.safeExtend=r=>YC(e,r),e.merge=r=>HC(e,r),e.pick=r=>VC(e,r),e.omit=r=>WC(e,r),e.partial=(...r)=>qC(d0,e,r[0]),e.required=(...r)=>ZC(h0,e,r[0])});function l0(e,t){const r={type:"object",get shape(){return yn(this,"shape",e?$C(e):{}),this.shape},...je(t)};return new Ek(r)}const Dk=X("ZodUnion",(e,t)=>{kD.init(e,t),Nt.init(e,t),e.options=t.options});function Ak(e,t){return new Dk({type:"union",options:e,...je(t)})}const kk=X("ZodIntersection",(e,t)=>{TD.init(e,t),Nt.init(e,t)});function Tk(e,t){return new kk({type:"intersection",left:e,right:t})}const Nl=X("ZodEnum",(e,t)=>{OD.init(e,t),Nt.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 i={};for(const s of n)if(r.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Nl({...t,checks:[],...je(o),entries:i})},e.exclude=(n,o)=>{const i={...t.entries};for(const s of n)if(r.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Nl({...t,checks:[],...je(o),entries:i})}});function u0(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Nl({type:"enum",entries:r,...je(t)})}const Ok=X("ZodLiteral",(e,t)=>{MD.init(e,t),Nt.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 Mk(e,t){return new Ok({type:"literal",values:Array.isArray(e)?e:[e],...je(t)})}const Pk=X("ZodTransform",(e,t)=>{PD.init(e,t),Nt.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ch(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Si(i,r.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Si(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Ik(e){return new Pk({type:"transform",transform:e})}const d0=X("ZodOptional",(e,t)=>{ID.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function f0(e){return new d0({type:"optional",innerType:e})}const jk=X("ZodNullable",(e,t)=>{jD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function p0(e){return new jk({type:"nullable",innerType:e})}const Rk=X("ZodDefault",(e,t)=>{RD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Nk(e,t){return new Rk({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Th(t)}})}const $k=X("ZodPrefault",(e,t)=>{ND.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Lk(e,t){return new $k({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Th(t)}})}const h0=X("ZodNonOptional",(e,t)=>{$D.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function zk(e,t){return new h0({type:"nonoptional",innerType:e,...je(t)})}const Bk=X("ZodCatch",(e,t)=>{LD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Fk(e,t){return new Bk({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Vk=X("ZodPipe",(e,t)=>{zD.init(e,t),Nt.init(e,t),e.in=t.in,e.out=t.out});function m0(e,t){return new Vk({type:"pipe",in:e,out:t})}const Wk=X("ZodReadonly",(e,t)=>{BD.init(e,t),Nt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Uk(e){return new Wk({type:"readonly",innerType:e})}const Yk=X("ZodCustom",(e,t)=>{FD.init(e,t),Nt.init(e,t)});function Hk(e,t={}){return PA(Yk,e,t)}function qk(e){return IA(e)}const $l=()=>{const{calendarApiUrl:e}=cl(),t=async(p,y)=>{try{return(await vt.get(`${e}/api/Calendario/v1/local/ListarEventosXUsuario/${p}/${y}`)).data.map(C=>{const E=new Date(C.fechaInicio),S=new Date(C.fechaFin),x=C?.solicitudRelacionada?.[0]?.nombreCliente??null;return{...C,fechaInicio:E,fechaFin:S,client:x}})}catch(_){return console.error("Error events:",_),[]}},r=async(p,y)=>{try{const _=await vt.post(`${e}/api/Calendario/v1/local/InsertarEvento/${y}`,p);return{..._.data,fechaInicio:new Date(_.data.fechaInicio),fechaFin:new Date(_.data.fechaFin)}}catch(_){throw console.log("Error creating event:",_),_}},n=async p=>{try{const y=await vt.post(`${e}/api/Calendario/v1/local/ActualizarEvento/${p.eventoID}`,p);return{eventoID:y.data.eventoID,titulo:y.data.titulo,descripcion:y.data.descripcion,fechaInicio:new Date(y.data.fechaInicio),fechaFin:new Date(y.data.fechaFin),todoElDia:y.data.todoElDia,color:y.data.color,repetir:y.data.repetir,link:y.data.link,solID:y.data.solID,disID:y.data.disID,client:y.data.client,esOrganizador:y.data.esOrganizador}}catch(y){throw console.log("Error updating event:",y),y}},o=async p=>{try{const y=await vt.get(`${e}/api/Calendario/v1/local/ObtenerEvento/${p}`);console.log("response",y);const _=y.data[0]?.solicitudRelacionada?.[0]?.nombreCliente||null;return{...y.data[0],fechaInicio:y.data[0]?.fechaInicio,fechaFin:y.data[0]?.fechaFin,client:_}}catch(y){throw console.error(`Error fetching event with ID ${p}:`,y),y}},i=async p=>{try{await vt.post(`${e}/api/Calendario/v1/local/EliminarEvento/${p}`)}catch(y){throw console.log(`Error ID ${p}:`,y),y}},s=b.useCallback(async(p,y,_,C,E)=>{try{const S={masNombreBD:_,usrID:C,disID:y,nombreCliente:p,tiposSolicitud:E},I=(await vt.post(`${e}/api/Calendario/v1/local/ConsultaClientesXUsuariologgeado/`,S)).data?.data;return Array.isArray(I)?I.map(D=>({clienteID:D.clienteID,solID:D.solID,marca:D?.marca,modelo:D?.modelo,nombreCliente:D?.nombreCliente,email:D?.email,tel:D?.tel})):[]}catch(S){return console.error("Error clientes:",S),[]}},[e]),a=async(p,y)=>{try{const _={disID:p,usrMail:y},E=(await vt.post(`${e}/api/Calendario/v1/Consulta_UsuariosInvitados/`,_)).data?.data;return Array.isArray(E)?E.map(S=>({usrID:S.usrID,usrNombre:S.usrNombre,usrMail:S?.usrMail,disID:S?.disID})):[]}catch(_){return console.error("Error usuarios:",_),[]}},c=async(p,y,_,C,E)=>{const S={tieneConflicto:!1,usrMail:""};try{const x={disID:p,usrMail:y,startDate:_,horaInicio:C,horaFin:E};return(await vt.post(`${e}/api/Calendario/v1/local/ConsultaConflictoInvitados`,x)).data?.data}catch(x){return console.error("Error al verificar conflicto:",x),S}},u=async(p,y,_,C)=>{try{const E={disID:p,usrMail:y,startDate:_,DuracionEvento:C},S=await vt.post(`${e}/api/Calendario/v1/local/ConsultaDisponibilidadUsuario`,E);console.log("response",S);const x=S.data?.data;return Array.isArray(x)?x.map(I=>({Fecha:I.fecha,HoraInicio:I.horaInicio,HoraFin:I.horaFin})):[]}catch(E){return console.error("Error usuarios:",E),[]}},l=b.useCallback(async(p,y)=>{try{return(await vt.post(`${e}/api/Notificaciones/v1/local/ObtenerNotificacionesPorUsuarioAsync/${p}/${y}?soloNoLeidas=true`)).data}catch(_){return console.error("Error usuarios:",_),[]}},[e]);return{getEventsByUser:t,createEvent:r,updateEvent:n,getEventById:o,deleteEvent:i,getClients:s,getUsuariosInvitados:a,VerificarConflicto:c,getDisponibilidadUsuario:u,getNotificacionesXUsuario:l,UpdateStatusEvento:async(p,y,_)=>{try{const C={EventoID:p,UsuarioID:y,status:_};return(await vt.post(`${e}/api/Calendario/v1/local/ActualizarEstadoInvitacionAsync/`,C)).data}catch(C){return C?.response?.data?C.response.data:(console.error("Error Actualizar estatus:",C),{success:!1,message:"Error al procesar la solicitud"})}},MarcarLeido:async(p,y)=>{try{return(await vt.post(`${e}/api/Notificaciones/v1/local/MarcarComoLeidaAsync/${p}?usuarioId=${y}&marcarComoLeida=true`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},ReenviarNotificacion:async(p,y)=>{try{return(await vt.post(`${e}/api/Calendario/v1/local/ReenviarNotificacion/${y}/${p}`)).data?.data}catch(_){return console.error("Error Actualizar estatus:",_),{}}},insertarEventoGoogle:async(p,y,_,C)=>{try{const E=`api/Calendario/v1/google/InsertarEvento?disID=${p}&usrMail=${y}&incluirMeet=${_}`;return(await vt.post(`${e}/${E}`,C)).data}catch(E){throw console.error("Error al insertar evento en Google:",E),E}}}};var Di={},g0;function Zk(){if(g0)return Di;g0=1;var e=ct();Object.defineProperty(Di,"__esModule",{value:!0}),Di.default=void 0;var t=e(ht()),r=pt();return Di.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 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"},"0"),(0,r.jsx)("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"},"1")],"AccessTime"),Di}var Gk=Zk();const Ll=st(Gk);var Ai=e=>e.type==="checkbox",Bn=e=>e instanceof Date,er=e=>e==null;const v0=e=>typeof e=="object";var $t=e=>!er(e)&&!Array.isArray(e)&&v0(e)&&!Bn(e),y0=e=>$t(e)&&e.target?Ai(e.target)?e.target.checked:e.target.value:e,Kk=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,b0=(e,t)=>e.has(Kk(t)),Qk=e=>{const t=e.constructor&&e.constructor.prototype;return $t(t)&&t.hasOwnProperty("isPrototypeOf")},zl=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Wt(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(zl&&(e instanceof Blob||n))&&(r||$t(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!Qk(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=Wt(e[o]));else return e;return t}var Ia=e=>/^\w*$/.test(e),Lt=e=>e===void 0,Bl=e=>Array.isArray(e)?e.filter(Boolean):[],Fl=e=>Bl(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ye=(e,t,r)=>{if(!t||!$t(e))return r;const n=(Ia(t)?[t]:Fl(t)).reduce((o,i)=>er(o)?o:o[i],e);return Lt(n)||n===e?Lt(e[t])?r:e[t]:n},pr=e=>typeof e=="boolean",at=(e,t,r)=>{let n=-1;const o=Ia(t)?[t]:Fl(t),i=o.length,s=i-1;for(;++n<i;){const a=o[n];let c=r;if(n!==s){const u=e[a];c=$t(u)||Array.isArray(u)?u:isNaN(+o[n+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=c,e=e[a]}};const ja={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Mr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},an={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Vl=b.createContext(null);Vl.displayName="HookFormContext";const Wl=()=>b.useContext(Vl),Xk=e=>{const{children:t,...r}=e;return b.createElement(Vl.Provider,{value:r},t)};var x0=(e,t,r,n=!0)=>{const o={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(o,i,{get:()=>{const s=i;return t._proxyFormState[s]!==Mr.all&&(t._proxyFormState[s]=!n||Mr.all),r&&(r[s]=!0),e[s]}});return o};const Ul=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Jk(e){const t=Wl(),{control:r=t.control,disabled:n,name:o,exact:i}=e||{},[s,a]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Ul(()=>r._subscribe({name:o,formState:c.current,exact:i,callback:u=>{!n&&a({...r._formState,...u})}}),[o,n,i]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>x0(s,r,c.current,!1),[s,r])}var Kr=e=>typeof e=="string",w0=(e,t,r,n,o)=>Kr(e)?(n&&t.watch.add(e),ye(r,e,o)):Array.isArray(e)?e.map(i=>(n&&t.watch.add(i),ye(r,i))):(n&&(t.watchAll=!0),r),Yl=e=>er(e)||!v0(e);function cn(e,t,r=new WeakSet){if(Yl(e)||Yl(t))return e===t;if(Bn(e)&&Bn(t))return e.getTime()===t.getTime();const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const i of n){const s=e[i];if(!o.includes(i))return!1;if(i!=="ref"){const a=t[i];if(Bn(s)&&Bn(a)||$t(s)&&$t(a)||Array.isArray(s)&&Array.isArray(a)?!cn(s,a,r):s!==a)return!1}}return!0}function _0(e){const t=Wl(),{control:r=t.control,name:n,defaultValue:o,disabled:i,exact:s,compute:a}=e||{},c=b.useRef(o),u=b.useRef(a),l=b.useRef(void 0);u.current=a;const f=b.useMemo(()=>r._getWatch(n,c.current),[r,n]),[h,m]=b.useState(u.current?u.current(f):f);return Ul(()=>r._subscribe({name:n,formState:{values:!0},exact:s,callback:v=>{if(!i){const p=w0(n,r._names,v.values||r._formValues,!1,c.current);if(u.current){const y=u.current(p);cn(y,l.current)||(m(y),l.current=y)}else m(p)}}}),[r,i,n,s]),b.useEffect(()=>r._removeUnmounted()),h}function e3(e){const t=Wl(),{name:r,disabled:n,control:o=t.control,shouldUnregister:i,defaultValue:s}=e,a=b0(o._names.array,r),c=b.useMemo(()=>ye(o._formValues,r,ye(o._defaultValues,r,s)),[o,r,s]),u=_0({control:o,name:r,defaultValue:c,exact:!0}),l=Jk({control:o,name:r,exact:!0}),f=b.useRef(e),h=b.useRef(o.register(r,{...e.rules,value:u,...pr(e.disabled)?{disabled:e.disabled}:{}}));f.current=e;const m=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ye(l.errors,r)},isDirty:{enumerable:!0,get:()=>!!ye(l.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!ye(l.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!ye(l.validatingFields,r)},error:{enumerable:!0,get:()=>ye(l.errors,r)}}),[l,r]),v=b.useCallback(C=>h.current.onChange({target:{value:y0(C),name:r},type:ja.CHANGE}),[r]),p=b.useCallback(()=>h.current.onBlur({target:{value:ye(o._formValues,r),name:r},type:ja.BLUR}),[r,o._formValues]),y=b.useCallback(C=>{const E=ye(o._fields,r);E&&C&&(E._f.ref={focus:()=>C.focus&&C.focus(),select:()=>C.select&&C.select(),setCustomValidity:S=>C.setCustomValidity(S),reportValidity:()=>C.reportValidity()})},[o._fields,r]),_=b.useMemo(()=>({name:r,value:u,...pr(n)||l.disabled?{disabled:l.disabled||n}:{},onChange:v,onBlur:p,ref:y}),[r,n,l.disabled,v,p,y,u]);return b.useEffect(()=>{const C=o._options.shouldUnregister||i;o.register(r,{...f.current.rules,...pr(f.current.disabled)?{disabled:f.current.disabled}:{}});const E=(S,x)=>{const I=ye(o._fields,S);I&&I._f&&(I._f.mount=x)};if(E(r,!0),C){const S=Wt(ye(o._options.defaultValues,r));at(o._defaultValues,r,S),Lt(ye(o._formValues,r))&&at(o._formValues,r,S)}return!a&&o.register(r),()=>{(a?C&&!o._state.action:C)?o.unregister(r):E(r,!1)}},[r,o,a,i]),b.useEffect(()=>{o._setDisabledField({disabled:n,name:r})},[n,r,o]),b.useMemo(()=>({field:_,formState:l,fieldState:m}),[_,l,m])}const Pr=e=>e.render(e3(e));var Hl=(e,t,r,n,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:o||!0}}:{},ki=e=>Array.isArray(e)?e:[e],S0=()=>{let e=[];return{get observers(){return e},next:o=>{for(const i of e)i.next&&i.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(i=>i!==o)}}),unsubscribe:()=>{e=[]}}},ar=e=>$t(e)&&!Object.keys(e).length,ql=e=>e.type==="file",Ir=e=>typeof e=="function",Ra=e=>{if(!zl)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},C0=e=>e.type==="select-multiple",Zl=e=>e.type==="radio",t3=e=>Zl(e)||Ai(e),Gl=e=>Ra(e)&&e.isConnected;function r3(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Lt(e)?n++:e[t[n++]];return e}function n3(e){for(const t in e)if(e.hasOwnProperty(t)&&!Lt(e[t]))return!1;return!0}function Vt(e,t){const r=Array.isArray(t)?t:Ia(t)?[t]:Fl(t),n=r.length===1?e:r3(e,r),o=r.length-1,i=r[o];return n&&delete n[i],o!==0&&($t(n)&&ar(n)||Array.isArray(n)&&n3(n))&&Vt(e,r.slice(0,-1)),e}var E0=e=>{for(const t in e)if(Ir(e[t]))return!0;return!1};function Na(e,t={}){const r=Array.isArray(e);if($t(e)||r)for(const n in e)Array.isArray(e[n])||$t(e[n])&&!E0(e[n])?(t[n]=Array.isArray(e[n])?[]:{},Na(e[n],t[n])):er(e[n])||(t[n]=!0);return t}function D0(e,t,r){const n=Array.isArray(e);if($t(e)||n)for(const o in e)Array.isArray(e[o])||$t(e[o])&&!E0(e[o])?Lt(t)||Yl(r[o])?r[o]=Array.isArray(e[o])?Na(e[o],[]):{...Na(e[o])}:D0(e[o],er(t)?{}:t[o],r[o]):r[o]=!cn(e[o],t[o]);return r}var Ti=(e,t)=>D0(e,t,Na(t));const A0={value:!1,isValid:!1},k0={value:!0,isValid:!0};var T0=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Lt(e[0].attributes.value)?Lt(e[0].value)||e[0].value===""?k0:{value:e[0].value,isValid:!0}:k0:A0}return A0},O0=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Lt(e)?e:t?e===""?NaN:e&&+e:r&&Kr(e)?new Date(e):n?n(e):e;const M0={isValid:!1,value:null};var P0=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,M0):M0;function I0(e){const t=e.ref;return ql(t)?t.files:Zl(t)?P0(e.refs).value:C0(t)?[...t.selectedOptions].map(({value:r})=>r):Ai(t)?T0(e.refs).value:O0(Lt(t.value)?e.ref.value:t.value,e)}var o3=(e,t,r,n)=>{const o={};for(const i of e){const s=ye(t,i);s&&at(o,i,s._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:n}},$a=e=>e instanceof RegExp,Oi=e=>Lt(e)?e:$a(e)?e.source:$t(e)?$a(e.value)?e.value.source:e.value:e,j0=e=>({isOnSubmit:!e||e===Mr.onSubmit,isOnBlur:e===Mr.onBlur,isOnChange:e===Mr.onChange,isOnAll:e===Mr.all,isOnTouch:e===Mr.onTouched});const R0="AsyncFunction";var i3=e=>!!e&&!!e.validate&&!!(Ir(e.validate)&&e.validate.constructor.name===R0||$t(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===R0)),s3=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),N0=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Mi=(e,t,r,n)=>{for(const o of r||Object.keys(e)){const i=ye(e,o);if(i){const{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],o)&&!n)return!0;if(s.ref&&t(s.ref,s.name)&&!n)return!0;if(Mi(a,t))break}else if($t(a)&&Mi(a,t))break}}};function $0(e,t,r){const n=ye(e,r);if(n||Ia(r))return{error:n,name:r};const o=r.split(".");for(;o.length;){const i=o.join("."),s=ye(t,i),a=ye(e,i);if(s&&!Array.isArray(s)&&r!==i)return{name:r};if(a&&a.type)return{name:i,error:a};if(a&&a.root&&a.root.type)return{name:`${i}.root`,error:a.root};o.pop()}return{name:r}}var a3=(e,t,r,n)=>{r(e);const{name:o,...i}=e;return ar(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(s=>t[s]===(!n||Mr.all))},c3=(e,t,r)=>!e||!t||e===t||ki(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),l3=(e,t,r,n,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?n.isOnBlur:o.isOnBlur)?!e:(r?n.isOnChange:o.isOnChange)?e:!0,u3=(e,t)=>!Bl(ye(e,t)).length&&Vt(e,t),d3=(e,t,r)=>{const n=ki(ye(e,r));return at(n,"root",t[r]),at(e,r,n),e},La=e=>Kr(e);function L0(e,t,r="validate"){if(La(e)||Array.isArray(e)&&e.every(La)||pr(e)&&!e)return{type:r,message:La(e)?e:"",ref:t}}var xo=e=>$t(e)&&!$a(e)?e:{value:e,message:""},z0=async(e,t,r,n,o,i)=>{const{ref:s,refs:a,required:c,maxLength:u,minLength:l,min:f,max:h,pattern:m,validate:v,name:p,valueAsNumber:y,mount:_}=e._f,C=ye(r,p);if(!_||t.has(p))return{};const E=a?a[0]:s,S=Y=>{o&&E.reportValidity&&(E.setCustomValidity(pr(Y)?"":Y||""),E.reportValidity())},x={},I=Zl(s),D=Ai(s),k=I||D,P=(y||ql(s))&&Lt(s.value)&&Lt(C)||Ra(s)&&s.value===""||C===""||Array.isArray(C)&&!C.length,O=Hl.bind(null,p,n,x),q=(Y,L,U,K=an.maxLength,F=an.minLength)=>{const G=Y?L:U;x[p]={type:Y?K:F,message:G,ref:s,...O(Y?K:F,G)}};if(i?!Array.isArray(C)||!C.length:c&&(!k&&(P||er(C))||pr(C)&&!C||D&&!T0(a).isValid||I&&!P0(a).isValid)){const{value:Y,message:L}=La(c)?{value:!!c,message:c}:xo(c);if(Y&&(x[p]={type:an.required,message:L,ref:E,...O(an.required,L)},!n))return S(L),x}if(!P&&(!er(f)||!er(h))){let Y,L;const U=xo(h),K=xo(f);if(!er(C)&&!isNaN(C)){const F=s.valueAsNumber||C&&+C;er(U.value)||(Y=F>U.value),er(K.value)||(L=F<K.value)}else{const F=s.valueAsDate||new Date(C),G=V=>new Date(new Date().toDateString()+" "+V),ie=s.type=="time",fe=s.type=="week";Kr(U.value)&&C&&(Y=ie?G(C)>G(U.value):fe?C>U.value:F>new Date(U.value)),Kr(K.value)&&C&&(L=ie?G(C)<G(K.value):fe?C<K.value:F<new Date(K.value))}if((Y||L)&&(q(!!Y,U.message,K.message,an.max,an.min),!n))return S(x[p].message),x}if((u||l)&&!P&&(Kr(C)||i&&Array.isArray(C))){const Y=xo(u),L=xo(l),U=!er(Y.value)&&C.length>+Y.value,K=!er(L.value)&&C.length<+L.value;if((U||K)&&(q(U,Y.message,L.message),!n))return S(x[p].message),x}if(m&&!P&&Kr(C)){const{value:Y,message:L}=xo(m);if($a(Y)&&!C.match(Y)&&(x[p]={type:an.pattern,message:L,ref:s,...O(an.pattern,L)},!n))return S(L),x}if(v){if(Ir(v)){const Y=await v(C,r),L=L0(Y,E);if(L&&(x[p]={...L,...O(an.validate,L.message)},!n))return S(L.message),x}else if($t(v)){let Y={};for(const L in v){if(!ar(Y)&&!n)break;const U=L0(await v[L](C,r),E,L);U&&(Y={...U,...O(L,U.message)},S(U.message),n&&(x[p]=Y))}if(!ar(Y)&&(x[p]={ref:E,...Y},!n))return x}}return S(!0),x};const f3={mode:Mr.onSubmit,reValidateMode:Mr.onChange,shouldFocusError:!0};function p3(e={}){let t={...f3,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ir(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},o=$t(t.defaultValues)||$t(t.values)?Wt(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Wt(o),s={action:!1,mount:!1,watch:!1},a={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const l={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let f={...l};const h={array:S0(),state:S0()},m=t.criteriaMode===Mr.all,v=T=>N=>{clearTimeout(u),u=setTimeout(T,N)},p=async T=>{if(!t.disabled&&(l.isValid||f.isValid||T)){const N=t.resolver?ar((await D()).errors):await P(n,!0);N!==r.isValid&&h.state.next({isValid:N})}},y=(T,N)=>{!t.disabled&&(l.isValidating||l.validatingFields||f.isValidating||f.validatingFields)&&((T||Array.from(a.mount)).forEach(z=>{z&&(N?at(r.validatingFields,z,N):Vt(r.validatingFields,z))}),h.state.next({validatingFields:r.validatingFields,isValidating:!ar(r.validatingFields)}))},_=(T,N=[],z,te,se=!0,j=!0)=>{if(te&&z&&!t.disabled){if(s.action=!0,j&&Array.isArray(ye(n,T))){const re=z(ye(n,T),te.argA,te.argB);se&&at(n,T,re)}if(j&&Array.isArray(ye(r.errors,T))){const re=z(ye(r.errors,T),te.argA,te.argB);se&&at(r.errors,T,re),u3(r.errors,T)}if((l.touchedFields||f.touchedFields)&&j&&Array.isArray(ye(r.touchedFields,T))){const re=z(ye(r.touchedFields,T),te.argA,te.argB);se&&at(r.touchedFields,T,re)}(l.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Ti(o,i)),h.state.next({name:T,isDirty:q(T,N),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else at(i,T,N)},C=(T,N)=>{at(r.errors,T,N),h.state.next({errors:r.errors})},E=T=>{r.errors=T,h.state.next({errors:r.errors,isValid:!1})},S=(T,N,z,te)=>{const se=ye(n,T);if(se){const j=ye(i,T,Lt(z)?ye(o,T):z);Lt(j)||te&&te.defaultChecked||N?at(i,T,N?j:I0(se._f)):U(T,j),s.mount&&p()}},x=(T,N,z,te,se)=>{let j=!1,re=!1;const Ce={name:T};if(!t.disabled){if(!z||te){(l.isDirty||f.isDirty)&&(re=r.isDirty,r.isDirty=Ce.isDirty=q(),j=re!==Ce.isDirty);const $e=cn(ye(o,T),N);re=!!ye(r.dirtyFields,T),$e?Vt(r.dirtyFields,T):at(r.dirtyFields,T,!0),Ce.dirtyFields=r.dirtyFields,j=j||(l.dirtyFields||f.dirtyFields)&&re!==!$e}if(z){const $e=ye(r.touchedFields,T);$e||(at(r.touchedFields,T,z),Ce.touchedFields=r.touchedFields,j=j||(l.touchedFields||f.touchedFields)&&$e!==z)}j&&se&&h.state.next(Ce)}return j?Ce:{}},I=(T,N,z,te)=>{const se=ye(r.errors,T),j=(l.isValid||f.isValid)&&pr(N)&&r.isValid!==N;if(t.delayError&&z?(c=v(()=>C(T,z)),c(t.delayError)):(clearTimeout(u),c=null,z?at(r.errors,T,z):Vt(r.errors,T)),(z?!cn(se,z):se)||!ar(te)||j){const re={...te,...j&&pr(N)?{isValid:N}:{},errors:r.errors,name:T};r={...r,...re},h.state.next(re)}},D=async T=>{y(T,!0);const N=await t.resolver(i,t.context,o3(T||a.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return y(T),N},k=async T=>{const{errors:N}=await D(T);if(T)for(const z of T){const te=ye(N,z);te?at(r.errors,z,te):Vt(r.errors,z)}else r.errors=N;return N},P=async(T,N,z={valid:!0})=>{for(const te in T){const se=T[te];if(se){const{_f:j,...re}=se;if(j){const Ce=a.array.has(j.name),$e=se._f&&i3(se._f);$e&&l.validatingFields&&y([te],!0);const W=await z0(se,a.disabled,i,m,t.shouldUseNativeValidation&&!N,Ce);if($e&&l.validatingFields&&y([te]),W[j.name]&&(z.valid=!1,N))break;!N&&(ye(W,j.name)?Ce?d3(r.errors,W,j.name):at(r.errors,j.name,W[j.name]):Vt(r.errors,j.name))}!ar(re)&&await P(re,N,z)}}return z.valid},O=()=>{for(const T of a.unMount){const N=ye(n,T);N&&(N._f.refs?N._f.refs.every(z=>!Gl(z)):!Gl(N._f.ref))&&ue(T)}a.unMount=new Set},q=(T,N)=>!t.disabled&&(T&&N&&at(i,T,N),!cn(V(),o)),Y=(T,N,z)=>w0(T,a,{...s.mount?i:Lt(N)?o:Kr(T)?{[T]:N}:N},z,N),L=T=>Bl(ye(s.mount?i:o,T,t.shouldUnregister?ye(o,T,[]):[])),U=(T,N,z={})=>{const te=ye(n,T);let se=N;if(te){const j=te._f;j&&(!j.disabled&&at(i,T,O0(N,j)),se=Ra(j.ref)&&er(N)?"":N,C0(j.ref)?[...j.ref.options].forEach(re=>re.selected=se.includes(re.value)):j.refs?Ai(j.ref)?j.refs.forEach(re=>{(!re.defaultChecked||!re.disabled)&&(Array.isArray(se)?re.checked=!!se.find(Ce=>Ce===re.value):re.checked=se===re.value||!!se)}):j.refs.forEach(re=>re.checked=re.value===se):ql(j.ref)?j.ref.value="":(j.ref.value=se,j.ref.type||h.state.next({name:T,values:Wt(i)})))}(z.shouldDirty||z.shouldTouch)&&x(T,se,z.shouldTouch,z.shouldDirty,!0),z.shouldValidate&&fe(T)},K=(T,N,z)=>{for(const te in N){if(!N.hasOwnProperty(te))return;const se=N[te],j=T+"."+te,re=ye(n,j);(a.array.has(T)||$t(se)||re&&!re._f)&&!Bn(se)?K(j,se,z):U(j,se,z)}},F=(T,N,z={})=>{const te=ye(n,T),se=a.array.has(T),j=Wt(N);at(i,T,j),se?(h.array.next({name:T,values:Wt(i)}),(l.isDirty||l.dirtyFields||f.isDirty||f.dirtyFields)&&z.shouldDirty&&h.state.next({name:T,dirtyFields:Ti(o,i),isDirty:q(T,j)})):te&&!te._f&&!er(j)?K(T,j,z):U(T,j,z),N0(T,a)&&h.state.next({...r,name:T}),h.state.next({name:s.mount?T:void 0,values:Wt(i)})},G=async T=>{s.mount=!0;const N=T.target;let z=N.name,te=!0;const se=ye(n,z),j=$e=>{te=Number.isNaN($e)||Bn($e)&&isNaN($e.getTime())||cn($e,ye(i,z,$e))},re=j0(t.mode),Ce=j0(t.reValidateMode);if(se){let $e,W;const ee=N.type?I0(se._f):y0(T),Ee=T.type===ja.BLUR||T.type===ja.FOCUS_OUT,Fe=!s3(se._f)&&!t.resolver&&!ye(r.errors,z)&&!se._f.deps||l3(Ee,ye(r.touchedFields,z),r.isSubmitted,Ce,re),ft=N0(z,a,Ee);at(i,z,ee),Ee?(!N||!N.readOnly)&&(se._f.onBlur&&se._f.onBlur(T),c&&c(0)):se._f.onChange&&se._f.onChange(T);const yt=x(z,ee,Ee),zt=!ar(yt)||ft;if(!Ee&&h.state.next({name:z,type:T.type,values:Wt(i)}),Fe)return(l.isValid||f.isValid)&&(t.mode==="onBlur"?Ee&&p():Ee||p()),zt&&h.state.next({name:z,...ft?{}:yt});if(!Ee&&ft&&h.state.next({...r}),t.resolver){const{errors:Ot}=await D([z]);if(j(ee),te){const Q=$0(r.errors,n,z),he=$0(Ot,n,Q.name||z);$e=he.error,z=he.name,W=ar(Ot)}}else y([z],!0),$e=(await z0(se,a.disabled,i,m,t.shouldUseNativeValidation))[z],y([z]),j(ee),te&&($e?W=!1:(l.isValid||f.isValid)&&(W=await P(n,!0)));te&&(se._f.deps&&fe(se._f.deps),I(z,W,$e,yt))}},ie=(T,N)=>{if(ye(r.errors,N)&&T.focus)return T.focus(),1},fe=async(T,N={})=>{let z,te;const se=ki(T);if(t.resolver){const j=await k(Lt(T)?T:se);z=ar(j),te=T?!se.some(re=>ye(j,re)):z}else T?(te=(await Promise.all(se.map(async j=>{const re=ye(n,j);return await P(re&&re._f?{[j]:re}:re)}))).every(Boolean),!(!te&&!r.isValid)&&p()):te=z=await P(n);return h.state.next({...!Kr(T)||(l.isValid||f.isValid)&&z!==r.isValid?{}:{name:T},...t.resolver||!T?{isValid:z}:{},errors:r.errors}),N.shouldFocus&&!te&&Mi(n,ie,T?se:a.mount),te},V=T=>{const N={...s.mount?i:o};return Lt(T)?N:Kr(T)?ye(N,T):T.map(z=>ye(N,z))},J=(T,N)=>({invalid:!!ye((N||r).errors,T),isDirty:!!ye((N||r).dirtyFields,T),error:ye((N||r).errors,T),isValidating:!!ye(r.validatingFields,T),isTouched:!!ye((N||r).touchedFields,T)}),De=T=>{T&&ki(T).forEach(N=>Vt(r.errors,N)),h.state.next({errors:T?r.errors:{}})},_e=(T,N,z)=>{const te=(ye(n,T,{_f:{}})._f||{}).ref,se=ye(r.errors,T)||{},{ref:j,message:re,type:Ce,...$e}=se;at(r.errors,T,{...$e,...N,ref:te}),h.state.next({name:T,errors:r.errors,isValid:!1}),z&&z.shouldFocus&&te&&te.focus&&te.focus()},xe=(T,N)=>Ir(T)?h.state.subscribe({next:z=>"values"in z&&T(Y(void 0,N),z)}):Y(T,N,!0),ne=T=>h.state.subscribe({next:N=>{c3(T.name,N.name,T.exact)&&a3(N,T.formState||l,He,T.reRenderRoot)&&T.callback({values:{...i},...r,...N,defaultValues:o})}}).unsubscribe,le=T=>(s.mount=!0,f={...f,...T.formState},ne({...T,formState:f})),ue=(T,N={})=>{for(const z of T?ki(T):a.mount)a.mount.delete(z),a.array.delete(z),N.keepValue||(Vt(n,z),Vt(i,z)),!N.keepError&&Vt(r.errors,z),!N.keepDirty&&Vt(r.dirtyFields,z),!N.keepTouched&&Vt(r.touchedFields,z),!N.keepIsValidating&&Vt(r.validatingFields,z),!t.shouldUnregister&&!N.keepDefaultValue&&Vt(o,z);h.state.next({values:Wt(i)}),h.state.next({...r,...N.keepDirty?{isDirty:q()}:{}}),!N.keepIsValid&&p()},me=({disabled:T,name:N})=>{(pr(T)&&s.mount||T||a.disabled.has(N))&&(T?a.disabled.add(N):a.disabled.delete(N))},pe=(T,N={})=>{let z=ye(n,T);const te=pr(N.disabled)||pr(t.disabled);return at(n,T,{...z||{},_f:{...z&&z._f?z._f:{ref:{name:T}},name:T,mount:!0,...N}}),a.mount.add(T),z?me({disabled:pr(N.disabled)?N.disabled:t.disabled,name:T}):S(T,!0,N.value),{...te?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:Oi(N.min),max:Oi(N.max),minLength:Oi(N.minLength),maxLength:Oi(N.maxLength),pattern:Oi(N.pattern)}:{},name:T,onChange:G,onBlur:G,ref:se=>{if(se){pe(T,N),z=ye(n,T);const j=Lt(se.value)&&se.querySelectorAll&&se.querySelectorAll("input,select,textarea")[0]||se,re=t3(j),Ce=z._f.refs||[];if(re?Ce.find($e=>$e===j):j===z._f.ref)return;at(n,T,{_f:{...z._f,...re?{refs:[...Ce.filter(Gl),j,...Array.isArray(ye(o,T))?[{}]:[]],ref:{type:j.type,name:T}}:{ref:j}}}),S(T,!1,void 0,j)}else z=ye(n,T,{}),z._f&&(z._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(b0(a.array,T)&&s.action)&&a.unMount.add(T)}}},ve=()=>t.shouldFocusError&&Mi(n,ie,a.mount),Pe=T=>{pr(T)&&(h.state.next({disabled:T}),Mi(n,(N,z)=>{const te=ye(n,z);te&&(N.disabled=te._f.disabled||T,Array.isArray(te._f.refs)&&te._f.refs.forEach(se=>{se.disabled=te._f.disabled||T}))},0,!1))},$=(T,N)=>async z=>{let te;z&&(z.preventDefault&&z.preventDefault(),z.persist&&z.persist());let se=Wt(i);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:j,values:re}=await D();r.errors=j,se=Wt(re)}else await P(n);if(a.disabled.size)for(const j of a.disabled)Vt(se,j);if(Vt(r.errors,"root"),ar(r.errors)){h.state.next({errors:{}});try{await T(se,z)}catch(j){te=j}}else N&&await N({...r.errors},z),ve(),setTimeout(ve);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ar(r.errors)&&!te,submitCount:r.submitCount+1,errors:r.errors}),te)throw te},ze=(T,N={})=>{ye(n,T)&&(Lt(N.defaultValue)?F(T,Wt(ye(o,T))):(F(T,N.defaultValue),at(o,T,Wt(N.defaultValue))),N.keepTouched||Vt(r.touchedFields,T),N.keepDirty||(Vt(r.dirtyFields,T),r.isDirty=N.defaultValue?q(T,Wt(ye(o,T))):q()),N.keepError||(Vt(r.errors,T),l.isValid&&p()),h.state.next({...r}))},Me=(T,N={})=>{const z=T?Wt(T):o,te=Wt(z),se=ar(T),j=se?o:te;if(N.keepDefaultValues||(o=z),!N.keepValues){if(N.keepDirtyValues){const re=new Set([...a.mount,...Object.keys(Ti(o,i))]);for(const Ce of Array.from(re))ye(r.dirtyFields,Ce)?at(j,Ce,ye(i,Ce)):F(Ce,ye(j,Ce))}else{if(zl&&Lt(T))for(const re of a.mount){const Ce=ye(n,re);if(Ce&&Ce._f){const $e=Array.isArray(Ce._f.refs)?Ce._f.refs[0]:Ce._f.ref;if(Ra($e)){const W=$e.closest("form");if(W){W.reset();break}}}}if(N.keepFieldsRef)for(const re of a.mount)F(re,ye(j,re));else n={}}i=t.shouldUnregister?N.keepDefaultValues?Wt(o):{}:Wt(j),h.array.next({values:{...j}}),h.state.next({values:{...j}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!l.isValid||!!N.keepIsValid||!!N.keepDirtyValues,s.watch=!!t.shouldUnregister,h.state.next({submitCount:N.keepSubmitCount?r.submitCount:0,isDirty:se?!1:N.keepDirty?r.isDirty:!!(N.keepDefaultValues&&!cn(T,o)),isSubmitted:N.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:N.keepDirtyValues?N.keepDefaultValues&&i?Ti(o,i):r.dirtyFields:N.keepDefaultValues&&T?Ti(o,T):N.keepDirty?r.dirtyFields:{},touchedFields:N.keepTouched?r.touchedFields:{},errors:N.keepErrors?r.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},ge=(T,N)=>Me(Ir(T)?T(i):T,N),Re=(T,N={})=>{const z=ye(n,T),te=z&&z._f;if(te){const se=te.refs?te.refs[0]:te.ref;se.focus&&(se.focus(),N.shouldSelect&&Ir(se.select)&&se.select())}},He=T=>{r={...r,...T}},dt={control:{register:pe,unregister:ue,getFieldState:J,handleSubmit:$,setError:_e,_subscribe:ne,_runSchema:D,_focusError:ve,_getWatch:Y,_getDirty:q,_setValid:p,_setFieldArray:_,_setDisabledField:me,_setErrors:E,_getFieldArray:L,_reset:Me,_resetDefaultValues:()=>Ir(t.defaultValues)&&t.defaultValues().then(T=>{ge(T,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:O,_disableForm:Pe,_subjects:h,_proxyFormState:l,get _fields(){return n},get _formValues(){return i},get _state(){return s},set _state(T){s=T},get _defaultValues(){return o},get _names(){return a},set _names(T){a=T},get _formState(){return r},get _options(){return t},set _options(T){t={...t,...T}}},subscribe:le,trigger:fe,register:pe,handleSubmit:$,watch:xe,setValue:F,getValues:V,reset:ge,resetField:ze,clearErrors:De,unregister:ue,setError:_e,setFocus:Re,getFieldState:J};return{...dt,formControl:dt}}function B0(e={}){const t=b.useRef(void 0),r=b.useRef(void 0),[n,o]=b.useState({isDirty:!1,isValidating:!1,isLoading:Ir(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ir(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Ir(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:s,...a}=p3(e);t.current={...a,formState:n}}const i=t.current.control;return i._options=e,Ul(()=>{const s=i._subscribe({formState:i._proxyFormState,callback:()=>o({...i._formState}),reRenderRoot:!0});return o(a=>({...a,isReady:!0})),i._formState.isReady=!0,s},[i]),b.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),b.useEffect(()=>{e.mode&&(i._options.mode=e.mode),e.reValidateMode&&(i._options.reValidateMode=e.reValidateMode)},[i,e.mode,e.reValidateMode]),b.useEffect(()=>{e.errors&&(i._setErrors(e.errors),i._focusError())},[i,e.errors]),b.useEffect(()=>{e.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,e.shouldUnregister]),b.useEffect(()=>{if(i._proxyFormState.isDirty){const s=i._getDirty();s!==n.isDirty&&i._subjects.state.next({isDirty:s})}},[i,n.isDirty]),b.useEffect(()=>{e.values&&!cn(e.values,r.current)?(i._reset(e.values,{keepFieldsRef:!0,...i._options.resetOptions}),r.current=e.values,o(s=>({...s}))):i._resetDefaultValues()},[i,e.values]),b.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),t.current.formState=x0(n,i),t.current}const F0=(e,t,r)=>{if(e&&"reportValidity"in e){const n=ye(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},Kl=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?F0(n.ref,r,e):n&&n.refs&&n.refs.forEach(o=>F0(o,r,e))}},V0=(e,t)=>{t.shouldUseNativeValidation&&Kl(e,t);const r={};for(const n in e){const o=ye(t.fields,n),i=Object.assign(e[n]||{},{ref:o&&o.ref});if(h3(t.names||Object.keys(e),n)){const s=Object.assign({},ye(r,n));at(s,"root",i),at(r,n,s)}else at(r,n,i)}return r},h3=(e,t)=>{const r=W0(t);return e.some(n=>W0(n).match(`^${r}\\.\\d+`))};function W0(e){return e.replace(/\]|\[/g,"")}function U0(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function m3(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if("unionErrors"in n){var a=n.unionErrors[0].errors[0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if("unionErrors"in n&&n.unionErrors.forEach(function(l){return l.errors.forEach(function(f){return e.push(f)})}),t){var c=r[s].types,u=c&&c[n.code];r[s]=Hl(s,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function g3(e,t){for(var r={};e.length;){var n=e[0],o=n.code,i=n.message,s=n.path.join(".");if(!r[s])if(n.code==="invalid_union"&&n.errors.length>0){var a=n.errors[0][0];r[s]={message:a.message,type:a.code}}else r[s]={message:i,type:o};if(n.code==="invalid_union"&&n.errors.forEach(function(l){return l.forEach(function(f){return e.push(f)})}),t){var c=r[s].types,u=c&&c[n.code];r[s]=Hl(s,t,r,o,u?[].concat(u,n.message):n.message)}e.shift()}return r}function v3(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,i){try{return Promise.resolve(U0(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(s){return i.shouldUseNativeValidation&&Kl({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return Array.isArray(a?.issues)})(s))return{values:{},errors:V0(m3(s.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,o,i){try{return Promise.resolve(U0(function(){return Promise.resolve((r.mode==="sync"?QC:XC)(e,n,t)).then(function(s){return i.shouldUseNativeValidation&&Kl({},i),{errors:{},values:r.raw?Object.assign({},n):s}})},function(s){if((function(a){return a instanceof Ml})(s))return{values:{},errors:V0(g3(s.issues,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw s}))}catch(s){return Promise.reject(s)}};throw new Error("Invalid input: not a Zod schema")}const Y0=/^((1[0-2]|0?[1-9]):[0-5][0-9]\s?([AaPp]\.?[Mm]\.?))|^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/,H0=(e,t)=>{if(!e||!t)return null;const r=t.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=r.includes("pm"),o=r.includes("am"),i=r.replace(/[a-z]/g,""),[s,a]=i.split(":");if(!s||!a)return null;let c=parseInt(s,10);const u=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[l,f,h]=e.split("-").map(Number),m=new Date(l,f-1,h,c,u);return w.isValid(m)?m:null},y3=l0({UsuarioID:Pa().nullable().optional(),disID:Pa().nullable().optional(),EsOrganizador:Ei().default(!1),Correo:Dr().email("Formato de correo inválido"),StatusInvitacion:u0(["PENDIENTE","CONFIRMADA","RECHAZADA"]).default("PENDIENTE")}),b3=l0({titulo:Dr().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:Dr().min(1,"El campo fecha inicio es requerido."),horaInicio:Dr().min(1,"La hora de inicio es requerida.").regex(Y0,{message:"Formato inválido (ej: 10:30am o 13:30)"}),horaFin:Dr().min(1,"La hora fin es requerida.").regex(Y0,{message:"Formato inválido"}),todoElDia:Ei(),fechaFin:Dr().optional(),showEndDate:Ei().optional(),horaInicio2:Dr().optional(),TodoElDia2:Ei().optional(),client:Dr().nullable().optional(),repetir:Dr().optional(),incluirMeet:Ei().default(!1),link:Dr().trim().url("Debe ser una URL válida de Google Meet, Zoom o Microsoft Teams. Ejemplo: https://meet.google.com/abc-defg-hij").or(Mk("")).optional().refine(e=>e===void 0?!0:!/\s/.test(e),{message:"El enlace no puede contener espacios en blanco"}).refine(e=>{if(!e)return!0;const t=e.toLowerCase();return t.includes("meet.google.com")||t.includes("zoom.us")||t.includes("zoom.com")||t.includes("teams.microsoft.com")||t.includes("teams.live.com")},{message:"El enlace debe pertenecer a las plataformas de Google Meet, Zoom o Microsoft Teams."}),descripcion:Dr().optional(),invitados:c0(y3).optional().default([]),color:Dr().optional(),solID:Pa().nullable().optional(),disID:Pa().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=H0(e.fechaInicio,e.horaInicio),r=H0(e.fechaFin,e.horaFin);return!t||!r?!1:w.isAfter(r,t)},{message:"",path:["horaFin"]}),x3=e=>B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},B.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"}),B.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"})),w3="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",_3=e=>B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},B.createElement("g",{clipPath:"url(#a)"},B.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"})),B.createElement("defs",null,B.createElement("clipPath",{id:"a"},B.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),q0="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",S3=e=>B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",...e},B.createElement("g",{fill:"#2571D6",clipPath:"url(#a)"},B.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"}),B.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"}),B.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"})),B.createElement("defs",null,B.createElement("clipPath",{id:"a"},B.createElement("path",{fill:"#fff",d:"M0 0h24v24H0z"})))),C3="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";var Pi={},Z0;function E3(){if(Z0)return Pi;Z0=1;var e=ct();Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.default=void 0;var t=e(ht()),r=pt();return Pi.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"),Pi}var D3=E3();const G0=st(D3);var Ii={},K0;function A3(){if(K0)return Ii;K0=1;var e=ct();Object.defineProperty(Ii,"__esModule",{value:!0}),Ii.default=void 0;var t=e(ht()),r=pt();return Ii.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"),Ii}var k3=A3();const T3=st(k3),Q0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAElBMVEUAAABpbXlpbXlobXhpbnppbnkdzkEGAAAABXRSTlMAgJ5Y75poDcUAAAA3SURBVBjTYyANiBog2IyhSBzRQGQJASSJIGQJBSIkTBESCA5CGcIAoqUEGDAdiukFBhE4hzAAAK+MB7AghHQFAAAAAElFTkSuQmCC",X0="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAADlQTFRFR3BMIHDPJHDUJHDVJXHWJHDVJHHWJHDUI3DUJXHWJXDUJHHUJXHW////c6Tlr8vwiLLp1eT3Nn3ZZnh0KAAAAAx0Uk5TABBAgN+bxCBc7zBwfOSOGgAAAKJJREFUeNp1klsOxSAIREerohb72v9iryFXsSQ9P+BMwiQgJpQ4ZBjIOwrcySAHZetS4Y6UOK3Mb7ZhRGOkYSRjFAg+sSXlNcDGBH5xnI9UB6O3dkhDSEY/pQmAl+Y6n1XnDJA0rd2P6Boex4z7mnrHQ6evOu8oNneE7Dyci5VAQA5sKZF0iSt+rt1AH4cKWC9VNKFiQvX/GTbU6vCGIpddnz/knxPCFgg8/wAAAABJRU5ErkJggg==",O3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYBAMAAAASWSDLAAAAGFBMVEUAAAAAfFQAflYAfVYAfVUAfFQAcFAAfVbb6xt6AAAAB3RSTlMAIN98m0wQyLlfvgAAAE1JREFUGNNjoAgwmiJxhMoDEBLq5QZIEkUCSBKKeCXYYBJgMQeEBHN5CUIHa3m5A8Io8/ISiAREHRAAJWBSSHYwgyXgUjAJsIGGpPkcAJCLE29yhAT7AAAAAElFTkSuQmCC",M3=e=>{const t=["#A17B4B","#7B5BE4","#F9A825","#4A90E2","#5CC85C","#FDD835","#E53935","#B0BEC5"],r=e.charCodeAt(0)%t.length;return t[r]},P3=(e,t,r,n,o,i)=>{if(t)return d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#1976D2"},children:[d.jsx("img",{src:X0,width:15,style:{marginRight:"5px"}}),d.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Anfitrión"})]});switch(e){case"PENDIENTE":return d.jsx(g.Typography,{variant:"caption",sx:{color:"#999",fontStyle:"italic",fontWeight:600},children:"Pendiente"});case"RECHAZADA":return i?d.jsx(g.Button,{onClick:()=>{n(r),o()},variant:"outlined",size:"small",sx:{fontWeight:600,borderRadius:"8px",textTransform:"none",fontSize:"11px",px:1,py:0},children:"Reenviar"}):null;case"CONFIRMADA":return d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#00A86B"},children:[d.jsx("img",{src:O3,width:15,style:{marginRight:"5px"}}),d.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold"},children:"Asistiré"})]});default:return null}};function I3({open:e,handleClose:t,guests:r,onReenviar:n,esOrganizador:o}){const i=r.filter(l=>l.estatus==="CONFIRMADA"||l.isHost),s=r.filter(l=>l.estatus==="PENDIENTE"&&!l.isHost),a=r.filter(l=>l.estatus==="RECHAZADA"&&!l.isHost),c=l=>d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1},children:[d.jsxs(g.Box,{sx:{position:"relative",mr:2},children:[d.jsx(g.Avatar,{sx:{bgcolor:M3(l.iniciales),width:32,height:32,fontSize:"12px",color:"#fff"},children:l.iniciales}),l.estatus==="PENDIENTE"&&d.jsx(g.Box,{sx:{position:"absolute",bottom:-2,right:-4,bgcolor:"#fff",borderRadius:"50%",display:"flex"},children:d.jsx(Ll,{sx:{fontSize:14,color:"#546E7A"}})})]}),d.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1,fontWeight:500,color:"#333"},children:l.nombre}),P3(l.estatus,l.isHost,l.usrID,n,t,o)]},l.nombre),u=({title:l,count:f,badgeColor:h})=>d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",mt:2,mb:1},children:[d.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:800,color:"#333",fontSize:"13px"},children:l}),h&&d.jsx(g.Box,{sx:{ml:1,bgcolor:h,color:"#fff",borderRadius:"50%",width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:f})]});return d.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"xs",PaperProps:{sx:{border:"solid 0.1 px",height:"100%"}},children:[d.jsxs(g.Box,{sx:{p:"16px 8px"},children:[d.jsx(g.Typography,{variant:"subtitle1",sx:{fontWeight:800,ml:1,color:"#333333"},children:"Lista de invitados"}),d.jsx(g.Button,{onClick:t,startIcon:d.jsx("img",{src:Q0,width:20}),sx:{textTransform:"none",color:"#666",fontSize:"16px",p:0,minWidth:0,ml:.5,"&:hover":{bgcolor:"transparent"}},children:"Volver al evento"}),d.jsx(g.IconButton,{onClick:t,sx:{position:"absolute",right:8,top:12},children:d.jsx(yr,{})})]}),d.jsxs(g.DialogContent,{sx:{p:2},children:[s.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(g.Divider,{sx:{backgroundColor:"black"}}),d.jsxs(g.Box,{sx:{mb:3},children:[d.jsx(u,{title:"Invitados",count:s.length}),s.map(c)]})]}),i.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(g.Divider,{sx:{my:1,backgroundColor:"black"}}),d.jsxs(g.Box,{sx:{mb:3},children:[d.jsx(u,{title:"Confirmados",count:i.length,badgeColor:"#1976D2"}),i.map(c)]})]}),a.length>0&&d.jsxs(d.Fragment,{children:[d.jsx(g.Divider,{sx:{my:1,backgroundColor:"black"}}),d.jsxs(g.Box,{children:[d.jsx(u,{title:"No asistirán",count:a.length,badgeColor:"#1976D2"}),a.map(c)]})]})]})]})}const j3=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FFEB3B","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function R3({guests:e,onReenviar:t,esOrganizador:r}){const[n,o]=b.useState(!1),i=()=>o(!0),s=()=>o(!1);return d.jsxs(d.Fragment,{children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",py:1,borderBottom:"1px solid #eee",width:"100%"},children:[d.jsx(g.AvatarGroup,{max:9,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((a,c)=>d.jsx(g.Tooltip,{title:a.nombre,arrow:!0,placement:"top",children:d.jsx(g.Box,{children:d.jsx(g.Badge,{overlap:"circular",anchorOrigin:{vertical:"bottom",horizontal:"right"},invisible:a.estatus!=="PENDIENTE",sx:{backgroundColor:"white"},badgeContent:d.jsx(g.Box,{sx:{bgcolor:"white",borderRadius:"50%",width:16,height:16,display:"flex",justifyContent:"center",border:"1px solid white",boxShadow:"none"},children:d.jsx("img",{src:qp})}),children:d.jsx(g.Avatar,{sx:{bgcolor:j3(a.iniciales)},children:a.iniciales})})})},c))}),d.jsx(g.Box,{sx:{flexGrow:1}}),d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",color:"#1976D2",transition:"opacity 0.2s","&:hover":{opacity:.7}},onClick:i,children:[d.jsx(g.Typography,{variant:"body2",sx:{fontWeight:"bold",fontSize:"14px"},children:"Ver invitados"}),d.jsx(T3,{sx:{fontSize:18,ml:.5}})]})]}),d.jsx(I3,{open:n,handleClose:s,guests:e,onReenviar:t,esOrganizador:r})]})}var ji={},J0;function N3(){if(J0)return ji;J0=1;var e=ct();Object.defineProperty(ji,"__esModule",{value:!0}),ji.default=void 0;var t=e(ht()),r=pt();return ji.default=(0,t.default)((0,r.jsx)("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"AddCircleOutline"),ji}var $3=N3();const L3=st($3),z3=e=>new Date(e+"T00:00:00").toLocaleDateString("es-ES",{day:"numeric",month:"short"}).replace(".",""),em=e=>{const[t,r]=e.split(":"),n=parseInt(t),o=n>=12?"pm":"am";return`${n%12||12}:${r} ${o}`},tm=e=>e.split(":").slice(0,2).join(":"),B3=({slot:e,onClick:t})=>d.jsxs(g.Box,{onClick:t,sx:{cursor:"pointer",borderRadius:"12px",overflow:"hidden",border:"1px solid #000000",textAlign:"center",transition:"0.2s",backgroundColor:"#fff","&:hover":{transform:"translateY(-3px)",boxShadow:"0px 4px 12px rgba(0,0,0,0.1)",borderColor:"#1976d2"}},children:[d.jsx(g.Box,{sx:{bgcolor:"#333",color:"white",py:.5},children:d.jsx(g.Typography,{variant:"caption",sx:{fontWeight:"bold",textTransform:"capitalize"},children:z3(e.Fecha)})}),d.jsxs(g.Box,{sx:{py:1.5},children:[d.jsx(g.Typography,{sx:{fontSize:"12px"},children:em(e.HoraInicio)}),d.jsxs(g.Typography,{sx:{fontSize:"12px"},children:["a ",em(e.HoraFin)]})]})]});function F3({open:e,handleClose:t,suggestions:r,onSelectSlot:n}){const[o,i]=b.useState(16),a=r.slice(0,o).reduce((l,f)=>{const h=f.Fecha;return l[h]||(l[h]=[]),l[h].push(f),l},{}),c=Object.keys(a),u=l=>{const f={...l,HoraInicio:tm(l.HoraInicio),HoraFin:tm(l.HoraFin)};n(f),t()};return b.useEffect(()=>{i(16)},[e]),d.jsxs(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"16px"}},children:[d.jsxs(g.Box,{sx:{p:2.5,display:"flex",flexDirection:"column",gap:.5},children:[d.jsx(g.Typography,{variant:"h6",sx:{fontWeight:800,fontSize:"1.1rem"},children:"Selecciona un nuevo horario"}),d.jsx(g.Box,{children:d.jsx(g.Button,{startIcon:d.jsx("img",{src:Q0,width:20}),onClick:t,sx:{textTransform:"none",color:"text.secondary",p:0,fontSize:"1rem","&:hover":{backgroundColor:"transparent",color:"#000"}},children:"Volver al evento"})})]}),d.jsx(g.Divider,{sx:{backgroundColor:"black"}}),d.jsx(g.DialogContent,{sx:{px:3,py:3,backgroundColor:"#f9f9f9"},children:c.length===0?d.jsx(g.Typography,{variant:"body2",color:"text.secondary",align:"center",children:"No hay horarios alternativos disponibles en este momento."}):d.jsxs(d.Fragment,{children:[c.map((l,f)=>d.jsxs(b.Fragment,{children:[" ",d.jsxs(g.Box,{sx:{mb:3},children:[d.jsxs(g.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",mb:2,display:"flex",alignItems:"center",color:f===0?"#1976d2":"text.primary",fontSize:"0.9rem"},children:[f===0?"Mismo día ":"Próximas fechas",f===0&&d.jsx("img",{src:X0,width:15,style:{marginLeft:5}})]}),d.jsx(g.Grid,{container:!0,spacing:2,children:a[l].map((h,m)=>d.jsx(g.Grid,{item:!0,xs:6,sm:3,children:d.jsx(B3,{slot:h,onClick:()=>u(h)})},`${l}-${m}`))})]}),f===0&&c.length>1&&d.jsx(g.Divider,{sx:{mb:4,mt:1,borderBottomWidth:2,backgroundColor:"#000000"}})]},l)),r.length>o&&d.jsx(g.Box,{sx:{display:"flex",justifyContent:"center",mt:2},children:d.jsx(g.Button,{onClick:()=>i(l=>l+12),startIcon:d.jsx(L3,{}),sx:{textTransform:"none",fontWeight:"bold",color:"#1976d2","&:hover":{backgroundColor:"transparent",textDecoration:"underline"}},children:"Mostrar más horarios disponibles"})})]})})]})}const V3="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAIVBMVEVHcExAR1ZAR1NARlVAR1VARlVAR1VARlVARlRARlRAR1ZiwDFVAAAACnRSTlMA5BvHaqI5kH9QLGWfKwAAAQlJREFUeNrd1luqwzAMBNDRw7I7+1/whd4mFa6tBPrX82uJGYMJwc+JLqQ1xU2dLx23NB5EgWjPtAe2Rp4Py8tLmuddeBK/KuRQMgusvDsAwkPRKgU4J14uBIwTw4K8G/GDFncQ6L0FrxYCn1TKhIU4D4UTwZIf8Z2ThjW1/9OoG2XqvTvmiI5LxsRwTRtPTbER3eTJHOcDN8fGkNxagfAxPLChxkyaohTCxEJRU2EeBxDe21NftsrzDuiQup+nwzivn41tQECNC5ZDHrmPCpdEVx+YluaLDONB0bnVcZAUwELgJQUYCzZXMihLOr0Lh7PkmBlLbbFQEsx44fsFY8kwU2PB9Ef+Lv4AL2kmcGZOH2MAAAAASUVORK5CYII=",W3=e=>{const t=["brown","purple","orange","blue","green","yellow","red","grey"],r=e.charCodeAt(0)%t.length;return t[r]};function U3({onSelectGuest:e,availableSuggestions:t,onInputTextChange:r}){const[n,o]=b.useState(null),[i,s]=b.useState(""),a=(u,l)=>{l?(e(l),o(null),s("")):(o(null),s(""))},c=(u,l)=>{s(l),r(l)};return d.jsx(g.Autocomplete,{options:t,value:n,inputValue:i,getOptionLabel:u=>`${u.nombre} (${u.correo})`,filterOptions:u=>u,onChange:a,onInputChange:c,isOptionEqualToValue:(u,l)=>u.correo===l.correo,disablePortal:!0,noOptionsText:"Sin resultados",renderInput:u=>d.jsx(g.TextField,{...u,placeholder:"Agregar invitados...",variant:"outlined",size:"small",InputProps:{...u.InputProps,startAdornment:d.jsx(g.Box,{sx:{ml:1,display:"flex",alignItems:"center"},children:d.jsx("img",{src:V3,color:"action",width:20})}),disableUnderline:!0}}),renderOption:(u,l)=>b.createElement(g.Box,{component:"li",...u,key:l.correo,sx:{py:1,"& > img":{mr:2,flexShrink:0}}},d.jsx(g.Avatar,{sx:{bgcolor:W3(l.iniciales),mr:2,width:32,height:32,fontSize:14},children:l.iniciales}),d.jsx(g.Typography,{children:l.nombre}))},"guest-autocomplete-field")}var Ri={},rm;function Y3(){if(rm)return Ri;rm=1;var e=ct();Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.default=void 0;var t=e(ht()),r=pt();return Ri.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"),Ri}var H3=Y3();const q3=st(H3);var Ni={},nm;function Z3(){if(nm)return Ni;nm=1;var e=ct();Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.default=void 0;var t=e(ht()),r=pt();return Ni.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"),Ni}var G3=Z3();const Ql=st(G3),K3=e=>e.tieneConflicto?{icon:d.jsx(Ql,{sx:{fontSize:18,color:"#d32f2f"}}),fillColor:"#FFF5F5",iconColor:"#d32f2f",textColor:"#333333",variant:"filled"}:{icon:d.jsx(q3,{sx:{fontSize:20,color:"#1a73e8"}}),fillColor:"#eaedf2",iconColor:"#1a73e8",textColor:"#000000",variant:"filled"},Q3=e=>{const t=["#8D6E63","#9C27B0","#FF9800","#2196F3","#4CAF50","#FDD835","#F44336","#9E9E9E"],r=e.charCodeAt(0)%t.length;return t[r]};function X3({guests:e,conflictCount:t,onViewSuggestions:r,onDeleteGuest:n}){const o=s=>a=>{a.stopPropagation(),n(s)},i=s=>s?s.trim().split(/\s+/).slice(0,2).join(" "):"";return d.jsxs(g.Box,{sx:{p:1},children:[d.jsx(g.Box,{sx:{display:"flex",flexWrap:"wrap",gap:1},children:e.map((s,a)=>{const c=K3(s),u=Q3(s.iniciales),l=s.email||s.correo||s.nombre;return d.jsx(g.Chip,{label:d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",width:"100%"},children:[d.jsx(g.Tooltip,{title:l,arrow:!0,placement:"top",children:d.jsx(g.Typography,{variant:"body2",sx:{color:c.textColor,ml:.5,mr:1,fontSize:"13px",fontWeight:400},children:i(s?.nombre)})}),d.jsx(g.Box,{className:"status-icon-wrapper",sx:{display:"flex",alignItems:"center",ml:"auto",margin:"5px"},children:c.icon})]}),avatar:d.jsx(g.Avatar,{sx:{bgcolor:u,width:24,height:24,fontSize:"10px",fontWeight:"bold",color:"#ffffff !important",ml:"4px !important"},children:s.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"}}},onDelete:o(s.nombre)},a)})}),t>0&&d.jsxs(g.Box,{sx:{mt:2,display:"flex",flexDirection:"column",gap:.5},children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",color:"#E53935"},children:[d.jsx(Ql,{sx:{mr:1,fontSize:22}}),d.jsxs(g.Typography,{sx:{fontSize:"15px",fontWeight:500,color:"#E53935"},children:["Se detectó un conflicto de agenda con ",d.jsxs("strong",{children:[t," invitado"]}),t!==1?"s":""]})]}),d.jsx(g.Link,{component:"button",type:"button",variant:"body2",onClick:s=>{s.preventDefault(),s.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 J3(e,t){const[r,n]=b.useState(e);return b.useEffect(()=>{const o=setTimeout(()=>{n(e)},t);return()=>{clearTimeout(o)}},[e,t]),r}var $i={},om;function eT(){if(om)return $i;om=1;var e=ct();Object.defineProperty($i,"__esModule",{value:!0}),$i.default=void 0;var t=e(ht()),r=pt();return $i.default=(0,t.default)((0,r.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-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"}),"Search"),$i}var tT=eT();const rT=st(tT),nT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAgCAYAAACYTcH3AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAMwSURBVFhH7ZZdSFRpGMd/1TrIHNZxglqYymLaDdmLscWBOBIzEUowN97owvZBElKbWLM4smNUSESkhG3SbvQh7S5rX4xI3sxFSWBEXqREc2FaroTuDrUik8YRG7G6aEbnPDPnDEFsXfiDF+Z9/s8Zfry873vOkslXr9/ymbBUFj4lizJGLMoYsShjRFaZ+LMemoK11B7pIKLJ9OOyxOzS0wavcaQxzMhcopBXQsPZ/ahzA4Su3ufFG/EAQO4KXN4teNbbZJIVQ5k0kSQJoeLxDoLBrvQ8gd3r57cDbhQZmJBRxlAkSVJoLMzFO1F9FntKz8MocayUHb1AbZE+NiNdZqKbYM2fDBqJJMkr5fil3biWyQB6z+yi6R4opYe4+uO3MjYkbQNHOkNCxIpT9aKut6YWYaqbK7cm9bUEqloCgNb7gIgMTRAyUYYeT+tLBT4CgWoaDlXhWWXFkhINDj1NmaVQtJHiZYB2n5sdvdy9N8CLWdmUTtrK6FhXzi/N5awGyFcJtDbyfYFsykCuG9UFME3/9XO0nDnJ3mPdxGSf4AtZWMBB5cEKnDlRbp9o5cqohj1f4Z9R2ddHS0Urd2VZMhMnLmsCk5Wxsjwv+XsWbWKSkb+jWf8wE05fDc0/+/hKBgITmWHCncNoOCg7fJpQezOBrQ7dnjHCkmfDnp8zP5+1rqVwpa4lIyYyMBY+RpW/jZuPxonnOvDUNHN0mzhVKSheP6EbfxG6/Ct/tNXgSdTHnou7yABTGYD4vz38fryOHaf6iAMu10bZMk/hd0VYkvfOjMaHvspMZZzbfmCnz4uquin3fIMFiI3/J9vm6T+7j6p9te9HdRv9siELJjIOist8VO6ppiHgZ+cmG/FnYU53DsvGBeZmiU1Mvh8zMsyOiUyUUP0uKuu7GAEY7aCu/hqRKdn38RDvpiihuiDt4i6xb3CzZqqPyHN9nc1+un4qQns5rT/yfZeoOv9I9LlTOzIiVkZByXBYYk8yiACKYgVyUPJt2FPHlx/y4bCAkLHh27ub4pULd4QRloJSGrYbvJFXr6UwNznJwfm1Q58bkP4J8Qkx2cD/P4syRnxWMu8A780N97kmJqMAAAAASUVORK5CYII=",oT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAbCAYAAABr/T8RAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAP4SURBVEhLxZZdSJtXGMd/XZYgCUYdJErmZpc668Qtg2QXcaO2UBFCIUESpO0KWpCWaS/W2SrMKm1F6srcZA66TlzH3KRL6QeygCiIZZus0wtlqOuqa+oHflxYLSmtEraL9zV5c/JGLYzud3XO8z/v+eecPOc8Z8fKo6f/8D/wghh4Xux4lhWvra4w8/cYM4+AZAtvvmYhzagVh22LrY0fBum9fgV/7z0W1kUR0JrILXJzrKQQa6ooJiaxcXiF0asXOX89yJqoqaLFWlJNfWkeaRpRi0fdOHSPznNN+CflJSZZcHo8eN6zYc3QowNgndB8kOGff+LHm0NMP5GG6na5OV/vJdegmE+FeOPwHP6aGjrvs/1ViLuz08uXzW4yN/kmLqtHO87Kpnrslc18dmgLUwBNCm8daqSt0oYB4P41TneMiaNiiDWevcXlnscAvOJtoH6fKUbeivR91XzitQAQ6vkW/6w4IkqM8Wh3gGkAs4uTPmmCZyXT9wEeM8AcN7oTrzpqHB6it19arcHxDlaV7V2bH6StpoqyY1WU1bRze17lfGmyyM2RmqH+AQbD4gCJaHJNdlFWE2AZQGPC6XNTkCHlLwCLd+i4OsSyciJNCs7SwxSYo6Gn83fw+4dYCAOk4Gluo3yX4huZqPFgK+5Ph0RdQI+9opHa4lSWe1r58OsRQuIQAedH31HrFKOKrZ6ZnYtVVHmbomITOrSkF+/FLsoqJJo3Ypz58kYymSg61cKV9jYuN1VT7somPXId/8XohPS/hn77neGNsNaCveQg9U3yd6cKSZel6LyxvBhpJadiAELoycwykZYKpNrw5NjwHAnirztL5+QSgbqj9Bm1rK1KP8CQf5DGj11YlbUiyyKdZ/SkJSviCqJZnb2TXACCjI4L2arNwtdUjcsodTdMMbtoPCOYAmvjY0wB8DrW7Fhtg6hxUgF7HVJzuLdXym4lmjzKj9hiQvZSr8qxm+NW94jUdLxLYZKoSyguEC17DuyXtuhuF1/IZ1qJ7o08rJFeNg5bfC0O9f9A5wMAPa4DTrmgxBN7Zeb7OOHUAzB8qYlvJgTzDDOZkY5ZygMFoYku6i5JqzU4K3g/P1ZXIhQJPc7jFewxAuEgNxtOc6FvaRv1eJ2FvlYqGwJMhQFjASeOO+QEUye+LAIsDnCutp3hVamrM2ez3+Wj0PQrLRcHWADAgutMBc7pX/g+MMDEopxwRhtVF6opUtxmaqgbIz0G/C2f0zmyIioJSbN5qT3p3vIRwKbGMst/BPiq4xqDD1QKgozuVQeHj5bhyU8RpYRsaRzhyWOm/hxhZmmR8bsPeSknh3STBfvuLAwJjsxmbN/4Pybu6fO8+BfHjFz+tNVn6wAAAABJRU5ErkJggg==",iT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAXCAYAAAAcP/9qAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJJSURBVEhL5ZVPSJNhHMc/NuZBo7VkLCJT1ogRoYm7TF7oMi+7uMMGMwixQ1EYLfpDRiSkkIJm0i7rZNQhyMvoVhcVcYcMDKKQYGzNoiG19y0Uaow6vHPvu2dr72CUhz6n5/k+3/f98vs9z/O+Dcr3H7/YAXaJwr/i/wtuMN7jHJmlGNFn8yRkca2c3bbjeENB/Mcs4lIJBsFbxO9fY3xBERcMcYQmmA4cEOUi1YOTc5y5EiMDWI+4cR9sFh1lfF1b5tXHHOBkMDqCv0V0qFQNTjwa4lJMgRYf09F+HKKhEvm3RE7f4cUmtIYmiPyh6iqHK8XCktpiq9RTWyiA6SjdXeowvfySdXG9QHlwbousrJB9PU/8C0ATnq420VUVj6dHHXxYJZ5UyMpb/MyXeoRWp3g8dJOnn3WOZi+jDwfo0EmG5FeYOjnDoj7MNcDsmBdrYSoErzAVmGFRE8Bkxrq3Sa/UxKasCFX2cH3uHJ7CTAjOkXgyye3n78l+y2lynTTuseDqu8Fon3bQhD024wgNM+azlcp1YveVhlIerJJe/1QYWei9fJfZyAi3wv34Dldvub2zj8HweUYnIzy44Gb71mvv06gYrNGM/ZAN634n3ZKPs8NBXKKlSCfBqwH8koeOdgt2Zzv7RIsOg2CZd29S6vWSFTJrSbKipcgGibWNojexskpatOio+OWK3zvF+JKo1oF0kVjYXSIZVPz32LHg2lpdoVXVqOX5Hau4YnCrs43G7YnJQq/UWWowoFs6gdW0PTPjcJb/Gn8DgFjOhT2aaY4AAAAASUVORK5CYII=",sT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAXCAYAAAD+4+QTAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAJrSURBVEhLxZVLSFRRGIA/tRGZC02XiEAdCRUXIW2apTSbHtimTQPZgzFSgkpULCyZEEqUIWkWNplopDC0aeNA6qIhEypJciGIuUnKRDAZrpPcS3obbHGd8T7GV4P07c45//m/c/5z7rkZseWVNfaYTHPHXvAfJfIUr5728WbWPKBHYfp1H13D8+YBC6klkyOE3kYIj22VYIqB3giDz8KMm4dMZCQP/udnQt39RGaXQFWQfqmQ40AUzFMSqMhRhVVsCAftZOccwnXKw6Xyo4hZxkhNEo3QeKOP6bhxcLcIrioCd9wcNkkyARbev0tbILpr6b5rFZCQqKpq7t8VheeaCda4EAB+K0iyMV/qg98xdo5d8xO4UowAyJ86qfRep9J7iwfDi8moNCR2jt9s4WF5LgDSaCfVjz4ixQEUxoM+uia1yH36ac4Lfp6c1ybthoXhduqDE8iGXoWZHzEodaSzE43UAsguqqDmtAPSKxfMDbWlFAilXgKtZ8lfv2n/LJkL+6h/PmUVuKoI3D+ZFGA+k62Qv40Q6hlkdFGGuIK0ZL32QlktwRqX5Yvf0U7mhtqovt3D4PQ8UjS2qaC7zipgR5JohI5ea1n0iG5NsNkzt61EGvuQfHLEkmIKD9iMAUUV+BNf+yZsK5FlBdZXG2xtJtDTgidPF6CqWItnxCj5Y2gBkO88gvPMvY23KQ7o616QR76umYqM2PLK2upIO56OCbDZEfdr5RBLPDTUubUEiaTxefqbfLz4mlh7Lp7Hfi4XJNKlJhMgu+wiV4ts2s8qGkOKxpgZfcnAF51A/U6osXFDkOXgREPTtgKAv71g3h2chXDUAAAAAElFTkSuQmCC",aT=({open:e,onClose:t,clientOptions:r,isClientsLoading:n,setClientSearchTerm:o,onSelectClient:i,setFiltroPadre:s})=>{const[a,c]=b.useState("COT"),u=f=>{c(f),s(f)},l=[{id:"COT",label:"Nuevo",icon:iT},{id:"SEMI",label:"Seminuevo",icon:nT},{id:"PM",label:"Prueba de manejo",icon:oT},{id:"SER",label:"Cita de servicio",icon:sT}];return d.jsx(g.Dialog,{open:e,onClose:t,fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:"12px",maxHeight:"85vh",position:"relative"}},children:d.jsxs(g.DialogContent,{sx:{p:0,display:"flex",flexDirection:"column"},children:[d.jsxs(g.Box,{sx:{p:2,pb:1},children:[d.jsx(g.Typography,{variant:"h6",fontWeight:"bold",sx:{mb:1,fontSize:"1.1rem"},children:"Vincular cliente"}),d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",cursor:"pointer",mb:2,width:"fit-content","&:hover":{opacity:.7}},onClick:t,children:[d.jsx(Ac,{sx:{color:"#666",ml:-1}}),d.jsx(g.Typography,{variant:"body2",color:"text.secondary",fontWeight:"500",children:"Volver al evento"})]}),d.jsx(g.TextField,{fullWidth:!0,placeholder:"Buscar cliente, correo electrónico, teléfono...",size:"small",onChange:f=>o(f.target.value),InputProps:{startAdornment:d.jsx(g.InputAdornment,{position:"start",children:d.jsx(rT,{sx:{color:"#999"}})}),endAdornment:n&&d.jsx(g.InputAdornment,{position:"end",children:d.jsx(g.CircularProgress,{size:20,color:"inherit"})}),sx:{borderRadius:"8px",backgroundColor:"#f5f5f5","& fieldset":{border:"none"}}}}),d.jsx(g.Box,{sx:{display:"flex",gap:1,mt:2,pb:1,overflowX:"auto",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}},children:l.map(f=>{const h=a===f.id;return d.jsx(g.Chip,{label:f.label,icon:d.jsx("img",{src:f.icon,alt:f.label,style:{width:"20px",height:"20px",borderRadius:"50%",objectFit:"cover"}}),onClick:()=>u(String(f.id)),sx:{borderRadius:"16px",fontSize:"13px",transition:"all 0.2s",backgroundColor:h?"#1976d2":"#f0f2f5",color:h?"#fff !important":"#5f6368",fontWeight:h?"bold":"normal",border:"none","&:hover":{backgroundColor:h?"#1565c0":"#e0e2e5"},"& .MuiChip-icon":{color:h?"#fff":"inherit"}}},f.id)})})]}),d.jsxs(g.Box,{sx:{flexGrow:1,overflowY:"auto",minHeight:"300px"},children:[r.map((f,h)=>d.jsxs(g.Box,{onClick:()=>{i(f,a),t()},sx:{p:"14px 20px",borderTop:"1px solid #f0f0f0",cursor:"pointer",transition:"background-color 0.2s","&:hover":{backgroundColor:"#f9f9f9"},"&:active":{backgroundColor:"#f0f0f0"}},children:[d.jsx(g.Typography,{fontWeight:"600",sx:{fontSize:"14px",color:"#333"},children:f.nombreCliente||"Sin nombre registrado"}),d.jsxs(g.Typography,{variant:"body2",sx:{fontSize:"12px",color:"#666",mt:.5},children:[f.email||"Sin correo"," • ",f.tel||"Sin teléfono"]})]},f.clienteID||h)),!n&&r.length===0&&d.jsx(g.Box,{sx:{p:4,textAlign:"center"},children:d.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"No se encontraron resultados para tu búsqueda."})})]})]})})},cT={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"},im=["#dbe3fe","#fcebc7","#d9f1d2","#fdf5d1","#ebe3d7","#e1d6fb","#f7c7cc","#f9e7fb","#eaedf2","#d5d8dd"],lT=()=>{const e=[];for(let t=0;t<24;t++)for(let r=0;r<60;r+=15){const n=new Date;n.setHours(t,r),e.push(w.format(n,"h:mmaaaa"))}return e},sm=[],za=lT(),xn=(e,t)=>{if(!e||!t)return null;const r=t.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=r.includes("pm"),o=r.includes("am"),i=r.replace(/[a-z]/g,""),[s,a]=i.split(":");if(!s||!a)return null;let c=parseInt(s,10);const u=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[l,f,h]=e.split("-").map(Number),m=new Date(l,f-1,h,c,u);return w.isValid(m)?m:null},uT=({isVisible:e,onClose:t,onSave:r,onDelete:n,selectedDate:o,initialEvent:i,userId:s,masNombreBD:a,disId:c,gmail:u,onReenviar:l,onNavigate:f})=>{const[h,m]=b.useState(!1),v=w.format(new Date,"yyyy-MM-dd"),[p,y]=b.useState(""),[_,C]=b.useState([]),[E,S]=b.useState(!1),x=$l(),[I,D]=b.useState(sm),[k,P]=b.useState(!1),[O,q]=b.useState(""),[Y,L]=b.useState(!1),[U,K]=b.useState([]),[F,G]=b.useState(!1),[ie,fe]=b.useState(null),V=(Q,he)=>{fe(Q),ge("client",Q.nombreCliente||""),ge("solID",null),G(!1)},[J,De]=b.useState([]),_e=J3(O,300),xe=I.filter(Q=>Q.tieneConflicto).length,[ne,le]=b.useState(!1),[ue,me]=b.useState("COT"),{control:pe,handleSubmit:ve,reset:Pe,formState:{errors:$,isValid:ze},watch:Me,setValue:ge}=B0({resolver:v3(b3),defaultValues:{titulo:i?.titulo||"",fechaInicio:w.format(new Date,"yyyy-MM-dd"),horaInicio:w.format(new Date,"h:mmaaaa"),horaFin:w.format(w.addHours(new Date,1),"h:mmaaaa"),todoElDia:!1,client:i?.client||null,repetir:"No repetir",link:i?.link||"",descripcion:i?.descripcion||"",solID:i?.solID??null,invitados:[],incluirMeet:!1},mode:"onChange"}),Re=Me("fechaInicio"),He=Me("fechaFin"),We=Me("todoElDia");b.useEffect(()=>{if(p.trim()===""||!s||!c||!a){C([]),ge("solID",null),S(!1);return}S(!0);const Q=setTimeout(()=>{x.getClients(p,c,a,s,ue).then(he=>{S(!1);const Oe=Array.from(new Map(he.map(R=>[R.nombreCliente,R])).values());if(Oe.length>0)C(Oe);else if(i?.client&&i.solID!==null){const R=[{solID:i.solID,nombreCliente:i.client}];C(R)}else C([])}).catch(he=>{console.error("Error al buscar clientes:",he),S(!1)})},500);return()=>clearTimeout(Q)},[p,s,c,a,ue]),b.useEffect(()=>{if(i){const Q=i?.solicitudRelacionada&&i?.solicitudRelacionada[0];if(Q){const he={nombreCliente:i?.client||"",tel:Q.tel||"",email:Q.email||"",marca:Q.marca||"",modelo:Q.modelo||"",solID:Number(Q.solID)};fe(he),C([he]),ge("client",Q.nombreCliente),ge("solID",Q?.solID)}}},[i]),b.useEffect(()=>{if(Re&&He){const Q=new Date(Re),he=new Date(He);(Q===he||Q>he)&&ge("fechaFin",Re)}},[Re,He,ge]),b.useEffect(()=>{Re&&ge("fechaFin",Re)},[Re]),b.useEffect(()=>{ge("showEndDate",h)},[h,ge]),b.useEffect(()=>{if(i){const Q=w.format(i.fechaInicio,"yyyy-MM-dd")===w.format(i.fechaFin,"yyyy-MM-dd");if(m(!Q),ge("titulo",i?.titulo),ge("fechaInicio",w.format(i.fechaInicio,"yyyy-MM-dd")),ge("fechaFin",w.format(i.fechaFin,"yyyy-MM-dd")),ge("horaInicio",w.format(i.fechaInicio,"h:mmaaaa")),ge("horaFin",w.format(i.fechaFin,"h:mmaaaa")),ge("horaInicio2",w.format(i.fechaFin,"h:mmaaaa")),ge("descripcion",i.descripcion),ge("link",i.link),ge("repetir","false"),ge("color",i.color),ge("todoElDia",i.todoElDia),ge("solID",i.solID),ge("client",i.client),i.invitados&&i.invitados.length>0){const he=(i?.invitados||[]).map(R=>{const oe=R.usrNombre?.trim()||"",de=oe.split(/\s+/),ke=de.length>1?(de[0][0]+de[1][0]).toUpperCase():oe.substring(0,2).toUpperCase();return{nombre:R.usrNombre||"Sin nombre",correo:R.correo||"",iniciales:ke||"--",usrID:R.usuarioID??null,isHost:R.esOrganizador||!1,estatus:R.statusInvitacion,tieneConflicto:!1,disID:R.disID}}),Oe={nombre:i?.nombreAnfitrion?i?.nombreAnfitrion:"Anfitrion",correo:"",iniciales:(i?.nombreAnfitrion?i?.nombreAnfitrion:"Anfitrion").substring(0,2).toUpperCase(),usrID:s??0,isHost:!0,estatus:"CONFIRMADA",tieneConflicto:!1};D([Oe,...he])}else D(sm)}else{const Q=o||new Date,he=new Date,Oe=new Date(Q.getFullYear(),Q.getMonth(),Q.getDate(),he.getHours(),he.getMinutes()),R=w.addHours(Oe,1);Pe({titulo:"",fechaInicio:w.format(Oe,"yyyy-MM-dd"),fechaFin:w.format(R,"yyyy-MM-dd"),horaFin:w.format(R,"h:mmaaaa"),horaInicio:w.format(Oe,"h:mmaaaa"),horaInicio2:w.format(R,"HH:mm"),todoElDia:!1,client:"",repetir:"No repetir",link:"",descripcion:"",color:im[0],solID:null}),m(!1)}},[i,e,o]);const dt=Q=>({UsuarioID:Q.usrID??null,Correo:Q.correo,EsOrganizador:Q.usrID==s,StatusInvitacion:Q.estatus,disID:c??null}),T=ve(Q=>{const he=I.map(R=>dt(R)),Oe={...Q,invitados:he};r(Oe,i?.eventoID),t(),Pe(),m(!1)},Q=>{});b.useEffect(()=>{We&&(ge("horaInicio","00:00"),ge("horaFin","23:59"))},[We,ge,Me]);const N=()=>{const Q=Me("fechaInicio");if(Q){const he=new Date(`${Q}T00:00:00`),Oe=w.addDays(he,1);ge("fechaFin",w.format(Oe,"yyyy-MM-dd"))}m(!0)},z=Me("fechaInicio"),te=Me("horaInicio"),se=Me("fechaFin"),j=Me("horaFin"),re=Me("todoElDia");b.useEffect(()=>{if(re||!te||!j||!z||!se)return;const Q=xn(z,te),he=xn(se,j);if(!Q||!he||!w.isValid(Q)||!w.isValid(he))return;const Oe=w.isSameDay(Q,he),R=Oe&&(w.isAfter(Q,he)||Q.getTime()===he.getTime()),oe=w.isBefore(he,Q)&&!Oe;(R||oe)&&ge("horaFin","")},[te,z]);const Ce=b.useMemo(()=>{if(!te||!z)return za;const Q=xn(z,te);return Q?za.map(he=>{const Oe=xn(se||z,he);if(Oe&&w.isAfter(Oe,Q)){const R=(Oe.getTime()-Q.getTime())/6e4,oe=Math.floor(R/60),de=R%60,ke=oe>0?`${oe} h${de>0?` ${de} min`:""}`:`${de} min`;return{value:he,label:`${he} (${ke})`}}return he}).filter(he=>{const Oe=typeof he=="string"?he:he.value,R=xn(se||z,Oe);return R?w.isAfter(R,Q):!1}):za},[te,z,se]),$e=b.useMemo(()=>za,[]);b.useEffect(()=>{if(!i&&te&&z){const Q=xn(z,te);if(Q){const he=w.addMinutes(Q,15),Oe=te.toLowerCase(),R=Oe.includes("pm")||Oe.includes("p.m."),oe=Oe.includes(".");let de=w.format(he,"h:mm"),ke=R?"pm":"am";oe&&(ke=R?"p.m.":"a.m.");const Mt=`${de}${ke}`,Pt=(j||"").toLowerCase();(j!==Mt||R&&(Pt.includes("am")||Pt.includes("a.m.")))&&ge("horaFin",Mt,{shouldValidate:!0})}}},[te,ge,z]);const W=async Q=>{const he=Me("fechaInicio"),Oe=Me("horaInicio"),R=Me("horaFin");if(!c||!he||!Oe||!R||Q.length===0)return;const oe=await Promise.all(Q.map(async de=>{if(de.isHost||!de.correo)return de;try{const ke=await x.VerificarConflicto(c,de.correo,he,Oe,R),Mt=Array.isArray(ke)?ke[0]:ke;if(Mt){const Pt=await x.getDisponibilidadUsuario(c,de.correo,he,"60");K(Pt)}return{...de,tieneConflicto:String(Mt.tieneConflicto).toLowerCase()==="true"}}catch{return{...de,tieneConflicto:!1}}}));D(oe)};b.useEffect(()=>{I.filter(he=>!he.isHost).length>0&&z&&te&&j&&W(I)},[z,te,j]);const ee=async Q=>{if(I.some(de=>de.correo===Q.correo))return;L(!0);const Oe=Me("fechaInicio"),R=Me("horaInicio"),oe=Me("horaFin");if(!c||!Q.correo||!Oe||!R||!oe){D(de=>[...de,{...Q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:!1}]);return}try{const de=await x.VerificarConflicto(c,Q.correo,Oe,R,oe),ke=Array.isArray(de)?de[0]:de,Mt=String(ke?.tieneConflicto).toLowerCase()==="true",Pt={...Q,estatus:"PENDIENTE",isHost:!1,tieneConflicto:Mt};if(Mt){const Qt=await x.getDisponibilidadUsuario(c,Q.correo,Oe,"60");K(Qt)}D(Qt=>[...Qt,Pt])}catch(de){console.error("Error al verificar conflicto:",de),D(ke=>[...ke,{...Q,tieneConflicto:!1,isHost:!1}])}},Ee=Q=>{D(he=>he.filter(Oe=>Oe.nombre!==Q))},Fe=()=>{P(!1)},ft=Q=>{const R=(Q.usrNombre??"").split(" ").map(oe=>oe.charAt(0)).join("").toUpperCase().substring(0,2);return{nombre:Q.usrNombre??"",correo:Q.usrMail??"",iniciales:R,usrID:Q.usrID??0,estatus:"PENDIENTE",tieneConflicto:!1,isHost:!1}};b.useEffect(()=>{_e.length>0&&c?(async()=>{const Oe=(await x.getUsuariosInvitados(c,_e)).map(ft).filter(R=>R.usrID!==s&&!I.some(oe=>oe.correo===R.correo));De(Oe)})():De([])},[_e,I]);const yt=Q=>{q(Q)},zt=Q=>{const{Fecha:he,HoraInicio:Oe,HoraFin:R}=Q,oe=de=>de.split(":").slice(0,2).join(":");ge("fechaInicio",he),ge("fechaFin",he),ge("horaInicio",oe(Oe)),ge("horaFin",oe(R)),m(!1),Fe()},Ot=async()=>{const Q=Me(),he=xn(Q.fechaInicio,Q.horaInicio),Oe=xn(Q.fechaFin||Q.fechaInicio,Q.horaFin);if(!he||!Oe)return;if(!c||!u){console.error("Faltan datos requeridos (disId, userMail o calendarId)");return}le(!0);const R={summary:Q.titulo||"Sin título",description:Q.descripcion||"",start:{dateTime:w.format(he,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"},end:{dateTime:w.format(Oe,"yyyy-MM-dd'T'HH:mm:ssxxx"),timeZone:"America/Mexico_City"}};try{const oe=await x.insertarEventoGoogle(c,u,!0,R);oe?.hangoutLink&&(ge("link",oe.hangoutLink),ge("incluirMeet",!1))}catch(oe){console.error("Error al generar Meet",oe)}finally{le(!1)}};return d.jsx(d.Fragment,{children:d.jsx(g.Modal,{open:e,onClose:t,children:d.jsxs("form",{onSubmit:T,children:[d.jsxs(g.Box,{sx:cT,children:[d.jsx(g.IconButton,{"aria-label":"close",onClick:t,sx:{position:"absolute",right:8,top:12},children:d.jsx(yr,{})}),d.jsx(g.Typography,{style:{fontSize:18,fontWeight:600},mb:2,children:i?.client&&i?.solicitudRelacionada?.[0]?d.jsxs(d.Fragment,{children:["Evento para el cliente:"," ",d.jsx(g.Link,{component:"button",variant:"inherit",type:"button",onClick:()=>{const Q=i?.solicitudRelacionada?.[0];if(Q&&Q.tipoSol){const he=Q?.tipoSol,R={COT:{url:"/netcar/cotizaciones/",pag:10,tipo:"COT"},SEMI:{url:"/netcar/seminuevos/",pag:12,tipo:"SEMI"},SER:{url:"/netcar/servicio/",pag:14,tipo:"SER"},PM:{url:"/netcar/pruebademanejo/",pag:16,tipo:"PM"}}[he];R&&f(`${R.url}${Q?.solID}`,{replace:!0,state:{tipoSOL:R.tipo,pag:R.pag,modulo:"Consulta"}})}},sx:{color:"#1976d2",cursor:"pointer",fontWeight:700,textDecoration:"underline",verticalAlign:"baseline",p:0,border:"none",backgroundColor:"transparent",fontSize:"14px"},children:`${i.client} / ${i?.solicitudRelacionada[0].marca} ${i?.solicitudRelacionada[0].modelo}`})]}):i?"Editar Evento":"Agregar Evento"}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(Pr,{name:"titulo",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,label:"Título",fullWidth:!0,variant:"outlined",multiline:!0,maxRows:4,size:"small",error:!!$.titulo,helperText:$.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"}}})})})}),d.jsxs("div",{className:`row g-2 ${h?"mb-1":"mb-2"}`,children:[d.jsx("div",{className:"col-12 col-md-4",children:d.jsx(Pr,{name:"fechaInicio",control:pe,render:({field:Q})=>d.jsx(g.TextField,{fullWidth:!0,...Q,type:"date",placeholder:"Fecha de inicio",size:"small",InputLabelProps:{shrink:!0},inputProps:{min:v},error:!!$.fechaInicio,helperText:$.fechaInicio?.message})})}),h?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"col-md-3 d-none d-md-block"}),d.jsx("div",{className:"col-10 col-md-4",children:d.jsx(Pr,{name:"fechaFin",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,type:"date",placeholder:"Fecha de fin",fullWidth:!0,size:"small",InputLabelProps:{shrink:!0},inputProps:{min:Re||v},error:!!$.fechaFin,helperText:$.fechaFin?.message})})}),!i&&d.jsx("div",{className:"col-2 col-md-1 d-flex align-items-start",children:d.jsx(g.IconButton,{onClick:()=>m(!1),sx:{fontSize:18},children:d.jsx(x3,{})})})]}):d.jsx("div",{className:"col-md-8"})]}),h&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12 d-flex justify-content-center",children:d.jsx(G0,{sx:{color:"#757575",my:1}})})}),d.jsxs("div",{className:"row g-2 mb-2",children:[d.jsx("div",{className:"col-12 col-md-4",children:d.jsx(Pr,{name:"horaInicio",control:pe,render:({field:{onChange:Q,value:he,...Oe}})=>d.jsx(g.Autocomplete,{freeSolo:!0,options:$e,value:he||"",getOptionLabel:R=>typeof R=="string"?R:R.value,onChange:(R,oe)=>{const de=typeof oe=="string"?oe:oe?.value;if(de){const ke=de.split(" (")[0].trim();Q(ke)}else Q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},onInputChange:(R,oe)=>Q(oe),renderInput:R=>d.jsx(g.TextField,{...R,...Oe,size:"small",error:!!$.horaInicio,helperText:$.horaInicio?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...R.InputProps}}),popupIcon:d.jsx(Ll,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:re})})}),!h&&d.jsx("div",{className:"col-1 d-flex align-items-center justify-content-center",style:{marginTop:$.horaInicio?"5px":"0px"},children:d.jsx(G0,{sx:{color:"#757575"}})}),h&&d.jsx("div",{className:"col-md-3 d-none d-md-block"}),d.jsx("div",{className:"col-12 col-md-4",children:d.jsx(Pr,{name:"horaFin",control:pe,render:({field:{onChange:Q,value:he,...Oe}})=>d.jsx(g.Autocomplete,{freeSolo:!0,options:Ce,getOptionLabel:R=>typeof R=="string"?R:R.value,value:he||"",onChange:(R,oe)=>{const de=typeof oe=="string"?oe:oe?.value;if(de){const ke=de.split(" (")[0].trim();Q(ke)}else Q("")},slotProps:{paper:{sx:{width:"fit-content",minWidth:"250px"}}},renderOption:(R,oe)=>b.createElement(g.Box,{component:"li",...R,key:typeof oe=="string"?oe:oe.value},d.jsx(g.Typography,{children:typeof oe=="string"?oe:oe.label})),onInputChange:(R,oe)=>Q(oe),renderInput:R=>d.jsx(g.TextField,{...R,...Oe,size:"small",error:!!$.horaFin,helperText:$.horaFin?.message,sx:{"& .MuiOutlinedInput-root":{paddingRight:"8px !important"},"& .MuiAutocomplete-endAdornment":{position:"end",right:10}},InputProps:{...R.InputProps}}),popupIcon:d.jsx(Ll,{sx:{cursor:"pointer",color:"#5f6368"}}),forcePopupIcon:!0,sx:{"& .MuiAutocomplete-clearIndicator":{display:"none"}},disabled:re})})}),!h&&d.jsx("div",{className:"col-12 col-md-2 d-flex align-items-center",children:d.jsx(Pr,{name:"todoElDia",control:pe,render:({field:Q})=>d.jsx(g.FormControlLabel,{control:d.jsx(g.Checkbox,{checked:Q.value,onChange:he=>Q.onChange(he.target.checked)}),label:d.jsx("label",{style:{fontSize:"0.7rem",fontWeight:"normal"},children:"Todo el día"}),sx:{whiteSpace:"nowrap"}})})})]}),(!i?.isGoogleEvent||i?.isOutlookEvent)&&!h&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsxs(g.Button,{onClick:N,size:"small",sx:{textTransform:"none",fontSize:16},children:[d.jsx(S3,{})," Agregar fecha final"]})})}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(Pr,{name:"link",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,placeholder:" Agregar enlace de reunión",fullWidth:!0,variant:"outlined",size:"small",error:!!$.link,helperText:$.link?.message,InputProps:{startAdornment:d.jsx("img",{src:w3,width:20,style:{alignSelf:"flex-start",marginRight:"8px",marginTop:"8px"}})}})})})}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(Pr,{name:"descripcion",control:pe,render:({field:Q})=>d.jsx(g.TextField,{...Q,placeholder:" Agregar descripción aquí...",fullWidth:!0,multiline:!0,rows:3,inputProps:{maxLength:500},variant:"outlined",size:"small",InputProps:{startAdornment:d.jsx("img",{src:C3,width:20,style:{alignSelf:"flex-start",marginRight:"8px"}})}})})})}),!i?.solicitudRelacionada&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(U3,{onSelectGuest:ee,availableSuggestions:J,onInputTextChange:yt})})}),(Y||xe>0)&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(X3,{guests:I,conflictCount:xe,onViewSuggestions:()=>P(!0),onDeleteGuest:Ee})})}),i?.invitados&&i?.invitados?.length>0&&d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsx(g.Box,{children:d.jsx(R3,{guests:I,onReenviar:l,esOrganizador:i?.esOrganizador})})})}),d.jsx(F3,{open:k,handleClose:Fe,suggestions:U,onSelectSlot:zt})]}),d.jsxs(g.Box,{sx:{display:"none",alignItems:"center",mt:1,mb:1,px:0},children:[d.jsx(g.Box,{sx:{minWidth:40,display:"flex",justifyContent:"flex-start"},children:d.jsx("img",{src:"https://fonts.gstatic.com/s/i/productlogos/meet_2020q4/v1/web-512dp/logo_meet_2020q4_color_2x_web_512dp.png",alt:"Meet",style:{width:22,height:22}})}),d.jsx(g.Box,{sx:{flex:1},children:!Me("link")&&!Me("incluirMeet")?d.jsx(g.Button,{fullWidth:!0,disabled:ne||!c||!u,onClick:Ot,sx:{justifyContent:"flex-start",textTransform:"none",bgcolor:"#f1f3f4",color:"#3c4043","&:hover":{bgcolor:"#e8eaed",boxShadow:"none"},borderRadius:"4px",fontWeight:400,fontSize:"14px",py:1,px:2,border:"none",boxShadow:"none"},children:ne?d.jsxs(d.Fragment,{children:[d.jsx(g.CircularProgress,{size:18,sx:{mr:1.5,color:"#5f6368"}}),d.jsx(g.Typography,{variant:"body2",sx:{fontSize:"14px",color:"#5f6368"},children:"Generando enlace..."})]}):"Añadir videoconferencia de Google Meet"}):d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",bgcolor:"#f1f3f4",p:"6px 12px",borderRadius:"4px",border:"1px solid #dadce0"},children:[d.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[d.jsx(g.Typography,{variant:"body2",sx:{color:"#1a73e8",fontWeight:500,cursor:Me("link")?"pointer":"default",textDecoration:"none","&:hover":{textDecoration:Me("link")?"underline":"none"},whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},onClick:()=>Me("link")&&window.open(Me("link"),"_blank"),children:Me("link")?Me("link"):"Se añadirá Google Meet al guardar"}),d.jsx(g.Typography,{variant:"caption",sx:{color:"#70757a"},children:"Google Meet"})]}),d.jsx(g.IconButton,{size:"small",onClick:()=>{ge("incluirMeet",!1),ge("link","")},sx:{color:"#5f6368"},children:d.jsx(yr,{sx:{fontSize:18}})})]})})]}),d.jsx("div",{className:"row mb-2",children:d.jsx("div",{className:"col-12",children:d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[d.jsx(_3,{}),im.map(Q=>d.jsx(Pr,{name:"color",control:pe,render:({field:he})=>d.jsx(g.IconButton,{onClick:()=>he.onChange(Q),sx:{width:24,height:24,borderRadius:"50%",bgcolor:Q,border:he.value===Q?"2px solid":"none",borderColor:he.value===Q?"primary.main":"transparent"}})},Q))]})})}),d.jsx("div",{className:"row",children:d.jsxs("div",{className:"col-12 d-flex flex-column flex-sm-row gap-2",style:{width:"100%",marginTop:"20px"},children:[i&&!i?.isGoogleEvent&&!i?.isOutlookEvent&&d.jsx(g.Button,{onClick:n,variant:"outlined",startIcon:d.jsx("img",{src:q0,width:15}),hidden:i?i?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",backgroundColor:"#FFF5F5",color:"#d32f2f",borderColor:"red",borderRadius:"8px",fontWeight:700,fontSize:"14px",padding:"8px 0","&:hover":{backgroundColor:"#FEE2E2",borderColor:"red"}},children:"Eliminar"}),d.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"}),d.jsx(g.Button,{onClick:T,variant:"contained",disabled:!ze,hidden:i?i?.esOrganizador!=!0:!1,sx:{flex:1,textTransform:"none",fontWeight:700,fontSize:"14px",borderRadius:"8px",backgroundColor:"#1976D2",boxShadow:"none","&:hover":{backgroundColor:"#115293",boxShadow:"0px 2px 4px rgba(0,0,0,0.2)"}},children:"Guardar"})]})})]}),d.jsx(aT,{open:F,onClose:()=>G(!1),clientOptions:_,isClientsLoading:E,setClientSearchTerm:y,onSelectClient:V,setFiltroPadre:me})]})})})},dT={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"},fT=({isOpen:e,onClose:t,events:r,date:n,onEventClick:o})=>{if(!n)return null;const i=a=>{o(a),t()},s=a=>a.isGoogleEvent?{label:"G",borderColor:"#4285F4"}:a.isOutlookEvent?{label:"O",borderColor:"#0078d9"}:{label:"-",borderColor:"#CCC"};return d.jsx(g.Modal,{open:e,onClose:t,children:d.jsxs(g.Box,{sx:dT,children:[d.jsxs(g.Box,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:1},children:[d.jsxs(g.Typography,{sx:{fontSize:"18px",fontWeight:"bold"},component:"h2",children:["Eventos del"," ",n.toLocaleDateString("es-ES",{weekday:"long",day:"numeric",month:"long"})]}),d.jsx(g.IconButton,{onClick:t,size:"small",children:d.jsx(yr,{})})]}),d.jsx(g.Divider,{}),d.jsx(g.List,{sx:{mt:1},children:r.map(a=>{const c=s(a);return d.jsx(g.ListItem,{disablePadding:!0,sx:{mb:1},children:d.jsx(g.ListItemButton,{onClick:()=>i(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:d.jsxs(g.Box,{sx:{flexGrow:1},children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:.5},children:[d.jsx(g.Typography,{sx:{fontSize:"10px",fontWeight:"bold",px:.5,borderRadius:"3px",backgroundColor:c?.borderColor,color:"white",textTransform:"uppercase"},children:c?.label}),d.jsx(g.Typography,{sx:{fontSize:"14px",fontWeight:600,lineHeight:1.2,color:"#333"},children:a.titulo})]}),d.jsx(g.Typography,{sx:{fontSize:"12px",color:"#666"},children:a.todoElDia?"Todo el día":`${w.format(a.fechaInicio,"hh:mm aa").toLowerCase()} - ${w.format(a.fechaFin,"hh:mm aa").toLowerCase()}`})]})})},a.eventoID)})})]})})};var Li={},am;function pT(){if(am)return Li;am=1;var e=ct();Object.defineProperty(Li,"__esModule",{value:!0}),Li.default=void 0;var t=e(ht()),r=pt();return Li.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"),Li}var hT=pT();const mT=st(hT);var zi={},cm;function gT(){if(cm)return zi;cm=1;var e=ct();Object.defineProperty(zi,"__esModule",{value:!0}),zi.default=void 0;var t=e(ht()),r=pt();return zi.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"),zi}var vT=gT();const yT=st(vT),bT="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",xT="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==",Xl=b.forwardRef(({id:e,message:t,variant:r},n)=>{const{closeSnackbar:o}=Ji.useSnackbar(),i={success:{color:"#fff",icon:d.jsx("img",{width:25,src:bT,style:{borderRadius:"50%",backgroundColor:"#4caf50",color:"white",fontSize:"12px",padding:3}})},error:{color:"#f44336",icon:d.jsx(mT,{sx:{color:"#f44336"}})},info:{color:"#2196f3",icon:d.jsx(yT,{sx:{color:"#2196f3"}})},delete:{color:"#fff",icon:d.jsx("img",{src:q0,width:25,style:{borderRadius:"50%",backgroundColor:"#ffdfd4",color:"red",fontSize:"16px",padding:3}})},rechazar:{color:"#fff",icon:d.jsx("img",{src:xT,width:30,style:{borderRadius:"50%",color:"red",fontSize:"16px",padding:3}})}},s=i[r]||i.info;return d.jsx(Ji.SnackbarContent,{ref:n,children:d.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 ${s.color}`},children:[d.jsx(g.Box,{sx:{mr:1.5},children:s.icon}),d.jsx(g.Typography,{variant:"body2",sx:{flexGrow:1},children:t}),d.jsx(g.IconButton,{size:"small",onClick:()=>o(e),children:d.jsx(yr,{fontSize:"small"})})]})})}),lm=b.createContext(void 0),wT=({children:e})=>{const[t,r]=b.useState([]),[n,o]=b.useState([]),[i,s]=b.useState(!1);return d.jsx(lm.Provider,{value:{googleEvents:t,setGoogleEvents:r,outlookEvents:n,setOutlookEvents:o,isLoadingGoogleEvents:i,setIsLoadingGoogleEvents:s},children:e})},_T=()=>{const e=b.useContext(lm);if(e===void 0)throw new Error("useEvents must be used within an EventsProvider");return e},ST=(e,t,r)=>{const n=(s,a)=>a?new Date(a):s?new Date(s.replace(/-/g,"/")):new Date,o=n(e.start.date,e.start.dateTime);let i=n(e.end.date,e.end.dateTime);return e.end.date&&!e.end.dateTime&&i.setDate(i.getDate()-1),{eventoID:Math.abs(CT(e.id)),titulo:e.summary||"(Sin título)",descripcion:e.description,fechaInicio:o,fechaFin:i,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 CT(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 ET(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 DT=(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(ET(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}},um="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",AT="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",kT=({open:e,onClose:t,onConfirm:r,title:n,description:o,icon:i,confirmText:s,confirmColor:a="#d32f2f",loading:c=!1})=>d.jsxs(g.Dialog,{open:e,onClose:t,PaperProps:{sx:{borderRadius:"15px",p:1,maxWidth:"400px"}},children:[d.jsx(g.Box,{sx:{display:"flex",justifyContent:"flex-end"},children:d.jsx(g.IconButton,{onClick:t,size:"small",children:d.jsx(yr,{fontSize:"small"})})}),d.jsxs(g.DialogContent,{sx:{textAlign:"center",pt:0},children:[d.jsx(g.Box,{sx:{mb:2,display:"flex",justifyContent:"center"},children:i}),d.jsx(g.Typography,{variant:"h6",sx:{fontWeight:"bold",mb:2},children:n}),d.jsx(g.Typography,{variant:"body2",sx:{color:"#555",mb:4,px:2},children:o}),d.jsxs(g.Box,{sx:{display:"flex",gap:2,justifyContent:"center",mb:2},children:[d.jsx(g.Button,{variant:"outlined",onClick:t,sx:{textTransform:"none",borderRadius:"8px",px:4,borderColor:"#1976D2",color:"#1976D2"},children:"Regresar"}),d.jsxs(g.Button,{variant:"contained",onClick:r,disabled:c,sx:{textTransform:"none",borderRadius:"8px",px:4,bgcolor:a,"&:hover":{bgcolor:"#b71c1c"}},children:[s=="Eliminar"&&d.jsx("img",{src:AT,width:15,style:{marginRight:6,marginBottom:2}}),c?"Procesando...":s]})]})]})]}),Ba=(e,t)=>{if(!e||!t)return null;const r=t.toLowerCase().replace(/\s/g,"").replace(/\./g,""),n=r.includes("pm"),o=r.includes("am"),i=r.replace(/[a-z]/g,""),[s,a]=i.split(":");if(!s||!a)return null;let c=parseInt(s,10);const u=parseInt(a,10);n&&c<12&&(c+=12),o&&c===12&&(c=0);const[l,f,h]=e.split("-").map(Number),m=new Date(l,f-1,h,c,u);return w.isValid(m)?m:null},TT=({userId:e,leads30Days:t,leads90Days:r,disId:n,masNombreBD:o,usrNombre:i,onNavigate:s})=>{const[a,c]=b.useState(new Date),[u,l]=b.useState([]),[f,h]=b.useState(!1),[m,v]=b.useState(null),[p,y]=b.useState(null),[_,C]=b.useState([]),{enqueueSnackbar:E}=Ji.useSnackbar(),S=$l(),x=ll(),I=Wp(),[D,k]=b.useState(!1),[P,O]=b.useState([]),[q,Y]=b.useState(null),{session:L,sessionoutlook:U}=Gc(),{googleEvents:K,setGoogleEvents:F,outlookEvents:G,setOutlookEvents:ie}=_T(),[fe,V]=b.useState([]),[J,De]=b.useState([]),[_e,xe]=b.useState([]),[ne,le]=b.useState(!1),[ue,me]=b.useState([]),[pe,ve]=b.useState(),Pe=(R,oe)=>{O(R),Y(oe),k(!0)},$=async()=>{if(e===void 0||n===void 0)return;const R=await S.getNotificacionesXUsuario(e,n);i?localStorage.setItem("nombreAnfitrion",i):localStorage.setItem("nombreAnfitrion","Anfitrion"),me(R)};b.useEffect(()=>{const R=new Date,oe=w.startOfDay(R),de=w.endOfDay(w.addDays(oe,6)),ke={start:oe,end:de},Mt=u.filter(Pt=>{const Qt={start:Pt.fechaInicio,end:Pt.fechaFin};return qf(Qt,ke)}).sort((Pt,Qt)=>Pt.fechaInicio.getTime()-Qt.fechaInicio.getTime());C(Mt)},[u]),b.useEffect(()=>{const R=async()=>{try{if(e&&n){const de=await S.getEventsByUser(e,n);$(),l(de)}}catch(de){console.log("Error al cargar eventos locales:",de)}};R();const oe=setInterval(R,4e3);return()=>clearInterval(oe)},[e]),b.useEffect(()=>{if(!n||!e)return;const R=[...u];if(K.length>0&&L?.userEmail){const oe=K.map(de=>ST(de,n,e));R.push(...oe)}if(G.length>0&&U?.userEmail){const oe=G.map(de=>DT(de,n,e));R.push(...oe)}V(R)},[u,K,G,n,e,L?.userEmail,U?.userEmail]);const ze=async R=>{try{if(R?.isGoogleEvent||R.isOutlookEvent)v(R),h(!0);else{const oe=await S.getEventById(R.eventoID);v(oe),h(!0)}}catch(oe){console.error(oe)}},Me=()=>{h(!1),v(null)},ge=async(R,oe)=>{let de,ke;if(R.todoElDia)de=Ba(R.fechaInicio,R.horaInicio),ke=Ba(R.fechaInicio,R.horaFin);else{de=Ba(R.fechaInicio,R.horaInicio);const Ht=R.fechaFin||R.fechaInicio;ke=Ba(Ht,R.horaFin)}if(!de||!ke){console.error("No se pudieron procesar las fechas. Revisa el formato de hora:",{inicio:R.horaInicio,fin:R.horaFin});return}const Mt=w.format(de,"yyyy-MM-dd HH:mm:ss.SSS"),Pt=w.format(ke,"yyyy-MM-dd HH:mm:ss.SSS");if(oe){const Ht={...R,eventoID:oe,fechaInicio:Mt,fechaFin:Pt,solID:R.solID??null,disID:n??null,client:R.client,invitados:R.invitados.map(Ue=>({usrNombre:Ue.nombre||Ue.usrNombre,Correo:Ue.correo||Ue.Correo,EsOrganizador:Ue.isHost||Ue.EsOrganizador,StatusInvitacion:Ue.StatusInvitacion,UsuarioID:Ue.usrID||Ue.UsuarioID,disID:Ue.disID||n}))};try{const Ue=await S.updateEvent(Ht);var Qt=u.map(hr=>hr.eventoID===Ue.eventoID?Ue:hr);l(Qt),E("El evento se ha actualizado correctamente.",{variant:"success"}),Me()}catch{E("Error al actualizar Evento",{variant:"error"})}}else{const Ht={...R,fechaInicio:Mt,fechaFin:Pt,todoElDia:R.todoElDia,solID:R.solID??null,disID:n??null,client:R.client,invitados:R.invitados.map(Ue=>({usrNombre:Ue.nombre||Ue.usrNombre,Correo:Ue.correo||Ue.Correo,EsOrganizador:Ue.isHost||Ue.EsOrganizador,StatusInvitacion:Ue.StatusInvitacion,UsuarioID:Ue.usrID||Ue.UsuarioID,disID:Ue.disID||n}))};try{const Ue=await S.createEvent(Ht,e);l(hr=>[...hr,Ue]),E("El evento se ha creado con éxito",{variant:"success"}),Me()}catch{E("Error al guardar Evento",{variant:"error"})}}if(e&&n){const Ht=await S.getEventsByUser(e,n);l(Ht)}},Re=()=>{c(R=>new Date(R.getFullYear(),R.getMonth()-1,1))},He=()=>{c(R=>new Date(R.getFullYear(),R.getMonth()+1,1))},We=()=>{Ot("ELIMINAR")},dt=()=>{Ot("RECHAZAR")},T=()=>{y(new Date),h(!0)},N=R=>{R&&c(R)},z=R=>{y(R),h(!0),v(null)},te=async()=>{if(m)try{await S.deleteEvent(m.eventoID),l(u.filter(R=>R.eventoID!==m.eventoID)),E("El evento se ha eliminado de tu calendario",{content:(R,oe)=>d.jsx(Xl,{id:R,message:String(oe),variant:"delete"})})}catch{E("Error al eliminar Evento",{variant:"error"})}finally{Me(),Q()}},se=async()=>{if(!(!L?.userEmail||!n)){le(!0);try{const oe=(await x.getGoogleCalendars(L.userEmail,n)).map(ke=>({...ke,selected:!0}));De(oe);const de=oe.map(ke=>ke.id);$e(de)}catch(R){console.error("Error Google Cals:",R)}finally{le(!1)}}},j=async R=>{const oe=J.map(ke=>ke.id===R?{...ke,selected:!ke.selected}:ke);De(oe);const de=oe.filter(ke=>ke.selected).map(ke=>ke.id);$e(de)},re=async()=>{if(!(!U?.userEmail||!n)){le(!0);try{const oe=(await I.getOutlookCalendars(U.userEmail,n)).map(ke=>({...ke,selected:!0}));xe(oe);const de=oe.map(ke=>ke.id);W(de)}catch(R){console.error("Error Outlook Cals:",R)}finally{le(!1)}}},Ce=async R=>{const oe=_e.map(ke=>ke.id===R?{...ke,selected:!ke.selected}:ke);xe(oe);const de=oe.filter(ke=>ke.selected).map(ke=>ke.id);W(de)};b.useEffect(()=>{se()},[L?.userEmail,n]),b.useEffect(()=>{re()},[U?.userEmail,n]);const $e=async R=>{if(!L?.userEmail||!n)return;const oe=R||J.filter(de=>de.selected).map(de=>de.id);try{const de={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:L.userEmail,calendarIds:oe},ke=await x.getGoogleEventsByMonth(de);F(ke)}catch(de){console.error("Error al obtener eventos de Google:",de)}},W=async R=>{if(!U?.userEmail||!n)return;const oe=R||_e.filter(de=>de.selected).map(de=>de.id);try{const de={disID:n,year:a.getFullYear(),month:a.getMonth()+1,usrMail:U.userEmail,calendarIds:oe},ke=await I.getOutlookEventsByMonth(de);ie(ke)}catch(de){console.error("Error al obtener eventos de Outlook:",de)}};if(n===void 0||e===void 0)return d.jsx("div",{children:"Cargando configuración de usuario..."});const ee=async(R,oe)=>{const de=await S.UpdateStatusEvento(R.evento.eventoID,e,oe);if(de?.success===!1){E(de?.message||"No se pudo procesar la invitación",{variant:"error"});return}de&&(await S.MarcarLeido(R.notificacionID,e),me(ke=>ke.filter(Mt=>Mt.notificacionID!==R.notificacionID)),E(R?.evento?.titulo+" fue agregado a tu calendario",{variant:"success"}))},Ee=async()=>{if(!pe)return;const R=await S.UpdateStatusEvento(pe.evento.eventoID,e,"RECHAZADA");if(R?.success===!1){E(R?.message||"No se pudo procesar la invitación",{variant:"error"}),Q();return}R&&(await S.MarcarLeido(pe.notificacionID,e),me(oe=>oe.filter(de=>de.notificacionID!==pe.notificacionID)),E("Haz rechazado la Invitación a "+pe?.evento?.titulo,{content:(oe,de)=>d.jsx(Xl,{id:oe,message:String(de),variant:"rechazar"})}),Q())},Fe=async(R,oe)=>{try{if(!e)return;ve(R),oe=="RECHAZADA"?dt():ee(R,oe)}catch{E("Error al procesar la invitación",{variant:"error"})}},ft=async R=>{if(e)try{await S.MarcarLeido(R,e),me(oe=>oe.filter(de=>de.notificacionID!==R))}catch{E("Error al marcar como leída",{variant:"error"})}},yt=async R=>{try{if(!m)return;await S.ReenviarNotificacion(m?.eventoID,R),E("Invitación enviada con éxito",{variant:"success"})}catch(oe){console.error("Error al conectar con la API",oe)}},[zt,Ot]=b.useState(null),Q=()=>Ot(null),he={RECHAZAR:{title:"Rechazar invitación",confirmText:"Rechazar evento",description:d.jsxs(d.Fragment,{children:["Estás a punto de declinar la invitación de ",d.jsx("strong",{children:pe?.evento?.nombreAnfitrion})," a ",d.jsx("strong",{children:pe?.evento?.titulo})]}),icon:d.jsx("img",{src:um}),action:()=>pe&&Ee()},ELIMINAR:{title:"Eliminar evento",confirmText:"Eliminar",description:"¿De verdad deseas eliminar este evento? Esta acción no se puede deshacer.",icon:d.jsx("img",{src:um}),action:()=>te()},DESVINCULAR:{title:"Desvincular Outlook",confirmText:"Desvincular",description:"Si desvinculas tu cuenta, perderás acceso a todos los eventos sincronizados.",icon:"",action:()=>te}},Oe=zt?he[zt]:null;return d.jsxs("div",{id:"Agenda",style:{height:"100%",width:"100%"},children:[d.jsx(Eb,{header:d.jsx(U2,{currentDate:a,onPrevMonth:Re,onNextMonth:He,onAddEvent:T,onDateChange:N}),sidebar:d.jsx(R_,{onEventClick:ze,upcomingEvents:_,leads30Days:t,leads90Days:r,disID:n,usrID:e,onAddEvent:T,googleCalendars:J,outlookCalendars:_e,isLoadingCalendars:ne,onToggleGoogle:j,onToggleOutlook:Ce,notifications:ue,unreadCount:ue?.filter(R=>!R.leida).length,onAceppInvitacion:Fe,onMarkAsRead:ft}),mainContent:d.jsx(jC,{onSeeMoreClick:Pe,currentDate:a,events:fe,onDayClick:z,onEventClick:ze})}),f&&d.jsx(uT,{isVisible:f,onClose:Me,onSave:ge,onDelete:We,selectedDate:p,initialEvent:m,userId:e,masNombreBD:o,disId:n,gmail:"llopez@exagono.net",onReenviar:yt,onNavigate:s}),d.jsx(fT,{isOpen:D,onClose:()=>k(!1),events:P,date:q,onEventClick:ze}),Oe&&d.jsx(kT,{open:!!zt,onClose:Q,onConfirm:()=>{Oe.action()},title:Oe.title,description:Oe.description,icon:Oe.icon,confirmText:Oe.confirmText})]})},OT="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",MT="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 Jl(e,t,r){return e.accessor?e.accessor(t,r):e.field?t?.[e.field]:t?.[e?.key||""]}function PT(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 eu(e,t,r=!0){return typeof e=="function"?e(t):e??r}function IT(e){return e.replace(/[^\d]/g,"")}function jT(e,t){return t}var Bi={},dm;function RT(){if(dm)return Bi;dm=1;var e=ct();Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.default=void 0;var t=e(ht()),r=pt();return Bi.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"),Bi}var NT=RT();const $T=st(NT);var Fi={},fm;function LT(){if(fm)return Fi;fm=1;var e=ct();Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.default=void 0;var t=e(ht()),r=pt();return Fi.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"),Fi}var zT=LT();const BT=st(zT);var Vi={},pm;function FT(){if(pm)return Vi;pm=1;var e=ct();Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.default=void 0;var t=e(ht()),r=pt();return Vi.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"),Vi}var VT=FT();const WT=st(VT);var Wi={},hm;function UT(){if(hm)return Wi;hm=1;var e=ct();Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.default=void 0;var t=e(ht()),r=pt();return Wi.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"),Wi}var YT=UT();const HT=st(YT);function mm(e){return e==="right"?"end":e==="center"?"center":"start"}function gm(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 qT=1060,tu=(e,t)=>e.metrics.find(r=>String(r.label).toLowerCase()===t.toLowerCase())?.value??"";function ZT({sections:e,detailColumns:t,summaryWidths:r=["1fr",120,120,150],minWidth:n=qT,getDetailColumns:o,onRowClick:i}){function c(l){if(typeof l=="number")return l;if(!l)return 0;const f=/^(\d+)\s*px$/.exec(l.trim());return f?Number(f[1]):/fr$/i.test(l)?160:0}function u(l){const f=l.reduce((v,p)=>v+c(p.width),0),h=Math.max(l.length-1,0)*16;return f+h+32}return d.jsx(g.Box,{sx:{border:"1px solid rgba(0,0,0,0.15)",overflow:"hidden",bgcolor:"background.paper",width:"100%"},children:d.jsxs(g.Box,{children:[d.jsx(g.Box,{sx:{display:"grid",gridTemplateColumns:r.map(l=>typeof l=="number"?`${l}px`:l).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:"#1E5BCE",color:"#fff",boxSizing:"border-box"},children:["Tipo","En Proceso","Finalizadas","Último seg."].map(l=>d.jsx(g.Typography,{sx:{fontSize:13,fontWeight:800},children:l},l))}),e.map((l,f)=>{const[h,m]=B.useState(!!l.initiallyOpen),v=f%2===1,p=o?o(l):t,y=Math.max(n,u(p));return d.jsxs(g.Box,{children:[d.jsxs(g.Box,{sx:{display:"grid",gridTemplateColumns:r.map(_=>typeof _=="number"?`${_}px`:_).join(" "),columnGap:"16px",alignItems:"center",px:"16px",py:1,bgcolor:v?"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:()=>m(_=>!_),children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1,minWidth:0},children:[d.jsx(g.IconButton,{size:"small",disableRipple:!0,children:h?d.jsx(HT,{}):d.jsx(WT,{})}),d.jsx(g.Typography,{sx:{fontWeight:700,fontSize:14,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(l.title),children:l.title})]}),d.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tu(l,"En Proceso")}),d.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tu(l,"Finalizadas")}),d.jsx(g.Typography,{sx:{fontSize:13.5,fontWeight:800},children:tu(l,"Último seg.")})]}),d.jsx(g.Collapse,{in:h,unmountOnExit:!0,children:d.jsxs(g.Box,{sx:{overflowX:"auto","&::-webkit-scrollbar":{height:"5px"}},children:[d.jsx(g.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:gm(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(_=>d.jsx(g.Typography,{sx:{justifySelf:mm(_.align),textAlign:_.align??"left",fontSize:12.5,fontWeight:800,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:_.header},_.key))}),(l.rows??[]).map((_,C)=>d.jsx(g.Box,{sx:{minWidth:y,display:"grid",gridTemplateColumns:gm(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:()=>i?.(_,l),children:p.map((E,S)=>{const x=E.accessor?E.accessor(_,C):E.field?_[E.field]:null;return d.jsx(g.Box,{sx:{justifySelf:mm(E.align),textAlign:E.align??"left",minWidth:0,overflow:"hidden",maxWidth:"100%"},children:typeof x=="string"||typeof x=="number"?d.jsx(g.Typography,{sx:{fontSize:13,fontWeight:/^(estatus|seg|avance|nivel|asesor|fecha)$/i.test(E.key)?700:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:String(x),children:x}):x},E.key??S)})},_.id??C))]})})]},l.id)})]})})}var Ui={},vm;function GT(){if(vm)return Ui;vm=1;var e=ct();Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.default=void 0;var t=e(ht()),r=pt();return Ui.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"),Ui}var KT=GT();const QT=st(KT),XT=e=>e?new Date(e).toLocaleDateString("es-MX",{day:"2-digit",month:"short",year:"numeric"}).replace(".",""):"",JT=e=>{const t=`${e?.Nombre??""} ${e?.Apellido??""}`.trim();return t||(e?.IdAsesor?e?.Correo??"Usuario":"Sin asesor asignado")},e5=e=>{const t=(e||"").split(" ").filter(Boolean);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():(e?.[0]??"?").toUpperCase()};var Yi={},ym;function t5(){if(ym)return Yi;ym=1;var e=ct();Object.defineProperty(Yi,"__esModule",{value:!0}),Yi.default=void 0;var t=e(ht()),r=pt();return Yi.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"),Yi}var r5=t5();const n5=st(r5),ru=({current:e=0,total:t=0,color:r="#4caf50"})=>d.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)=>d.jsx("div",{style:{width:"7px",height:"7px",borderRadius:"2px",backgroundColor:o<e?r:"#e0e0e0",display:"flex"}},o))});var Hi={},bm;function o5(){if(bm)return Hi;bm=1;var e=ct();Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.default=void 0;var t=e(ht()),r=pt();return Hi.default=(0,t.default)((0,r.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"}),"Add"),Hi}var i5=o5();const xm=st(i5);var qi={},wm;function s5(){if(wm)return qi;wm=1;var e=ct();Object.defineProperty(qi,"__esModule",{value:!0}),qi.default=void 0;var t=e(ht()),r=pt();return qi.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"),qi}var a5=s5();const c5=st(a5),l5=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"}},u5=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}},d5=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}},f5=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 p5(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 h5(e){return e.replace(/<br\s*\/?>/gi,`
|
|
169
169
|
`).replace(/\r\n/g,`
|
|
170
170
|
`).replace(/\r/g,`
|
|
171
171
|
`)}const m5={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"]},g5={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"]},v5={Todos:[],"Algo interesado":["Algo interesado"],Interesado:["Interesado"],"Muy interesado":["Muy interesado"],"Venta definitiva":["Venta definitiva"],"No sé":["No sé"]};function y5(e,t){switch(e){case"pruebas":return d5(t)??"—";case"servicio":return f5(t)??"—";case"nuevos":case"seminuevos":default:return u5(t)??"—"}}function b5({open:e,onClose:t,customer:r,fields:n=[],header:o,extraSections:i,normalTable:s,normalTableColumns:a=[],history:c=[],advisorHistory:u=[],onRequestEdit:l,searchFilter:f,urlsQA:h,solicitudesNuevos:m=[],solicitudesPrueba:v=[],solicitudesServicio:p=[],solicitudesSeminuevos:y=[],onCreateSolicitud:_,isCrmMode:C=!1,onSolicitudBaseUrl:E,onIframeClose:S,reloadInfo:x,idAdminSistemas:I}){if(!r)return null;const D=3,[k,P]=b.useState(null),O=!!k,[q,Y]=b.useState(!1),[L,U]=b.useState(null),[K,F]=b.useState(c??[]),[G,ie]=b.useState(null),fe=b.useMemo(()=>[...u].sort((H,ae)=>new Date(ae.FechaAsignacion).getTime()-new Date(H.FechaAsignacion).getTime()),[u]);b.useEffect(()=>{c&&c.length&&F(c)},[c]);const V=c?.length?c:K,J=o?.title??(H=>H?.Nombre||H?.name||"Sin título"),De=o?.infoItems??[],_e=H=>H.nombreAsesor?.trim()||(H.Email?H.Email:"Sistema"),xe=H=>{const ae=H||"",Ae=ae.split(" ").filter(Boolean);return Ae.length>=2?(Ae[0][0]+Ae[1][0]).toUpperCase():(ae[0]||"?").toUpperCase()},ne=H=>H?.SolID??H?.solID??H?.SolId??H?.SOLID??null,le=b.useMemo(()=>{const H=V??[];return Array.isArray(H?.[0])?H.flat():H},[V]),ue=b.useMemo(()=>{const H=le;return!G||L==null?H:H.filter(ae=>{const Ae=ne(ae);return Ae!=null&&String(Ae)===String(L)})},[le,G,L]),me=b.useMemo(()=>[...ue].sort((H,ae)=>new Date(ae.fecAlta).getTime()-new Date(H.fecAlta).getTime()),[ue]),[pe,ve]=b.useState(!1),Pe=b.useMemo(()=>pe?me:me.slice(0,D),[pe,me]),$=Math.max(me.length-D,0),ze=H=>String(H??"").normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase().trim(),Me=(H,ae)=>ze(JSON.stringify(H)).includes(ze(ae)),ge=(H,ae)=>f?f(H,ae):Me(H,ae),Re=(H,ae)=>{const Ae=ze(ae).split(/\s+/).filter(Boolean);return Ae.length?Ae.every(Ne=>ge(H,Ne)):!0},[He,We]=b.useState(""),[dt,T]=b.useState([]);b.useMemo(()=>s??[],[s]),b.useMemo(()=>{const H=He.trim();return H?(s??[]).filter(ae=>Re(ae,H)):s??[]},[s,He]);const N=g.useTheme(),z=g.useMediaQuery(N.breakpoints.down("md")),[te,se]=b.useState(""),[j,re]=b.useState(!0),[Ce,$e]=b.useState(!1),W=new Date().toISOString().slice(0,10),ee=new Date(Date.now()-720*3600*1e3).toISOString().slice(0,10),[Ee,Fe]=b.useState(ee),[ft,yt]=b.useState(W),[zt,Ot]=b.useState(null),Q=!!zt,[he,Oe]=b.useState("En Proceso"),[R,oe]=b.useState("Todos"),[de,ke]=b.useState("Todos"),Mt=["Algo interesado","Interesado","Muy interesado","Venta definitiva","No sé"],Pt=["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"],Qt=()=>{se(""),re(!1),$e(!1),Fe(ee),yt(W),Oe("Todos"),oe("Todos"),ke("Todos")},Ht=b.useMemo(()=>(te??"").trim()!==""||he!=="Todos"||R!=="Todos"||j||Ce||de!=="Todos",[te,he,R,j,Ce,de]);function Ue(H){if(!H)return"";const ae=new Date(H);if(isNaN(ae.getTime()))return"";const Ae=String(ae.getDate()).padStart(2,"0"),Ne=String(ae.getMonth()+1).padStart(2,"0"),Dt=String(ae.getFullYear()).slice(-2);return`${Ae}/${Ne}/${Dt}`}function hr(H){const ae=H?new Date(H):null;return ae&&!isNaN(ae.getTime())?ae:null}function Qi(H,ae){let Ae=null;for(const Ne of H){const Dt=hr(ae(Ne));if(Dt){const St=Dt.getTime();(Ae===null||St>Ae)&&(Ae=St)}}return Ae?new Date(Ae):null}function Rr(H){const ae=Qi(H,Ae=>Ae.UltimoSeguimiento||Ae.FechaCita);return ae?Ue(ae.toISOString()):"—"}function ln(H){const ae=(H??"").toLowerCase().trim();return ae==="sin venta"||ae==="con venta"||ae==="rechazada"||ae==="rechazadas"}function qt(H){return H.filter(ae=>ln(ae.EstatusDescripcion)).length}function Qr(H){return H.filter(ae=>!ln(ae.EstatusDescripcion)).length}const Xi=({progress:H,color:ae})=>{if(!H)return d.jsx(ru,{current:0,total:0,color:ae});const Ae=H.split("/").map(Number);if(Ae.length!==2||Ae.some(St=>Number.isNaN(St)))return d.jsx(ru,{current:0,total:0,color:ae});const[Ne,Dt]=Ae;return d.jsx(ru,{current:Ne,total:Dt,color:ae})};function Xr(H){return[{key:"fecha",header:"Fecha",accessor:ae=>Ue(ae.Fecha),width:110},{key:"vehiculo",header:"Vehículo",accessor:ae=>d.jsx(g.Tooltip,{title:ae.Vehiculo??"",placement:"top",arrow:!0,children:d.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:ae.Vehiculo??"—"})}),width:260},{key:"estatus",header:"Estatus",accessor:ae=>d.jsx(g.Typography,{sx:{fontWeight:800,fontSize:13},children:y5(H,ae.IdEstatus)}),width:170},{key:"nivel",header:"Nivel de Interés",accessor:ae=>{const{bg:Ae,color:Ne}=l5(ae.NivelInteres);return d.jsx(g.Box,{sx:{display:"inline-block",px:1,py:.25,borderRadius:9999,bgcolor:Ae,color:Ne,fontSize:12,fontWeight:ae.NivelInteres?800:500},children:ae.NivelInteres??"—"})},width:150},{key:"asesor",header:"Asesor",accessor:ae=>{const Ae=(ae.Asesor??"").trim(),Ne=su=>{if(!su)return"";const W5=su[0]?.toUpperCase()??"",U5=su[1]?.toLowerCase()??"";return`${W5}${U5}`};if(!Ae)return d.jsx(g.Tooltip,{title:"",placement:"top",children:d.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:"—"})});const Dt=Ae.split(/\s+/),St=Dt[0]??"",Nr=Dt[1]??"",Ar=Ne(St),Fn=Ne(Nr),V5=`${Ar}${Fn}`||"—";return d.jsx(g.Tooltip,{title:Ae,placement:"top",children:d.jsx(g.Typography,{sx:{fontWeight:700,fontSize:13,textAlign:"center"},children:V5})})},width:120,align:"center"},{key:"origen",header:"Origen",accessor:ae=>ae.Origen??"—",width:120,align:"center"},{key:"actividad",header:"Actividad",accessor:ae=>d.jsx(g.Tooltip,{title:ae.Actividad??"",placement:"top",arrow:!0,children:d.jsxs(g.Box,{sx:{maxWidth:160,overflow:"hidden",display:"flex",gap:.5,alignItems:"center"},children:[ae.Icon&&d.jsx("span",{style:{color:"#fff",backgroundColor:ae.Color,borderRadius:100,alignItems:"center",justifyContent:"center",display:"flex",padding:3},children:d.jsx("i",{className:ae.Icon})}),d.jsx(g.Typography,{component:"span",noWrap:!0,sx:{fontSize:13,fontWeight:500,display:"block",overflow:"hidden",textOverflow:"ellipsis",lineHeight:1.3,cursor:(ae.Actividad??"").length?"default":"inherit"},children:ae.Actividad??"—"})]})}),width:180},{key:"avance",header:"Avance",accessor:ae=>d.jsx(Xi,{progress:ae.Avance,color:ae.Color}),width:200,align:"left"}]}function M(H){const Ae=Xr(H).slice(1);return[{key:"fecha",header:"Fecha",accessor:Ne=>Ue(Ne.Fecha),width:110},{key:"fechaCita",header:"Fecha Cita",accessor:Ne=>Ue(Ne.FechaCita),width:120},{key:"horaCita",header:"Hora Cita",accessor:Ne=>Ne.HoraCita??"—",width:110},...Ae]}function ce(H){const ae=H.kind;switch(ae){case"pruebas":case"servicio":return M(ae);case"nuevos":case"seminuevos":default:return Xr(ae)}}function be(H,ae,Ae,Ne){return{id:H,kind:Ae,title:ae,metrics:[{label:"En Proceso",value:Qr(Ne)},{label:"Finalizadas",value:qt(Ne)},{label:"Último seg.",value:Rr(Ne)}],rows:Ne,initiallyOpen:!1}}const Le=[be("n-1","Cotización de nuevos","nuevos",m),be("p-1","Prueba de Manejo","pruebas",v),be("s-1","Cita de Servicio","servicio",p),be("sn-1","Cotización para Seminuevos","seminuevos",y)],Qe=b.useMemo(()=>{const H=(te??"").trim().toLowerCase(),ae=(Ae,Ne)=>{if(H&&!(Ae.Vehiculo??"").toLowerCase().includes(H))return!1;const Dt=Ce?Ae.FechaCita:Ae.Fecha;if(j&&Dt){const St=hr(Dt??"");if(!St)return!1;const Nr=Ee?new Date(`${Ee}T00:00:00`):null,Ar=ft?new Date(`${ft}T00:00:00`):null;if(Ar&&Ar.setDate(Ar.getDate()+1),Nr&&St<Nr||Ar&&St>=Ar)return!1}if(he!=="Todos"){const St=(Ae.EstatusDescripcion??"").toLowerCase();if(!(m5[he]??[]).some(Fn=>St===Fn.toLowerCase()))return!1}if(R!=="Todos"){const St=(Ae.Actividad??"").toLowerCase();if(!(g5[R]??[]).some(Fn=>St===Fn.toLowerCase()))return!1}if(de!=="Todos"){const St=(Ae.NivelInteres??"").toLowerCase();if(!(v5[de]??[]).some(Fn=>St===Fn.toLowerCase()))return!1}return!0};return Le.map(Ae=>{const Ne=(Ae.rows??[]).filter(St=>ae(St,Ae.kind)),Dt=[{label:"En Proceso",value:Qr(Ne)},{label:"Finalizadas",value:qt(Ne)},{label:"Último seg.",value:Rr(Ne)}];return{...Ae,rows:Ne,metrics:Dt}})},[Le,te,j,Ee,ft,Ce,he,R,de]),et={nuevos:"cotizaciones",pruebas:"pruebademanejo",servicio:"citasservicio",seminuevos:"seminuevos"},Ye=(H,ae)=>{const Ae=H.SolID;if(!Ae)return;const Ne=ae.kind,Dt=et[Ne]??"cotizaciones",St=h?`https://qa2.crm.netcar.com.mx/netcar/${Dt}/${Ae}`:`https://crmxs.netcar.com.mx/netcar/${Dt}/${Ae}`,Nr=E?.({row:H,section:ae,slug:Dt,solId:Ae,baseUrl:St});if(!C){const Ar=Nr??St;U(Ae),ie(Ar),Y(!0)}},Ve=()=>{S?.(r),U(null),ie(null),Y(!1)},Bt=b.useRef(!1),Te=b.useRef(null),Ge=b.useCallback(()=>{if(!Bt.current){Bt.current=!0;return}Te.current&&window.clearTimeout(Te.current),Te.current=window.setTimeout(()=>{x?.(r)},500)},[x,r]);return b.useEffect(()=>{Bt.current=!1,Te.current&&window.clearTimeout(Te.current)},[G,L]),d.jsx(g.Dialog,{open:e,onClose:t,fullWidth:!0,fullScreen:z,PaperProps:{sx:{height:{xs:"100dvh",md:"90vh"},maxWidth:{xs:"100vw",md:"92vw"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:d.jsxs(g.Box,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},height:"100%",minHeight:0,overflow:"auto",position:"relative"},children:[d.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:[d.jsxs(g.Box,{children:[d.jsx(g.Stack,{direction:"row",spacing:2,alignItems:"center",mb:1,sx:{px:2.5,pt:2.5},children:d.jsxs(g.Box,{display:"flex",flexDirection:"column",gap:1,width:"100%",children:[d.jsx(g.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",alignItems:"center",children:d.jsx(g.Box,{sx:{flex:1,minWidth:0,pr:1},children:d.jsxs(g.Typography,{component:"span",fontWeight:700,sx:{display:"inline",lineHeight:1.2,wordBreak:"break-word",pr:.5},children:[J(r)," ",d.jsx(g.IconButton,{component:"span",size:"small",disableRipple:!0,onClick:()=>{t?.(),r&&l?.(r)},sx:{p:0,ml:.5,verticalAlign:"text-bottom",color:"#336BE1","&:hover":{bgcolor:"transparent"},"&:focus-visible":{outline:"none"}},"aria-label":"Editar nombre",children:d.jsx(n5,{sx:{fontSize:"1em"}})})]})})}),De.map((H,ae)=>d.jsxs(g.Box,{sx:{display:"flex",gap:1.2,alignItems:"center",cursor:H.onClick?"pointer":"default"},onClick:()=>{H.onClick&&H.onClick(r)},children:[H.icon,d.jsx(g.Typography,{variant:"body2",sx:{color:H.inLink?"#336BE1":"#070C10"},style:{},children:H.value(r)})]},ae))]})}),d.jsx(g.Stack,{mb:2,sx:{px:2.5,pt:0,gap:2},children:n.map((H,ae)=>{const Ae=H.label?.toLowerCase().startsWith("asesor");return d.jsxs(g.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[d.jsx(g.Box,{sx:{width:"50%"},children:d.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{color:"#5C6372"},children:H.label})}),d.jsxs(g.Box,{sx:{width:"50%",display:"flex",alignItems:"center",gap:1},children:[d.jsx("div",{children:H?.avatar?H.avatar(r):null}),d.jsx(g.Typography,{variant:"body2",color:"textPrimary",children:H?.value(r)}),Ae&&!I&&d.jsx(g.Tooltip,{title:"Historial asesores",placement:"top",arrow:!0,children:d.jsx(g.IconButton,{size:"small",onClick:Ne=>P(Ne.currentTarget),sx:{ml:.5},disableRipple:!0,children:d.jsx(QT,{fontSize:"small",sx:{color:"#5C6372"}})})})]})]},ae)})}),d.jsx(g.Divider,{sx:{my:2}})]}),d.jsx(g.Box,{px:2.5,pb:.5,children:d.jsxs(g.Typography,{children:[d.jsx("span",{style:{fontWeight:800},children:"Última actividad"}),!G&&" por solicitud",":"]})}),d.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:[Pe.length===0&&d.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin actividad registrada."}),d.jsxs(g.Box,{children:[Pe?.map((H,ae)=>{const Ae=_e(H),Ne=h5(H.comentario||"");return d.jsxs(g.Box,{sx:{pb:1.5},children:[d.jsxs(g.Stack,{direction:"row",spacing:1,alignItems:"center",justifyContent:"space-between",sx:{mb:.75},children:[d.jsx(g.Typography,{variant:"subtitle2",sx:{color:"#5C6372"},children:H.tipo||"Evento"}),d.jsx(g.Chip,{size:"small",label:H.auto!=null?`${H.auto}`:"—",sx:{bgcolor:"#336be1",color:"#fff",height:20}})]}),Ne?d.jsx(g.Typography,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"pre-line",lineHeight:1.5,mb:.75},children:Ne}):null,d.jsxs(g.Stack,{direction:"row",spacing:1.25,alignItems:"center",children:[H?.ImgAsesor!=null?d.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},alt:xe(Ae),src:H?.ImgAsesor}):d.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},children:xe(Ae)}),d.jsxs(g.Stack,{spacing:0,children:[d.jsx(g.Typography,{variant:"body2",fontWeight:600,children:Ae}),d.jsx(g.Typography,{variant:"caption",color:"text.secondary",children:p5(H.fecAlta)})]})]}),ae<Pe.length-1&&d.jsx(g.Divider,{sx:{mt:1.25}})]},H.segID??ae)}),me.length>D&&d.jsx(g.Box,{sx:{mt:1},children:d.jsx(g.Button,{onClick:()=>ve(H=>!H),size:"small",sx:{textTransform:"none",px:0,color:"#336BE1","&:hover":{background:"transparent",textDecoration:"underline"}},children:pe?"Ver menos":`Ver más (${$})`})})]})]}),d.jsx(g.Menu,{anchorEl:k,open:O,onClose:()=>P(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:d.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[d.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"}),d.jsxs(g.Box,{sx:{overflowY:"auto",py:.5,maxHeight:200},children:[fe.length===0&&d.jsx(g.Box,{sx:{px:1.5,py:1},children:d.jsx(g.Typography,{variant:"body2",color:"text.secondary",children:"Sin registros"})}),fe.map((H,ae)=>{const Ae=JT(H),Ne=XT(H.FechaBaja??H.FechaAsignacion);return d.jsx(g.Box,{sx:{px:1,py:.75},children:d.jsxs(g.Stack,{direction:"row",alignItems:"center",spacing:1,children:[d.jsx(g.Avatar,{sx:{width:28,height:28,bgcolor:"#EAEBF2",color:"#5C6372",fontSize:14},src:H?.ImgAsesor??void 0,children:e5(Ae)}),d.jsx(g.Box,{sx:{flex:1,minWidth:0},children:d.jsx(g.Typography,{variant:"body2",noWrap:!0,children:Ae})}),d.jsx(g.Typography,{variant:"caption",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:Ne})]})},ae)})]})]})})]}),q?d.jsxs(g.Box,{sx:{flex:1,minWidth:0,overflow:"hidden",position:"relative"},children:[d.jsx(g.Box,{sx:{position:"absolute",top:18,left:24,zIndex:10,pointerEvents:"auto"},children:d.jsx(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:d.jsx(g.Button,{onClick:Ve,sx:{backgroundColor:"#2571d6",minWidth:36,minHeight:36,p:.5,borderRadius:"8px",color:"#fff",boxShadow:3,"&:hover":{backgroundColor:"#2074e3"}},children:d.jsx(c5,{fontSize:"medium"})})})}),G&&d.jsx("iframe",{src:G,width:"100%",height:"100%",onLoad:Ge,style:{border:0}})]}):d.jsxs(g.Box,{sx:{width:"100%",minHeight:0,overflowY:"auto"},children:[d.jsx(g.Box,{sx:{mt:{xs:1.5,md:3}},children:d.jsxs(g.Box,{sx:{mt:3,display:"flex",flexDirection:"column",gap:4,padding:"0 20px 0 20px"},children:[d.jsx(g.Typography,{variant:"h4",sx:{fontWeight:800,textAlign:"center",mb:1,letterSpacing:.2},children:"Solicitudes"}),d.jsxs(g.Stack,{direction:{xs:"column",md:"column"},spacing:1.5,alignItems:{xs:"stretch",md:"center"},justifyContent:"space-between",sx:{mb:1.5},children:[d.jsxs(g.Stack,{direction:"row",spacing:1.5,alignItems:"flex-start",sx:{flexWrap:"wrap"},children:[d.jsx(g.TextField,{size:"small",placeholder:"Buscar por vehículo",value:te,onChange:H=>se(H.target.value),InputProps:{endAdornment:d.jsx(BT,{fontSize:"small",sx:{color:"#b6afaf"}})},sx:{minWidth:220}}),d.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",gap:.5,position:"relative"},children:[d.jsxs(g.Stack,{direction:"row",spacing:1.1,position:"absolute",bottom:48,left:0,alignItems:"center",children:[d.jsx(g.FormControlLabel,{label:d.jsx(g.Typography,{sx:{fontSize:15,fontWeight:600,marginLeft:0},children:"Por fecha"}),labelPlacement:"start",control:d.jsx(g.Checkbox,{checked:j,onChange:H=>re(H.target.checked),size:"small",sx:{p:.3,"& .MuiSvgIcon-root":{fontSize:19},color:"#bab4b4"}}),sx:{ml:0,"& .MuiFormControlLabel-label":{marginRight:0}}}),d.jsx(g.Typography,{sx:{fontSize:15,paddingLeft:.4},children:"De cita"})]}),d.jsxs(g.Stack,{direction:"row",spacing:1,children:[d.jsx(g.TextField,{size:"small",type:"date",label:"Desde",InputLabelProps:{shrink:!0},value:Ee,onChange:H=>Fe(H.target.value),disabled:!j,sx:{width:170}}),d.jsx(g.TextField,{size:"small",type:"date",label:"Hasta",InputLabelProps:{shrink:!0},value:ft,onChange:H=>yt(H.target.value),disabled:!j,sx:{width:170}})]})]}),d.jsx(g.IconButton,{onClick:H=>Ot(H.currentTarget),disableRipple:!0,sx:{border:"1px solid #d4d7de",borderRadius:2,width:40,height:40,mt:2},children:d.jsx($T,{})}),Ht&&d.jsx(g.Button,{variant:"outlined",onClick:Qt,disableRipple:!0,sx:{height:40,textTransform:"none",borderColor:"#d4d7de",color:"#333",mt:2},children:"Limpiar filtros"}),d.jsx(g.Tooltip,{title:Ht&&"Crear Solicitud",arrow:!0,placement:"top",disableHoverListener:!Ht,children:d.jsx("span",{children:d.jsxs(g.Button,{variant:"outlined",sx:{height:40,textTransform:"none",borderColor:"none",color:"#fff",backgroundColor:"#1e5bce","&:hover":{backgroundColor:"#1e5bce",boxShadow:"none"}},onClick:()=>{_?.(r)},disableRipple:!0,children:[d.jsx(xm,{sx:{color:"#fff",fontSize:24,paddingRight:.6}}),!Ht&&"Crear Solicitud"]})})})]}),d.jsx(ZT,{sections:Qe,detailColumns:[],getDetailColumns:ce,onRowClick:Ye})]})]})}),d.jsx(g.Menu,{anchorEl:zt,open:Q,onClose:()=>Ot(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:d.jsxs(g.Stack,{spacing:1.5,paddingX:1.5,paddingY:1,children:[d.jsx(g.Typography,{variant:"subtitle2",sx:{fontWeight:700,color:"#070C10"},children:"Filtro"}),d.jsxs(g.Box,{children:[d.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Estatus"}),d.jsx(g.RadioGroup,{value:he,onChange:H=>Oe(H.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(H=>d.jsx(g.FormControlLabel,{value:H,control:d.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:H},H))})]}),d.jsxs(g.Box,{children:[d.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Actividades"}),d.jsx(g.RadioGroup,{value:R,onChange:(H,ae)=>oe(ae),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Pt].map(H=>d.jsx(g.FormControlLabel,{value:H,sx:{alignItems:"start"},control:d.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:H},H))})]}),d.jsxs(g.Box,{children:[d.jsx(g.Typography,{variant:"body2",sx:{fontWeight:700,mb:.5,color:"#5C6372"},children:"Nivel de interés"}),d.jsx(g.RadioGroup,{value:de,onChange:(H,ae)=>ke(ae),sx:{"& .MuiFormControlLabel-root":{m:0,py:.3},"& .MuiFormControlLabel-label":{fontSize:14,fontWeight:400,ml:0}},children:["Todos",...Mt].map(H=>d.jsx(g.FormControlLabel,{value:H,control:d.jsx(g.Radio,{size:"small",sx:{p:.2,"& .MuiSvgIcon-root":{fontSize:18}}}),label:H},H))})]})]})})]})]})})}const _m={tableClientes:"_tableClientes_acwe7_1",tableResponsive:"_tableResponsive_acwe7_1"};function Sm(e,t,r){const{fields:n,order:o=["nombreCliente","email","acciones"],header:i={},cells:s={},hide:a={},actions:c}=t,u=c??{},l=u.show??{},f=u.handlers??{},h=u.accessors??{},m=u.icons??{},v=u.className??"d-flex flex-row gap-2 align-items-center ",p=u.tooltip??{},y=m.view??d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",style:{fill:"#070c10"},children:[d.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"}),d.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),_={nombreCliente:{key:"nombreCliente",header:i.nombreCliente??"Cliente",accessor:O=>O[n.nombreCliente],cell:s.nombreCliente,width:190},email:{key:"email",header:i.email??"Correo",accessor:O=>O[n.email],cell:s.email??(O=>{const q=String(O[n.email]??"");return q?d.jsx("a",{href:`mailto:${q}`,children:q}):d.jsx("span",{className:"text-muted",children:"—"})}),width:230},acciones:a.acciones?void 0:{key:"acciones",header:"",cell:s.acciones??(O=>{const q=eu(l.whatsapp,O,!0),Y=eu(l.email,O,!0),L=eu(l.view,O,!0),U=h.phone?.(O),K=h.email?.(O),F=fe=>{if(fe.stopPropagation(),f.onWhatsApp)return f.onWhatsApp(O);if(!U)return;const V=h.countryCode??"52",J=IT(String(U));typeof window<"u"&&window.open(`https://wa.me/${V}${J}`,"_blank")},G=fe=>{if(fe.stopPropagation(),f.onEmail)return f.onEmail(O);K&&typeof window<"u"&&(window.location.href=`mailto:${K}`)},ie=fe=>{fe.stopPropagation(),f.onView&&f.onView(O)};return d.jsxs("div",{className:v,children:[q&&d.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.whatsapp??"WhatsApp",onClick:F,style:{width:24,height:24},children:d.jsx("img",{src:OT,alt:"WhatsApp"})}),Y&&d.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.email??"Email",onClick:G,style:{width:24,height:24},children:d.jsx("img",{src:MT,alt:"Email"})}),L&&d.jsx("button",{type:"button",className:"btn p-0 border-0 bg-transparent",title:p.view??"Ver detalle",onClick:ie,style:{width:24,height:24},children:y})]})}),width:120}},C=Object.values(_).filter(O=>!!O),E=(e??[]).filter(O=>!!O?.key),S=new Map;for(const O of C)S.set(String(O.key),O);for(const O of E)S.set(String(O.key),O);const x=[...C.map(O=>String(O.key)),...E.map(O=>String(O.key))],I=Array.from(new Set(o.map(O=>String(O)).filter(O=>S.has(O)))),D=x.filter(O=>!I.includes(O)),k=[...I,...D],P="acciones";if(S.has(P)){const O=k.filter(q=>q!==P);k.splice(0,k.length,...O,P)}return k.map(O=>S.get(O))}function x5(e){const{rows:t,columns:r,clientSort:n=!0,urlsQA:o=!0,defaultSort:i,minWidth:s=1100,rowKey:a=jT,haveOpenDetailFor:c=!0,defaults:u,detailConfig:l,normalTable:f,onRowClick:h,activityHistory:m,advisorHistory:v,forceOpenDetailFor:p,closeDetailFor:y,onRequestEdit:_,searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:x,solicitudesSeminuevos:I,onCreateSolicitud:D,isCrmMode:k,onSolicitudBaseUrl:P,onIframeClose:O,reloadInfo:q,idAdminSistemas:Y=!1}=e,[L,U]=b.useState(i??null),[K,F]=b.useState({open:!1,customer:null}),[G,ie]=b.useState([]),fe=ne=>{F({open:!0,customer:ne})},V=ne=>{if(!(typeof c=="function"?c(ne):!!c)){console.log("🚫 Bloqueado - no se abre el detalle");return}h?.(ne),F({open:!0,customer:ne})},J=()=>{F({open:!1,customer:null}),y?.()},De=b.useMemo(()=>u?Sm(r??[],u):Sm(r??[],{fields:{},order:[]}),[r,u]),_e=b.useMemo(()=>{if(!n||!L)return t;const ne=De.find(ue=>ue.key===L.key);if(!ne)return t;const le=[...t];return le.sort((ue,me)=>{const pe=Jl(ne,ue,0),ve=Jl(ne,me,0),Pe=PT(pe,ve);return L.direction==="asc"?Pe:-Pe}),le},[t,De,L,n]),xe=b.useMemo(()=>{const ne=l?.getCustomerId;return le=>{const ue=ne?.(le)??le?.Id_cliente??le?.CliID??le?.id??le?.ID??le?.Id??"";return String(ue)}},[l]);return b.useEffect(()=>{if(!K.open||!K.customer)return;const ne=xe(K.customer);if(!ne)return;const le=(t??[]).find(ue=>xe(ue)===ne);le&&le!==K.customer&&F(ue=>({...ue,customer:le}))},[t,K.open,K.customer,xe]),b.useEffect(()=>{p&&fe(p)},[p]),d.jsxs("div",{children:[d.jsx("div",{className:`${_m.tableClientes} back-white rounded-3 shadow-main mt-4 mb-4`,children:d.jsx("div",{className:`${_m.tableResponsive} table-responsive`,children:d.jsxs("table",{className:"table table-hover align-middle mb-0",children:[d.jsx("thead",{children:d.jsx("tr",{children:De.map(ne=>d.jsx("th",{style:{fontWeight:600,width:ne.width,paddingTop:"20px",paddingBottom:"20px",textAlign:ne.align??"left"},children:ne.header},ne.key))})}),d.jsx("tbody",{children:_e.map((ne,le)=>d.jsx("tr",{onClick:()=>V?.(ne),role:"button",tabIndex:0,onKeyDown:ue=>{(ue.key==="Enter"||ue.key===" ")&&V?.(ne)},style:{cursor:"pointer"},children:De.map((ue,me)=>{const pe=ue.Component?d.jsx(ue.Component,{row:ne,index:le}):ue.cell?ue.cell(ne,le):(()=>{const ve=Jl(ue,ne,le);return ve==null||ve===""?"":String(ve)})();return d.jsx("td",{style:{paddingTop:"20px",paddingBottom:"20px",textAlign:ue.align??"left"},children:pe},`${String(ue.key)}-${me}`)})},a(ne,le)))})]})})}),K.open&&d.jsx(b5,{open:K.open,onClose:J,customer:K.customer,fields:l?.dynamicFields,header:l?.header,normalTable:f,history:m,advisorHistory:v,urlsQA:o,onRequestEdit:ne=>{J(),_?.(ne)},searchFilter:C,solicitudesNuevos:E,solicitudesPrueba:S,solicitudesServicio:x,solicitudesSeminuevos:I,onCreateSolicitud:D,isCrmMode:k,onSolicitudBaseUrl:P,onIframeClose:O,reloadInfo:q,idAdminSistemas:Y})]})}const Cm=B.forwardRef(({sx:e,...t},r)=>d.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}}));Cm.displayName="SoftInput";function w5({message:e}){return e?d.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:[d.jsx(Ql,{fontSize:"small",sx:{color:"rgb(211, 47, 47)"}}),d.jsx("span",{style:{color:"rgb(95, 33, 32)",fontSize:14,fontWeight:"500"},children:e})]}):null}function _5(e){if(e.required)return e.required===!0?"El campo es obligatorio.":e.required}function nu(e,t){const r=_5(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 Em={"& .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%"},S5={mb:1,fontWeight:600,color:"#1C1C1D","&.Mui-focused":{color:"#1C1C1D !important"},"&.Mui-error":{color:"#1C1C1D !important"}};function ou({label:e,errorMsg:t,helperText:r,children:n,sx:o}){return d.jsxs(g.FormControl,{fullWidth:!0,error:!!t,sx:o,className:"1- FieldWrapper",children:[d.jsx(g.FormLabel,{sx:S5,children:e}),n,d.jsx(w5,{message:t||r})]})}function C5(e,t){const{register:r,formState:{errors:n}}=t,o={...nu(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 i=e.type==="email";i&&!o.pattern&&(o.pattern={value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Correo electrónico inválido"});const s=/[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(s)??[]).join(""):S,l=(S,x)=>c.has(S)||x?!0:e.onlyNumbers?/^[0-9]$/.test(S):e.onlyLetters?/^[A-Za-zÁÉÍÓÚÜÑáéíóúüñ\s'.-]$/.test(S):!0,f=n[e.name]?.message,h=r(e.name,o),m=(e.inputProps&&typeof e.inputProps.maxLength=="number"?e.inputProps.maxLength:void 0)??e.maxLength,v=S=>{l(S.key,S.ctrlKey||S.metaKey)||S.preventDefault()},p=S=>{const x=S.data??null;x!=null&&(e.onlyNumbers&&/[^0-9]/.test(x)&&S.preventDefault(),e.onlyLetters&&/[^A-Za-zÁÉÍÓÚÜÑáéíóúüñ ]/.test(x)&&S.preventDefault())},y=S=>{const x=S.clipboardData.getData("text"),I=u(x);if(I!==x){S.preventDefault();const D=S.target,k=D.selectionStart??D.value.length,P=D.selectionEnd??D.value.length;D.setRangeText(I,k,P,"end"),D.dispatchEvent(new Event("input",{bubbles:!0}))}},_=S=>{const x=u(S.target.value);x!==S.target.value&&(S.target.value=x),m&&S.target.value.length>m&&(S.target.value=S.target.value.slice(0,m)),h.onChange(S)},C={...e.inputProps,...i?{inputMode:"email",autoComplete:"email"}:{},maxLength:m,onKeyDown:v,onBeforeInput:p,onPaste:y,onInvalid:S=>S.preventDefault()},E=e.onlyNumbers||i?"text":e.type??"text";return d.jsx(ou,{label:e.label,errorMsg:f,helperText:e.helperText,sx:Em,children:d.jsx(Cm,{placeholder:e.placeholder,type:E,inputProps:C,...h,onChange:_,sx:{width:"100%",maxWidth:"none"},className:"SoftInputData"})})}function E5(e,t){const{control:r}=t,n=!!e.multiple;return d.jsx(Pr,{name:e.name,control:r,rules:nu(e,{isArray:n}),render:({field:o,fieldState:i})=>d.jsx(ou,{label:e.label,errorMsg:i.error?.message,helperText:e.helperText,sx:Em,children:d.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&&d.jsx(g.MenuItem,{value:"",disabled:!0,children:"Selecciona…"}),e.options.map(s=>d.jsx(g.MenuItem,{value:s.value,children:s.label},String(s.value)))]})})})}function D5(e,t){return d.jsx(Pr,{name:e.name,control:t.control,rules:nu(e),render:({field:r,fieldState:n})=>d.jsx(ou,{label:e.label,errorMsg:n.error?.message,helperText:e.helperText,children:d.jsx(g.RadioGroup,{row:!0,...r,className:"3-RadioFieldRender",children:e.options.map(o=>d.jsx(g.FormControlLabel,{value:o.value,control:d.jsx(g.Radio,{}),label:o.label},String(o.value)))})})})}function Dm(e,t){if(e.render)return e.render(t);switch(e.kind){case"text":return C5(e,t);case"select":return E5(e,t);case"radio":return D5(e,t);default:return null}}function A5(e,{initialPerPage:t=25,perPageOptions:r=[10,25,50,100,"Todos"],onPageChange:n,onPerPageChange:o,scrollTop:i,deps:s=[]}={}){const a=Array.isArray(e)?e:[],[c,u]=b.useState(1),[l,f]=b.useState(t),{currentItems:h,totalPages:m,showingFrom:v,showingTo:p,totalItems:y}=b.useMemo(()=>{const E=a.length,S=l==="Todos"?1/0:Number(l),x=S===1/0?1:Math.max(1,Math.ceil(E/S)),I=Math.min(c,x),D=S===1/0?E:I*S,k=S===1/0?0:D-S;return{currentItems:S===1/0?a:a.slice(k,D),totalPages:x,showingFrom:E===0?0:k+1,showingTo:S===1/0?E:Math.min(D,E),totalItems:E}},[a,c,l]),_=E=>{const S=Math.max(1,Math.min(E,m||1));u(S),n?.(S),i?.()};return{currentItems:h,totalPages:m,showingFrom:v,showingTo:p,totalItems:y,currentPage:c,itemsPerPage:l,perPageOptions:r,goTo:_,next:()=>_(c+1),prev:()=>_(c-1),setItemsPerPage:E=>{f(E),o?.(E),u(1),i?.()},setCurrentPage:_}}var Zi={},Am;function k5(){if(Am)return Zi;Am=1;var e=ct();Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.default=void 0;var t=e(ht()),r=pt();return Zi.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"),Zi}var T5=k5();const O5=st(T5);var Gi={},km;function M5(){if(km)return Gi;km=1;var e=ct();Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.default=void 0;var t=e(ht()),r=pt();return Gi.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"),Gi}var P5=M5();const I5=st(P5),j5=({currentPage:e,totalPages:t,onPageChange:r,itemsPerPage:n,onItemsPerPageChange:o,itemsPerPageOptions:i,showingFrom:s,showingTo:a,totalItems:c})=>{const u=g.useTheme(),l=g.useMediaQuery(u.breakpoints.down("sm")),f=()=>{if(t<=1)return[1];const v=l?0:2,p=[],y=1,_=t,C=Math.max(y+1,e-v),E=Math.min(_-1,e+v);p.push(y),C>y+1&&p.push("...");for(let S=C;S<=E;S++)S>=y+1&&S<=_-1&&p.push(S);return E<_-1&&p.push("..."),p.push(_),p},h=v=>{const p=v.target.value;o(p)},m=Math.max(1,t);return d.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:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",justifyContent:"center"},children:[d.jsx(g.IconButton,{onClick:()=>r(e-1),disabled:e<=1,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página anterior",children:d.jsx(O5,{fontSize:"large"})}),f().map((v,p)=>v==="..."?d.jsx(g.Box,{sx:{px:1,display:"flex",alignItems:"center",fontSize:"1.1rem"},children:". . ."},`dots-${p}`):d.jsx(g.Button,{onClick:()=>r(v),size:"small",sx:{minWidth:36,height:36,fontSize:"1.05rem",p:1,borderRadius:"10px",backgroundColor:e===v?"primary.main":"transparent",fontWeight:e===v?700:400,color:e===v?"#fff":"#5C6372","&:hover":{backgroundColor:e===v?"primary.dark":"action.hover"},boxShadow:"none",border:"none",mx:.5},children:v},`p-${v}`)),d.jsx(g.IconButton,{onClick:()=>r(e+1),disabled:e>=m,size:"medium",sx:{"&:hover":{backgroundColor:"action.hover"}},"aria-label":"Página siguiente",children:d.jsx(I5,{fontSize:"large"})})]}),d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1.25,justifyContent:{xs:"center",sm:"flex-start"},mt:{xs:1,sm:0}},children:[d.jsx(g.Typography,{variant:"body2",children:"Mostrar"}),d.jsx(g.FormControl,{size:"small",sx:{minWidth:72},children:d.jsx(g.Select,{value:n,onChange:h,renderValue:v=>v==="Todos"?"Todos":String(v),children:i.map(v=>d.jsx(g.MenuItem,{value:v,children:v==="Todos"?"Todos":v},String(v)))})}),d.jsx(g.Typography,{variant:"body2",children:"por página"})]})]})};function R5(e){const{open:t,dataAdd:r,fields:n,onSubmit:o,onCancel:i,defaultValues:s,txtBtnGuardar:a,haveId:c=!1,itemsTable:u,filter:l,getId:f,renderRow:h,selectedIds:m,onSelectedChange:v,onSubmitAddData:p,initialSelectedIds:y=[],showAutosPanel:_}=e,C=B0({mode:"onSubmit",reValidateMode:"onChange",criteriaMode:"all",shouldUnregister:!1,defaultValues:s});b.useEffect(()=>{s&&C.reset(s)},[s,C]);const[E,S]=b.useState(""),[x,I]=b.useState(y),D=Array.isArray(m)&&!!v,k=D?m:x,P=j=>{const re=typeof j=="function"?j(k):j;D?v(re):I(re)},O=b.useCallback(j=>f?f(j):j?.IdAuto,[f]),q=b.useMemo(()=>{const j=new Map;return(u??[]).forEach((re,Ce)=>j.set(O(re),Ce)),j},[u,O]),Y=b.useRef(new Set),L=b.useMemo(()=>{const j=new Map;return(u??[]).forEach(re=>j.set(f?f(re):re?.IdAuto,re)),j},[u,f]),U=b.useMemo(()=>(n??[]).filter(j=>!!j.required).map(j=>j.name),[n]),K=_0({control:C.control,name:U}),F=j=>j==null?!1:typeof j=="string"?j.trim().length>0:Array.isArray(j)?j.length>0:typeof j=="number"?!Number.isNaN(j):typeof j=="object"?Object.keys(j).length>0:!0,G=b.useMemo(()=>U.length?K?.every(F)??!1:!0,[K,U]),{handleSubmit:ie,formState:{isSubmitting:fe,isDirty:V,isValid:J}}=C,De=l??((j,re)=>JSON.stringify(j).toLowerCase().includes(re.toLowerCase())),_e=b.useMemo(()=>E.trim()?u?.filter(j=>De(j,E)):u,[u,E,De]),xe=b.useMemo(()=>{if(!_e)return _e;const j=Y.current,re=[..._e];return re.sort((Ce,$e)=>{const W=j.has(O(Ce))?0:1,ee=j.has(O($e))?0:1;if(W!==ee)return W-ee;const Ee=q.get(O(Ce))??0,Fe=q.get(O($e))??0;return Ee-Fe}),re},[_e,q,O]),{currentItems:ne,totalPages:le,showingFrom:ue,showingTo:me,totalItems:pe,currentPage:ve,itemsPerPage:Pe,perPageOptions:$,goTo:ze,setItemsPerPage:Me}=A5(xe,{initialPerPage:25,perPageOptions:[10,25,50,100,"Todos"],deps:[E],scrollTop:()=>{}}),ge=j=>{const re=L.get(j)??null;P([j]),p?.({items:re})},Re=j=>k.includes(j),He=async j=>{try{await o?.(j),C.reset(C.getValues())}catch(re){console.error("Error al enviar AddCliente:",re)}},We=b.useMemo(()=>{const j=new Map;return(n??[]).forEach(re=>j.set(String(re.name),re)),j},[n]),dt=(j,re)=>{const Ce=We.get(String(j));if(!Ce)return null;const $e={xs:12,...Ce.grid,...re||{}};return d.jsx(g.Grid,{item:!0,...$e,children:Ce.render?Ce.render(C):Dm(Ce,C)},`fld-${String(j)}`)},T=_??(e.haveId?"edit":"new"),N=T!=="onlyCars",z=T==="new"||T==="onlyCars",te=k?.length>0,se=T==="onlyCars"?te:e.haveId?G&&V||te:G&&te;return d.jsx(g.Dialog,{open:t,onClose:i,maxWidth:"lg",fullWidth:!0,PaperProps:{sx:{height:{xs:"100dvh",md:z?"90vw":"auto"},maxWidth:{xs:"100vw",md:z?"98vw":"50%"},overflow:"hidden",display:"flex",flexDirection:"column",borderRadius:{xs:0,md:3}}},children:d.jsx(Xk,{...C,children:d.jsxs(g.Box,{component:"form",noValidate:!0,onSubmit:ie(He),display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%",height:"100%",minHeight:0,overflow:"hidden",position:"relative",children:[N&&d.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:[d.jsxs(g.Box,{p:{xs:2,md:2},height:"100%",width:"100%",children:[d.jsx(g.Typography,{fontWeight:700,fontSize:20,children:r.title}),d.jsxs(g.Box,{sx:{flex:1,height:"100%",overflowY:"auto",paddingBottom:10},children:[d.jsx(g.Typography,{fontSize:"18px",mt:2.5,fontWeight:500,children:r.subTitle}),d.jsx(g.Box,{mt:2,display:"flex",flexDirection:"column",width:"100%",gap:2,children:Array.isArray(e.formLayout)&&c?e.formLayout.map((j,re)=>d.jsx(g.Grid,{container:!0,spacing:2,alignItems:"flex-start",wrap:"wrap",width:"100%",children:j.map((Ce,$e)=>{const W=typeof Ce=="string"?{name:Ce}:Ce;return W.hidden?.(C)?null:dt(W.name,W.grid)})},`row-${re}`)):d.jsx(g.Grid,{container:!0,spacing:2,width:"100%",children:n?.map((j,re)=>{const Ce=j.grid??{xs:12,md:12};return d.jsx(g.Grid,{item:!0,...Ce,children:j.render?j.render(C):Dm(j,C)},`${String(j.name)}-${re}`)})})})]})]}),d.jsx(g.Box,{sx:{position:"absolute",zIndex:j=>j.zIndex.modal+1,bottom:0,width:"100%",borderRadius:2,boxShadow:{xs:"0",md:"0 -8px 8px -6px #0003"},p:1,backgroundColor:"#fff"},children:d.jsx(g.Box,{display:"flex",alignItems:"center",children:d.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",justifyContent:c?"flex-end":"center",children:d.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})})})})]}),z&&d.jsx(g.Box,{flex:1,display:"flex",flexDirection:"column",minWidth:0,sx:{height:"100%"},children:d.jsx(g.Box,{mt:1,sx:{flex:1,display:"flex",flexDirection:"column",height:"100%"},children:d.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0},children:[d.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:[d.jsx(g.TextField,{value:E,onChange:j=>S(j.target.value),placeholder:"Buscar marca, modelo, vin...",InputProps:{endAdornment:d.jsx(g.InputAdornment,{position:"start",children:d.jsx(Q2,{})}),disableUnderline:!0},variant:"standard",sx:{maxWidth:360,width:"100%",backgroundColor:"#EBEEF0",paddingX:"16px",paddingY:"10px"}}),d.jsx(g.Box,{display:"flex",gap:2,alignItems:"center",sx:{marginTop:{sm:0,xs:2}},children:d.jsx(g.Box,{onClick:i,sx:{cursor:"pointer",position:"absolute",top:0,right:10},display:{xs:"none",md:"block"},children:d.jsx(yr,{sx:{color:"#070C10",fontSize:24}})})}),_=="onlyCars"&&d.jsx(g.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:d.jsx(g.Box,{display:"flex",gap:1.5,width:"100%",children:d.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:[d.jsx(xm,{sx:{color:fe||!se?"gray":"#fff",fontSize:26,paddingRight:.6}}),"Crear Solicitud"]})})})]}),d.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:d.jsx(g.Box,{sx:{minWidth:1150,width:"max(1150px, 100%)",paddingBottom:10},children:d.jsxs(g.List,{disablePadding:!0,sx:{borderColor:"transparent",padding:0},children:[ne?.map((j,re)=>{const Ce=f?f(j):re,$e=Re(Ce);return d.jsx(g.Box,{sx:{borderBottom:"1px solid #D3D4D5",padding:0},children:d.jsx(g.ListItem,{disableGutters:!0,sx:{paddingTop:0,padding:0,m:0},children:d.jsx(g.ListItemButton,{onClick:()=>ge(Ce),disableRipple:!0,sx:{padding:0},children:d.jsx(g.ListItemText,{disableTypography:!0,primary:h?h({item:j,selected:$e,toggle:()=>ge(Ce),index:re}):null})})})},`${String(Ce)}`)}),!ne?.length&&d.jsx(g.Box,{p:3,children:d.jsxs(g.Typography,{fontSize:14,color:"#5C6372",children:["Sin resultados para “",E,"”."]})})]})})}),d.jsx(g.Box,{sx:{position:"sticky",bottom:0,bgcolor:"#fff"},children:d.jsx(j5,{currentPage:ve,totalPages:le,onPageChange:ze,itemsPerPage:Pe,onItemsPerPageChange:Me,itemsPerPageOptions:$,showingFrom:ue,showingTo:me,totalItems:pe})})]})})})]})})})}var Ki={},Tm;function N5(){if(Tm)return Ki;Tm=1;var e=ct();Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.default=void 0;var t=e(ht()),r=pt();return Ki.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"),Ki}var $5=N5();const L5=st($5),iu=/^[^\s@]+@[^\s@]+\.[^\s@]+$/i,Fa=/[,\s;]+/g,wn=e=>e.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase(),_n=(e,t)=>Array.from(new Set([...e,...t.map(r=>r.trim()).filter(Boolean)])),Om=(e,t)=>t?e.filter(r=>wn(r)!==wn(t)):e,z5=(e,t)=>e.filter(r=>!t.some(n=>wn(n)===wn(r)));function jr(e,t,r){if(r)return typeof r=="function"?r(e,t):e[r]}function B5(e,t){if(t)return!e||/^https?:\/\//i.test(t)?t:e+t}function F5({open:e,onClose:t,value:r,onChange:n,onRequestSend:o,customer:i,itemsSelects:s,renderItem:a,filterFields:c=[],multiSelectAutos:u=!0,imgCorreoSrc:l,baseURLImages:f,itemProps:h,defaultItemImageSrc:m}){const v=b.useRef(null),[p,y]=b.useState("idle"),_=b.useRef(e);b.useEffect(()=>{const W=_.current;e&&!W&&y("entering"),!e&&W&&y("exiting"),_.current=e},[e]),b.useEffect(()=>{if(p==="entering"){const Ee=setTimeout(()=>y("idle"),320);return()=>clearTimeout(Ee)}if(p==="exiting"){const Ee=setTimeout(()=>y("idle"),220);return()=>clearTimeout(Ee)}},[p]);const[C,E]=b.useState(""),[S,x]=b.useState(!1),[I,D]=b.useState(!1),[k,P]=b.useState(!1),[O,q]=b.useState(""),[Y,L]=b.useState([]),U=k?Y:r.selectedIds,K=()=>{L([...r.selectedIds]),q(""),P(!0)},F=()=>{P(!1),L([])},G=()=>{const W=new Set(We.map((Ee,Fe)=>String(jr(Ee,Fe,h.id)))),ee=Y.filter(Ee=>W.has(String(Ee)));n({...r,selectedIds:ee}),P(!1)},ie=(W,ee)=>wn(W??"")===wn(ee??"");function fe(W,ee,Ee,Fe,ft){const yt=ee?W.some(Ot=>ie(Ot,ee)):!1,zt=Ee.length>0?Ee.some(Ot=>W.some(Q=>ie(Q,Ot))):!1;Fe(yt),ft(zt)}const V=W=>{const ee=typeof W=="function"?W(r.recipients):W;n({...r,recipients:ee}),fe(ee,ne,ue,x,D)},J=W=>n({...r,message:W}),De=W=>n({...r,attachments:[...r.attachments,...W]}),_e=W=>n({...r,attachments:r.attachments.filter(ee=>ee.name!==W)}),xe=W=>{if(k)if(u){const ee=new Set(Y);ee.has(W)?ee.delete(W):ee.add(W),L(Array.from(ee))}else{const ee=Y.includes(W);L(ee?[]:[W])}else if(u){const ee=new Set(r.selectedIds);ee.has(W)?ee.delete(W):ee.add(W),n({...r,selectedIds:Array.from(ee)})}else{const ee=r.selectedIds.includes(W);n({...r,selectedIds:ee?[]:[W]})}},ne=b.useMemo(()=>(i?.Correo??"").trim(),[i]),le=b.useMemo(()=>Array.isArray(i?.Asesores)?i.Asesores.filter(W=>W?.EmailAsesor&&W?.Activo):[],[i]),ue=b.useMemo(()=>le.map(W=>(W.EmailAsesor??"").trim()).filter(Boolean),[le]),me=b.useRef(!1);b.useEffect(()=>{if(e&&!me.current){let W=[];S&&ne&&(W=_n(W,[ne])),I&&ue.length&&(W=_n(W,ue)),V(ee=>_n(ee,W)),fe(r.recipients,ne,ue,x,D),E(""),me.current=!0}e||(me.current=!1)},[e,S,I,ne,ue]);const pe=W=>{const ee=le.find(Ee=>wn(Ee.EmailAsesor??"")===wn(W));if(ee){if(ee.ImgAsesor)return d.jsx(g.Avatar,{src:ee.ImgAsesor,alt:ee.NombreAsesor});const Ee=(ee.NombreAsesor||"").trim(),Fe=(ee.ApellidosAsesor||"").trim();return d.jsx(g.Avatar,{children:`${Ee[0]??""}${Fe[0]??""}`.toUpperCase()})}return d.jsx(g.Avatar,{children:W[0]?.toUpperCase()})},ve=()=>{const W=C.trim();if(!W)return;const Ee=W.split(Fa).filter(Boolean).filter(Fe=>iu.test(Fe));Ee.length>0&&V(Fe=>_n(Fe,Ee)),E("")},Pe=W=>{x(W),V(ee=>W&&ne?_n(ee,[ne]):Om(ee,ne))},$=W=>{D(W),V(ee=>W?_n(ee,ue):z5(ee,ue))},ze=W=>{const ee=Array.from(W.target.files||[]);De(ee.map(Ee=>({name:Ee.name,size:Ee.size,file:Ee}))),W.target.value=""},Me=U[0],ge=b.useMemo(()=>!s||Me===void 0?void 0:s.find((ee,Ee)=>String(jr(ee,Ee,h.id))===String(Me)),[s,Me,h.id]),Re=b.useMemo(()=>{if(!(!ge||!h.distributorId))return jr(ge,0,h.distributorId)},[ge,h.distributorId]);console.log("lockedDisId",Re);const He=b.useMemo(()=>ge?(h.distributorTitle?jr(ge,0,h.distributorTitle):void 0)??(Re!=null?String(Re):void 0):void 0,[ge,h.distributorTitle,Re]),We=b.useMemo(()=>{const W=s??[];return Re==null||!h.distributorId?W:W.filter((ee,Ee)=>jr(ee,Ee,h.distributorId)==Re)},[s,Re,h.distributorId]),dt=b.useMemo(()=>{if(!O.trim())return We;const W=O.toLowerCase();return We.filter(ee=>(c??[]).some(Ee=>String(ee?.[Ee]??"").toLowerCase().includes(W)))},[We,O,c]),T=b.useMemo(()=>{if(!s||!r.selectedIds.length)return[];const W=new Map;return s.forEach((ee,Ee)=>{W.set(String(jr(ee,Ee,h.id)),ee)}),r.selectedIds.map(ee=>W.get(String(ee))).filter(Boolean)},[s,r.selectedIds,h.id]),N=W=>n({...r,selectedIds:r.selectedIds.filter(ee=>String(ee)!==String(W))}),z=()=>{let W=r.recipients;if(C.trim()){const yt=C.split(Fa).filter(zt=>iu.test(zt));W=_n(W,yt),V(W),E("")}const ee=S?ne:"",Ee=le.find(yt=>yt?.Activo&&yt?.EmailAsesor)?.EmailAsesor?.trim()??"";o?.({recipients:W,toClient:S,toAdvisor:I,tipoInt:S&&I?2:1,correoCliente:ee,correoAsesor:I?Ee:"",disIdLocked:Re}),t?.()},te=b.useMemo(()=>{const ee=C.split(Fa).filter(Boolean).some(Ee=>iu.test(Ee));return r.recipients.length>0||ee},[r.recipients,C]),se=(r.selectedIds?.length??0)>0,j=r.message.trim().length>0,re=te&&se&&j,Ce=g.useTheme(),$e=g.useMediaQuery(Ce.breakpoints.down("sm"));return d.jsxs(g.Drawer,{anchor:$e?"bottom":"right",open:e,onClose:t,ModalProps:{keepMounted:!0,BackdropProps:{invisible:!$e}},transitionDuration:{enter:320,exit:220},SlideProps:{direction:$e?"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:[d.jsxs(g.Box,{sx:{display:"flex",flexDirection:"column",height:{xs:"100%",sm:"auto"},position:"relative",overflow:"auto"},children:[d.jsxs(g.Box,{sx:{p:2,pb:1,position:"sticky",top:0,zIndex:1,bgcolor:"#fff",borderBottom:"1px solid #E5E7EB"},children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mb:1},children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2},children:[l?d.jsx("img",{src:l,alt:"Correo",style:{width:24,height:18}}):null,d.jsxs(g.Typography,{fontWeight:700,children:["Mensaje a"," ",i?`${i.Nombre??""} ${i.ApellidoP??""} ${i.ApellidoM??""}`.trim():"—"]})]}),d.jsx(g.IconButton,{onClick:t,size:"small",children:d.jsx(yr,{})})]}),d.jsx("div",{children:d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 10px",backgroundColor:"#EBEEF0",border:"1px solid #E5E7EB",borderRadius:8,flexWrap:"wrap"},children:[d.jsx("label",{style:{fontSize:14,fontWeight:600,marginRight:4},children:"Para:"}),d.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",flex:1},children:[r.recipients.map(W=>d.jsx(g.Chip,{avatar:pe(W),label:W,onDelete:()=>V(ee=>Om(ee,W)),size:"small",variant:"outlined",sx:{borderRadius:999,height:28}},W)),d.jsx("input",{type:"text",value:C,onChange:W=>E(W.target.value),onKeyDown:W=>{const ee=W.key;ee==="Enter"||ee===","||ee===";"||ee===" "||ee==="Tab"?(W.preventDefault(),ve()):ee==="Backspace"&&!C&&r.recipients.length&&V(Fe=>Fe.slice(0,-1))},onBlur:ve,onPaste:W=>{const Ee=W.clipboardData.getData("text").split(Fa).filter(Boolean);Ee.length>1&&(W.preventDefault(),V(Fe=>_n(Fe,Ee)),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"}})]})]})}),d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:2,mb:1.5},children:[d.jsx(g.FormControlLabel,{control:d.jsx(g.Checkbox,{checked:S,onChange:W=>Pe(W.target.checked),size:"small"}),label:"Cliente"}),le.length!==0&&d.jsx(g.FormControlLabel,{control:d.jsx(g.Checkbox,{checked:I,onChange:W=>$(W.target.checked),size:"small"}),label:`Asesor${le.length>1?"es":""}`})]})]}),d.jsx(g.Divider,{}),d.jsxs(g.Box,{p:2,children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},onClick:K,children:[d.jsx(g.Typography,{fontSize:12,fontWeight:600,sx:{textDecorationLine:"underline",cursor:"pointer"},children:"Selecciona el auto de seguimiento"}),He!=null&&d.jsx(g.Chip,{size:"small",label:`Distribuidora: ${He}`})]}),T.length>0?d.jsx(g.Box,{sx:{mt:1.5,display:"flex",gap:1,flexWrap:"wrap"},children:T.map((W,ee)=>{const Ee=jr(W,ee,h.id),Fe=jr(W,ee,h.title)??"",ft=jr(W,ee,h.image),yt=B5(f,ft);return d.jsx(g.Chip,{onDelete:()=>N(Ee),label:d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[d.jsx(g.Box,{sx:{width:28,height:20,borderRadius:.8,bgcolor:"#e5e6e8",overflow:"hidden",flex:"0 0 auto"},children:yt?d.jsx("img",{src:yt,alt:Fe,style:{width:"100%",height:"100%",objectFit:"cover"}}):d.jsx("img",{src:m,alt:Fe,style:{width:"100%",height:"100%",objectFit:"cover"}})}),d.jsx("span",{style:{fontSize:12},children:d.jsx("b",{children:Fe})})]}),sx:{pl:.5,pr:.3,py:.2,borderRadius:2,".MuiChip-deleteIcon":{fontSize:18}},variant:"outlined"},String(Ee))})}):d.jsx(g.Typography,{fontSize:13,color:"#5C6372",sx:{mt:.5},children:"Aún no has seleccionado autos."})]}),d.jsx(g.Divider,{}),d.jsxs(g.Box,{sx:{p:2},children:[d.jsx(g.TextField,{placeholder:"Escribe aquí tu mensaje...",value:r.message,onChange:W=>J(W.target.value),multiline:!0,minRows:6,fullWidth:!0,sx:{mb:1.5}}),r.attachments.length>0&&d.jsx(g.List,{dense:!0,sx:{display:"flex",flexDirection:"column",gap:2,border:"none"},children:r.attachments.map(W=>d.jsxs(g.ListItem,{sx:{px:0,background:"#EAEBF2",borderRadius:2,paddingX:1},children:[d.jsx(g.ListItemText,{style:{gap:10,fontSize:15,color:"#5285F7",display:"flex",flexWrap:"wrap",flex:"none"},primary:W.name,secondary:W.size<1024?`${W.size} b`:W.size<1024*1024?`${(W.size/1024).toFixed(0)} kb`:`${(W.size/(1024*1024)).toFixed(1)} MB`,secondaryTypographyProps:{sx:{fontSize:12,color:"#64748B",fontWeight:500,mt:.25}},primaryTypographyProps:{noWrap:!0,width:"auto"}}),d.jsx(g.Tooltip,{title:"Quitar",children:d.jsx(g.IconButton,{edge:"end",onClick:()=>_e(W.name),size:"small",children:d.jsx(yr,{fontSize:"small"})})})]},W.name))})]}),d.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:[d.jsx("input",{ref:v,hidden:!0,type:"file",multiple:!0,accept:".jpg,.jpeg,.png,.mp4,.pdf,.xlsx,.csv,.docx,.pptx,.txt",onChange:ze}),d.jsx(g.Button,{startIcon:d.jsx(L5,{}),variant:"text",onClick:()=>v.current?.click(),sx:{color:"#5C6372"},children:"Adjuntar archivo"}),d.jsx(g.Box,{sx:{flex:1}}),d.jsx(g.Button,{variant:"contained",onClick:z,disabled:!re,sx:{maxWidth:146,width:"100%",height:53,backgroundColor:"#336BE1"},children:"Enviar"})]})]}),d.jsxs(g.Dialog,{fullWidth:!0,maxWidth:"sm",fullScreen:$e,open:k,onClose:F,children:[d.jsxs(g.DialogTitle,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1},children:["Selecciona tu auto de seguimiento",d.jsx(g.IconButton,{onClick:F,size:"small",children:d.jsx(yr,{})})]}),d.jsxs(g.DialogContent,{children:[d.jsxs(g.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[d.jsx(g.TextField,{placeholder:"Buscar...",fullWidth:!0,size:"small",value:O,onChange:W=>q(W.target.value),sx:{mb:2}}),He!=null&&d.jsx(g.Chip,{size:"small",label:`Distribuidora: ${He}`})]}),d.jsxs(g.Typography,{variant:"caption",fontWeight:600,children:["RESULTADOS (",dt.length,")"]}),d.jsxs(g.List,{sx:{p:0},children:[dt.map((W,ee)=>{const Ee=jr(W,ee,h.id),Fe=U.includes(String(Ee))||U.includes(Ee),ft=Re==null||jr(W,ee,h.distributorId)==Re;return d.jsx(g.ListItem,{disableGutters:!0,sx:{p:0,opacity:ft?1:.5},children:d.jsx(g.Box,{onClick:()=>ft&&xe(Ee),sx:{cursor:ft?"pointer":"not-allowed",p:.5,backgroundColor:Fe?"#e5f0ff":"transparent",width:"100%",borderBottom:"solid 1px #D3D4D5"},children:a?a(W,ee):d.jsx("pre",{style:{margin:0},children:JSON.stringify(W,null,2)})})},String(Ee))}),dt.length===0&&d.jsx(g.Box,{p:2,children:d.jsx(g.Typography,{children:"Tu búsqueda no generó resultados"})})]})]}),d.jsxs(g.DialogActions,{sx:{px:3,pb:2},children:[d.jsx(g.Button,{variant:"text",onClick:F,sx:{color:"#5C6372"},children:"Cancelar"}),d.jsx(g.Button,{variant:"contained",onClick:G,sx:{backgroundColor:"#336BE1"},children:"Guardar selección"})]})]})]})}It.AddCliente=R5,It.ApiProvider=Kw,It.AuthProvider=Ex,It.Clientes=x5,It.CustomSnackbar=Xl,It.EventsProvider=wT,It.ModalCorreo=F5,It.MyCalendar=TT,It.useAuth=Gc,It.useAuthRepository=ll,It.useEventRepository=$l,Object.defineProperty(It,Symbol.toStringTag,{value:"Module"})}));
|