@glatam/calendar-ui 1.0.5 → 1.0.7

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),i=require("lit/decorators.js"),y=require("@glatam/calendar-core"),$=require("lit/directives/class-map.js"),M=s.css`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("lit"),i=require("lit/decorators.js"),g=require("@glatam/calendar-core"),R=require("lit/directives/class-map.js"),E=s.css`
2
2
  :host {
3
3
  /* Fonts */
4
4
  --glatam-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
@@ -342,24 +342,24 @@
342
342
  min-width: 32px;
343
343
  }
344
344
  }
345
- `;function k(d,t,e){if(t===e)return 0;const a=(r,l)=>{const o={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1};l!=="local"&&(o.timeZone=l);const p=new Intl.DateTimeFormat("en-US",o).formatToParts(r),n=new Map(p.map(u=>[u.type,u.value])),h=Number(n.get("hour")),m=h===24?0:h;return new Date(Number(n.get("year")),Number(n.get("month"))-1,Number(n.get("day")),m,Number(n.get("minute")),Number(n.get("second")))};try{const r=a(d,t);return(a(d,e).getTime()-r.getTime())/(60*1e3)}catch{return 0}}function R(d,t){if(t===0)return{start:d.start,end:d.end,dayShift:0};const e=n=>{const[h,m]=n.split(":").map(Number);return h*60+m},a=n=>{let h=n%1440;h<0&&(h+=1440);const m=String(Math.floor(h/60)).padStart(2,"0"),u=String(h%60).padStart(2,"0");return`${m}:${u}`},r=e(d.start),l=e(d.end),o=r+t,c=l+t;let p=0;return o<0?p=-1:o>=1440&&(p=1),{start:a(o),end:a(c),dayShift:p}}var E=Object.defineProperty,z=Object.getOwnPropertyDescriptor,v=(d,t,e,a)=>{for(var r=a>1?void 0:a?z(t,e):t,l=d.length-1,o;l>=0;l--)(o=d[l])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&E(t,e,r),r};exports.GlatamCalendarMonthView=class extends s.LitElement{constructor(){super(...arguments),this.days=[],this.locale="es",this.startOfWeekDay=0,this.selectedDates=[],this.role="provider",this.size="medium",this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null}getWeekdayNames(){const t=[],e=new Date(2026,6,12+this.startOfWeekDay),a=new Intl.DateTimeFormat(this.locale,{weekday:"short"});for(let r=0;r<7;r++)t.push(a.format(e)),e.setDate(e.getDate()+1);return t}handleDayClick(t){const e=this.minDate&&t.dateString<this.minDate||this.maxDate&&t.dateString>this.maxDate;this.role==="buyer"&&(t.isBlocked||e)||this.dispatchEvent(new CustomEvent("day-select",{detail:{dateString:t.dateString,isBlocked:t.isBlocked},bubbles:!0,composed:!0}))}render(){const t=this.getWeekdayNames();return s.html`
345
+ `;function k(c,t,e){if(t===e)return 0;const a=(r,o)=>{const l={year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1};o!=="local"&&(l.timeZone=o);const m=new Intl.DateTimeFormat("en-US",l).formatToParts(r),n=new Map(m.map(y=>[y.type,y.value])),p=Number(n.get("hour")),u=p===24?0:p;return new Date(Number(n.get("year")),Number(n.get("month"))-1,Number(n.get("day")),u,Number(n.get("minute")),Number(n.get("second")))};try{const r=a(c,t);return(a(c,e).getTime()-r.getTime())/(60*1e3)}catch{return 0}}function T(c,t){if(t===0)return{start:c.start,end:c.end,dayShift:0};const e=n=>{const[p,u]=n.split(":").map(Number);return p*60+u},a=n=>{let p=n%1440;p<0&&(p+=1440);const u=String(Math.floor(p/60)).padStart(2,"0"),y=String(p%60).padStart(2,"0");return`${u}:${y}`},r=e(c.start),o=e(c.end),l=r+t,d=o+t;let m=0;return l<0?m=-1:l>=1440&&(m=1),{start:a(l),end:a(d),dayShift:m}}function I(c,t,e){let a=null;return{updatedRules:c.map(o=>{if(o.id!==t)return o;a=o;const l=o.exceptions||[],d=l.includes(e)?l:[...l,e];return{...o,exceptions:d}}),targetRule:a}}function M(c,t){const e=c.find(r=>r.id===t)||null;return{updatedRules:c.filter(r=>r.id!==t),targetRule:e}}var V=Object.defineProperty,_=Object.getOwnPropertyDescriptor,x=(c,t,e,a)=>{for(var r=a>1?void 0:a?_(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&V(t,e,r),r};exports.GlatamCalendarMonthView=class extends s.LitElement{constructor(){super(...arguments),this.days=[],this.locale="es",this.startOfWeekDay=0,this.selectedDates=[],this.role="provider",this.size="medium",this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null}getWeekdayNames(){const t=[],e=new Date(2026,6,12+this.startOfWeekDay),a=new Intl.DateTimeFormat(this.locale,{weekday:"short"});for(let r=0;r<7;r++)t.push(a.format(e)),e.setDate(e.getDate()+1);return t}handleDayClick(t){const e=this.minDate&&t.dateString<this.minDate||this.maxDate&&t.dateString>this.maxDate;this.role==="buyer"&&(t.isBlocked||e)||this.dispatchEvent(new CustomEvent("day-select",{detail:{dateString:t.dateString,isBlocked:t.isBlocked},bubbles:!0,composed:!0}))}render(){const t=this.getWeekdayNames();return s.html`
346
346
  ${t.map(e=>s.html`<div class="weekday">${e}</div>`)}
347
347
 
348
- ${this.days.map(e=>{var p;if(!e.isCurrentMonth&&!this.showNeighboringMonth)return s.html`<div class="day-cell empty"></div>`;const a=e.dateString===new Date().toISOString().split("T")[0],r=this.selectedDates.includes(e.dateString),l=e.slots.filter(n=>n.isBlocked),o=this.minDate&&e.dateString<this.minDate||this.maxDate&&e.dateString>this.maxDate,c=this.tileClassName?this.tileClassName({date:e.date,dateString:e.dateString}):"";return s.html`
348
+ ${this.days.map(e=>{var m;if(!e.isCurrentMonth&&!this.showNeighboringMonth)return s.html`<div class="day-cell empty"></div>`;const a=e.dateString===g.formatISODate(new Date),r=this.selectedDates.includes(e.dateString),o=e.slots.filter(n=>n.isBlocked),l=this.minDate&&e.dateString<this.minDate||this.maxDate&&e.dateString>this.maxDate,d=this.tileClassName?this.tileClassName({date:e.date,dateString:e.dateString}):"";return s.html`
349
349
  <div
350
- class=${$.classMap({"day-cell":!0,padding:!e.isCurrentMonth,blocked:e.isBlocked,today:a,selected:r,disabled:!!o,[c]:!!c})}
351
- part="day-cell ${c}"
350
+ class=${R.classMap({"day-cell":!0,padding:!e.isCurrentMonth,blocked:e.isBlocked,today:a,selected:r,disabled:!!l,[d]:!!d})}
351
+ part="day-cell ${d}"
352
352
  @click=${()=>this.handleDayClick(e)}
353
353
  >
354
354
  <div class="day-number">${e.dayNumber}</div>
355
355
 
356
356
  <div class="slot-indicator">
357
- ${e.isBlocked?s.html`<div class="badge blocked-day">${((p=e.rule)==null?void 0:p.description)||"Bloqueado"}</div>`:l.slice(0,2).map(n=>{var h,m;return s.html`
358
- <div class="badge blocked-slot" title=${((h=n.rule)==null?void 0:h.description)||""}>
359
- 🚫 ${((m=n.rule)==null?void 0:m.description)||n.start}
357
+ ${e.isBlocked?s.html`<div class="badge blocked-day">${((m=e.rule)==null?void 0:m.description)||"Bloqueado"}</div>`:o.slice(0,2).map(n=>{var p,u;return s.html`
358
+ <div class="badge blocked-slot" title=${((p=n.rule)==null?void 0:p.description)||""}>
359
+ 🚫 ${((u=n.rule)==null?void 0:u.description)||n.start}
360
360
  </div>
361
361
  `})}
362
- ${!e.isBlocked&&l.length>2?s.html`<div style="text-align: center; font-size: 0.65rem; color: var(--glatam-text-secondary);">+${l.length-2} tareas</div>`:""}
362
+ ${!e.isBlocked&&o.length>2?s.html`<div style="text-align: center; font-size: 0.65rem; color: var(--glatam-text-secondary);">+${o.length-2} tareas</div>`:""}
363
363
  </div>
364
364
  </div>
365
365
  `})}
@@ -395,27 +395,27 @@
395
395
  .slot-indicator { display: none; }
396
396
  .day-number { margin-bottom: 0; font-size: 0.8rem; }
397
397
  }
398
- `;v([i.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"days",2);v([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"locale",2);v([i.property({type:Number})],exports.GlatamCalendarMonthView.prototype,"startOfWeekDay",2);v([i.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"selectedDates",2);v([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"role",2);v([i.property({type:String,reflect:!0})],exports.GlatamCalendarMonthView.prototype,"size",2);v([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"minDate",2);v([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"maxDate",2);v([i.property({type:Boolean})],exports.GlatamCalendarMonthView.prototype,"showNeighboringMonth",2);v([i.property({attribute:!1})],exports.GlatamCalendarMonthView.prototype,"tileClassName",2);exports.GlatamCalendarMonthView=v([i.customElement("glatam-calendar-month-view")],exports.GlatamCalendarMonthView);var T=Object.defineProperty,O=Object.getOwnPropertyDescriptor,x=(d,t,e,a)=>{for(var r=a>1?void 0:a?O(t,e):t,l=d.length-1,o;l>=0;l--)(o=d[l])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&T(t,e,r),r};exports.GlatamCalendarWeekView=class extends s.LitElement{constructor(){super(...arguments),this.days=[],this.slots=[],this.locale="es",this.selectedRange=null,this.role="provider",this.isDragging=!1,this.dragDayIndex=null,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null,this.handleMouseUp=()=>{if(!this.isDragging||this.dragDayIndex===null||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.days[this.dragDayIndex],r=a.slots.slice(t,e+1);r.some(l=>l.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:a.dateString,start:r[0].start,end:r[r.length-1].end},bubbles:!0,composed:!0})),this.dragDayIndex=null,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e,a){if(a){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.days[t].dateString,slot:this.days[t].slots[e],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragDayIndex=t,this.dragStartSlotIndex=e,this.dragEndSlotIndex=e}handleMouseEnter(t,e,a){this.isDragging&&t===this.dragDayIndex&&!a&&(this.dragEndSlotIndex=e)}isSlotSelected(t,e){return!this.selectedRange||this.selectedRange.dateString!==t?!1:e.start>=this.selectedRange.start&&e.end<=this.selectedRange.end}isSlotDragSelecting(t,e){if(!this.isDragging||t!==this.dragDayIndex)return!1;const a=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),r=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return e>=a&&e<=r}render(){const t=new Date().toISOString().split("T")[0];return s.html`
398
+ `;x([i.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"days",2);x([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"locale",2);x([i.property({type:Number})],exports.GlatamCalendarMonthView.prototype,"startOfWeekDay",2);x([i.property({type:Array})],exports.GlatamCalendarMonthView.prototype,"selectedDates",2);x([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"role",2);x([i.property({type:String,reflect:!0})],exports.GlatamCalendarMonthView.prototype,"size",2);x([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"minDate",2);x([i.property({type:String})],exports.GlatamCalendarMonthView.prototype,"maxDate",2);x([i.property({type:Boolean})],exports.GlatamCalendarMonthView.prototype,"showNeighboringMonth",2);x([i.property({attribute:!1})],exports.GlatamCalendarMonthView.prototype,"tileClassName",2);exports.GlatamCalendarMonthView=x([i.customElement("glatam-calendar-month-view")],exports.GlatamCalendarMonthView);var B=Object.defineProperty,j=Object.getOwnPropertyDescriptor,v=(c,t,e,a)=>{for(var r=a>1?void 0:a?j(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&B(t,e,r),r};exports.GlatamCalendarWeekView=class extends s.LitElement{constructor(){super(...arguments),this.days=[],this.slots=[],this.locale="es",this.selectedRange=null,this.role="provider",this.minDate="",this.maxDate="",this.isDragging=!1,this.dragDayIndex=null,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null,this.handleMouseUp=()=>{if(!this.isDragging||this.dragDayIndex===null||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.days[this.dragDayIndex],r=a.slots.slice(t,e+1);r.some(o=>o.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:a.dateString,start:r[0].start,end:r[r.length-1].end},bubbles:!0,composed:!0})),this.dragDayIndex=null,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e,a){var l;const r=(l=this.days[t])==null?void 0:l.dateString;if(!(this.minDate&&r<this.minDate||this.maxDate&&r>this.maxDate)){if(a){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.days[t].dateString,slot:this.days[t].slots[e],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragDayIndex=t,this.dragStartSlotIndex=e,this.dragEndSlotIndex=e}}handleMouseEnter(t,e,a){this.isDragging&&t===this.dragDayIndex&&!a&&(this.dragEndSlotIndex=e)}isSlotSelected(t,e){return!this.selectedRange||this.selectedRange.dateString!==t?!1:e.start>=this.selectedRange.start&&e.end<=this.selectedRange.end}isSlotDragSelecting(t,e){if(!this.isDragging||t!==this.dragDayIndex)return!1;const a=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),r=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return e>=a&&e<=r}render(){const t=g.formatISODate(new Date);return s.html`
399
399
  <div class="time-col">
400
400
  <div class="header-cell">Hora</div>
401
401
  ${this.slots.map(e=>s.html`<div class="slot-cell time-slot-label">${e.start}</div>`)}
402
402
  </div>
403
403
 
404
- ${this.days.map((e,a)=>{const r=e.dateString===t,l=new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(e.date);return s.html`
404
+ ${this.days.map((e,a)=>{const r=e.dateString===t,o=new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(e.date),l=this.minDate&&e.dateString<this.minDate||this.maxDate&&e.dateString>this.maxDate;return s.html`
405
405
  <div class="day-col">
406
406
  <div class="header-cell ${r?"today":""}">
407
- <div>${l}</div>
407
+ <div>${o}</div>
408
408
  <div class="day-num">${e.dayNumber}</div>
409
409
  </div>
410
410
 
411
- ${e.slots.map((o,c)=>{var m,u;const p=o.isBlocked,n=this.isSlotSelected(e.dateString,o),h=this.isSlotDragSelecting(a,c);return s.html`
411
+ ${e.slots.map((d,m)=>{var y,f;const n=d.isBlocked,p=this.isSlotSelected(e.dateString,d),u=this.isSlotDragSelecting(a,m);return s.html`
412
412
  <div
413
- class=${$.classMap({"slot-cell":!0,available:!p,blocked:p,selected:n,"drag-selecting":h})}
414
- @mousedown=${()=>this.handleMouseDown(a,c,p)}
415
- @mouseenter=${()=>this.handleMouseEnter(a,c,p)}
416
- title=${p&&((m=o.rule)!=null&&m.description)?o.rule.description:""}
413
+ class=${R.classMap({"slot-cell":!0,available:!n&&!l,blocked:n,selected:p,"drag-selecting":u,disabled:l})}
414
+ @mousedown=${()=>this.handleMouseDown(a,m,n)}
415
+ @mouseenter=${()=>this.handleMouseEnter(a,m,n)}
416
+ title=${n&&((y=d.rule)!=null&&y.description)?d.rule.description:""}
417
417
  >
418
- ${p?((u=o.rule)==null?void 0:u.description)||"Ocupado":n?"Reservado":""}
418
+ ${n?((f=d.rule)==null?void 0:f.description)||"Ocupado":p?"Reservado":""}
419
419
  </div>
420
420
  `})}
421
421
  </div>
@@ -472,25 +472,26 @@
472
472
  }
473
473
  .slot-cell.selected { background-color: var(--glatam-selection-bg); border-left: 3px solid var(--glatam-selection-border); }
474
474
  .slot-cell.drag-selecting { background-color: var(--glatam-primary-light); }
475
- `;x([i.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"days",2);x([i.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"slots",2);x([i.property({type:String})],exports.GlatamCalendarWeekView.prototype,"locale",2);x([i.property({type:Object})],exports.GlatamCalendarWeekView.prototype,"selectedRange",2);x([i.property({type:String})],exports.GlatamCalendarWeekView.prototype,"role",2);x([i.state()],exports.GlatamCalendarWeekView.prototype,"isDragging",2);x([i.state()],exports.GlatamCalendarWeekView.prototype,"dragDayIndex",2);x([i.state()],exports.GlatamCalendarWeekView.prototype,"dragStartSlotIndex",2);x([i.state()],exports.GlatamCalendarWeekView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarWeekView=x([i.customElement("glatam-calendar-week-view")],exports.GlatamCalendarWeekView);var I=Object.defineProperty,V=Object.getOwnPropertyDescriptor,w=(d,t,e,a)=>{for(var r=a>1?void 0:a?V(t,e):t,l=d.length-1,o;l>=0;l--)(o=d[l])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&I(t,e,r),r};exports.GlatamCalendarDayView=class extends s.LitElement{constructor(){super(...arguments),this.day=null,this.slots=[],this.locale="es",this.selectedRange=null,this.role="provider",this.isDragging=!1,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null,this.handleMouseUp=()=>{if(!this.isDragging||!this.day||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.day.slots.slice(t,e+1);a.some(r=>r.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:this.day.dateString,start:a[0].start,end:a[a.length-1].end},bubbles:!0,composed:!0})),this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e){if(e&&this.day){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.day.dateString,slot:this.day.slots[t],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragStartSlotIndex=t,this.dragEndSlotIndex=t}handleMouseEnter(t,e){this.isDragging&&!e&&(this.dragEndSlotIndex=t)}isSlotSelected(t){return!this.day||!this.selectedRange||this.selectedRange.dateString!==this.day.dateString?!1:t.start>=this.selectedRange.start&&t.end<=this.selectedRange.end}isSlotDragSelecting(t){if(!this.isDragging)return!1;const e=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),a=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return t>=e&&t<=a}render(){if(!this.day)return s.html`<div>Cargando...</div>`;const t=this.day.dateString===new Date().toISOString().split("T")[0],e=new Intl.DateTimeFormat(this.locale,{weekday:"long",day:"numeric",month:"long"}).format(this.day.date);return s.html`
475
+ .slot-cell.disabled { opacity: 0.35; cursor: not-allowed; background-color: var(--glatam-surface); pointer-events: none; }
476
+ `;v([i.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"days",2);v([i.property({type:Array})],exports.GlatamCalendarWeekView.prototype,"slots",2);v([i.property({type:String})],exports.GlatamCalendarWeekView.prototype,"locale",2);v([i.property({type:Object})],exports.GlatamCalendarWeekView.prototype,"selectedRange",2);v([i.property({type:String})],exports.GlatamCalendarWeekView.prototype,"role",2);v([i.property({type:String})],exports.GlatamCalendarWeekView.prototype,"minDate",2);v([i.property({type:String})],exports.GlatamCalendarWeekView.prototype,"maxDate",2);v([i.state()],exports.GlatamCalendarWeekView.prototype,"isDragging",2);v([i.state()],exports.GlatamCalendarWeekView.prototype,"dragDayIndex",2);v([i.state()],exports.GlatamCalendarWeekView.prototype,"dragStartSlotIndex",2);v([i.state()],exports.GlatamCalendarWeekView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarWeekView=v([i.customElement("glatam-calendar-week-view")],exports.GlatamCalendarWeekView);var P=Object.defineProperty,N=Object.getOwnPropertyDescriptor,w=(c,t,e,a)=>{for(var r=a>1?void 0:a?N(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&P(t,e,r),r};exports.GlatamCalendarDayView=class extends s.LitElement{constructor(){super(...arguments),this.day=null,this.slots=[],this.locale="es",this.selectedRange=null,this.role="provider",this.minDate="",this.maxDate="",this.isDragging=!1,this.dragStartSlotIndex=null,this.dragEndSlotIndex=null,this.handleMouseUp=()=>{if(!this.isDragging||!this.day||this.dragStartSlotIndex===null||this.dragEndSlotIndex===null){this.isDragging=!1;return}this.isDragging=!1;const t=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),e=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex),a=this.day.slots.slice(t,e+1);a.some(r=>r.isBlocked)||this.dispatchEvent(new CustomEvent("range-select",{detail:{dateString:this.day.dateString,start:a[0].start,end:a[a.length-1].end},bubbles:!0,composed:!0})),this.dragStartSlotIndex=null,this.dragEndSlotIndex=null}}connectedCallback(){super.connectedCallback(),window.addEventListener("mouseup",this.handleMouseUp)}disconnectedCallback(){window.removeEventListener("mouseup",this.handleMouseUp),super.disconnectedCallback()}handleMouseDown(t,e){if(!this.day)return;const a=this.day.dateString;if(!(this.minDate&&a<this.minDate||this.maxDate&&a>this.maxDate)){if(e){if(this.role==="buyer")return;this.dispatchEvent(new CustomEvent("slot-click",{detail:{dateString:this.day.dateString,slot:this.day.slots[t],isBlocked:!0},bubbles:!0,composed:!0}));return}this.isDragging=!0,this.dragStartSlotIndex=t,this.dragEndSlotIndex=t}}handleMouseEnter(t,e){this.isDragging&&!e&&(this.dragEndSlotIndex=t)}isSlotSelected(t){return!this.day||!this.selectedRange||this.selectedRange.dateString!==this.day.dateString?!1:t.start>=this.selectedRange.start&&t.end<=this.selectedRange.end}isSlotDragSelecting(t){if(!this.isDragging)return!1;const e=Math.min(this.dragStartSlotIndex,this.dragEndSlotIndex),a=Math.max(this.dragStartSlotIndex,this.dragEndSlotIndex);return t>=e&&t<=a}render(){if(!this.day)return s.html`<div>Cargando...</div>`;const t=this.day.dateString===g.formatISODate(new Date),e=this.minDate&&this.day.dateString<this.minDate||this.maxDate&&this.day.dateString>this.maxDate,a=new Intl.DateTimeFormat(this.locale,{weekday:"long",day:"numeric",month:"long"}).format(this.day.date);return s.html`
476
477
  <div class="time-col">
477
478
  <div class="header-cell">Hora</div>
478
- ${this.slots.map(a=>s.html`<div class="slot-cell time-slot-label">${a.start}</div>`)}
479
+ ${this.slots.map(r=>s.html`<div class="slot-cell time-slot-label">${r.start}</div>`)}
479
480
  </div>
480
481
 
481
482
  <div class="day-col">
482
483
  <div class="header-cell ${t?"today":""}">
483
- <div style="text-transform: capitalize;">${e}</div>
484
+ <div style="text-transform: capitalize;">${a}</div>
484
485
  </div>
485
486
 
486
- ${this.day.slots.map((a,r)=>{var p,n;const l=a.isBlocked,o=this.isSlotSelected(a),c=this.isSlotDragSelecting(r);return s.html`
487
+ ${this.day.slots.map((r,o)=>{var n,p;const l=r.isBlocked,d=this.isSlotSelected(r),m=this.isSlotDragSelecting(o);return s.html`
487
488
  <div
488
- class=${$.classMap({"slot-cell":!0,available:!l,blocked:l,selected:o,"drag-selecting":c})}
489
- @mousedown=${()=>this.handleMouseDown(r,l)}
490
- @mouseenter=${()=>this.handleMouseEnter(r,l)}
491
- title=${l&&((p=a.rule)!=null&&p.description)?a.rule.description:""}
489
+ class=${R.classMap({"slot-cell":!0,available:!l&&!e,blocked:l,selected:d,"drag-selecting":m,disabled:e})}
490
+ @mousedown=${()=>this.handleMouseDown(o,l)}
491
+ @mouseenter=${()=>this.handleMouseEnter(o,l)}
492
+ title=${l&&((n=r.rule)!=null&&n.description)?r.rule.description:""}
492
493
  >
493
- ${l?((n=a.rule)==null?void 0:n.description)||"Ocupado":o?"Reservado":""}
494
+ ${l?((p=r.rule)==null?void 0:p.description)||"Ocupado":d?"Reservado":""}
494
495
  </div>
495
496
  `})}
496
497
  </div>
@@ -523,7 +524,8 @@
523
524
  }
524
525
  .slot-cell.selected { background-color: var(--glatam-selection-bg); border-left: 3px solid var(--glatam-selection-border); }
525
526
  .slot-cell.drag-selecting { background-color: var(--glatam-primary-light); }
526
- `;w([i.property({type:Object})],exports.GlatamCalendarDayView.prototype,"day",2);w([i.property({type:Array})],exports.GlatamCalendarDayView.prototype,"slots",2);w([i.property({type:String})],exports.GlatamCalendarDayView.prototype,"locale",2);w([i.property({type:Object})],exports.GlatamCalendarDayView.prototype,"selectedRange",2);w([i.property({type:String})],exports.GlatamCalendarDayView.prototype,"role",2);w([i.state()],exports.GlatamCalendarDayView.prototype,"isDragging",2);w([i.state()],exports.GlatamCalendarDayView.prototype,"dragStartSlotIndex",2);w([i.state()],exports.GlatamCalendarDayView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarDayView=w([i.customElement("glatam-calendar-day-view")],exports.GlatamCalendarDayView);const B=s.css`
527
+ .slot-cell.disabled { opacity: 0.35; cursor: not-allowed; background-color: var(--glatam-surface); pointer-events: none; }
528
+ `;w([i.property({type:Object})],exports.GlatamCalendarDayView.prototype,"day",2);w([i.property({type:Array})],exports.GlatamCalendarDayView.prototype,"slots",2);w([i.property({type:String})],exports.GlatamCalendarDayView.prototype,"locale",2);w([i.property({type:Object})],exports.GlatamCalendarDayView.prototype,"selectedRange",2);w([i.property({type:String})],exports.GlatamCalendarDayView.prototype,"role",2);w([i.property({type:String})],exports.GlatamCalendarDayView.prototype,"minDate",2);w([i.property({type:String})],exports.GlatamCalendarDayView.prototype,"maxDate",2);w([i.state()],exports.GlatamCalendarDayView.prototype,"isDragging",2);w([i.state()],exports.GlatamCalendarDayView.prototype,"dragStartSlotIndex",2);w([i.state()],exports.GlatamCalendarDayView.prototype,"dragEndSlotIndex",2);exports.GlatamCalendarDayView=w([i.customElement("glatam-calendar-day-view")],exports.GlatamCalendarDayView);const W=s.css`
527
529
  dialog {
528
530
  background: transparent;
529
531
  border: none;
@@ -678,7 +680,7 @@
678
680
  .btn-danger:hover {
679
681
  background: rgba(255, 69, 58, 0.18);
680
682
  }
681
- `;var j=Object.defineProperty,N=Object.getOwnPropertyDescriptor,f=(d,t,e,a)=>{for(var r=a>1?void 0:a?N(t,e):t,l=d.length-1,o;l>=0;l--)(o=d[l])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&j(t,e,r),r};exports.GlatamCalendarModal=class extends s.LitElement{constructor(){super(...arguments),this.open=!1,this.dateString="",this.startTime="",this.endTime="",this.isRange=!1,this.existingRule=null,this.description="",this.blockAllDay=!0,this.isRecurring=!1,this.selectedDays=[]}willUpdate(t){t.has("open")&&this.open&&(this.existingRule?(this.description="Bloqueo",this.blockAllDay=!this.existingRule.slots||this.existingRule.slots.length===0,this.isRecurring=this.existingRule.type==="weekly",this.selectedDays=this.existingRule.daysOfWeek||[]):(this.description="",this.blockAllDay=!this.isRange,this.isRecurring=!1,this.selectedDays=[new Date(this.dateString+"T00:00:00").getDay()]))}updated(t){var e;if(t.has("open")){const a=(e=this.shadowRoot)==null?void 0:e.getElementById("booking-dialog");a&&(this.open?a.open||a.showModal():a.open&&a.close())}}handleDialogClose(){this.open&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}toggleDay(t){const e=this.selectedDays.indexOf(t);this.selectedDays=e>-1?this.selectedDays.filter(a=>a!==t):[...this.selectedDays,t]}handleSave(){const t={title:this.description||"Bloqueo",blockAllDay:this.blockAllDay,isRecurring:this.isRecurring,selectedDays:this.selectedDays,dateString:this.dateString,startTime:this.startTime,endTime:this.endTime};this.dispatchEvent(new CustomEvent("save-rule",{detail:t,bubbles:!0,composed:!0}))}handleDelete(){this.existingRule&&this.dispatchEvent(new CustomEvent("delete-rule",{detail:{id:this.existingRule.id},bubbles:!0,composed:!0}))}render(){const t=["D","L","M","M","J","V","S"],e=this.isRange?`${this.dateString} (${this.startTime} - ${this.endTime})`:this.dateString;return s.html`
683
+ `;var A=Object.defineProperty,L=Object.getOwnPropertyDescriptor,D=(c,t,e,a)=>{for(var r=a>1?void 0:a?L(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&A(t,e,r),r};exports.GlatamCalendarModal=class extends s.LitElement{constructor(){super(...arguments),this.open=!1,this.dateString="",this.startTime="",this.endTime="",this.isRange=!1,this.existingRule=null,this.description="",this.blockAllDay=!0,this.isRecurring=!1,this.selectedDays=[]}willUpdate(t){if(t.has("open")&&this.open)if(this.existingRule)this.description=this.existingRule.description||"",this.blockAllDay=!this.existingRule.slots||this.existingRule.slots.length===0,this.isRecurring=this.existingRule.type==="weekly",this.selectedDays=this.existingRule.daysOfWeek||[],this.existingRule.slots&&this.existingRule.slots.length>0&&(this.startTime=this.existingRule.slots[0].start,this.endTime=this.existingRule.slots[0].end);else{this.description="",this.blockAllDay=!this.isRange,this.isRecurring=!1;const e=g.parseISODate(this.dateString);this.selectedDays=[e.getDay()]}}updated(t){var e;if(t.has("open")){const a=(e=this.shadowRoot)==null?void 0:e.getElementById("booking-dialog");a&&(this.open?a.open||a.showModal():a.open&&a.close())}}handleDialogClose(){this.open&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}toggleDay(t){const e=this.selectedDays.indexOf(t);this.selectedDays=e>-1?this.selectedDays.filter(a=>a!==t):[...this.selectedDays,t]}handleSave(){const t={title:this.description.trim(),blockAllDay:this.blockAllDay,isRecurring:this.isRecurring,selectedDays:this.selectedDays,dateString:this.dateString,startTime:this.startTime,endTime:this.endTime};this.dispatchEvent(new CustomEvent("save-rule",{detail:t,bubbles:!0,composed:!0}))}handleDelete(){this.existingRule&&this.dispatchEvent(new CustomEvent("delete-rule",{detail:{id:this.existingRule.id,dateString:this.dateString,rule:this.existingRule},bubbles:!0,composed:!0}))}render(){const t=["D","L","M","M","J","V","S"],e=this.isRange?`${this.dateString} (${this.startTime} - ${this.endTime})`:this.dateString;return s.html`
682
684
  <dialog id="booking-dialog" @close=${this.handleDialogClose}>
683
685
  <div class="modal-content">
684
686
  <h3>${this.existingRule?"Gestionar Bloqueo":"Crear Bloqueo"}</h3>
@@ -709,6 +711,27 @@
709
711
  </label>
710
712
  </div>
711
713
 
714
+ ${this.blockAllDay?"":s.html`
715
+ <div style="display: flex; gap: 12px;" class="form-group">
716
+ <div style="flex: 1;">
717
+ <label>Hora Inicio</label>
718
+ <input
719
+ type="time"
720
+ .value=${this.startTime}
721
+ @input=${a=>this.startTime=a.target.value}
722
+ />
723
+ </div>
724
+ <div style="flex: 1;">
725
+ <label>Hora Fin</label>
726
+ <input
727
+ type="time"
728
+ .value=${this.endTime}
729
+ @input=${a=>this.endTime=a.target.value}
730
+ />
731
+ </div>
732
+ </div>
733
+ `}
734
+
712
735
  <div class="switch-row">
713
736
  <label>Repetir semanalmente</label>
714
737
  <label class="switch">
@@ -727,6 +750,7 @@
727
750
  <div class="days-grid">
728
751
  ${[1,2,3,4,5,6,0].map(a=>s.html`
729
752
  <button
753
+ type="button"
730
754
  class="day-btn ${this.selectedDays.includes(a)?"selected":""}"
731
755
  @click=${()=>this.toggleDay(a)}
732
756
  >
@@ -738,13 +762,209 @@
738
762
  `:""}
739
763
 
740
764
  <div class="btn-actions">
741
- ${this.existingRule?s.html`<button class="btn btn-danger" @click=${this.handleDelete}>Eliminar</button>`:""}
742
- <button class="btn btn-cancel" @click=${()=>this.dispatchEvent(new CustomEvent("close"))}>Cancelar</button>
743
- <button class="btn btn-save" @click=${this.handleSave}>Guardar</button>
765
+ ${this.existingRule?s.html`<button type="button" class="btn btn-danger" @click=${this.handleDelete}>Eliminar</button>`:""}
766
+ <button type="button" class="btn btn-cancel" @click=${()=>this.dispatchEvent(new CustomEvent("close"))}>Cancelar</button>
767
+ <button type="button" class="btn btn-save" @click=${this.handleSave}>Guardar</button>
744
768
  </div>
745
769
  </div>
746
770
  </dialog>
747
- `}};exports.GlatamCalendarModal.styles=B;f([i.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"open",2);f([i.property({type:String})],exports.GlatamCalendarModal.prototype,"dateString",2);f([i.property({type:String})],exports.GlatamCalendarModal.prototype,"startTime",2);f([i.property({type:String})],exports.GlatamCalendarModal.prototype,"endTime",2);f([i.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"isRange",2);f([i.property({type:Object})],exports.GlatamCalendarModal.prototype,"existingRule",2);f([i.state()],exports.GlatamCalendarModal.prototype,"description",2);f([i.state()],exports.GlatamCalendarModal.prototype,"blockAllDay",2);f([i.state()],exports.GlatamCalendarModal.prototype,"isRecurring",2);f([i.state()],exports.GlatamCalendarModal.prototype,"selectedDays",2);exports.GlatamCalendarModal=f([i.customElement("glatam-calendar-modal")],exports.GlatamCalendarModal);var _=Object.defineProperty,P=Object.getOwnPropertyDescriptor,g=(d,t,e,a)=>{for(var r=a>1?void 0:a?P(t,e):t,l=d.length-1,o;l>=0;l--)(o=d[l])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&_(t,e,r),r};const W=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}];exports.GlatamCalendar=class extends s.LitElement{constructor(){super(...arguments),this.role="provider",this.size="medium",this.view="month",this.locale="es",this.startOfWeekDay=0,this.rules=[],this.selectedDates=[],this.selectedRange=null,this.hostTimezone="America/Bogota",this.activeTimezone="local",this.slots=W,this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null,this.activeDate=new Date,this.localRules=[],this.darkMode=!1,this.modalOpen=!1,this.modalDateString="",this.modalStartTime="",this.modalEndTime="",this.modalIsRange=!1,this.modalExistingRule=null}firstUpdated(){this.darkMode=window.matchMedia("(prefers-color-scheme: dark)").matches,this.localRules=[...this.rules]}willUpdate(t){t.has("rules")&&(this.localRules=[...this.rules||[]])}updated(t){t.has("darkMode")&&this.classList.toggle("dark-mode",this.darkMode)}handlePrev(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()-1):this.view==="week"?t.setDate(t.getDate()-7):t.setDate(t.getDate()-1),this.activeDate=t}handleNext(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()+1):this.view==="week"?t.setDate(t.getDate()+7):t.setDate(t.getDate()+1),this.activeDate=t}getHeaderTitle(){const t=this.view==="month"?{month:"long",year:"numeric"}:this.view==="week"?{month:"short",year:"numeric"}:{day:"numeric",month:"long",year:"numeric"};return new Intl.DateTimeFormat(this.locale,t).format(this.activeDate)}handleDaySelect(t){const{dateString:e,isBlocked:a}=t.detail;this.role==="buyer"&&a||(this.activeDate=new Date(e+"T00:00:00"),this.view="day",this.dispatchEvent(new CustomEvent("date-selected",{detail:{dateString:e},bubbles:!0,composed:!0})))}handleRangeSelect(t){var S,D;const{dateString:e,start:a,end:r}=t.detail,l=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,o=new Date().toISOString().split("T")[0],c=this.minDate||(this.role==="buyer"?o:"");if(this.role==="buyer"&&c&&e<c)return;const p=this.getDisplaySlots(l),n=p.findIndex(C=>C.start===a),h=p.findIndex(C=>C.end===r),m=((S=this.slots[n])==null?void 0:S.start)||a,u=((D=this.slots[h])==null?void 0:D.end)||r;if(this.role==="buyer"){this.selectedRange={dateString:e,start:a,end:r},this.dispatchEvent(new CustomEvent("booking-selected",{detail:{dateString:e,start:a,end:r,hostStart:m,hostEnd:u},bubbles:!0,composed:!0}));return}this.openModal(e,m,u,!0,null)}handleSlotClick(t){const{dateString:e,slot:a}=t.detail,r=new Date(e+"T00:00:00"),l=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,o=new Date().toISOString().split("T")[0],c=this.minDate||(this.role==="buyer"?o:"");if(this.role==="buyer"&&(a.isBlocked||c&&e<c))return;const p=this.getDisplaySlots(l),n=p.findIndex(u=>u.start===a.start),h=this.slots[n]||a;if(this.role==="buyer"){this.selectedRange={dateString:e,start:a.start,end:a.end},this.dispatchEvent(new CustomEvent("booking-selected",{detail:{dateString:e,start:a.start,end:a.end,hostStart:h.start,hostEnd:h.end},bubbles:!0,composed:!0}));return}const m=this.localRules.find(u=>y.isTimeBlocked(r,h,[u]));this.openModal(e,h.start,h.end,!0,m||null)}handleBlockDayAction(){const t=y.formatISODate(this.activeDate),e=this.localRules.find(a=>y.isTimeBlocked(this.activeDate,void 0,[a]));this.openModal(t,"","",!1,e||null)}openModal(t,e,a,r,l){this.modalDateString=t,this.modalStartTime=e,this.modalEndTime=a,this.modalIsRange=r,this.modalExistingRule=l,this.modalOpen=!0}handleSaveRule(t){const e=t.detail,a=this.modalExistingRule?this.modalExistingRule.id:`rule-${Date.now()}`,r={id:a,type:e.isRecurring?"weekly":"date-range",slots:e.blockAllDay?void 0:[{start:e.startTime,end:e.endTime}],daysOfWeek:e.isRecurring?e.selectedDays:void 0,startDate:e.isRecurring?void 0:e.dateString,endDate:e.isRecurring?void 0:e.dateString,description:e.title};this.localRules=this.modalExistingRule?this.localRules.map(l=>l.id===a?r:l):[...this.localRules,r],this.modalOpen=!1,this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:this.localRules},bubbles:!0,composed:!0}))}handleDeleteRule(t){this.localRules=this.localRules.filter(e=>e.id!==t.detail.id),this.modalOpen=!1,this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:this.localRules},bubbles:!0,composed:!0}))}getDisplaySlots(t){return t===0?this.slots:this.slots.map(e=>{const a=R(e,t),r=a.dayShift>0?" (+1d)":a.dayShift<0?" (-1d)":"";return{start:a.start+r,end:a.end+r}})}render(){var p;const t=this.activeDate.getFullYear(),e=this.activeDate.getMonth(),a=y.isTimeBlocked(this.activeDate,void 0,this.localRules),r=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,l=this.getDisplaySlots(r),o=n=>n.map(h=>({...h,slots:h.slots.map((m,u)=>{var S,D;return{...m,start:((S=l[u])==null?void 0:S.start)||m.start,end:((D=l[u])==null?void 0:D.end)||m.end}})})),c=((p=this.hostTimezone.split("/").pop())==null?void 0:p.replace("_"," "))||"Anfitrión";return s.html`
771
+ `}};exports.GlatamCalendarModal.styles=W;D([i.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"open",2);D([i.property({type:String})],exports.GlatamCalendarModal.prototype,"dateString",2);D([i.property({type:String})],exports.GlatamCalendarModal.prototype,"startTime",2);D([i.property({type:String})],exports.GlatamCalendarModal.prototype,"endTime",2);D([i.property({type:Boolean})],exports.GlatamCalendarModal.prototype,"isRange",2);D([i.property({type:Object})],exports.GlatamCalendarModal.prototype,"existingRule",2);D([i.state()],exports.GlatamCalendarModal.prototype,"description",2);D([i.state()],exports.GlatamCalendarModal.prototype,"blockAllDay",2);D([i.state()],exports.GlatamCalendarModal.prototype,"isRecurring",2);D([i.state()],exports.GlatamCalendarModal.prototype,"selectedDays",2);exports.GlatamCalendarModal=D([i.customElement("glatam-calendar-modal")],exports.GlatamCalendarModal);const U=s.css`
772
+ :host {
773
+ display: contents;
774
+ font-family: var(--glatam-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
775
+ }
776
+
777
+ dialog {
778
+ border: none;
779
+ border-radius: var(--glatam-border-radius, 16px);
780
+ padding: 0;
781
+ background: var(--glatam-bg, #ffffff);
782
+ color: var(--glatam-text, #1d1d1f);
783
+ max-width: 440px;
784
+ width: 90vw;
785
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
786
+ overflow: hidden;
787
+ }
788
+
789
+ dialog::backdrop {
790
+ background: rgba(0, 0, 0, 0.4);
791
+ backdrop-filter: blur(8px);
792
+ -webkit-backdrop-filter: blur(8px);
793
+ }
794
+
795
+ .confirmation-container {
796
+ padding: 24px;
797
+ display: flex;
798
+ flex-direction: column;
799
+ gap: 18px;
800
+ }
801
+
802
+ .header {
803
+ display: flex;
804
+ flex-direction: column;
805
+ gap: 6px;
806
+ }
807
+
808
+ .title {
809
+ font-size: 1.15rem;
810
+ font-weight: 600;
811
+ margin: 0;
812
+ color: var(--glatam-text, #1d1d1f);
813
+ line-height: 1.3;
814
+ }
815
+
816
+ .subtitle {
817
+ font-size: 0.88rem;
818
+ color: var(--glatam-text-secondary, #86868b);
819
+ margin: 0;
820
+ line-height: 1.4;
821
+ }
822
+
823
+ .rule-badge {
824
+ display: inline-flex;
825
+ align-items: center;
826
+ gap: 6px;
827
+ padding: 6px 12px;
828
+ background: var(--glatam-surface, #f5f5f7);
829
+ border-radius: 8px;
830
+ font-size: 0.82rem;
831
+ font-weight: 500;
832
+ color: var(--glatam-text, #1d1d1f);
833
+ }
834
+
835
+ .options-group {
836
+ display: flex;
837
+ flex-direction: column;
838
+ gap: 10px;
839
+ }
840
+
841
+ .option-card {
842
+ display: flex;
843
+ align-items: flex-start;
844
+ gap: 12px;
845
+ padding: 14px 16px;
846
+ border: 1.5px solid var(--glatam-border, #e5e5ea);
847
+ border-radius: 12px;
848
+ background: var(--glatam-bg, #ffffff);
849
+ cursor: pointer;
850
+ text-align: left;
851
+ transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
852
+ width: 100%;
853
+ box-sizing: border-box;
854
+ }
855
+
856
+ .option-card:hover {
857
+ border-color: var(--glatam-primary, #5856d6);
858
+ background: var(--glatam-primary-light, rgba(88, 86, 214, 0.06));
859
+ transform: translateY(-1px);
860
+ }
861
+
862
+ .option-card:active {
863
+ transform: scale(0.99);
864
+ }
865
+
866
+ .option-icon {
867
+ font-size: 1.25rem;
868
+ line-height: 1;
869
+ margin-top: 2px;
870
+ }
871
+
872
+ .option-text {
873
+ display: flex;
874
+ flex-direction: column;
875
+ gap: 3px;
876
+ }
877
+
878
+ .option-title {
879
+ font-size: 0.92rem;
880
+ font-weight: 600;
881
+ color: var(--glatam-text, #1d1d1f);
882
+ }
883
+
884
+ .option-desc {
885
+ font-size: 0.8rem;
886
+ color: var(--glatam-text-secondary, #86868b);
887
+ line-height: 1.35;
888
+ }
889
+
890
+ .actions {
891
+ display: flex;
892
+ justify-content: flex-end;
893
+ margin-top: 4px;
894
+ }
895
+
896
+ .btn-cancel {
897
+ padding: 10px 18px;
898
+ border-radius: 10px;
899
+ border: 1px solid var(--glatam-border, #e5e5ea);
900
+ background: var(--glatam-surface, #f5f5f7);
901
+ color: var(--glatam-text, #1d1d1f);
902
+ font-weight: 500;
903
+ font-size: 0.88rem;
904
+ cursor: pointer;
905
+ transition: background 0.15s ease;
906
+ }
907
+
908
+ .btn-cancel:hover {
909
+ background: var(--glatam-border, #e5e5ea);
910
+ }
911
+ `;var F=Object.defineProperty,q=Object.getOwnPropertyDescriptor,C=(c,t,e,a)=>{for(var r=a>1?void 0:a?q(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&F(t,e,r),r};exports.GlatamSeriesConfirmationModal=class extends s.LitElement{constructor(){super(...arguments),this.open=!1,this.dateString="",this.targetRule=null}updated(t){var e;if(t.has("open")){const a=(e=this.shadowRoot)==null?void 0:e.getElementById("series-dialog");a&&(this.open?a.open||a.showModal():a.open&&a.close())}}handleDialogClose(){this.open&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}handleSelectOption(t){this.targetRule&&this.dispatchEvent(new CustomEvent("confirm-action",{detail:{actionType:t,dateString:this.dateString,targetRule:this.targetRule},bubbles:!0,composed:!0}))}render(){var e;const t=((e=this.targetRule)==null?void 0:e.description)||"Bloqueo recurrente";return s.html`
912
+ <dialog id="series-dialog" @close=${this.handleDialogClose}>
913
+ <div class="confirmation-container">
914
+ <div class="header">
915
+ <h3 class="title">¿Eliminar bloqueo recurrente?</h3>
916
+ <p class="subtitle">
917
+ Este horario pertenece a una regla con patrón de repetición semanal.
918
+ </p>
919
+ <div class="rule-badge">
920
+ <span>📅 ${this.dateString}</span> • <span>${t}</span>
921
+ </div>
922
+ </div>
923
+
924
+ <div class="options-group">
925
+ <button
926
+ type="button"
927
+ class="option-card"
928
+ @click=${()=>this.handleSelectOption("delete_instance")}
929
+ title="Anular la regla solo en esta fecha"
930
+ >
931
+ <span class="option-icon">🗓️</span>
932
+ <div class="option-text">
933
+ <span class="option-title">Eliminar / Liberar solo este día</span>
934
+ <span class="option-desc">
935
+ Libera el horario exclusivamente para el ${this.dateString}. El resto de semanas continuarán bloqueadas.
936
+ </span>
937
+ </div>
938
+ </button>
939
+
940
+ <button
941
+ type="button"
942
+ class="option-card"
943
+ @click=${()=>this.handleSelectOption("delete_series")}
944
+ title="Eliminar la regla semanal completa"
945
+ >
946
+ <span class="option-icon">🔄</span>
947
+ <div class="option-text">
948
+ <span class="option-title">Eliminar toda la serie recurrente</span>
949
+ <span class="option-desc">
950
+ Remueve la regla semanal completa, liberando este horario para todas las semanas pasadas y futuras.
951
+ </span>
952
+ </div>
953
+ </button>
954
+ </div>
955
+
956
+ <div class="actions">
957
+ <button
958
+ type="button"
959
+ class="btn-cancel"
960
+ @click=${()=>this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}
961
+ >
962
+ Cancelar
963
+ </button>
964
+ </div>
965
+ </div>
966
+ </dialog>
967
+ `}};exports.GlatamSeriesConfirmationModal.styles=U;C([i.property({type:Boolean})],exports.GlatamSeriesConfirmationModal.prototype,"open",2);C([i.property({type:String})],exports.GlatamSeriesConfirmationModal.prototype,"dateString",2);C([i.property({type:Object})],exports.GlatamSeriesConfirmationModal.prototype,"targetRule",2);exports.GlatamSeriesConfirmationModal=C([i.customElement("glatam-series-confirmation-modal")],exports.GlatamSeriesConfirmationModal);var Y=Object.defineProperty,H=Object.getOwnPropertyDescriptor,h=(c,t,e,a)=>{for(var r=a>1?void 0:a?H(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&Y(t,e,r),r};const X=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}];exports.GlatamCalendar=class extends s.LitElement{constructor(){super(...arguments),this.role="provider",this.size="medium",this.view="month",this.locale="es",this.startOfWeekDay=0,this.rules=[],this.selectedDates=[],this.selectedRange=null,this.hostTimezone="America/Bogota",this.activeTimezone="local",this.slots=X,this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null,this.enableSeriesConfirmation=!1,this.activeDate=new Date,this.localRules=[],this.darkMode=!1,this.modalOpen=!1,this.modalDateString="",this.modalStartTime="",this.modalEndTime="",this.modalIsRange=!1,this.modalExistingRule=null,this.seriesModalOpen=!1,this.seriesTargetRule=null,this.seriesTargetDateString=""}firstUpdated(){this.darkMode=window.matchMedia("(prefers-color-scheme: dark)").matches,this.localRules=[...this.rules]}willUpdate(t){t.has("rules")&&this.rules!==this.localRules&&(this.localRules=[...this.rules||[]])}updated(t){t.has("darkMode")&&this.classList.toggle("dark-mode",this.darkMode)}handlePrev(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()-1):this.view==="week"?t.setDate(t.getDate()-7):t.setDate(t.getDate()-1),this.activeDate=t}handleNext(){const t=new Date(this.activeDate);this.view==="month"?t.setMonth(t.getMonth()+1):this.view==="week"?t.setDate(t.getDate()+7):t.setDate(t.getDate()+1),this.activeDate=t}getHeaderTitle(){const t=this.view==="month"?{month:"long",year:"numeric"}:this.view==="week"?{month:"short",year:"numeric"}:{day:"numeric",month:"long",year:"numeric"};return new Intl.DateTimeFormat(this.locale,t).format(this.activeDate)}handleDaySelect(t){const{dateString:e,isBlocked:a}=t.detail;this.role==="buyer"&&a||(this.activeDate=g.parseISODate(e),this.view="day",this.dispatchEvent(new CustomEvent("date-selected",{detail:{dateString:e},bubbles:!0,composed:!0})))}handleRangeSelect(t){var O,z;const{dateString:e,start:a,end:r}=t.detail,o=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,l=g.formatISODate(new Date),d=this.minDate||(this.role==="buyer"?l:"");if(this.role==="buyer"&&(d&&e<d||this.maxDate&&e>this.maxDate))return;const m=this.getDisplaySlots(o),n=a.split(" ")[0],p=r.split(" ")[0],u=m.findIndex($=>$.start.startsWith(n)),y=m.findIndex($=>$.end.startsWith(p)),f=((O=this.slots[u])==null?void 0:O.start)||n,S=((z=this.slots[y])==null?void 0:z.end)||p;if(this.role==="buyer"){this.selectedRange={dateString:e,start:n,end:p},this.dispatchEvent(new CustomEvent("booking-selected",{detail:{dateString:e,start:n,end:p,hostStart:f,hostEnd:S},bubbles:!0,composed:!0}));return}this.openModal(e,f,S,!0,null)}handleSlotClick(t){const{dateString:e,slot:a}=t.detail,r=g.parseISODate(e),o=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,l=g.formatISODate(new Date),d=this.minDate||(this.role==="buyer"?l:"");if(this.role==="buyer"&&(a.isBlocked||d&&e<d||this.maxDate&&e>this.maxDate))return;const m=this.getDisplaySlots(o),n=a.start.split(" ")[0],p=m.findIndex(f=>f.start.startsWith(n)),u=this.slots[p]||a;if(this.role==="buyer"){this.selectedRange={dateString:e,start:a.start,end:a.end},this.dispatchEvent(new CustomEvent("booking-selected",{detail:{dateString:e,start:a.start,end:a.end,hostStart:u.start,hostEnd:u.end},bubbles:!0,composed:!0}));return}const y=this.localRules.find(f=>g.isTimeBlocked(r,u,[f]));this.openModal(e,u.start,u.end,!0,y||null)}handleBlockDayAction(){const t=g.formatISODate(this.activeDate),e=this.localRules.find(a=>g.isTimeBlocked(this.activeDate,void 0,[a]));this.openModal(t,"","",!1,e||null)}openModal(t,e,a,r,o){this.modalDateString=t,this.modalStartTime=e,this.modalEndTime=a,this.modalIsRange=r,this.modalExistingRule=o,this.modalOpen=!0}handleSaveRule(t){var l;const e=t.detail,a=this.modalExistingRule?this.modalExistingRule.id:`rule-${Date.now()}`,r={id:a,type:e.isRecurring?"weekly":"date-range",slots:e.blockAllDay?void 0:[{start:e.startTime,end:e.endTime}],daysOfWeek:e.isRecurring?e.selectedDays:void 0,startDate:e.isRecurring?void 0:e.dateString,endDate:e.isRecurring?void 0:e.dateString,description:e.title,exceptions:(l=this.modalExistingRule)==null?void 0:l.exceptions},o=this.modalExistingRule?this.localRules.map(d=>d.id===a?r:d):[...this.localRules,r];this.localRules=o,this.rules=o,this.modalOpen=!1,this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:o},bubbles:!0,composed:!0}))}handleDeleteRule(t){const e=t.detail.rule||this.localRules.find(l=>l.id===t.detail.id),a=t.detail.dateString||this.modalDateString;if(this.enableSeriesConfirmation&&e&&e.type==="weekly"){this.modalOpen=!1,this.seriesTargetRule=e,this.seriesTargetDateString=a,this.seriesModalOpen=!0;return}const{updatedRules:r,targetRule:o}=M(this.localRules,t.detail.id);if(this.localRules=r,this.rules=r,this.modalOpen=!1,o){const l={actionType:"delete_series",targetRule:o,dateString:a,updatedRules:r};this.dispatchEvent(new CustomEvent("rule-action-triggered",{detail:l,bubbles:!0,composed:!0}))}this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:r},bubbles:!0,composed:!0}))}handleConfirmSeriesAction(t){const{actionType:e,dateString:a,targetRule:r}=t.detail,{updatedRules:o,targetRule:l}=e==="delete_instance"?I(this.localRules,r.id,a):M(this.localRules,r.id);if(this.localRules=o,this.rules=o,this.seriesModalOpen=!1,l){const d={actionType:e,targetRule:l,dateString:a,updatedRules:o};this.dispatchEvent(new CustomEvent("rule-action-triggered",{detail:d,bubbles:!0,composed:!0}))}this.dispatchEvent(new CustomEvent("rules-changed",{detail:{rules:o},bubbles:!0,composed:!0}))}getDisplaySlots(t){return t===0?this.slots:this.slots.map(e=>{const a=T(e,t),r=a.dayShift>0?" (+1d)":a.dayShift<0?" (-1d)":"";return{start:a.start+r,end:a.end+r}})}render(){var m;const t=this.activeDate.getFullYear(),e=this.activeDate.getMonth(),a=g.isTimeBlocked(this.activeDate,void 0,this.localRules),r=this.activeTimezone==="local"?k(this.activeDate,this.hostTimezone,"local"):0,o=this.getDisplaySlots(r),l=n=>n.map(p=>({...p,slots:p.slots.map((u,y)=>{var f,S;return{...u,start:((f=o[y])==null?void 0:f.start)||u.start,end:((S=o[y])==null?void 0:S.end)||u.end}})})),d=((m=this.hostTimezone.split("/").pop())==null?void 0:m.replace("_"," "))||"Anfitrión";return s.html`
748
968
  <div class="calendar-header">
749
969
  <div class="nav-group">
750
970
  <button class="btn" @click=${()=>this.activeDate=new Date}>Hoy</button>
@@ -759,7 +979,7 @@
759
979
  🌐 Zona:
760
980
  <select class="timezone-select" @change=${n=>this.activeTimezone=n.target.value}>
761
981
  <option value="local" ?selected=${this.activeTimezone==="local"}>Mi Hora</option>
762
- <option value="host" ?selected=${this.activeTimezone==="host"}>Hora ${c}</option>
982
+ <option value="host" ?selected=${this.activeTimezone==="host"}>Hora ${d}</option>
763
983
  </select>
764
984
  </div>
765
985
  `:""}
@@ -774,7 +994,7 @@
774
994
  </div>
775
995
 
776
996
  <div class="calendar-body">
777
- ${this.view==="month"?s.html`<glatam-calendar-month-view .days=${y.generateMonthDays(t,e,this.localRules,this.slots,this.startOfWeekDay)} .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${this.size} .minDate=${this.minDate||(this.role==="buyer"?new Date().toISOString().split("T")[0]:"")} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth} .tileClassName=${this.tileClassName} @day-select=${this.handleDaySelect}></glatam-calendar-month-view>`:this.view==="week"?s.html`<glatam-calendar-week-view .days=${o(y.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay))} .slots=${l} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>`:s.html`<glatam-calendar-day-view .day=${o(y.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay)).find(n=>n.dateString===y.formatISODate(this.activeDate))||null} .slots=${l} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
997
+ ${this.view==="month"?s.html`<glatam-calendar-month-view .days=${g.generateMonthDays(t,e,this.localRules,this.slots,this.startOfWeekDay)} .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${this.size} .minDate=${this.minDate||(this.role==="buyer"?g.formatISODate(new Date):"")} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth} .tileClassName=${this.tileClassName} @day-select=${this.handleDaySelect}></glatam-calendar-month-view>`:this.view==="week"?s.html`<glatam-calendar-week-view .days=${l(g.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay))} .slots=${o} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} .minDate=${this.minDate||(this.role==="buyer"?g.formatISODate(new Date):"")} .maxDate=${this.maxDate} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>`:s.html`<glatam-calendar-day-view .day=${l(g.generateWeekDays(this.activeDate,this.localRules,this.slots,this.startOfWeekDay)).find(n=>n.dateString===g.formatISODate(this.activeDate))||null} .slots=${o} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} .minDate=${this.minDate||(this.role==="buyer"?g.formatISODate(new Date):"")} .maxDate=${this.maxDate} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
778
998
  </div>
779
999
 
780
1000
  <glatam-calendar-modal
@@ -782,122 +1002,98 @@
782
1002
  .isRange=${this.modalIsRange} .existingRule=${this.modalExistingRule} @save-rule=${this.handleSaveRule}
783
1003
  @delete-rule=${this.handleDeleteRule} @close=${()=>this.modalOpen=!1}
784
1004
  ></glatam-calendar-modal>
785
- `}};exports.GlatamCalendar.styles=[M,G];g([i.property({type:String})],exports.GlatamCalendar.prototype,"role",2);g([i.property({type:String,reflect:!0})],exports.GlatamCalendar.prototype,"size",2);g([i.property({type:String})],exports.GlatamCalendar.prototype,"view",2);g([i.property({type:String})],exports.GlatamCalendar.prototype,"locale",2);g([i.property({type:Number})],exports.GlatamCalendar.prototype,"startOfWeekDay",2);g([i.property({type:Array})],exports.GlatamCalendar.prototype,"rules",2);g([i.property({type:Array})],exports.GlatamCalendar.prototype,"selectedDates",2);g([i.property({type:Object})],exports.GlatamCalendar.prototype,"selectedRange",2);g([i.property({type:String})],exports.GlatamCalendar.prototype,"hostTimezone",2);g([i.property({type:String})],exports.GlatamCalendar.prototype,"activeTimezone",2);g([i.property({type:Array})],exports.GlatamCalendar.prototype,"slots",2);g([i.property({type:String})],exports.GlatamCalendar.prototype,"minDate",2);g([i.property({type:String})],exports.GlatamCalendar.prototype,"maxDate",2);g([i.property({type:Boolean})],exports.GlatamCalendar.prototype,"showNeighboringMonth",2);g([i.property({attribute:!1})],exports.GlatamCalendar.prototype,"tileClassName",2);g([i.state()],exports.GlatamCalendar.prototype,"activeDate",2);g([i.state()],exports.GlatamCalendar.prototype,"localRules",2);g([i.state()],exports.GlatamCalendar.prototype,"darkMode",2);g([i.state()],exports.GlatamCalendar.prototype,"modalOpen",2);g([i.state()],exports.GlatamCalendar.prototype,"modalDateString",2);g([i.state()],exports.GlatamCalendar.prototype,"modalStartTime",2);g([i.state()],exports.GlatamCalendar.prototype,"modalEndTime",2);g([i.state()],exports.GlatamCalendar.prototype,"modalIsRange",2);g([i.state()],exports.GlatamCalendar.prototype,"modalExistingRule",2);exports.GlatamCalendar=g([i.customElement("glatam-calendar")],exports.GlatamCalendar);var A=Object.defineProperty,L=Object.getOwnPropertyDescriptor,b=(d,t,e,a)=>{for(var r=a>1?void 0:a?L(t,e):t,l=d.length-1,o;l>=0;l--)(o=d[l])&&(r=(a?o(t,e,r):o(r))||r);return a&&r&&A(t,e,r),r};exports.GlatamCalendarMini=class extends s.LitElement{constructor(){super(...arguments),this.role="buyer",this.locale="es",this.startOfWeekDay=0,this.rules=[],this.selectedRange=null,this.size="medium",this.hostTimezone="America/Bogota",this.activeTimezone="local",this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null,this.slots=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}],this.activeDate=new Date,this.dropdownOpen=!1,this.dropdownSelectedDateString="",this.touchStartX=0,this.touchStartY=0}handlePrevMonth(t){t.stopPropagation();const e=new Date(this.activeDate);e.setMonth(e.getMonth()-1),this.activeDate=e}handleNextMonth(t){t.stopPropagation();const e=new Date(this.activeDate);e.setMonth(e.getMonth()+1),this.activeDate=e}handleTouchStart(t){t.touches&&t.touches.length>0&&(this.touchStartX=t.touches[0].clientX,this.touchStartY=t.touches[0].clientY)}handleTouchEnd(t){if(t.changedTouches&&t.changedTouches.length>0){const e=t.changedTouches[0].clientX,a=t.changedTouches[0].clientY,r=this.touchStartX-e,l=this.touchStartY-a;Math.abs(r)>50&&Math.abs(r)>Math.abs(l)&&(r>0?this.handleNextMonth(t):this.handlePrevMonth(t))}}getFormattedMonthTitle(){const t=this.activeDate.toLocaleDateString(this.locale||"es",{month:"long",year:"numeric"});return t.charAt(0).toUpperCase()+t.slice(1)}handleDropdownDaySelect(t){this.dropdownSelectedDateString=t.detail.dateString}selectDropdownSlot(t){const e={dateString:this.dropdownSelectedDateString,start:t.displayStart,end:t.displayEnd,hostStart:t.start,hostEnd:t.end};this.selectedRange={dateString:this.dropdownSelectedDateString,start:t.displayStart,end:t.displayEnd},this.dispatchEvent(new CustomEvent("booking-selected",{detail:e,bubbles:!0,composed:!0})),this.dropdownOpen=!1,this.dropdownSelectedDateString=""}render(){const t=this.selectedRange?`Reserva: ${this.selectedRange.dateString} (${this.selectedRange.start} - ${this.selectedRange.end})`:"Seleccionar Fecha y Hora",e=this.activeDate.getFullYear(),a=this.activeDate.getMonth(),r=this.dropdownSelectedDateString?new Date(this.dropdownSelectedDateString+"T00:00:00"):null,l=r&&this.activeTimezone==="local"?k(r,this.hostTimezone,"local"):0,o=r?this.slots.map(c=>{const p=y.isTimeBlocked(r,c,this.rules),n=R(c,l),h=n.dayShift>0?" (+1d)":n.dayShift<0?" (-1d)":"";return{...c,displayStart:n.start+h,displayEnd:n.end+h,isBlocked:p}}):[];return s.html`
1005
+
1006
+ <glatam-series-confirmation-modal
1007
+ .open=${this.seriesModalOpen} .dateString=${this.seriesTargetDateString} .targetRule=${this.seriesTargetRule}
1008
+ @confirm-action=${this.handleConfirmSeriesAction} @close=${()=>this.seriesModalOpen=!1}
1009
+ ></glatam-series-confirmation-modal>
1010
+ `}};exports.GlatamCalendar.styles=[E,G];h([i.property({type:String})],exports.GlatamCalendar.prototype,"role",2);h([i.property({type:String,reflect:!0})],exports.GlatamCalendar.prototype,"size",2);h([i.property({type:String})],exports.GlatamCalendar.prototype,"view",2);h([i.property({type:String})],exports.GlatamCalendar.prototype,"locale",2);h([i.property({type:Number})],exports.GlatamCalendar.prototype,"startOfWeekDay",2);h([i.property({type:Array})],exports.GlatamCalendar.prototype,"rules",2);h([i.property({type:Array})],exports.GlatamCalendar.prototype,"selectedDates",2);h([i.property({type:Object})],exports.GlatamCalendar.prototype,"selectedRange",2);h([i.property({type:String})],exports.GlatamCalendar.prototype,"hostTimezone",2);h([i.property({type:String})],exports.GlatamCalendar.prototype,"activeTimezone",2);h([i.property({type:Array})],exports.GlatamCalendar.prototype,"slots",2);h([i.property({type:String})],exports.GlatamCalendar.prototype,"minDate",2);h([i.property({type:String})],exports.GlatamCalendar.prototype,"maxDate",2);h([i.property({type:Boolean})],exports.GlatamCalendar.prototype,"showNeighboringMonth",2);h([i.property({attribute:!1})],exports.GlatamCalendar.prototype,"tileClassName",2);h([i.property({type:Boolean,attribute:"enable-series-confirmation"})],exports.GlatamCalendar.prototype,"enableSeriesConfirmation",2);h([i.state()],exports.GlatamCalendar.prototype,"activeDate",2);h([i.state()],exports.GlatamCalendar.prototype,"localRules",2);h([i.state()],exports.GlatamCalendar.prototype,"darkMode",2);h([i.state()],exports.GlatamCalendar.prototype,"modalOpen",2);h([i.state()],exports.GlatamCalendar.prototype,"modalDateString",2);h([i.state()],exports.GlatamCalendar.prototype,"modalStartTime",2);h([i.state()],exports.GlatamCalendar.prototype,"modalEndTime",2);h([i.state()],exports.GlatamCalendar.prototype,"modalIsRange",2);h([i.state()],exports.GlatamCalendar.prototype,"modalExistingRule",2);h([i.state()],exports.GlatamCalendar.prototype,"seriesModalOpen",2);h([i.state()],exports.GlatamCalendar.prototype,"seriesTargetRule",2);h([i.state()],exports.GlatamCalendar.prototype,"seriesTargetDateString",2);exports.GlatamCalendar=h([i.customElement("glatam-calendar")],exports.GlatamCalendar);const K=s.css`
1011
+ :host {
1012
+ display: inline-block;
1013
+ background: transparent;
1014
+ border: none;
1015
+ padding: 0;
1016
+ box-shadow: none;
1017
+ width: 100%;
1018
+ overflow: visible !important;
1019
+ }
1020
+
1021
+ .mini-calendar-header {
1022
+ display: flex;
1023
+ justify-content: space-between;
1024
+ align-items: center;
1025
+ padding: 4px 8px;
1026
+ margin-bottom: 8px;
1027
+ user-select: none;
1028
+ }
1029
+
1030
+ .mini-month-title {
1031
+ font-size: 0.875rem;
1032
+ font-weight: 600;
1033
+ color: var(--glatam-text);
1034
+ text-transform: capitalize;
1035
+ letter-spacing: -0.01em;
1036
+ }
1037
+
1038
+ .mini-nav-btn {
1039
+ background: transparent;
1040
+ border: 1px solid var(--glatam-border);
1041
+ border-radius: 8px;
1042
+ color: var(--glatam-text);
1043
+ width: 28px;
1044
+ height: 28px;
1045
+ display: flex;
1046
+ align-items: center;
1047
+ justify-content: center;
1048
+ cursor: pointer;
1049
+ font-size: 0.75rem;
1050
+ transition: background-color var(--glatam-transition-fast), border-color var(--glatam-transition-fast), transform var(--glatam-transition-fast);
1051
+ }
1052
+
1053
+ .mini-nav-btn:hover:not(:disabled) {
1054
+ background-color: var(--glatam-surface);
1055
+ border-color: var(--glatam-text-secondary);
1056
+ }
1057
+
1058
+ .mini-nav-btn:active:not(:disabled) {
1059
+ transform: scale(0.95);
1060
+ }
1061
+ `;var Z=Object.defineProperty,J=Object.getOwnPropertyDescriptor,b=(c,t,e,a)=>{for(var r=a>1?void 0:a?J(t,e):t,o=c.length-1,l;o>=0;o--)(l=c[o])&&(r=(a?l(t,e,r):l(r))||r);return a&&r&&Z(t,e,r),r};exports.GlatamCalendarMini=class extends s.LitElement{constructor(){super(...arguments),this.role="buyer",this.locale="es",this.startOfWeekDay=0,this.rules=[],this.selectedRange=null,this.size="medium",this.hostTimezone="America/Bogota",this.activeTimezone="local",this.minDate="",this.maxDate="",this.showNeighboringMonth=!0,this.tileClassName=null,this.slots=[{start:"09:00",end:"10:00"},{start:"10:00",end:"11:00"},{start:"11:00",end:"12:00"},{start:"12:00",end:"13:00"},{start:"13:00",end:"14:00"},{start:"14:00",end:"15:00"},{start:"15:00",end:"16:00"},{start:"16:00",end:"17:00"},{start:"17:00",end:"18:00"}],this.activeDate=new Date,this.dropdownOpen=!1,this.dropdownSelectedDateString="",this.touchStartX=0,this.touchStartY=0,this.handleOutsideClick=t=>{this.dropdownOpen&&!t.composedPath().includes(this)&&(this.dropdownOpen=!1,this.dropdownSelectedDateString="")},this.handleKeyDown=t=>{t.key==="Escape"&&this.dropdownOpen&&(this.dropdownOpen=!1,this.dropdownSelectedDateString="")}}connectedCallback(){super.connectedCallback(),window.addEventListener("click",this.handleOutsideClick),window.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){window.removeEventListener("click",this.handleOutsideClick),window.removeEventListener("keydown",this.handleKeyDown),super.disconnectedCallback()}toggleDropdown(t){t.stopPropagation(),this.dropdownOpen=!this.dropdownOpen,this.dropdownOpen||(this.dropdownSelectedDateString="")}handlePrevMonth(t){t.stopPropagation();const e=new Date(this.activeDate);e.setMonth(e.getMonth()-1),this.activeDate=e}handleNextMonth(t){t.stopPropagation();const e=new Date(this.activeDate);e.setMonth(e.getMonth()+1),this.activeDate=e}handleTouchStart(t){t.touches&&t.touches.length>0&&(this.touchStartX=t.touches[0].clientX,this.touchStartY=t.touches[0].clientY)}handleTouchEnd(t){if(t.changedTouches&&t.changedTouches.length>0){const e=this.touchStartX-t.changedTouches[0].clientX,a=this.touchStartY-t.changedTouches[0].clientY;Math.abs(e)>50&&Math.abs(e)>Math.abs(a)&&(e>0?this.handleNextMonth(t):this.handlePrevMonth(t))}}getFormattedMonthTitle(){const t=this.activeDate.toLocaleDateString(this.locale||"es",{month:"long",year:"numeric"});return t.charAt(0).toUpperCase()+t.slice(1)}handleDropdownDaySelect(t){this.dropdownSelectedDateString=t.detail.dateString}selectDropdownSlot(t){const e={dateString:this.dropdownSelectedDateString,start:t.displayStart,end:t.displayEnd,hostStart:t.start,hostEnd:t.end};this.selectedRange={dateString:this.dropdownSelectedDateString,start:t.displayStart,end:t.displayEnd},this.dispatchEvent(new CustomEvent("booking-selected",{detail:e,bubbles:!0,composed:!0})),this.dropdownOpen=!1,this.dropdownSelectedDateString=""}render(){const t=this.selectedRange?`Reserva: ${this.selectedRange.dateString} (${this.selectedRange.start} - ${this.selectedRange.end})`:"Seleccionar Fecha y Hora",e=this.activeDate.getFullYear(),a=this.activeDate.getMonth(),r=this.dropdownSelectedDateString?g.parseISODate(this.dropdownSelectedDateString):null,o=r&&this.activeTimezone==="local"?k(r,this.hostTimezone,"local"):0,l=r?this.slots.map(d=>{const m=g.isTimeBlocked(r,d,this.rules),n=T(d,o),p=n.dayShift>0?" (+1d)":n.dayShift<0?" (-1d)":"";return{...d,displayStart:n.start+p,displayEnd:n.end+p,isBlocked:m}}):[];return s.html`
786
1062
  <div class="dropdown-container">
787
- <button class="btn btn-primary dropdown-toggle" @click=${()=>this.dropdownOpen=!this.dropdownOpen}>
1063
+ <button class="btn btn-primary dropdown-toggle" @click=${this.toggleDropdown}>
788
1064
  <span>${t}</span> <span>${this.dropdownOpen?"▲":"▼"}</span>
789
1065
  </button>
790
1066
 
791
1067
  ${this.dropdownOpen?s.html`
792
- <div class="dropdown-card" style="--glatam-day-min-height: 38px;">
793
- ${this.dropdownSelectedDateString?s.html`
794
- <div style="display:flex; justify-content:space-between; align-items:center; border-bottom: 1px solid var(--glatam-border); padding-bottom:8px;">
795
- <button class="btn" style="height:28px; padding:0 8px; font-size:0.75rem;" @click=${()=>this.dropdownSelectedDateString=""}>&lt; Volver</button>
796
- <span style="font-size:0.8rem; font-weight:600; color: var(--glatam-text);">${this.dropdownSelectedDateString}</span>
797
- </div>
798
- <div class="slot-list">
799
- ${o.map(c=>s.html`
800
- <button
801
- class="slot-btn ${c.isBlocked?"blocked":""}"
802
- ?disabled=${c.isBlocked}
803
- @click=${()=>this.selectDropdownSlot(c)}
804
- >
805
- ${c.displayStart} - ${c.displayEnd} ${c.isBlocked?"(Ocupado)":""}
806
- </button>
807
- `)}
808
- </div>
809
- `:s.html`
810
- <div class="mini-calendar-header">
811
- <button
812
- type="button"
813
- class="mini-nav-btn"
814
- aria-label="Mes anterior"
815
- @click=${this.handlePrevMonth}
816
- >
817
- &lt;
818
- </button>
819
- <span class="mini-month-title">
820
- ${this.getFormattedMonthTitle()}
821
- </span>
822
- <button
823
- type="button"
824
- class="mini-nav-btn"
825
- aria-label="Mes siguiente"
826
- @click=${this.handleNextMonth}
827
- >
828
- &gt;
829
- </button>
830
- </div>
831
- <div
832
- class="mini-calendar-touch-wrapper"
833
- @touchstart=${this.handleTouchStart}
834
- @touchend=${this.handleTouchEnd}
835
- >
836
- <glatam-calendar-month-view
837
- .days=${y.generateMonthDays(e,a,this.rules,this.slots,this.startOfWeekDay)}
838
- .locale=${this.locale}
839
- .startOfWeekDay=${this.startOfWeekDay}
840
- .role=${this.role}
841
- size="small"
842
- .minDate=${this.minDate}
843
- .maxDate=${this.maxDate}
844
- .showNeighboringMonth=${this.showNeighboringMonth}
845
- .tileClassName=${this.tileClassName}
846
- @day-select=${this.handleDropdownDaySelect}
847
- ></glatam-calendar-month-view>
848
- </div>
849
- `}
1068
+ <div class="dropdown-card" style="--glatam-day-min-height: 38px;">
1069
+ ${this.dropdownSelectedDateString?s.html`
1070
+ <div style="display:flex; justify-content:space-between; align-items:center; border-bottom: 1px solid var(--glatam-border); padding-bottom:8px;">
1071
+ <button type="button" class="btn" style="height:28px; padding:0 8px; font-size:0.75rem;" @click=${()=>this.dropdownSelectedDateString=""}>&lt; Volver</button>
1072
+ <span style="font-size:0.8rem; font-weight:600; color: var(--glatam-text);">${this.dropdownSelectedDateString}</span>
1073
+ </div>
1074
+ <div class="slot-list">
1075
+ ${l.map(d=>s.html`
1076
+ <button type="button" class="slot-btn ${d.isBlocked?"blocked":""}" ?disabled=${d.isBlocked} @click=${()=>this.selectDropdownSlot(d)}>
1077
+ ${d.displayStart} - ${d.displayEnd} ${d.isBlocked?"(Ocupado)":""}
1078
+ </button>
1079
+ `)}
1080
+ </div>
1081
+ `:s.html`
1082
+ <div class="mini-calendar-header">
1083
+ <button type="button" class="mini-nav-btn" aria-label="Mes anterior" @click=${this.handlePrevMonth}>&lt;</button>
1084
+ <span class="mini-month-title">${this.getFormattedMonthTitle()}</span>
1085
+ <button type="button" class="mini-nav-btn" aria-label="Mes siguiente" @click=${this.handleNextMonth}>&gt;</button>
850
1086
  </div>
851
- `:""}
1087
+ <div class="mini-calendar-touch-wrapper" @touchstart=${this.handleTouchStart} @touchend=${this.handleTouchEnd}>
1088
+ <glatam-calendar-month-view
1089
+ .days=${g.generateMonthDays(e,a,this.rules,this.slots,this.startOfWeekDay)}
1090
+ .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${"small"}
1091
+ .minDate=${this.minDate} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth}
1092
+ .tileClassName=${this.tileClassName} @day-select=${this.handleDropdownDaySelect}
1093
+ ></glatam-calendar-month-view>
1094
+ </div>
1095
+ `}
1096
+ </div>
1097
+ `:""}
852
1098
  </div>
853
- `}};exports.GlatamCalendarMini.styles=[M,G,s.css`
854
- :host {
855
- display: inline-block;
856
- background: transparent;
857
- border: none;
858
- padding: 0;
859
- box-shadow: none;
860
- width: 100%;
861
- }
862
-
863
- .mini-calendar-header {
864
- display: flex;
865
- justify-content: space-between;
866
- align-items: center;
867
- padding: 4px 8px;
868
- margin-bottom: 8px;
869
- user-select: none;
870
- }
871
-
872
- .mini-month-title {
873
- font-size: 0.875rem;
874
- font-weight: 600;
875
- color: var(--glatam-text);
876
- text-transform: capitalize;
877
- letter-spacing: -0.01em;
878
- }
879
-
880
- .mini-nav-btn {
881
- background: transparent;
882
- border: 1px solid var(--glatam-border);
883
- border-radius: 8px;
884
- color: var(--glatam-text);
885
- width: 28px;
886
- height: 28px;
887
- display: flex;
888
- align-items: center;
889
- justify-content: center;
890
- cursor: pointer;
891
- font-size: 0.75rem;
892
- transition: background-color var(--glatam-transition-fast), border-color var(--glatam-transition-fast), transform var(--glatam-transition-fast);
893
- }
894
-
895
- .mini-nav-btn:hover:not(:disabled) {
896
- background-color: var(--glatam-surface);
897
- border-color: var(--glatam-text-secondary);
898
- }
899
-
900
- .mini-nav-btn:active:not(:disabled) {
901
- transform: scale(0.95);
902
- }
903
- `];b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"role",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"locale",2);b([i.property({type:Number})],exports.GlatamCalendarMini.prototype,"startOfWeekDay",2);b([i.property({type:Array})],exports.GlatamCalendarMini.prototype,"rules",2);b([i.property({type:Object})],exports.GlatamCalendarMini.prototype,"selectedRange",2);b([i.property({type:String,reflect:!0})],exports.GlatamCalendarMini.prototype,"size",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"hostTimezone",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"activeTimezone",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"minDate",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"maxDate",2);b([i.property({type:Boolean})],exports.GlatamCalendarMini.prototype,"showNeighboringMonth",2);b([i.property({attribute:!1})],exports.GlatamCalendarMini.prototype,"tileClassName",2);b([i.property({type:Array})],exports.GlatamCalendarMini.prototype,"slots",2);b([i.state()],exports.GlatamCalendarMini.prototype,"activeDate",2);b([i.state()],exports.GlatamCalendarMini.prototype,"dropdownOpen",2);b([i.state()],exports.GlatamCalendarMini.prototype,"dropdownSelectedDateString",2);exports.GlatamCalendarMini=b([i.customElement("glatam-calendar-mini")],exports.GlatamCalendarMini);Object.defineProperty(exports,"formatISODate",{enumerable:!0,get:()=>y.formatISODate});Object.defineProperty(exports,"isTimeBlocked",{enumerable:!0,get:()=>y.isTimeBlocked});Object.defineProperty(exports,"parseISODate",{enumerable:!0,get:()=>y.parseISODate});exports.calendarStyles=G;exports.variablesStyles=M;
1099
+ `}};exports.GlatamCalendarMini.styles=[E,G,K];b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"role",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"locale",2);b([i.property({type:Number})],exports.GlatamCalendarMini.prototype,"startOfWeekDay",2);b([i.property({type:Array})],exports.GlatamCalendarMini.prototype,"rules",2);b([i.property({type:Object})],exports.GlatamCalendarMini.prototype,"selectedRange",2);b([i.property({type:String,reflect:!0})],exports.GlatamCalendarMini.prototype,"size",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"hostTimezone",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"activeTimezone",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"minDate",2);b([i.property({type:String})],exports.GlatamCalendarMini.prototype,"maxDate",2);b([i.property({type:Boolean})],exports.GlatamCalendarMini.prototype,"showNeighboringMonth",2);b([i.property({attribute:!1})],exports.GlatamCalendarMini.prototype,"tileClassName",2);b([i.property({type:Array})],exports.GlatamCalendarMini.prototype,"slots",2);b([i.state()],exports.GlatamCalendarMini.prototype,"activeDate",2);b([i.state()],exports.GlatamCalendarMini.prototype,"dropdownOpen",2);b([i.state()],exports.GlatamCalendarMini.prototype,"dropdownSelectedDateString",2);exports.GlatamCalendarMini=b([i.customElement("glatam-calendar-mini")],exports.GlatamCalendarMini);Object.defineProperty(exports,"formatISODate",{enumerable:!0,get:()=>g.formatISODate});Object.defineProperty(exports,"isTimeBlocked",{enumerable:!0,get:()=>g.isTimeBlocked});Object.defineProperty(exports,"parseISODate",{enumerable:!0,get:()=>g.parseISODate});exports.calendarStyles=G;exports.deleteSeries=M;exports.deleteSingleInstance=I;exports.variablesStyles=E;