@mediquo/elements 0.3.1
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/README.md +22 -0
- package/dist/chunks/api-chat-client-BTBtu01T.js +1 -0
- package/dist/chunks/apple-pay-outcomes-BlytM6W-.js +1 -0
- package/dist/chunks/appointment-details-DpzdYLjq.d.ts +24 -0
- package/dist/chunks/appointment.model.d-Dy50gMPg.d.ts +171 -0
- package/dist/chunks/ca_ES-nttMFJzr.js +1 -0
- package/dist/chunks/chunk-S5RWG6G2-oTcdgk2H.js +1 -0
- package/dist/chunks/chunk-YTQUGGS3-DN-JZpgG.js +1 -0
- package/dist/chunks/class-map-Co76I6aw.js +1 -0
- package/dist/chunks/context-provider-CiMFpvDA.js +1 -0
- package/dist/chunks/context-request-event-Dfydf1ub.js +1 -0
- package/dist/chunks/custom-element-DA9Fxvxd.js +1 -0
- package/dist/chunks/de_DE-CrwfSJnS.js +1 -0
- package/dist/chunks/default-IpEn36CA.d.ts +5 -0
- package/dist/chunks/directive-2EDmOukv.js +1 -0
- package/dist/chunks/en_US-BslWF9nj.js +1 -0
- package/dist/chunks/ensure-context-root-DbdqwnKB.js +1 -0
- package/dist/chunks/exports-XZaVrMLd.js +1 -0
- package/dist/chunks/external-zAbuzxDj.js +1 -0
- package/dist/chunks/format-Cm3B1GMy.js +1 -0
- package/dist/chunks/get-organization-setup-query-BMbuRi6v.js +1 -0
- package/dist/chunks/get-patient-profile-query-C8T8DJ7z.js +1 -0
- package/dist/chunks/if-defined-BYeVdwgd.js +1 -0
- package/dist/chunks/index-B9iWdvW3.js +1 -0
- package/dist/chunks/index-BYHKNPG2.js +1 -0
- package/dist/chunks/index-Bxh8Qfwr.js +1 -0
- package/dist/chunks/isBefore-Cof0D841.js +1 -0
- package/dist/chunks/isSameDay-DPfclwIL.js +1 -0
- package/dist/chunks/lit-element-DiWJYFwC.js +1 -0
- package/dist/chunks/login-token-task-BI-L2zSV.js +1 -0
- package/dist/chunks/mq-chat-room-DuG4RuIp.d.ts +503 -0
- package/dist/chunks/mq-layout-D8Mak16a.d.ts +21 -0
- package/dist/chunks/mq-layout-DpzeL9_i.js +1 -0
- package/dist/chunks/mutation-controller-OVT8NEt6.js +1 -0
- package/dist/chunks/parseISO-jT42c8Ob.js +1 -0
- package/dist/chunks/price-Dtdjx70D.js +1 -0
- package/dist/chunks/price.d-CwLosdAN.d.ts +10 -0
- package/dist/chunks/professional-overview-mO3tuMuH.d.ts +25 -0
- package/dist/chunks/property-scuRaFcM.js +1 -0
- package/dist/chunks/provide-CfT7g_Zi.js +1 -0
- package/dist/chunks/pt_PT-CFbbWowX.js +1 -0
- package/dist/chunks/query-CeeutdfT.js +1 -0
- package/dist/chunks/query-QJ1INUTG.js +1 -0
- package/dist/chunks/refund-cancel-policy-Bm5djPds.js +1 -0
- package/dist/chunks/runtime-Bg1WXVCx.js +1 -0
- package/dist/chunks/schemas.d-BEA8Pl6w.d.ts +44 -0
- package/dist/chunks/state-LQivXIgA.js +1 -0
- package/dist/chunks/style-map-CIdqdn7C.js +1 -0
- package/dist/chunks/task-Bj8p7kJX.js +1 -0
- package/dist/chunks/telemetry-client-CKCb9Gnf.js +1 -0
- package/dist/env.d.ts +21 -0
- package/dist/env.js +1 -0
- package/dist/events.d.ts +141 -0
- package/dist/events.js +1 -0
- package/dist/i18n.d.ts +11 -0
- package/dist/i18n.js +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -0
- package/dist/mq-apple-pay-checkout.d.ts +82 -0
- package/dist/mq-apple-pay-checkout.js +1 -0
- package/dist/mq-appointment-checkout.d.ts +55 -0
- package/dist/mq-appointment-checkout.js +1 -0
- package/dist/mq-chat-room.d.ts +20 -0
- package/dist/mq-chat-room.js +1 -0
- package/dist/mq-checkout.d.ts +108 -0
- package/dist/mq-checkout.js +1 -0
- package/dist/mq-google-pay-checkout.d.ts +117 -0
- package/dist/mq-google-pay-checkout.js +1 -0
- package/dist/mq-immediate-videocall-checkout.d.ts +47 -0
- package/dist/mq-immediate-videocall-checkout.js +1 -0
- package/dist/mq-my-appointments.d.ts +602 -0
- package/dist/mq-my-appointments.js +1 -0
- package/dist/mq-query-client-provider.d.ts +17 -0
- package/dist/mq-query-client-provider.js +1 -0
- package/dist/mq-schedule-success.d.ts +84 -0
- package/dist/mq-schedule-success.js +4 -0
- package/dist/mq-schedule.d.ts +1013 -0
- package/dist/mq-schedule.js +1 -0
- package/dist/mq-socket-provider.d.ts +103 -0
- package/dist/mq-socket-provider.js +1 -0
- package/dist/mq-support-chat.d.ts +86 -0
- package/dist/mq-support-chat.js +1 -0
- package/dist/mq-theme-provider.d.ts +34 -0
- package/dist/mq-theme-provider.js +1 -0
- package/dist/mq-videocall.d.ts +151 -0
- package/dist/mq-videocall.js +1 -0
- package/dist/theme.d.ts +200 -0
- package/dist/theme.js +1 -0
- package/dist/ui/back-link.d.ts +21 -0
- package/dist/ui/back-link.js +1 -0
- package/dist/ui/icons/alert-circle-icon.d.ts +6 -0
- package/dist/ui/icons/alert-circle-icon.js +1 -0
- package/dist/ui/icons/annotation-question-icon.d.ts +6 -0
- package/dist/ui/icons/annotation-question-icon.js +1 -0
- package/dist/ui/icons/briefcase-icon.d.ts +6 -0
- package/dist/ui/icons/briefcase-icon.js +1 -0
- package/dist/ui/icons/calendar-icon.d.ts +6 -0
- package/dist/ui/icons/calendar-icon.js +1 -0
- package/dist/ui/icons/chat-bubble-icon.d.ts +6 -0
- package/dist/ui/icons/chat-bubble-icon.js +1 -0
- package/dist/ui/icons/check-circle-icon.d.ts +5 -0
- package/dist/ui/icons/check-circle-icon.js +1 -0
- package/dist/ui/icons/check-double-icon.d.ts +6 -0
- package/dist/ui/icons/check-double-icon.js +1 -0
- package/dist/ui/icons/check-icon.d.ts +6 -0
- package/dist/ui/icons/check-icon.js +1 -0
- package/dist/ui/icons/chevron-down-icon.d.ts +6 -0
- package/dist/ui/icons/chevron-down-icon.js +1 -0
- package/dist/ui/icons/chevron-left-icon.d.ts +6 -0
- package/dist/ui/icons/chevron-left-icon.js +1 -0
- package/dist/ui/icons/chevron-right-icon.d.ts +6 -0
- package/dist/ui/icons/chevron-right-icon.js +1 -0
- package/dist/ui/icons/clock-icon.d.ts +6 -0
- package/dist/ui/icons/clock-icon.js +1 -0
- package/dist/ui/icons/download-icon.d.ts +6 -0
- package/dist/ui/icons/download-icon.js +1 -0
- package/dist/ui/icons/file-icon.d.ts +6 -0
- package/dist/ui/icons/file-icon.js +1 -0
- package/dist/ui/icons/heartbeat-icon.d.ts +5 -0
- package/dist/ui/icons/heartbeat-icon.js +1 -0
- package/dist/ui/icons/info-circle-outine-icon.d.ts +6 -0
- package/dist/ui/icons/info-circle-outine-icon.js +1 -0
- package/dist/ui/icons/message-bubble-icon.d.ts +6 -0
- package/dist/ui/icons/message-bubble-icon.js +1 -0
- package/dist/ui/icons/message-square-icon.d.ts +6 -0
- package/dist/ui/icons/message-square-icon.js +1 -0
- package/dist/ui/icons/mic-icon.d.ts +6 -0
- package/dist/ui/icons/mic-icon.js +1 -0
- package/dist/ui/icons/mic-off-icon.d.ts +6 -0
- package/dist/ui/icons/mic-off-icon.js +1 -0
- package/dist/ui/icons/phone-icon.d.ts +6 -0
- package/dist/ui/icons/phone-icon.js +1 -0
- package/dist/ui/icons/spinner-icon.d.ts +6 -0
- package/dist/ui/icons/spinner-icon.js +1 -0
- package/dist/ui/icons/tag-icon.d.ts +6 -0
- package/dist/ui/icons/tag-icon.js +1 -0
- package/dist/ui/icons/time-left-icon.d.ts +5 -0
- package/dist/ui/icons/time-left-icon.js +1 -0
- package/dist/ui/icons/types.d.ts +9 -0
- package/dist/ui/icons/types.js +1 -0
- package/dist/ui/icons/upload-icon.d.ts +6 -0
- package/dist/ui/icons/upload-icon.js +1 -0
- package/dist/ui/icons/video-icon.d.ts +6 -0
- package/dist/ui/icons/video-icon.js +1 -0
- package/dist/ui/icons/video-off-icon.d.ts +6 -0
- package/dist/ui/icons/video-off-icon.js +1 -0
- package/dist/ui/icons/x-icon.d.ts +6 -0
- package/dist/ui/icons/x-icon.js +1 -0
- package/dist/ui/mq-avatar.d.ts +37 -0
- package/dist/ui/mq-avatar.js +1 -0
- package/dist/ui/mq-button.d.ts +34 -0
- package/dist/ui/mq-button.js +1 -0
- package/dist/ui/mq-calendar.d.ts +66 -0
- package/dist/ui/mq-calendar.js +1 -0
- package/dist/ui/mq-callout.d.ts +23 -0
- package/dist/ui/mq-callout.js +1 -0
- package/dist/ui/mq-card.d.ts +18 -0
- package/dist/ui/mq-card.js +1 -0
- package/dist/ui/mq-checkbox.d.ts +41 -0
- package/dist/ui/mq-checkbox.js +1 -0
- package/dist/ui/mq-clamped-text.d.ts +46 -0
- package/dist/ui/mq-clamped-text.js +1 -0
- package/dist/ui/mq-dialog.d.ts +53 -0
- package/dist/ui/mq-dialog.js +1 -0
- package/dist/ui/mq-floating-bubble.d.ts +42 -0
- package/dist/ui/mq-floating-bubble.js +1 -0
- package/dist/ui/mq-input.d.ts +41 -0
- package/dist/ui/mq-input.js +1 -0
- package/dist/ui/mq-rating.d.ts +30 -0
- package/dist/ui/mq-rating.js +1 -0
- package/dist/ui/mq-select.d.ts +83 -0
- package/dist/ui/mq-select.js +1 -0
- package/dist/ui/mq-skeleton.d.ts +18 -0
- package/dist/ui/mq-skeleton.js +1 -0
- package/dist/ui/mq-tabs.d.ts +56 -0
- package/dist/ui/mq-tabs.js +1 -0
- package/dist/ui/mq-text-button.d.ts +39 -0
- package/dist/ui/mq-text-button.js +1 -0
- package/dist/ui/mq-textarea.d.ts +38 -0
- package/dist/ui/mq-textarea.js +1 -0
- package/dist/ui/mq-time-slot-picker.d.ts +84 -0
- package/dist/ui/mq-time-slot-picker.js +1 -0
- package/dist/ui/mq-toast.d.ts +111 -0
- package/dist/ui/mq-toast.js +1 -0
- package/dist/ui/mq-unread-badge.d.ts +15 -0
- package/dist/ui/mq-unread-badge.js +1 -0
- package/package.json +176 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,t}from"./custom-element-DA9Fxvxd.js";import{e as s}from"./provide-CfT7g_Zi.js";import{Q as o,c as i,s as a,M as r}from"./mutation-controller-OVT8NEt6.js";import{l as n}from"./parseISO-jT42c8Ob.js";import{m as l,s as d}from"./runtime-Bg1WXVCx.js";import{i as c,a as m,x as h,E as p}from"./lit-element-DiWJYFwC.js";import{n as g}from"./property-scuRaFcM.js";import{r as u}from"./state-LQivXIgA.js";import{n as v}from"./context-provider-CiMFpvDA.js";import{tokens as y}from"../theme.js";import{a as b,M as f}from"./api-chat-client-BTBtu01T.js";import{xIcon as w}from"../ui/icons/x-icon.js";import"../ui/mq-avatar.js";import"../ui/mq-button.js";import"../ui/mq-skeleton.js";import{o as x}from"./if-defined-BYeVdwgd.js";import{chevronLeftIcon as k}from"../ui/icons/chevron-left-icon.js";import{e as $}from"./query-CeeutdfT.js";import{l as I,z}from"./external-zAbuzxDj.js";import{DownloadFileEvent as C}from"../events.js";import{checkDoubleIcon as T}from"../ui/icons/check-double-icon.js";import{checkIcon as D}from"../ui/icons/check-icon.js";import{getLocale as M}from"../i18n.js";import{S as q,a as S}from"./chunk-YTQUGGS3-DN-JZpgG.js";import{Q as j}from"./query-QJ1INUTG.js";import{e as P}from"./class-map-Co76I6aw.js";const _=v("apiKey"),A=v("token"),E=v("professionalHash"),R=v("roomId"),U=v("consultationId"),B=v("consultationType");class MqChatRoomCloseEvent extends Event{static{this.eventName="mq-chat-room-close"}constructor(){super(MqChatRoomCloseEvent.eventName,{bubbles:!0,composed:!0})}}class MqChatRoomProfileEvent extends Event{static{this.eventName="mq-chat-room-profile"}constructor(){super(MqChatRoomProfileEvent.eventName,{bubbles:!0,composed:!0})}}function H(e,t,s){return{queryKey:["professionals",t.hash],queryFn:()=>e.professionals.getProfessional(t),staleTime:0,...s}}const N=c`header{padding:var(--size-3) var(--size-4);background-color:var(--color-background-primary);display:flex;justify-content:space-between;gap:var(--size-1)}.left-side{display:flex;flex:1;min-width:0;align-items:center;gap:var(--size-3)}.left-side mq-avatar{flex-shrink:0}.info{min-width:0}.ghost-btn{text-align:left;background:0 0;border:none;padding:0;cursor:pointer}.right-side{display:flex;align-items:center}.name{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-bold);margin:0;color:var(--color-background);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.specialty{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);margin:0;color:var(--color-white);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.name-skeleton{margin-bottom:var(--size-1)}.profile-title{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-medium);margin:0;color:var(--color-white)}`;let K=class ChatRoomHeader extends m{constructor(){super(...arguments),this.hideCloseButton=!1,this.getProfessionalQuery=new o(this,()=>H(b,{hash:this.professionalHash}))}static{this.styles=N}handleClose(){this.dispatchEvent(new MqChatRoomCloseEvent)}handleClickProfile(){this.dispatchEvent(new MqChatRoomProfileEvent)}renderProfile(){return h`<div class="left-side"><mq-button type="button" size="icon-md" variant="ghost-inverted" @click="${()=>{this.dispatchEvent(new CustomEvent("goto-chat",{bubbles:!0,composed:!0}))}}">${k({size:24})}</mq-button><p class="profile-title">${l("Perfil de profesional")}</p></div>`}renderChat(){return h`${this.getProfessionalQuery.render({complete:e=>h`<button type="button" class="left-side ghost-btn" @click="${this.handleClickProfile}"><mq-avatar src="${x(e.avatar??void 0)}" alt="User Avatar" fallback="John Doe" size="sm"></mq-avatar><div class="info"><p class="name">${e.name}</p><p class="specialty">${e.title}</p></div></button>`,pending:()=>h`<div class="left-side"><mq-skeleton width="45px" height="45px" border-radius="full"></mq-skeleton><div><mq-skeleton class="name-skeleton" height="14px" width="120px"></mq-skeleton><mq-skeleton height="14px" width="100px"></mq-skeleton></div></div>`})}`}render(){return h`<header>${"profile"===this.view?this.renderProfile():this.renderChat()}<div class="right-side">${this.hideCloseButton?p:h`<mq-button type="button" size="icon-md" variant="ghost-inverted" @click="${this.handleClose}">${w({size:24})}</mq-button>`}</div></header>`}};e([g({type:String})],K.prototype,"professionalHash",void 0),e([g({type:Boolean})],K.prototype,"hideCloseButton",void 0),e([g({type:String})],K.prototype,"view",void 0),K=e([n(),t("chat-room-header")],K);const L=/(https?:\/\/[^\s,;:!)\]}\]]+|www\.[^\s,;:!)\]}\]]+|[a-zA-Z0-9][-a-zA-Z0-9]*(?:\.[a-zA-Z0-9][-a-zA-Z0-9]*)+(?:\/[^\s,;:!)\]}\]]*|(?:\?|#|&)[^\s,;:!)\]}\]]*)?)/gi;function F(e){return e.split(L).map((e,t)=>{if(t%2==1){const t=e.startsWith("http")?e:`https://${e}`;return h`<a href="${t}" target="_blank" rel="noopener noreferrer" class="message-link">${e}</a>`}return e})}let O=class TextMessageBubble extends m{static{this.styles=[c`:host{display:block}.message-bubble{padding:var(--size-2_5) var(--size-4);border-radius:var(--border-radius-lg);word-wrap:break-word;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal)}.message-bubble.received{background-color:var(--chat-received-message-background);color:var(--chat-received-message-foreground);border-bottom-left-radius:0}.message-bubble.sent{background-color:var(--chat-sent-message-background);color:var(--chat-sent-message-foreground);border-bottom-right-radius:0}.message-content{white-space:pre-wrap}.message-paragraph{margin:0 0 var(--size-3) 0}.message-paragraph:last-child{margin-bottom:0}.message-bubble.received .message-content a.message-link,.message-bubble.sent .message-content a.message-link{color:var(--color-primary-link-default);text-decoration:underline}.message-bubble.received .message-content a.message-link:hover,.message-bubble.sent .message-content a.message-link:hover{opacity:.8}`]}formatMessageContent(e){const t=e.split("\n\n").filter(e=>e.trim());if(t.length<=1)return h`<div class="message-content">${F(e)}</div>`;const s=t.map(e=>h`<div class="message-paragraph">${F(e.trim())}</div>`);return h`<div class="message-content">${s}</div>`}render(){return h`<div class="message-bubble ${this.kind}">${this.formatMessageContent(this.message.string)}</div>`}};e([g({type:Object})],O.prototype,"message",void 0),e([g({type:String})],O.prototype,"kind",void 0),O=e([t("text-message-bubble")],O);const Q=c`:host{display:block}.message-bubble{padding:var(--size-2);border-radius:var(--border-radius-lg);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);overflow:hidden}.message-bubble.received{background-color:var(--chat-received-message-background);border-bottom-left-radius:0}.message-bubble.sent{background-color:var(--chat-sent-message-background);border-bottom-right-radius:0}.image-content{display:block;width:229px;height:229px;object-fit:cover;border-radius:var(--border-radius-md)}.image-placeholder{display:flex;align-items:center;justify-content:center;width:100%;max-width:300px;height:200px;background-color:var(--color-gray-light);border-radius:var(--border-radius-md);color:var(--chat-sent-message-foreground);font-size:var(--text-sm)}.image-content{cursor:pointer;transition:opacity .2s ease}.image-content:hover{opacity:.9}.preview-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:var(--dialog-underlay);display:flex;align-items:center;justify-content:center;z-index:1000;cursor:pointer;opacity:0;transition:opacity var(--dialog-transition-duration) ease}.preview-overlay.open{opacity:1}.preview-image{position:fixed;z-index:1000;inset:var(--mq-safe-top,0) var(--mq-safe-right,0) var(--mq-safe-bottom,0) var(--mq-safe-left,0);max-width:calc(100% - var(--mq-safe-left,4px) - var(--mq-safe-right,4px));max-height:calc(100% - var(--mq-safe-top,4px) - var(--mq-safe-bottom,4px));margin:auto;object-fit:contain;cursor:default;box-shadow:var(--dialog-shadow);transform:scale(.95);transition:transform var(--dialog-transition-duration) ease}.preview-overlay.open .preview-image{transform:scale(1)}.preview-close{z-index:1001;display:inline-flex;align-items:center;justify-content:center;height:var(--size-10);width:var(--size-10);position:absolute;top:var(--mq-safe-top,4px);right:var(--mq-safe-right,4px);background:rgba(255,255,255,.3);border:none;color:var(--color-neutrals-text-default);font-size:var(--text-xl);padding:var(--size-2) var(--size-3);border-radius:var(--border-radius-md);cursor:pointer;transition:background var(--dialog-transition-duration) ease}.preview-close:hover{background:var(--dialog-close-hover-bg)}`;let V=class ImageMessageBubble extends m{constructor(){super(...arguments),this.showPreview=!1,this.isPreviewRendered=!1,this.isPreviewActive=!1,this.closeTimer=null}static{this.styles=Q}handleImageError(e){const t=e.target;t.style.display="none";const s=t.nextElementSibling;s&&(s.style.display="flex")}handleImageLoad(e){const t=e.target.nextElementSibling;t&&(t.style.display="none")}handleImageClick(){this.showPreview=!0,this.isPreviewRendered=!0,this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.isPreviewActive=!0})})}handleImageKeyDown(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleImageClick())}handleClosePreview(e){e&&e.stopPropagation(),this.isPreviewActive=!1,this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=window.setTimeout(()=>{this.isPreviewRendered=!1,this.showPreview=!1,this.closeTimer=null},200)}handleOverlayClick(e){e.target===e.currentTarget&&this.handleClosePreview()}handleOverlayKeyDown(e){"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),this.handleClosePreview())}handleKeyDown(e){"Escape"===e.key&&this.showPreview&&(e.preventDefault(),this.handleClosePreview())}handlePreviewImageKeyDown(e){e.stopPropagation()}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleKeyDown.bind(this))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleKeyDown.bind(this)),this.closeTimer&&(window.clearTimeout(this.closeTimer),this.closeTimer=null)}render(){const e=this.message.attachment.signed_url??this.message.attachment.url;return h`<div class="message-bubble ${this.kind}"><img class="image-content" src="${e}" width="229" height="229" alt="Shared attachment" @error="${this.handleImageError}" @load="${this.handleImageLoad}" @click="${this.handleImageClick}" @keydown="${this.handleImageKeyDown}" tabindex="0"><div class="image-placeholder" style="display:none">Image unavailable</div></div>${this.showPreview&&this.isPreviewRendered?h`<div class="preview-overlay ${this.isPreviewActive?"open":""}" @click="${this.handleOverlayClick}" @keydown="${this.handleOverlayKeyDown}" tabindex="0"><button class="preview-close" @click="${this.handleClosePreview}" aria-label="Close preview">${w({size:24})}</button> <img class="preview-image" src="${e}" alt="Shared attachment preview" @click="${e=>e.stopPropagation()}" @keydown="${this.handlePreviewImageKeyDown}" tabindex="0"></div>`:""}`}};e([g({type:Object})],V.prototype,"message",void 0),e([g({type:String})],V.prototype,"kind",void 0),e([i({context:A})],V.prototype,"token",void 0),e([u()],V.prototype,"showPreview",void 0),e([u()],V.prototype,"isPreviewRendered",void 0),e([u()],V.prototype,"isPreviewActive",void 0),V=e([t("image-message-bubble")],V);const Y=c`:host{background-color:var(--chat-system-message-background);color:var(--chat-system-message-foreground);display:block;padding:var(--size-2_5) var(--size-4);border-radius:var(--border-radius-lg);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal)}a.message-link{color:var(--color-primary-link-default);text-decoration:underline}a.message-link:hover{opacity:.8}`;let Z=class SystemMessageBubble extends m{static{this.styles=Y}render(){return h`<div class="system-message-bubble">${F(this.message.string)}</div>`}};e([g({type:Object})],Z.prototype,"message",void 0),Z=e([t("system-message-bubble")],Z);const J=c`:host{display:block}.message-bubble{display:inline-block;padding:var(--size-2_5) var(--size-4);border-radius:var(--border-radius-lg);word-wrap:break-word;font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);text-decoration:underline;color:var(--color-primary-link-default);border:none;cursor:pointer;text-align:left}.message-bubble:hover:not(:disabled){opacity:.8}.message-bubble:disabled{opacity:.5;cursor:not-allowed}.message-bubble.received{background-color:var(--chat-received-message-background);border-bottom-left-radius:0}.message-bubble.sent{background-color:var(--chat-sent-message-background);border-bottom-right-radius:0}.message-content{white-space:pre-wrap}.message-paragraph{margin:0 0 var(--size-3) 0}.message-paragraph:last-child{margin-bottom:0}`;let G=class FileMessageBubble extends m{constructor(){super(...arguments),this.isDownloading=!1}static{this.styles=J}formatMessageContent(e){const t=e.split("\n\n").filter(e=>e.trim());if(t.length<=1)return h`<div class="message-content">${e}</div>`;const s=t.map(e=>h`<div class="message-paragraph">${e.trim()}</div>`);return h`<div class="message-content">${s}</div>`}async handleDownload(){if(this.isDownloading)return;const e=this.message.attachment.url;try{this.isDownloading=!0;const t=await fetch(e,{headers:{Authorization:`Bearer ${this.token}`}});if(!t.ok)throw new Error(`Failed to fetch file: ${t.statusText}`);const s=await t.blob(),o=new FileReader;o.onloadend=()=>{const e=o.result,t=new C({url:e,filename:this.message.attachment.file_name});this.dispatchEvent(t),this.isDownloading=!1},o.onerror=()=>{I.error("Error reading file as data URL"),this.isDownloading=!1},o.readAsDataURL(s)}catch(e){I.error("Error downloading file:",e),this.isDownloading=!1}}render(){return h`<button type="button" @click="${this.handleDownload}" class="message-bubble ${this.kind}" ?disabled="${this.isDownloading}">${this.formatMessageContent(this.message.attachment.file_name)}</button>`}};e([g({type:Object})],G.prototype,"message",void 0),e([g({type:String})],G.prototype,"kind",void 0),e([i({context:A})],G.prototype,"token",void 0),e([u()],G.prototype,"isDownloading",void 0),G=e([t("file-message-bubble")],G);var W=z.enum(["ordinary","system"]).enum;let X=class MessageBubble extends m{constructor(){super(...arguments),this.showTimestamp=!0}static{this.styles=[c`:host{display:block}.timestamp{font-family:var(--font-body);font-size:var(--text-xs);color:var(--color-gray-medium);font-weight:var(--font-weight-normal);text-align:left;display:flex;align-items:center;gap:var(--size-1)}.timestamp.sent{text-align:right;justify-content:flex-end}.status-icon{width:12px;height:12px}.status-icon.read{color:var(--color-primary)}`]}formatTimestamp(e){if(!e)return"";try{const t=new Date(e);return new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}catch{return e}}renderStatusIcon(){switch(this.message.status){case f.Sent:return D({size:12,color:"currentColor"});case f.Received:return T({size:12,color:"currentColor"});case f.Read:return T({size:12,color:"currentColor",className:"read"});default:return null}}renderBubbleContent(){switch(this.message.type){case"image":return h`<image-message-bubble .message="${this.message}" .kind="${this.kind}"></image-message-bubble>`;case"file":return h`<file-message-bubble .message="${this.message}" .kind="${this.kind}"></file-message-bubble>`;default:return h`<text-message-bubble .message="${this.message}" .kind="${this.kind}"></text-message-bubble>`}}render(){if(this.message.senderType===W.system)return h`<system-message-bubble .message="${this.message}"></system-message-bubble>`;const e=this.message.createdAt?new Date(this.message.createdAt):this.message.time?new Date(this.message.time):null;return h`${this.renderBubbleContent()} ${this.showTimestamp&&e?h`<div class="timestamp ${this.kind}">${this.formatTimestamp(e.toISOString())} ${"sent"===this.kind?h`<span class="status-icon ${this.message.status===f.Read?"read":""}">${this.renderStatusIcon()}</span>`:""}</div>`:""}`}};e([g({type:String})],X.prototype,"kind",void 0),e([g({type:Object})],X.prototype,"message",void 0),e([g({type:Boolean})],X.prototype,"showTimestamp",void 0),X=e([t("message-bubble")],X);let ee=class DateBanner extends m{constructor(){super(...arguments),this.date=""}static{this.styles=[y,c`:host{display:block;margin-bottom:var(--size-2)}.date-banner{display:flex;align-items:center;justify-content:center;position:relative}.date-text{background-color:var(--color-gray-light);color:var(--color-gray-darker);font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);padding:var(--size-1) var(--size-2);border-radius:var(--border-radius-2xl);white-space:nowrap}`]}formatDate(e){const t=M().replace("_","-"),s=new Date(e),o=new Date,i=new Date(o);i.setDate(i.getDate()-1);const a=new Date(s.getFullYear(),s.getMonth(),s.getDate()),r=new Date(o.getFullYear(),o.getMonth(),o.getDate()),n=new Date(i.getFullYear(),i.getMonth(),i.getDate());return a.getTime()===r.getTime()?l("Hoy"):a.getTime()===n.getTime()?l("Ayer"):s.toLocaleDateString(t,{dateStyle:"medium"})}render(){return h`<div class="date-banner"><span class="date-text">${this.formatDate(this.date)}</span></div>`}};function te(e){return e.createdAt?new Date(e.createdAt):e.time?new Date(e.time):new Date}e([g({type:String})],ee.prototype,"date",void 0),ee=e([n(),t("date-banner")],ee);let se=class MessagesList extends m{constructor(){super(...arguments),this.messages=[]}static{this.styles=[y,c`:host{display:block;width:100%;height:100%;overflow-y:auto;overflow-x:hidden}.messages-container{display:flex;flex-direction:column;padding:var(--size-4);gap:var(--size-1);background-color:var(--color-white);padding-bottom:var(--size-4)}.message-wrapper{display:flex;width:100%}.message-wrapper.received{justify-content:flex-start}.message-wrapper.sent{justify-content:flex-end}.message-wrapper.system{justify-content:center}message-bubble{max-width:70%}`]}scrollToBottom(){requestAnimationFrame(()=>{const e=this.messagesContainerEnd;e&&e.scrollIntoView({behavior:"instant",block:"end"})})}shouldShowMessageTimestamp(e,t){if(e.senderType===W.system)return!1;if(!t)return!0;if(t.senderType!==e.senderType)return!0;if(t.senderType===W.ordinary&&e.senderType===W.ordinary&&t.fromUserHash!==e.fromUserHash)return!0;return(te(t).getTime()-te(e).getTime())/6e4>1}groupMessagesByDate(e){const t=[];let s=null;return e.forEach((o,i)=>{const a=te(o),r=a?.toDateString();r!==s&&(t.push({type:"date",data:a.toDateString()}),s=r??null);const n=e[i+1],l=this.shouldShowMessageTimestamp(o,n);t.push({type:"message",data:o,showTimestamp:l})}),t}firstUpdated(){this.scrollToBottom()}willUpdate(e){e.has("messages")&&this.scrollToBottom()}render(){const e=this.groupMessagesByDate(this.messages),t=e.map((t,s)=>{if("date"===t.type)return h`<date-banner .date="${t.data}"></date-banner>`;const o=this.professionalHash!==t.data.fromUserHash,i=t.data.senderType===W.system?"system":o?"sent":"received";return h`<div class="message-wrapper ${i}"><message-bubble .message="${t.data}" .kind="${i}" .showTimestamp="${t.showTimestamp||"date"===e[s+1]?.type}"></message-bubble></div>`});return h`<div class="messages-container">${t}<div class="messages-container-end"></div></div>`}};e([g({type:Array})],se.prototype,"messages",void 0),e([g({type:String})],se.prototype,"professionalHash",void 0),e([$(".messages-container-end")],se.prototype,"messagesContainerEnd",void 0),se=e([t("messages-list")],se);let oe=class MessageBubbleSkeleton extends m{constructor(){super(...arguments),this.variant="patient",this.height="md",this.showTimestamp=!0}static{this.styles=[c`:host{display:block}.message-bubble{padding:var(--size-4);border-radius:var(--border-radius-lg);margin-bottom:var(--size-1);position:relative;overflow:hidden}.message-bubble.doctor{background-color:var(--color-gray-light);border-bottom-left-radius:0}.message-bubble.patient{background-color:var(--color-background-primary-light);border-bottom-right-radius:0}:host([height=sm]) .message-bubble{height:var(--size-8)}:host([height=md]) .message-bubble{height:var(--size-12)}`]}render(){return h`<div class="message-bubble ${this.variant}"></div>${this.showTimestamp?h`<div class="timestamp-skeleton ${this.variant}"></div>`:""}`}};e([g({type:String})],oe.prototype,"variant",void 0),e([g({type:String})],oe.prototype,"height",void 0),e([g({type:Boolean})],oe.prototype,"showTimestamp",void 0),oe=e([t("message-bubble-skeleton")],oe);let ie=class MessagesSkeleton extends m{constructor(){super(...arguments),this.messageCount=6}static{this.styles=[y,c`:host{display:block;width:100%;height:100%;overflow:hidden}.messages-container{display:flex;flex-direction:column;padding:var(--size-4);gap:var(--size-3);max-width:100%;height:100%;background-color:var(--color-white)}.message-wrapper{display:flex;width:100%}.message-wrapper.doctor{justify-content:flex-start}.message-wrapper.patient{justify-content:flex-end}message-bubble-skeleton{max-width:85%;min-width:60%;width:100%}`]}getSkeletonHeight(e){const t=["sm","md","sm","md","sm","md"];return t[e%t.length]}getSkeletonVariant(e){const t=["doctor","patient","doctor","doctor","patient","doctor","patient"];return t[e%t.length]}renderSkeletonMessages(){return Array.from({length:this.messageCount},(e,t)=>{const s=this.getSkeletonVariant(t),o=this.getSkeletonHeight(t);return h`<div class="message-wrapper ${s}"><message-bubble-skeleton variant="${s}" height="${o}" ?showTimestamp="${t===this.messageCount-1||Math.random()>.7}"></message-bubble-skeleton></div>`})}render(){return h`<div class="messages-container">${this.renderSkeletonMessages()}</div>`}};e([g({type:Number})],ie.prototype,"messageCount",void 0),ie=e([t("messages-skeleton")],ie);var ae=class{constructor(e,t){this.host=e,this.listeners=[],this.host.addController(this),this.socketContext=new a(this.host,{context:q,subscribe:!0,callback:e=>{if(e&&(this.socket=e,t?.listeners)){this.listeners=t.listeners;for(const e of this.listeners)this.socket?.on(e.eventName,e.callback)}}})}hostConnected(){}hostDisconnected(){for(const e of this.listeners)this.socket?.off(e.eventName,e.callback)}};function re(e,t){return{queryKey:["rooms",t.roomId],queryFn:()=>e.rooms.getRoomMessages(t),staleTime:0}}class OptimisticUpdatesController{constructor(e){this.host=e,this.queryClientContext=new a(this.host,{context:j,subscribe:!0,callback:e=>{e&&(this.queryClient=e)}}),this.host.addController(this)}hostConnected(){}appendMessageToRoom(e,t){const s=re(b,{roomId:t}).queryKey;this.queryClient?.setQueriesData({queryKey:s,exact:!0},t=>[...t??[],e])}deleteMessage(e,t){if(!this.queryClient)return;const s=re(b,{roomId:t}).queryKey;this.queryClient.setQueryData(s,t=>(t??[]).map(t=>t.messageId===e?{...t,deletedAt:(new Date).toISOString(),string:l("Este mensaje fue eliminado")}:t))}updateMessageStatus({messageId:e,status:t,roomId:s}){if(!this.queryClient)return;const o=re(b,{roomId:s}).queryKey;this.queryClient.setQueryData(o,s=>(s??[]).map(s=>s.messageId===e?{...s,status:t}:s))}}let ne=class ChatRoomMessages extends m{constructor(){super(...arguments),this.getRoomMessagesQuery=new o(this,()=>re(b,{roomId:this.roomId})),this.optimisticUpdatesController=new OptimisticUpdatesController(this),this.onMessageReceived=e=>{if(e.roomId!==this.roomId)return;const t=function(e){const t={roomId:"string"==typeof e.roomId?Number.parseInt(e.roomId,10):e.roomId,messageId:e.messageId,status:e.status,senderType:e.senderType,fromUserHash:e.fromUserHash,time:e.time,createdAt:e.time?new Date(e.time).toISOString():null,deletedAt:null};switch(e.type){case"string":return{...t,type:"string",string:e.string,auto:e.auto?1:0,attachment:null};case"image":return{...t,type:"image",string:e.fileName||"",auto:0,attachment:{file_name:e.fileName,file_size:e.fileSize,url:e.imageUrl,type:"uncategorized",meta:{duration:0},signed_url:e.imageUrl}};case"file":return{...t,type:"file",string:e.fileName||"",auto:0,attachment:{file_name:e.fileName,file_size:e.fileSize,url:e.fileUrl,type:"uncategorized",meta:{duration:0},signed_url:e.fileUrl}};default:return{...t,type:"string",string:"",auto:0,attachment:null}}}(e);this.optimisticUpdatesController.appendMessageToRoom(t,t.roomId),t.roomId===this.roomId&&e.fromUserHash===this.professionalHash&&this._socketController.socket?.emit(S.messageStatus,e.messageId,this.roomId,f.Read)},this.onMessageDeleted=e=>{e.room_id===this.roomId&&this.optimisticUpdatesController.deleteMessage(e.message_id,e.room_id)},this.onMessageStatusUpdated=e=>{e.roomId===this.roomId&&this.optimisticUpdatesController.updateMessageStatus({messageId:e.messageId,status:e.status,roomId:e.roomId})},this._socketController=new ae(this,{listeners:[{eventName:S.message,callback:this.onMessageReceived},{eventName:S.message_deleted,callback:this.onMessageDeleted},{eventName:S.messageStatus,callback:this.onMessageStatusUpdated}]})}static{this.styles=[y,c`:host{display:block;width:100%;height:100%}`]}render(){return this.getRoomMessagesQuery.render({pending:()=>h`<messages-skeleton messageCount="8"></messages-skeleton>`,complete:e=>h`<messages-list .messages="${e}" .professionalHash="${this.professionalHash}"></messages-list>`})}};e([g({type:Number})],ne.prototype,"roomId",void 0),e([g({type:String})],ne.prototype,"professionalHash",void 0),ne=e([t("chat-room-messages")],ne);var le=class{constructor(e){this.string=e.string,this.roomId=e.roomId,this.messageId=e.messageId,this.type=e.type,this.fileName=e.fileName,this.autoMessage=e.autoMessage,this.senderType=e.senderType,this.attachmentType=e.attachmentType,this.consultationId=e.consultationId,this.consultationType=e.consultationType}toSocketMessage(){return[S.message,this.string,this.roomId,this.messageId,this.type,this.fileName,this.autoMessage,this.senderType,this.attachmentType,this.consultationId,this.consultationType]}},de=class extends le{constructor(e){super({roomId:e.roomId,messageId:e.messageId,string:e.string,type:"string",fileName:null,autoMessage:!1,senderType:W.ordinary,attachmentType:"uncategorized",consultationId:e.consultationId,consultationType:e.consultationType})}},ce=class extends le{constructor(e){super({roomId:e.roomId,messageId:e.messageId,string:e.base64Attachment,fileName:e.fileName,type:e.type,autoMessage:!1,senderType:W.ordinary,attachmentType:"uncategorized",consultationId:e.consultationId,consultationType:e.consultationType})}};async function me(e){return await Promise.all(e.map(async e=>{const t=await function(e){return new Promise((t,s)=>{const o=new FileReader;o.onload=()=>{const i=o.result.split(",")[1];i?t(i):s(new Error(`Invalid data URL format for file: ${e.name}`))},o.onerror=()=>{s(new Error(`Failed to read file: ${e.name}`))},o.readAsDataURL(e)})}(e);return{name:e.name,size:e.size,type:e.type,base64:t}}))}const he=c`:host{display:block;position:absolute;bottom:0;padding:var(--size-2) var(--size-2);background:#fff}.footer-container{display:flex;align-items:center;gap:var(--size-1);max-width:100%}.input-container{flex:1;position:relative;display:flex;align-items:center;border:1px solid var(--color-neutrals-border-disabled);border-radius:var(--border-radius-2xl);padding:0 var(--size-1);overflow:hidden}.input-container:focus-within{border-color:var(--color-primary)}.message-input{flex:1;border:none;outline:0;background:0 0;font-family:var(--font-body);font-size:var(--text-base);font-size:var(--text-sm);line-height:var(--text-sm--line-height);color:var(--color-neutrals-text-default);padding-left:var(--sp-2)}.message-input::placeholder{color:var(--color-neutrals-text-medium)}.attachment-icon{width:var(--size-5);height:var(--size-5);color:var(--color-primary)}.send-icon{width:var(--size-5);height:var(--size-5);color:var(--color-primary)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.send-button{color:var(--color-neutrals-link-disabled);background:0 0;border:none;padding:var(--size-2);border-radius:var(--border-radius-md);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background-color .2s ease}.send-button:hover:not(.disabled){background:var(--color-primary-light)}.send-button:active:not(.disabled){background-color:var(--color-neutrals-background-active)}.send-button.disabled{cursor:not-allowed;opacity:.4}.send-button.disabled .send-icon{color:var(--color-neutrals-text-disabled)}`;let pe=class ChatRoomFooter extends m{constructor(){super(...arguments),this.isTyping=!1,this.typingTimeoutId=null,this.inputValue="",this.socketController=new ae(this)}static{this.styles=[he]}handleInputChange(e){const t=e.target;this.inputValue=t.value,this.isTyping||(this.socketController.socket?.emit(S.typing,this.roomId),this.isTyping=!0),this.typingTimeoutId&&clearTimeout(this.typingTimeoutId),this.typingTimeoutId=setTimeout(()=>{this.isTyping&&(this.socketController.socket?.emit(S.stop_typing,this.roomId),this.isTyping=!1)},1500)}handleKeyDown(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),this.handleSendMessage())}async handleAttachment(e){const t=e.target.files;if(!t||0===t.length)return;const s=t.item(0);if(s)try{const e=(await me([s]))[0];if(!e)return void I.error("Error converting file to base64");const t=e?.type.includes("image")?"image":"file",o=crypto.randomUUID(),i=s.name,a=new ce({type:t,base64Attachment:e.base64,fileName:i,roomId:this.roomId,messageId:o,consultationId:this.consultationId,consultationType:this.consultationType});this.socketController.socket?.emit(...a.toSocketMessage())}catch(e){I.error("Error converting files to base64:",e)}}handleAttachmentClick(){this.attachmentInput.click()}handleSendMessage(){const e=this.inputValue.trim();if(!e)return;const t=crypto.randomUUID();this.isTyping&&(this.socketController.socket?.emit(S.stop_typing,this.roomId),this.isTyping=!1,this.typingTimeoutId&&clearTimeout(this.typingTimeoutId));const s=new de({messageId:t,string:e,roomId:this.roomId,consultationId:this.consultationId,consultationType:this.consultationType});this.socketController.socket?.emit(...s.toSocketMessage()),this.inputValue=""}disconnectedCallback(){this.isTyping&&(this.socketController.socket?.emit(S.stop_typing,this.roomId),this.typingTimeoutId&&clearTimeout(this.typingTimeoutId))}render(){const e=this.inputValue.trim().length>0;return h`<div class="footer-container"><div class="input-container"><input class="message-input" type="text" placeholder="${l("Escribe aquí...")}" .value="${this.inputValue}" @input="${this.handleInputChange}" @keydown="${this.handleKeyDown}"><div><input class="attachment-input sr-only" type="file" accept="image/jpeg,image/jpg,image/png,image/gif,image/bmp,image/tiff,application/pdf,text/*,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,audio/*,video/*" @change="${this.handleAttachment}"><mq-button variant="ghost" size="icon-sm" @click="${this.handleAttachmentClick}" title="${l("Adjuntar archivo")}">${h`<svg class="attachment-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>`}</mq-button></div></div><button class="send-button ${e?"":"disabled"}" @click="${this.handleSendMessage}" ?disabled="${!e}" title="${l("Enviar mensaje")}">${h`<svg class="send-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 2L11 13"/><path d="M22 2L15 22L11 13L2 9L22 2z"/></svg>`}</button></div>`}};e([i({context:U})],pe.prototype,"consultationId",void 0),e([i({context:B})],pe.prototype,"consultationType",void 0),e([g({type:Number})],pe.prototype,"roomId",void 0),e([u()],pe.prototype,"inputValue",void 0),e([$(".attachment-input")],pe.prototype,"attachmentInput",void 0),pe=e([t("chat-room-footer")],pe);const ge=e=>({all_week:!0,monday:1===e,tuesday:2===e,wednesday:3===e,thursday:4===e,friday:5===e,saturday:6===e,sunday:7===e,working_week:e>=1&&e<=5,weekend:0===e||6===e});function ue(e,t){const s=ge(6===e?0:e+1);return t.some(e=>{const t=e.days_of_week;return!0===s[t]})}let ve=class AvailabilitySection extends m{constructor(){super(...arguments),this.gaps=[],this.selectedDay=function(){const e=(new Date).getDay();return 0===e?6:e-1}()}static{this.styles=c`:host{display:flex;flex-direction:column;gap:var(--size-3)}.availability-header{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-normal);color:var(--color-primary);text-align:center;margin:0;margin-bottom:var(--size-4) 0}.availability-days{display:flex;flex-direction:row;justify-content:center;gap:var(--size-1);overflow-x:auto;padding-bottom:var(--size-4)}.availability-button{outline:0;border:1px solid var(--color-gray-medium);background:0 0;color:var(--color-gray-medium);cursor:pointer;height:var(--size-9);width:var(--size-10);border-radius:var(--border-radius-sm);text-transform:capitalize;font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium)}.availability-button:hover{background-color:color-mix(in srgb,var(--color-gray-light) 50%,transparent)}.availability-button:focus{background-color:color-mix(in srgb,var(--color-gray-light) 50%,transparent)}.availability-button.active{background:var(--color-primary);color:var(--color-white);border:none}.availability-button:disabled{opacity:.5;cursor:not-allowed;background-color:var(--color-gray-light)}.time-title{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);color:var(--color-gray-dark);margin:0;margin-bottom:var(--size-1)}.time-entries{display:flex;flex-direction:column;gap:var(--size-1);margin-bottom:var(--size-6)}.time-entry{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-normal);color:var(--color-gray-medium);margin:0}`}updated(e){e.has("gaps")&&(void 0===this.selectedDay||ue(this.selectedDay,this.gaps)||(this.selectedDay=void 0))}render(){const e=[{shortLabel:l("Lu"),label:l("Lunes"),key:"monday",disabled:!ue(0,this.gaps)},{shortLabel:l("Ma"),label:l("Martes"),key:"tuesday",disabled:!ue(1,this.gaps)},{shortLabel:l("Mi"),label:l("Miércoles"),key:"wednesday",disabled:!ue(2,this.gaps)},{shortLabel:l("Ju"),label:l("Jueves"),key:"thursday",disabled:!ue(3,this.gaps)},{shortLabel:l("Vi"),label:l("Viernes"),key:"friday",disabled:!ue(4,this.gaps)},{shortLabel:l("Sa"),label:l("Sábado"),key:"saturday",disabled:!ue(5,this.gaps)},{shortLabel:l("Do"),label:l("Domingo"),key:"sunday",disabled:!ue(6,this.gaps)}];return h`<h2 class="availability-header">${l("Disponibilidad")}</h2><div class="availability-days">${e.map((e,t)=>h`<button type="button" class="availability-button ${P({active:this.selectedDay===t&&!e.disabled})}" ?disabled="${e.disabled}" @click="${()=>{e.disabled||(this.selectedDay=t)}}">${e.shortLabel}</button>`)}</div>${void 0===this.selectedDay||e[this.selectedDay]?.disabled?"":(()=>{const t=function(e,t){const s=ge(6===e?0:e+1);return t.filter(e=>{const t=e.days_of_week;return!0===s[t]}).map(e=>({from_time:e.from_time,to_time:e.to_time}))}(this.selectedDay,this.gaps);return h`<div class="availability-time"><p class="time-title">${e[this.selectedDay]?.label}</p><div class="time-entries">${t.length>0?t.map(e=>h`<p class="time-entry">${l("De")} ${e.from_time} ${l("a")} ${e.to_time}</p>`):h`<p class="time-entry">${l("No hay horarios disponibles")}</p>`}</div></div>`})()}`}};e([g({type:Array})],ve.prototype,"gaps",void 0),e([u()],ve.prototype,"selectedDay",void 0),ve=e([n(),t("availability-section")],ve);const ye=c`:host{display:flex;flex-direction:column;height:100%;overflow-y:auto;background-color:var(--color-white)}.profile-container{padding:var(--size-6);display:flex;flex-direction:column}.profile-header{display:flex;flex-direction:column;align-items:center;text-align:center;padding-bottom:var(--size-6);border-bottom:1px solid var(--color-gray-medium);margin-bottom:var(--size-6)}.profile-avatar{margin-bottom:var(--size-2)}.profile-name{font-family:var(--font-body);font-size:var(--text-lg);line-height:var(--text-lg--line-height);font-weight:var(--font-weight-medium);color:var(--color-text-primary);margin:var(--size-4) 0}.profile-specialty{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);font-weight:var(--font-weight-medium);color:var(--color-text-icons--secondary);margin:0;margin-bottom:var(--size-2);text-transform:uppercase}.profile-collegiate{font-family:var(--font-body);font-size:var(--text-xs);line-height:var(--text-xs--line-height);color:var(--color-gray-medium);text-transform:uppercase;margin:0}.description-header{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-medium);color:var(--color-primary);margin:0;margin-bottom:var(--size-3)}.description-text{font-family:var(--font-body);font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-foreground);margin:0}`;let be=class ChatRoomProfile extends m{constructor(){super(...arguments),this.getProfessionalQuery=new o(this,()=>H(b,{hash:this.professionalHash}))}static{this.styles=[y,ye]}renderProfile(e){return h`<div class="profile-container"><div class="profile-header"><mq-avatar class="profile-avatar" src="${e.avatar||""}" fallback="${e.name}" alt="${e.name}'s profile picture" size="xl"></mq-avatar><div><h1 class="profile-name">${e.name}</h1>${e.title?h`<p class="profile-specialty">${e.title}</p>`:""} ${e.collegiate_number?h`<p class="profile-collegiate">${l(d`Nº COL. ${e.collegiate_number}`)}</p>`:""}</div></div>${e.chat_schedule&&e.chat_schedule.gaps.length>0?h`<availability-section .gaps="${e.chat_schedule.gaps}"></availability-section>`:p} ${e.description||e.overview?h`<div><h2 class="description-header">${l("Descripción")}</h2><p class="description-text">${e.description||e.overview}</p></div>`:""}</div>`}render(){return this.getProfessionalQuery.render({pending:()=>h``,complete:e=>this.renderProfile(e)})}};function fe(e,t,s){return{queryKey:["unread-messages",t],queryFn:()=>e.rooms.getUnreadMessagesCount(t),staleTime:0,...s}}e([g({type:String})],be.prototype,"professionalHash",void 0),be=e([n(),t("chat-room-profile")],be);const we=c`.root{display:flex;flex-direction:column;height:100%;overflow:hidden}chat-room-header{flex-shrink:0}chat-room-messages{flex:1;overflow-y:auto;overflow-x:hidden}chat-room-footer{position:sticky;bottom:0;left:0;right:0;flex-shrink:0}`;let xe=class MqChatRoom extends m{constructor(){super(...arguments),this.consultationId=void 0,this.consultationType=void 0,this.readonly=!1,this.hideCloseButton=!1,this.view="chat",this.socketController=new ae(this),this.readAllMessagesMutation=new r(this,{mutationFn:()=>b.professionals.readAllMessages({roomId:this.roomId}),onSuccess:()=>{this.queryClientContext?.invalidateQueries({queryKey:fe(b,{roomId:this.roomId}).queryKey})}})}static{this.styles=[y,we]}willUpdate(e){e.has("apiKey")&&this.apiKey&&b.setApiKey(this.apiKey),e.has("token")&&b.setAuthToken(this.token),e.has("roomId")&&(this.socketController.socket?.emit(S.joinRoom,this.roomId),this.readAllMessagesMutation.run(void 0))}render(){return h`<div class="root"><chat-room-header .professionalHash="${this.professionalHash}" .view="${this.view}" .hideCloseButton="${this.hideCloseButton}" @mq-chat-room-profile="${()=>{this.view="profile"}}" @goto-chat="${()=>{this.view="chat"}}"></chat-room-header>${"chat"===this.view?h`<chat-room-messages .roomId="${this.roomId}" .professionalHash="${this.professionalHash}"></chat-room-messages>${this.readonly?p:h`<chat-room-footer .roomId="${this.roomId}"></chat-room-footer>`}`:h`<chat-room-profile .professionalHash="${this.professionalHash}" @mq-chat-room-chat="${()=>{this.view="chat"}}"></chat-room-profile>`}</div>`}};e([s({context:_}),g({type:String,attribute:"api-key"})],xe.prototype,"apiKey",void 0),e([s({context:A}),g({type:String,attribute:"token"})],xe.prototype,"token",void 0),e([s({context:E}),g({type:String,attribute:"professional-hash"})],xe.prototype,"professionalHash",void 0),e([s({context:R}),g({type:Number,attribute:"room-id"})],xe.prototype,"roomId",void 0),e([s({context:U}),g({type:String,attribute:"consultation-id"})],xe.prototype,"consultationId",void 0),e([s({context:B}),g({type:String,attribute:"consultation-type"})],xe.prototype,"consultationType",void 0),e([g({type:Boolean,reflect:!0})],xe.prototype,"readonly",void 0),e([g({type:Boolean,attribute:"hide-close-button"})],xe.prototype,"hideCloseButton",void 0),e([u()],xe.prototype,"view",void 0),e([i({context:j,subscribe:!0})],xe.prototype,"queryClientContext",void 0),xe=e([n(),t("mq-chat-room")],xe);export{xe as M,fe as a,MqChatRoomCloseEvent as b,MqChatRoomProfileEvent as c,H as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e,t,a=new class _Logger{static{this.prefix="[@mediquo/web-components]"}#e(e,...t){console[e](_Logger.prefix,...t)}debug(...e){this.#e("debug",...e)}info(...e){this.#e("info",...e)}warn(...e){this.#e("warn",...e)}error(...e){this.#e("error",...e)}};!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),s={};for(const e of a)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(e||(e={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(t||(t={}));const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),n=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},r=e.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ZodError extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},s=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(s);else if("invalid_return_type"===n.code)s(n.returnTypeError);else if("invalid_arguments"===n.code)s(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,s=0;for(;s<n.path.length;){const a=n.path[s];s===n.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(n))):e[a]=e[a]||{_errors:[]},e=e[a],s++}}};return s(this),a}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];t[a]=t[a]||[],t[a].push(e(s))}else a.push(e(s));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const i=(t,a)=>{let n;switch(t.code){case r.invalid_type:n=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case r.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case r.unrecognized_keys:n=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case r.invalid_union:n="Invalid input";break;case r.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case r.invalid_enum_value:n=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case r.invalid_arguments:n="Invalid function arguments";break;case r.invalid_return_type:n="Invalid function return type";break;case r.invalid_date:n="Invalid date";break;case r.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):n="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case r.too_small:n="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case r.too_big:n="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case r.custom:n="Invalid input";break;case r.invalid_intersection_types:n="Intersection results could not be merged";break;case r.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case r.not_finite:n="Number must be finite";break;default:n=a.defaultError,e.assertNever(t)}return{message:n}};let o=i;function d(){return o}const c=e=>{const{data:t,path:a,errorMaps:s,issueData:n}=e,r=[...a,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let o="";const d=s.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:r,message:o}};function u(e,t){const a=d(),s=c({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===i?void 0:i].filter(e=>!!e)});e.common.issues.push(s)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const s of t){if("aborted"===s.status)return l;"dirty"===s.status&&e.dirty(),a.push(s.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const e of t){const t=await e.key,s=await e.value;a.push({key:t,value:s})}return ParseStatus.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const s of t){const{key:t,value:n}=s;if("aborted"===t.status)return l;if("aborted"===n.status)return l;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!s.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}}const l=Object.freeze({status:"aborted"}),p=e=>({status:"dirty",value:e}),h=e=>({status:"valid",value:e}),m=e=>"aborted"===e.status,f=e=>"dirty"===e.status,y=e=>"valid"===e.status,_=e=>"undefined"!=typeof Promise&&e instanceof Promise;var g;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(g||(g={}));class ParseInputLazyPath{constructor(e,t,a,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const v=(e,t)=>{if(y(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new ZodError(e.common.issues);return this._error=t,this._error}}};function Z(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:s,description:n}=e;if(t&&(a||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??n.defaultError}:void 0===n.data?{message:r??s??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:r??a??n.defaultError}},description:n}}class ZodType{get description(){return this._def.description}_getType(e){return n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(_(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},s=this._parseSync({data:e,path:a.path,parent:a});return v(a,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return y(a)?{value:a.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>y(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},s=this._parse({data:e,path:a.path,parent:a}),r=await(_(s)?s:Promise.resolve(s));return v(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,s)=>{const n=e(t),i=()=>s.addIssue({code:r.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(i(),!1)):!!n||(i(),!1)})}refinement(e,t){return this._refinement((a,s)=>!!e(a)||(s.addIssue("function"==typeof t?t(a,s):t),!1))}_refinement(e){return new ZodEffects({schema:this,typeName:Q.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...Z(this._def),schema:this,typeName:Q.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...Z(this._def),innerType:this,defaultValue:t,typeName:Q.ZodDefault})}brand(){return new ZodBranded({typeName:Q.ZodBranded,type:this,...Z(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...Z(this._def),innerType:this,catchValue:t,typeName:Q.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const b=/^c[^\s-]{8,}$/i,k=/^[0-9a-z]+$/,x=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,T=/^[a-z0-9_-]{21}$/i,N=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,O=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,S=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let A;const E=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,j=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,C=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,P=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,R=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,L="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",$=new RegExp(`^${L}$`);function M(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function z(e){return new RegExp(`^${M(e)}$`)}function D(e){let t=`${L}T${M(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function F(e,t){return!("v4"!==t&&t||!E.test(e))||!("v6"!==t&&t||!C.test(e))}function U(e,t){if(!N.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const s=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(s));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===n?.typ)&&(!!n.alg&&(!t||n.alg===t)))}catch{return!1}}function V(e,t){return!("v4"!==t&&t||!j.test(e))||!("v6"!==t&&t||!P.test(e))}class ZodString extends ZodType{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return u(e,{code:r.invalid_type,expected:s.string,received:e.parsedType}),l}const a=new ParseStatus;let n;for(const s of this._def.checks)if("min"===s.kind)t.data.length<s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("max"===s.kind)t.data.length>s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),a.dirty());else if("length"===s.kind){const e=t.data.length>s.value,i=t.data.length<s.value;(e||i)&&(n=this._getOrReturnCtx(t,n),e?u(n,{code:r.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&u(n,{code:r.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),a.dirty())}else if("email"===s.kind)S.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"email",code:r.invalid_string,message:s.message}),a.dirty());else if("emoji"===s.kind)A||(A=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),A.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"emoji",code:r.invalid_string,message:s.message}),a.dirty());else if("uuid"===s.kind)w.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"uuid",code:r.invalid_string,message:s.message}),a.dirty());else if("nanoid"===s.kind)T.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"nanoid",code:r.invalid_string,message:s.message}),a.dirty());else if("cuid"===s.kind)b.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"cuid",code:r.invalid_string,message:s.message}),a.dirty());else if("cuid2"===s.kind)k.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"cuid2",code:r.invalid_string,message:s.message}),a.dirty());else if("ulid"===s.kind)x.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"ulid",code:r.invalid_string,message:s.message}),a.dirty());else if("url"===s.kind)try{new URL(t.data)}catch{n=this._getOrReturnCtx(t,n),u(n,{validation:"url",code:r.invalid_string,message:s.message}),a.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"regex",code:r.invalid_string,message:s.message}),a.dirty())}else if("trim"===s.kind)t.data=t.data.trim();else if("includes"===s.kind)t.data.includes(s.value,s.position)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),a.dirty());else if("toLowerCase"===s.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===s.kind)t.data=t.data.toUpperCase();else if("startsWith"===s.kind)t.data.startsWith(s.value)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:{startsWith:s.value},message:s.message}),a.dirty());else if("endsWith"===s.kind)t.data.endsWith(s.value)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:{endsWith:s.value},message:s.message}),a.dirty());else if("datetime"===s.kind){D(s).test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:"datetime",message:s.message}),a.dirty())}else if("date"===s.kind){$.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:"date",message:s.message}),a.dirty())}else if("time"===s.kind){z(s).test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{code:r.invalid_string,validation:"time",message:s.message}),a.dirty())}else"duration"===s.kind?O.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"duration",code:r.invalid_string,message:s.message}),a.dirty()):"ip"===s.kind?F(t.data,s.version)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"ip",code:r.invalid_string,message:s.message}),a.dirty()):"jwt"===s.kind?U(t.data,s.alg)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"jwt",code:r.invalid_string,message:s.message}),a.dirty()):"cidr"===s.kind?V(t.data,s.version)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"cidr",code:r.invalid_string,message:s.message}),a.dirty()):"base64"===s.kind?I.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"base64",code:r.invalid_string,message:s.message}),a.dirty()):"base64url"===s.kind?R.test(t.data)||(n=this._getOrReturnCtx(t,n),u(n,{validation:"base64url",code:r.invalid_string,message:s.message}),a.dirty()):e.assertNever(s);return{status:a.value,value:t.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:r.invalid_string,...g.errToObj(a)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function B(e,t){const a=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,n=a>s?a:s;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}ZodString.create=e=>new ZodString({checks:[],typeName:Q.ZodString,coerce:e?.coerce??!1,...Z(e)});class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return u(e,{code:r.invalid_type,expected:s.number,received:e.parsedType}),l}let a;const n=new ParseStatus;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:r.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty());else if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty())}else"multipleOf"===s.kind?0!==B(t.data,s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):"finite"===s.kind?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),u(a,{code:r.not_finite,message:s.message}),n.dirty()):e.assertNever(s);return{status:n.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,a,s){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:g.toString(s)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:Q.ZodNumber,coerce:e?.coerce||!1,...Z(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==s.bigint)return this._getInvalidInput(t);let a;const n=new ParseStatus;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?t.data<s.value:t.data<=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty())}else if("max"===s.kind){(s.inclusive?t.data>s.value:t.data>=s.value)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty())}else"multipleOf"===s.kind?t.data%s.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),u(a,{code:r.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):e.assertNever(s);return{status:n.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.bigint,received:t.parsedType}),l}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,a,s){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:g.toString(s)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>new ZodBigInt({checks:[],typeName:Q.ZodBigInt,coerce:e?.coerce??!1,...Z(e)});class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.boolean,received:t.parsedType}),l}return h(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:Q.ZodBoolean,coerce:e?.coerce||!1,...Z(e)});class ZodDate extends ZodType{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return u(e,{code:r.invalid_type,expected:s.date,received:e.parsedType}),l}if(Number.isNaN(t.data.getTime())){return u(this._getOrReturnCtx(t),{code:r.invalid_date}),l}const a=new ParseStatus;let n;for(const s of this._def.checks)"min"===s.kind?t.data.getTime()<s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),a.dirty()):"max"===s.kind?t.data.getTime()>s.value&&(n=this._getOrReturnCtx(t,n),u(n,{code:r.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),a.dirty()):e.assertNever(s);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:e?.coerce||!1,typeName:Q.ZodDate,...Z(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.symbol,received:t.parsedType}),l}return h(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:Q.ZodSymbol,...Z(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.undefined,received:t.parsedType}),l}return h(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:Q.ZodUndefined,...Z(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.null,received:t.parsedType}),l}return h(e.data)}}ZodNull.create=e=>new ZodNull({typeName:Q.ZodNull,...Z(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return h(e.data)}}ZodAny.create=e=>new ZodAny({typeName:Q.ZodAny,...Z(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return h(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:Q.ZodUnknown,...Z(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.never,received:t.parsedType}),l}}ZodNever.create=e=>new ZodNever({typeName:Q.ZodNever,...Z(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.void,received:t.parsedType}),l}return h(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:Q.ZodVoid,...Z(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==s.array)return u(t,{code:r.invalid_type,expected:s.array,received:t.parsedType}),l;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(u(t,{code:e?r.too_big:r.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(u(t,{code:r.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(u(t,{code:r.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new ParseInputLazyPath(t,e,t.path,a)))).then(e=>ParseStatus.mergeArray(a,e));const i=[...t.data].map((e,a)=>n.type._parseSync(new ParseInputLazyPath(t,e,t.path,a)));return ParseStatus.mergeArray(a,i)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}}function K(e){if(e instanceof ZodObject){const t={};for(const a in e.shape){const s=e.shape[a];t[a]=ZodOptional.create(K(s))}return new ZodObject({...e._def,shape:()=>t})}return e instanceof ZodArray?new ZodArray({...e._def,type:K(e.element)}):e instanceof ZodOptional?ZodOptional.create(K(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(K(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map(e=>K(e))):e}ZodArray.create=(e,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Q.ZodArray,...Z(t)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),a=e.objectKeys(t);return this._cached={shape:t,keys:a},this._cached}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.object,received:t.parsedType}),l}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const e in a.data)i.includes(e)||o.push(e);const d=[];for(const e of i){const t=n[e],s=a.data[e];d.push({key:{status:"valid",value:e},value:t._parse(new ParseInputLazyPath(a,s,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of o)d.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)o.length>0&&(u(a,{code:r.unrecognized_keys,keys:o}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of o){const s=a.data[t];d.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(a,s,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of d){const a=await t.key,s=await t.value;e.push({key:a,value:s,alwaysSet:t.alwaysSet})}return e}).then(e=>ParseStatus.mergeObjectSync(t,e)):ParseStatus.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const s=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:g.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Q.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(t){const a={};for(const s of e.objectKeys(t))t[s]&&this.shape[s]&&(a[s]=this.shape[s]);return new ZodObject({...this._def,shape:()=>a})}omit(t){const a={};for(const s of e.objectKeys(this.shape))t[s]||(a[s]=this.shape[s]);return new ZodObject({...this._def,shape:()=>a})}deepPartial(){return K(this)}partial(t){const a={};for(const s of e.objectKeys(this.shape)){const e=this.shape[s];t&&!t[s]?a[s]=e:a[s]=e.optional()}return new ZodObject({...this._def,shape:()=>a})}required(t){const a={};for(const s of e.objectKeys(this.shape))if(t&&!t[s])a[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof ZodOptional;)e=e._def.innerType;a[s]=e}return new ZodObject({...this._def,shape:()=>a})}keyof(){return J(e.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Q.ZodObject,...Z(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:Q.ZodObject,...Z(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:Q.ZodObject,...Z(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new ZodError(e.ctx.common.issues));return u(t,{code:r.invalid_union,unionErrors:a}),l});{let e;const s=[];for(const n of a){const a={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:a});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:a}),a.common.issues.length&&s.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=s.map(e=>new ZodError(e));return u(t,{code:r.invalid_union,unionErrors:n}),l}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:Q.ZodUnion,...Z(t)});const W=t=>t instanceof ZodLazy?W(t.schema):t instanceof ZodEffects?W(t.innerType()):t instanceof ZodLiteral?[t.value]:t instanceof ZodEnum?t.options:t instanceof ZodNativeEnum?e.objectValues(t.enum):t instanceof ZodDefault?W(t._def.innerType):t instanceof ZodUndefined?[void 0]:t instanceof ZodNull?[null]:t instanceof ZodOptional?[void 0,...W(t.unwrap())]:t instanceof ZodNullable?[null,...W(t.unwrap())]:t instanceof ZodBranded||t instanceof ZodReadonly?W(t.unwrap()):t instanceof ZodCatch?W(t._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return u(t,{code:r.invalid_type,expected:s.object,received:t.parsedType}),l;const a=this.discriminator,n=t.data[a],i=this.optionsMap.get(n);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(u(t,{code:r.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),l)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const s=new Map;for(const a of t){const t=W(a.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(s.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);s.set(n,a)}}return new ZodDiscriminatedUnion({typeName:Q.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...Z(a)})}}function q(t,a){const r=n(t),i=n(a);if(t===a)return{valid:!0,data:t};if(r===s.object&&i===s.object){const s=e.objectKeys(a),n=e.objectKeys(t).filter(e=>-1!==s.indexOf(e)),r={...t,...a};for(const e of n){const s=q(t[e],a[e]);if(!s.valid)return{valid:!1};r[e]=s.data}return{valid:!0,data:r}}if(r===s.array&&i===s.array){if(t.length!==a.length)return{valid:!1};const e=[];for(let s=0;s<t.length;s++){const n=q(t[s],a[s]);if(!n.valid)return{valid:!1};e.push(n.data)}return{valid:!0,data:e}}return r===s.date&&i===s.date&&+t===+a?{valid:!0,data:t}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=(e,s)=>{if(m(e)||m(s))return l;const n=q(e.value,s.value);return n.valid?((f(e)||f(s))&&t.dirty(),{status:t.value,value:n.data}):(u(a,{code:r.invalid_intersection_types}),l)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>s(e,t)):s(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}ZodIntersection.create=(e,t,a)=>new ZodIntersection({left:e,right:t,typeName:Q.ZodIntersection,...Z(a)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.array)return u(a,{code:r.invalid_type,expected:s.array,received:a.parsedType}),l;if(a.data.length<this._def.items.length)return u(a,{code:r.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;!this._def.rest&&a.data.length>this._def.items.length&&(u(a,{code:r.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new ParseInputLazyPath(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>ParseStatus.mergeArray(t,e)):ParseStatus.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:Q.ZodTuple,rest:null,...Z(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.object)return u(a,{code:r.invalid_type,expected:s.object,received:a.parsedType}),l;const n=[],i=this._def.keyType,o=this._def.valueType;for(const e in a.data)n.push({key:i._parse(new ParseInputLazyPath(a,e,a.path,e)),value:o._parse(new ParseInputLazyPath(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?ParseStatus.mergeObjectAsync(t,n):ParseStatus.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:Q.ZodRecord,...Z(a)}:{keyType:ZodString.create(),valueType:e,typeName:Q.ZodRecord,...Z(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.map)return u(a,{code:r.invalid_type,expected:s.map,received:a.parsedType}),l;const n=this._def.keyType,i=this._def.valueType,o=[...a.data.entries()].map(([e,t],s)=>({key:n._parse(new ParseInputLazyPath(a,e,a.path,[s,"key"])),value:i._parse(new ParseInputLazyPath(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of o){const s=await a.key,n=await a.value;if("aborted"===s.status||"aborted"===n.status)return l;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of o){const s=a.key,n=a.value;if("aborted"===s.status||"aborted"===n.status)return l;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,a)=>new ZodMap({valueType:t,keyType:e,typeName:Q.ZodMap,...Z(a)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==s.set)return u(a,{code:r.invalid_type,expected:s.set,received:a.parsedType}),l;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(u(a,{code:r.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(u(a,{code:r.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function o(e){const a=new Set;for(const s of e){if("aborted"===s.status)return l;"dirty"===s.status&&t.dirty(),a.add(s.value)}return{status:t.value,value:a}}const d=[...a.data.values()].map((e,t)=>i._parse(new ParseInputLazyPath(a,e,a.path,t)));return a.common.async?Promise.all(d).then(e=>o(e)):o(d)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:Q.ZodSet,...Z(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return u(t,{code:r.invalid_type,expected:s.function,received:t.parsedType}),l;function a(e,a){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter(e=>!!e),issueData:{code:r.invalid_arguments,argumentsError:a}})}function n(e,a){return c({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),i].filter(e=>!!e),issueData:{code:r.invalid_return_type,returnTypeError:a}})}const o={errorMap:t.common.contextualErrorMap},p=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return h(async function(...t){const s=new ZodError([]),r=await e._def.args.parseAsync(t,o).catch(e=>{throw s.addIssue(a(t,e)),s}),i=await Reflect.apply(p,this,r);return await e._def.returns._def.type.parseAsync(i,o).catch(e=>{throw s.addIssue(n(i,e)),s})})}{const e=this;return h(function(...t){const s=e._def.args.safeParse(t,o);if(!s.success)throw new ZodError([a(t,s.error)]);const r=Reflect.apply(p,this,s.data),i=e._def.returns.safeParse(r,o);if(!i.success)throw new ZodError([n(r,i.error)]);return i.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:Q.ZodFunction,...Z(a)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:Q.ZodLazy,...Z(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:r.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:e.data}}get value(){return this._def.value}}function J(e,t){return new ZodEnum({values:e,typeName:Q.ZodEnum,...Z(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:Q.ZodLiteral,...Z(t)});class ZodEnum extends ZodType{_parse(t){if("string"!=typeof t.data){const a=this._getOrReturnCtx(t),s=this._def.values;return u(a,{expected:e.joinValues(s),received:a.parsedType,code:r.invalid_type}),l}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),a=this._def.values;return u(e,{received:e.data,code:r.invalid_enum_value,options:a}),l}return h(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}ZodEnum.create=J;class ZodNativeEnum extends ZodType{_parse(t){const a=e.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==s.string&&n.parsedType!==s.number){const t=e.objectValues(a);return u(n,{expected:e.joinValues(t),received:n.parsedType,code:r.invalid_type}),l}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(a);return u(n,{received:n.data,code:r.invalid_enum_value,options:t}),l}return h(t.data)}get enum(){return this._def.values}}ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:Q.ZodNativeEnum,...Z(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return u(t,{code:r.invalid_type,expected:s.promise,received:t.parsedType}),l;const a=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return h(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:Q.ZodPromise,...Z(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:a,ctx:s}=this._processInputParams(t),n=this._def.effect||null,r={addIssue:e=>{u(s,e),e.fatal?a.abort():a.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(s.data,r);if(s.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===a.value)return l;const t=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===t.status?l:"dirty"===t.status||"dirty"===a.value?p(t.value):t});{if("aborted"===a.value)return l;const t=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===t.status?l:"dirty"===t.status||"dirty"===a.value?p(t.value):t}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const t=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===t.status?l:("dirty"===t.status&&a.dirty(),e(t.value),{status:a.value,value:t.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(t=>"aborted"===t.status?l:("dirty"===t.status&&a.dirty(),e(t.value).then(()=>({status:a.value,value:t.value}))))}if("transform"===n.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!y(e))return l;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:t}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(e=>y(e)?Promise.resolve(n.transform(e.value,r)).then(e=>({status:a.value,value:e})):l)}e.assertNever(n)}}ZodEffects.create=(e,t,a)=>new ZodEffects({schema:e,typeName:Q.ZodEffects,effect:t,...Z(a)}),ZodEffects.createWithPreprocess=(e,t,a)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:Q.ZodEffects,...Z(a)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===s.undefined?h(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:Q.ZodOptional,...Z(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===s.null?h(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:Q.ZodNullable,...Z(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===s.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:Q.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Z(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return _(s)?s.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new ZodError(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:Q.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Z(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return u(t,{code:r.invalid_type,expected:s.nan,received:t.parsedType}),l}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:Q.ZodNaN,...Z(e)});const Y=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?l:"dirty"===e.status?(t.dirty(),p(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?l:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:Q.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),a=e=>(y(e)&&(e.value=Object.freeze(e.value)),e);return _(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}function H(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function G(e,t={},a){return e?ZodAny.create().superRefine((s,n)=>{const r=e(s);if(r instanceof Promise)return r.then(e=>{if(!e){const e=H(t,s),r=e.fatal??a??!0;n.addIssue({code:"custom",...e,fatal:r})}});if(!r){const e=H(t,s),r=e.fatal??a??!0;n.addIssue({code:"custom",...e,fatal:r})}}):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:Q.ZodReadonly,...Z(t)});const X={object:ZodObject.lazycreate};var Q;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Q||(Q={}));const ee=(e,t={message:`Input not instance of ${e.name}`})=>G(t=>t instanceof e,t),te=ZodString.create,ae=ZodNumber.create,se=ZodNaN.create,ne=ZodBigInt.create,re=ZodBoolean.create,ie=ZodDate.create,oe=ZodSymbol.create,de=ZodUndefined.create,ce=ZodNull.create,ue=ZodAny.create,le=ZodUnknown.create,pe=ZodNever.create,he=ZodVoid.create,me=ZodArray.create,fe=ZodObject.create,ye=ZodObject.strictCreate,_e=ZodUnion.create,ge=ZodDiscriminatedUnion.create,ve=ZodIntersection.create,Ze=ZodTuple.create,be=ZodRecord.create,ke=ZodMap.create,xe=ZodSet.create,we=ZodFunction.create,Te=ZodLazy.create,Ne=ZodLiteral.create,Oe=ZodEnum.create,Se=ZodNativeEnum.create,Ae=ZodPromise.create,Ee=ZodEffects.create,je=ZodOptional.create,Ce=ZodNullable.create,Pe=ZodEffects.createWithPreprocess,Ie=ZodPipeline.create,Re={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},Le=l;var $e=Object.freeze({__proto__:null,BRAND:Y,DIRTY:p,EMPTY_PATH:[],INVALID:l,NEVER:Le,OK:h,ParseStatus,Schema:ZodType,ZodAny,ZodArray,ZodBigInt,ZodBoolean,ZodBranded,ZodCatch,ZodDate,ZodDefault,ZodDiscriminatedUnion,ZodEffects,ZodEnum,ZodError,get ZodFirstPartyTypeKind(){return Q},ZodFunction,ZodIntersection,ZodIssueCode:r,ZodLazy,ZodLiteral,ZodMap,ZodNaN,ZodNativeEnum,ZodNever,ZodNull,ZodNullable,ZodNumber,ZodObject,ZodOptional,ZodParsedType:s,ZodPipeline,ZodPromise,ZodReadonly,ZodRecord,ZodSchema:ZodType,ZodSet,ZodString,ZodSymbol,ZodTransformer:ZodEffects,ZodTuple,ZodType,ZodUndefined,ZodUnion,ZodUnknown,ZodVoid,addIssueToContext:u,any:ue,array:me,bigint:ne,boolean:re,coerce:Re,custom:G,date:ie,datetimeRegex:D,defaultErrorMap:i,discriminatedUnion:ge,effect:Ee,enum:Oe,function:we,getErrorMap:d,getParsedType:n,instanceof:ee,intersection:ve,isAborted:m,isAsync:_,isDirty:f,isValid:y,late:X,lazy:Te,literal:Ne,makeIssue:c,map:ke,nan:se,nativeEnum:Se,never:pe,null:ce,nullable:Ce,number:ae,object:fe,get objectUtil(){return t},oboolean:()=>re().optional(),onumber:()=>ae().optional(),optional:je,ostring:()=>te().optional(),pipeline:Ie,preprocess:Pe,promise:Ae,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),record:be,set:xe,setErrorMap:function(e){o=e},strictObject:ye,string:te,symbol:oe,transformer:Ee,tuple:Ze,undefined:de,union:_e,unknown:le,get util(){return e},void:he});export{me as a,Se as b,re as c,_e as d,Oe as e,ce as f,Ne as g,ue as h,ee as i,a as l,ae as n,fe as o,be as r,te as s,le as u,$e as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t,t as e,c as n,n as r,s as a,m as o,b as i,g as u}from"./parseISO-jT42c8Ob.js";function s(e,n){return t(e,{...n,weekStartsOn:1})}function c(t,r){const a=e(t,r?.in),o=a.getFullYear(),i=n(a,0);i.setFullYear(o+1,0,4),i.setHours(0,0,0,0);const u=s(i),c=n(a,0);c.setFullYear(o,0,4),c.setHours(0,0,0,0);const d=s(c);return a.getTime()>=u.getTime()?o+1:a.getTime()>=d.getTime()?o:o-1}function d(t){const n=e(t),r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return r.setUTCFullYear(n.getFullYear()),+t-+r}function h(t){return!(!((n=t)instanceof Date||"object"==typeof n&&"[object Date]"===Object.prototype.toString.call(n))&&"number"!=typeof t||isNaN(+e(t)));var n}const l={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function m(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const f={date:m({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:m({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:m({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},g={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function w(t){return(e,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&t.formattingValues){const e=t.defaultFormattingWidth||t.defaultWidth,a=n?.width?String(n.width):e;r=t.formattingValues[a]||t.formattingValues[e]}else{const e=t.defaultWidth,a=n?.width?String(n.width):t.defaultWidth;r=t.values[a]||t.values[e]}return r[t.argumentCallback?t.argumentCallback(e):e]}}function b(t){return(e,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=e.match(a);if(!o)return null;const i=o[0],u=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],s=Array.isArray(u)?function(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n;return}(u,t=>t.test(i)):function(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n;return}(u,t=>t.test(i));let c;c=t.valueCallback?t.valueCallback(s):s,c=n.valueCallback?n.valueCallback(c):c;return{value:c,rest:e.slice(i.length)}}}var y;const p={code:"en-US",formatDistance:(t,e,n)=>{let r;const a=l[t];return r="string"==typeof a?a:1===e?a.one:a.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r},formatLong:f,formatRelative:(t,e,n,r)=>g[t],localize:{ordinalNumber:(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:w({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:w({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:t=>t-1}),month:w({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:w({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:w({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(y={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:t=>parseInt(t,10)},(t,e={})=>{const n=t.match(y.matchPattern);if(!n)return null;const r=n[0],a=t.match(y.parsePattern);if(!a)return null;let o=y.valueCallback?y.valueCallback(a[0]):a[0];return o=e.valueCallback?e.valueCallback(o):o,{value:o,rest:t.slice(r.length)}}),era:b({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:b({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:t=>t+1}),month:b({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:b({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:b({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function M(t,n){const i=e(t,n?.in),u=function(t,e,n){const[i,u]=r(n?.in,t,e),s=a(i),c=a(u),h=+s-d(s),l=+c-d(c);return Math.round((h-l)/o)}(i,function(t,n){const r=e(t,n?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}(i));return u+1}function v(t,r){const a=e(t,r?.in),o=+s(a)-+function(t,e){const r=c(t,e),a=n(t,0);return a.setFullYear(r,0,4),a.setHours(0,0,0,0),s(a)}(a);return Math.round(o/i)+1}function x(r,a){const o=e(r,a?.in),i=o.getFullYear(),s=u(),c=a?.firstWeekContainsDate??a?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,d=n(a?.in||r,0);d.setFullYear(i+1,0,c),d.setHours(0,0,0,0);const h=t(d,a),l=n(a?.in||r,0);l.setFullYear(i,0,c),l.setHours(0,0,0,0);const m=t(l,a);return+o>=+h?i+1:+o>=+m?i:i-1}function P(r,a){const o=e(r,a?.in),s=+t(o,a)-+function(e,r){const a=u(),o=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,i=x(e,r),s=n(r?.in||e,0);return s.setFullYear(i,0,o),s.setHours(0,0,0,0),t(s,r)}(o,a);return Math.round(s/i)+1}function k(t,e){return(t<0?"-":"")+Math.abs(t).toString().padStart(e,"0")}const S={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return k("yy"===e?r%100:r,e.length)},M(t,e){const n=t.getMonth();return"M"===e?String(n+1):k(n+1,2)},d:(t,e)=>k(t.getDate(),e.length),a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return"am"===n?"a.m.":"p.m."}},h:(t,e)=>k(t.getHours()%12||12,e.length),H:(t,e)=>k(t.getHours(),e.length),m:(t,e)=>k(t.getMinutes(),e.length),s:(t,e)=>k(t.getSeconds(),e.length),S(t,e){const n=e.length,r=t.getMilliseconds();return k(Math.trunc(r*Math.pow(10,n-3)),e.length)}},W="midnight",D="noon",T="morning",Y="afternoon",C="evening",q="night",F={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if("yo"===e){const e=t.getFullYear(),r=e>0?e:1-e;return n.ordinalNumber(r,{unit:"year"})}return S.y(t,e)},Y:function(t,e,n,r){const a=x(t,r),o=a>0?a:1-a;if("YY"===e){return k(o%100,2)}return"Yo"===e?n.ordinalNumber(o,{unit:"year"}):k(o,e.length)},R:function(t,e){return k(c(t),e.length)},u:function(t,e){return k(t.getFullYear(),e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return k(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return k(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return S.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return k(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const a=P(t,r);return"wo"===e?n.ordinalNumber(a,{unit:"week"}):k(a,e.length)},I:function(t,e,n){const r=v(t);return"Io"===e?n.ordinalNumber(r,{unit:"week"}):k(r,e.length)},d:function(t,e,n){return"do"===e?n.ordinalNumber(t.getDate(),{unit:"date"}):S.d(t,e)},D:function(t,e,n){const r=M(t);return"Do"===e?n.ordinalNumber(r,{unit:"dayOfYear"}):k(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return k(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return k(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),a=0===r?7:r;switch(e){case"i":return String(a);case"ii":return k(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const r=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(r,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(r,{width:"narrow",context:"formatting"});default:return n.dayPeriod(r,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let a;switch(a=12===r?D:0===r?W:r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let a;switch(a=r>=17?C:r>=12?Y:r>=4?T:q,e){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,e,n){if("ho"===e){let e=t.getHours()%12;return 0===e&&(e=12),n.ordinalNumber(e,{unit:"hour"})}return S.h(t,e)},H:function(t,e,n){return"Ho"===e?n.ordinalNumber(t.getHours(),{unit:"hour"}):S.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return"Ko"===e?n.ordinalNumber(r,{unit:"hour"}):k(r,e.length)},k:function(t,e,n){let r=t.getHours();return 0===r&&(r=24),"ko"===e?n.ordinalNumber(r,{unit:"hour"}):k(r,e.length)},m:function(t,e,n){return"mo"===e?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):S.m(t,e)},s:function(t,e,n){return"so"===e?n.ordinalNumber(t.getSeconds(),{unit:"second"}):S.s(t,e)},S:function(t,e){return S.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(0===r)return"Z";switch(e){case"X":return O(r);case"XXXX":case"XX":return E(r);default:return E(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return O(r);case"xxxx":case"xx":return E(r);default:return E(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+N(r,":");default:return"GMT"+E(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+N(r,":");default:return"GMT"+E(r,":")}},t:function(t,e,n){return k(Math.trunc(+t/1e3),e.length)},T:function(t,e,n){return k(+t,e.length)}};function N(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),o=r%60;return 0===o?n+String(a):n+String(a)+e+k(o,2)}function O(t,e){if(t%60==0){return(t>0?"-":"+")+k(Math.abs(t)/60,2)}return E(t,e)}function E(t,e=""){const n=t>0?"-":"+",r=Math.abs(t);return n+k(Math.trunc(r/60),2)+e+k(r%60,2)}const H=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},z=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},j={p:z,P:(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return H(t,e);let o;switch(r){case"P":o=e.dateTime({width:"short"});break;case"PP":o=e.dateTime({width:"medium"});break;case"PPP":o=e.dateTime({width:"long"});break;default:o=e.dateTime({width:"full"})}return o.replace("{{date}}",H(r,e)).replace("{{time}}",z(a,e))}},L=/^D+$/,Q=/^Y+$/,G=["D","DD","YY","YYYY"];const X=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,A=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,B=/^'([^]*?)'?$/,$=/''/g,J=/[a-zA-Z]/;function I(t,n,r){const a=u(),o=a.locale??p,i=a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,s=a.weekStartsOn??a.locale?.options?.weekStartsOn??0,c=e(t,r?.in);if(!h(c))throw new RangeError("Invalid time value");let d=n.match(A).map(t=>{const e=t[0];if("p"===e||"P"===e){return(0,j[e])(t,o.formatLong)}return t}).join("").match(X).map(t=>{if("''"===t)return{isToken:!1,value:"'"};const e=t[0];if("'"===e)return{isToken:!1,value:R(t)};if(F[e])return{isToken:!0,value:t};if(e.match(J))throw new RangeError("Format string contains an unescaped latin alphabet character `"+e+"`");return{isToken:!1,value:t}});o.localize.preprocessor&&(d=o.localize.preprocessor(c,d));const l={firstWeekContainsDate:i,weekStartsOn:s,locale:o};return d.map(e=>{if(!e.isToken)return e.value;const r=e.value;(function(t){return Q.test(t)}(r)||function(t){return L.test(t)}(r))&&function(t,e,n){const r=function(t,e,n){const r="Y"===t[0]?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(t,e,n);if(console.warn(r),G.includes(t))throw new RangeError(r)}(r,n,String(t));return(0,F[r[0]])(c,r,o.localize,l)}).join("")}function R(t){const e=t.match(B);return e?e[1].replace($,"'"):t}export{I as f,h as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,t){return{queryKey:["organization-setup"],queryFn:()=>n.organizations.getOrganizationSetup(),...t}}export{n as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e,t,n){return{queryKey:["appointments",t.id],queryFn:()=>e.appointments.getAppointment(t),...n}}function t(e,t){return{queryKey:["patient-profile"],queryFn:()=>e.profile.getPatientProfile(),...t}}export{e as a,t as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as t}from"./lit-element-DiWJYFwC.js";const e=e=>e??t;export{e as o};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{E as s,i,a as o,x as n}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{r as l}from"./state-LQivXIgA.js";import{e as a}from"./class-map-Co76I6aw.js";import{i as d,t as c,e as p}from"./directive-2EDmOukv.js";import{o as v}from"./style-map-CIdqdn7C.js";import"../ui/mq-text-button.js";const u=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),u(t,e);return!0},m=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},b=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),g(e)}};function x(t){void 0!==this._$AN?(m(this),this._$AM=t,b(this)):this._$AM=t}function $(t,e=!1,s=0){const i=this._$AH,o=this._$AN;if(void 0!==o&&0!==o.size)if(e)if(Array.isArray(i))for(let t=s;t<i.length;t++)u(i[t],!1),m(i[t]);else null!=i&&(u(i,!1),m(i));else u(this,t)}const g=t=>{t.type==c.CHILD&&(t._$AP??=$,t._$AQ??=x)};class f extends d{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),b(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(u(this,t),m(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}class h{}const _=new WeakMap,A=p(class extends f{render(t){return s}update(t,[e]){const i=e!==this.G;return i&&void 0!==this.G&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),s}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const e=this.ht??globalThis;let s=_.get(e);void 0===s&&(s=new WeakMap,_.set(e,s)),void 0!==s.get(this.G)&&this.G.call(this.ht,void 0),s.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?_.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}),y=i`:host{display:flex;flex-direction:column;gap:var(--sp-1)}.text{margin:0}.text.is-clamped{display:-webkit-box;-webkit-box-orient:vertical;overflow:hidden}.toggle{align-self:flex-start}`;let w=class MqClampedText extends o{constructor(){super(...arguments),this.lines=2,this.expandLabel="",this.collapseLabel="",this.expanded=!1,this.overflowing=!1,this.textRef=new h,this.measure=()=>{const t=this.textRef.value;if(!t||this.expanded)return;const e=t.scrollHeight-t.clientHeight>1;e!==this.overflowing&&(this.overflowing=e)}}static{this.styles=y}updated(){const t=this.textRef.value;t&&!this.resizeObserver&&(this.resizeObserver=new ResizeObserver(()=>this.measure()),this.resizeObserver.observe(t)),this.measure()}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect(),this.resizeObserver=void 0}render(){return n`<div ${A(this.textRef)} class="text ${a({"is-clamped":!this.expanded})}" style="${v({"-webkit-line-clamp":this.expanded?"":String(this.lines)})}"><slot @slotchange="${this.measure}"></slot></div>${this.expanded||this.overflowing?n`<mq-text-button class="toggle" type="button" size="sm" fontWeight="normal" underlined @click="${()=>{this.expanded=!this.expanded}}">${this.expanded?this.collapseLabel:this.expandLabel}</mq-text-button>`:s}`}};t([r({type:Number})],w.prototype,"lines",void 0),t([r({type:String,attribute:"expand-label"})],w.prototype,"expandLabel",void 0),t([r({type:String,attribute:"collapse-label"})],w.prototype,"collapseLabel",void 0),t([l()],w.prototype,"expanded",void 0),t([l()],w.prototype,"overflowing",void 0),w=t([e("mq-clamped-text")],w);export{w as M,f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,t}from"./custom-element-DA9Fxvxd.js";import{m as a}from"./runtime-Bg1WXVCx.js";import{t as r,c as n,n as s,g as o,p as i,a as l,s as d,l as c}from"./parseISO-jT42c8Ob.js";import{i as v,a as h,x as u}from"./lit-element-DiWJYFwC.js";import{n as p}from"./property-scuRaFcM.js";import{r as g}from"./state-LQivXIgA.js";import{e as m}from"./class-map-Co76I6aw.js";import{chevronLeftIcon as y}from"../ui/icons/chevron-left-icon.js";import{chevronRightIcon as b}from"../ui/icons/chevron-right-icon.js";import{spinnerIcon as f}from"../ui/icons/spinner-icon.js";import{i as D}from"./isSameDay-DPfclwIL.js";import{i as k}from"./isBefore-Cof0D841.js";function w(e,t,a){const s=r(e,a?.in);if(isNaN(t))return n(e,NaN);if(!t)return s;const o=s.getDate(),i=n(e,s.getTime());i.setMonth(s.getMonth()+t+1,0);return o>=i.getDate()?i:(s.setFullYear(i.getFullYear(),i.getMonth(),o),s)}function M(e,t){const a=r(e,t?.in),n=a.getMonth();return a.setFullYear(a.getFullYear(),n+1,0),a.setHours(23,59,59,999),a}function S(e,t){const{start:a,end:r}=function(e,t){const[a,r]=s(e,t.start,t.end);return{start:a,end:r}}(t?.in,e);let o=+a>+r;const i=o?+a:+r,l=o?r:a;l.setHours(0,0,0,0);const d=[];for(;+l<=i;)d.push(n(a,l)),l.setDate(l.getDate()+1),l.setHours(0,0,0,0);return o?d.reverse():d}function x(e,t){const a=r(e,t?.in);return a.setDate(1),a.setHours(0,0,0,0),a}function E(e,t){const a=o(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,s=r(e,t?.in),i=s.getDay(),l=6+(i<n?-7:0)-(i-n);return s.setDate(s.getDate()+l),s.setHours(23,59,59,999),s}function j(e,t){return+r(e)>+r(t)}function $(e,t){return D(n(e,e),function(e){return n(e,Date.now())}(e))}const N=v`:host{display:block;font-family:var(--font-body)}.calendar{background:var(--color-card);border-radius:var(--border-radius-lg);user-select:none}.calendar-header{display:flex;align-items:center;justify-content:space-between;background:var(--color-primary-background-extraWeak);padding:var(--sp-4);border-radius:var(--border-radius-lg) var(--border-radius-lg) 0 0}.calendar-header-title{font-family:var(--font-titles);font-size:var(--text-lg);font-weight:var(--font-weight-bold);color:var(--color-gray-darkest)}.calendar-body{position:relative;transition:opacity .2s}.calendar-body.loading{opacity:.4;pointer-events:none}.calendar-nav{display:flex;gap:var(--sp-2)}.calendar-nav-button{display:flex;align-items:center;justify-content:center;width:var(--size-8);height:var(--size-8);border:none;background:0 0;border-radius:var(--border-radius-md);cursor:pointer;transition:background-color .2s;color:var(--color-gray-darkest);padding:0}.calendar-nav-button:hover{background:var(--color-background-primary-light)}.calendar-nav-button:disabled{opacity:.3;cursor:not-allowed}.calendar-weekdays{display:grid;grid-template-columns:repeat(7,var(--sp-11));justify-content:space-between;padding:var(--sp-4) var(--sp-4) var(--sp-2) var(--sp-4)}.calendar-weekday{text-align:center;font-size:var(--text-sm);font-weight:var(--font-weight-bold);color:var(--color-gray-darkest);padding:var(--sp-2)}.calendar-days{display:grid;gap:var(--sp-1);grid-template-columns:repeat(7,var(--sp-11));justify-content:space-between;padding:0 var(--sp-4) var(--sp-4) var(--sp-4)}.calendar-day{width:var(--sp-11);height:var(--sp-11);display:flex;align-items:center;justify-content:center;border:none;background:0 0;border-radius:var(--border-radius-full);cursor:pointer;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-gray-darkest);transition:all .2s;padding:0;position:relative}.calendar-day:hover:not(:disabled):not(.other-month){background:var(--color-gray-lighter)}.calendar-day.other-month{color:var(--color-gray-medium);background:0 0}.calendar-day:disabled{color:var(--color-gray-medium);background:0 0;cursor:not-allowed}.calendar-day.available:not(.selected){background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-semibold)}.calendar-day.available:hover:not(:disabled):not(.selected){background:var(--color-primary-dark)}.calendar-day.selected{background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-bold)}.calendar-day.selected:hover:not(:disabled){background:var(--color-primary-dark)}.calendar-day-empty{width:var(--sp-11);height:var(--sp-11)}.calendar-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;pointer-events:none;z-index:10}@media (min-width:640px){.calendar-weekdays{gap:var(--sp-2)}.calendar-days{gap:var(--sp-2)}}@media (min-width:768px){.calendar-weekdays{gap:var(--sp-3)}.calendar-days{gap:var(--sp-3)}}@media (min-width:1024px){.calendar-weekdays{gap:var(--sp-4)}.calendar-days{gap:var(--sp-4)}}`;class DateSelectEvent extends Event{static{this.eventName="date-select"}constructor(e){super(DateSelectEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class PrevMonthEvent extends Event{static{this.eventName="prev-month"}constructor(e){super(PrevMonthEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}class NextMonthEvent extends Event{static{this.eventName="next-month"}constructor(e){super(NextMonthEvent.eventName,{bubbles:!0,composed:!0}),this.detail=e}}let C=class MqCalendar extends h{constructor(){super(...arguments),this.locale="es-ES",this.isLoading=!1,this.handlePrevMonth=()=>{const e=this.getCurrentMonthDate(),t=w(e,-1,a);var a;this.dispatchEvent(new PrevMonthEvent({currentMonth:t.toISOString()}))},this.handleNextMonth=()=>{const e=w(this.getCurrentMonthDate(),1);this.dispatchEvent(new NextMonthEvent({currentMonth:e.toISOString()}))},this.handleDayClick=e=>{e.isDisabled||(this.selectedDate=e.date,this.value=e.date.toISOString(),this.dispatchEvent(new DateSelectEvent({date:e.date.toISOString()})),this.requestUpdate())}}static{this.styles=[N]}connectedCallback(){super.connectedCallback(),this.value&&(this.selectedDate=i(this.value))}getMonthYear(){const e=this.getCurrentMonthDate();return new Intl.DateTimeFormat(this.locale,{month:"long",year:"numeric"}).format(e)}getCurrentMonthDate(){return this.currentMonth?i(this.currentMonth):new Date}getWeekdays(){const e=l(new Date(2024,0,1),{weekStartsOn:1}),t=S({start:e,end:E(e,{weekStartsOn:1})}),a=new Intl.DateTimeFormat(this.locale,{weekday:"narrow"});return t.map(e=>a.format(e).toUpperCase())}getDaysInMonth(){const e=this.getCurrentMonthDate(),t=x(e),a=M(e);return S({start:l(t,{weekStartsOn:1}),end:E(a,{weekStartsOn:1})}).map(t=>{const a=function(e,t,a){const[r,n]=s(a?.in,e,t);return r.getFullYear()===n.getFullYear()&&r.getMonth()===n.getMonth()}(t,e);return this.createCalendarDay(t,a)})}createCalendarDay(e,t){const a=d(e),r=$(a),n=this.isDateAvailable(a);return{date:a,isCurrentMonth:t,isToday:r,isDisabled:this.isDateDisabled(a,n),isSelected:!!this.selectedDate&&D(a,this.selectedDate),isAvailable:n}}isDateAvailable(e){if(!this.availableDays||0===this.availableDays.length)return!1;const t=d(e);return this.availableDays.some(e=>{const a=d(i(e));return D(t,a)})}isDateDisabled(e,t){const a=d(e);if(this.availableDays&&this.availableDays.length>0)return!t;if(this.minDate){const e=d(i(this.minDate));if(k(a,e))return!0}if(this.maxDate){if(j(a,d(i(this.maxDate))))return!0}return!1}render(){const e=this.getDaysInMonth(),t=this.getWeekdays();return u`<div class="calendar"><div class="calendar-header"><button class="calendar-nav-button" @click="${this.handlePrevMonth}" aria-label="${a("Mes anterior")}">${y({size:24})}</button><div class="calendar-header-title">${this.getMonthYear()}</div><button class="calendar-nav-button" @click="${this.handleNextMonth}" aria-label="${a("Mes siguiente")}">${b({size:24})}</button></div><div class="calendar-body ${this.isLoading?"loading":""}"><div class="calendar-weekdays">${t.map(e=>u`<div class="calendar-weekday">${e}</div>`)}</div><div class="calendar-days">${e.map(e=>e.isCurrentMonth?u`<button class="${m({"calendar-day":!0,"other-month":!e.isCurrentMonth,today:e.isToday,selected:e.isSelected,available:e.isAvailable})}" ?disabled="${e.isDisabled||this.isLoading}" @click="${()=>this.handleDayClick(e)}" aria-label="${e.date.toLocaleDateString(this.locale)}">${e.date.getDate()}</button>`:u`<div class="calendar-day-empty"></div>`)}</div>${this.isLoading?u`<div class="calendar-spinner">${f({size:40,color:"var(--color-primary)"})}</div>`:""}</div></div>`}};e([p({type:String})],C.prototype,"locale",void 0),e([p({type:String,attribute:"min-date"})],C.prototype,"minDate",void 0),e([p({type:String,attribute:"max-date"})],C.prototype,"maxDate",void 0),e([p({type:String})],C.prototype,"value",void 0),e([p({type:Boolean,attribute:"is-loading"})],C.prototype,"isLoading",void 0),e([p({type:String,attribute:"current-month"})],C.prototype,"currentMonth",void 0),e([p({type:Array,attribute:"available-days"})],C.prototype,"availableDays",void 0),e([g()],C.prototype,"selectedDate",void 0),C=e([c(),t("mq-calendar")],C);export{DateSelectEvent as D,C as M,NextMonthEvent as N,PrevMonthEvent as P,M as e,j as i,x as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as t,t as e}from"./custom-element-DA9Fxvxd.js";import{x as a,i,a as s}from"./lit-element-DiWJYFwC.js";import{n as r}from"./property-scuRaFcM.js";import{e as o}from"./class-map-Co76I6aw.js";import{t as n,c as l,p as d,s as c,l as h}from"./parseISO-jT42c8Ob.js";import{f as m}from"./format-Cm3B1GMy.js";import"../ui/mq-skeleton.js";import{m as v}from"./runtime-Bg1WXVCx.js";import{i as p}from"./isSameDay-DPfclwIL.js";function u(t,e,a){const i=n(t,a?.in);return isNaN(e)?l(t,NaN):e?(i.setDate(i.getDate()+e),i):i}function g(t,e){const a=d(t);if(e)try{const t=new Intl.DateTimeFormat("en-CA",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(a),i=e=>t.find(t=>t.type===e)?.value??"";return{dateKey:`${i("year")}-${i("month")}-${i("day")}`,label:`${i("hour")}:${i("minute")}`}}catch{}return{dateKey:m(c(a),"yyyy-MM-dd"),label:m(a,"HH:mm")}}const y=i`:host{display:block;font-family:var(--font-body)}.time-slot-picker{display:flex;flex-direction:column;gap:var(--sp-4);border-radius:var(--border-radius-lg);transition:opacity .2s}.time-slot-picker.is-loading{opacity:.6}.picker-content{display:flex;flex-direction:column;gap:var(--sp-4)}.columns-wrapper{position:relative;display:flex;flex-direction:column;gap:var(--sp-4);flex:1;min-width:0}.grid-container{display:grid;grid-template-columns:repeat(var(--visible-days,4),1fr);gap:var(--sp-2);position:relative}.dates-header{position:sticky;top:0;display:contents;z-index:10;padding-bottom:var(--sp-2)}.nav-button{position:absolute;top:var(--sp-9);transform:translateY(-50%);display:flex;align-items:center;justify-content:center;width:var(--size-6);height:var(--size-6);border:none;cursor:pointer;transition:background-color .2s;background:var(--color-primary);color:var(--color-white);border-radius:var(--border-radius-full);padding:0;z-index:20}.nav-button-prev{left:0;transform:translate(-50%,-50%)}.nav-button-next{right:0;transform:translate(50%,-50%)}.nav-button:hover:not(:disabled){background:var(--color-primary-dark)}.nav-button:disabled{background:var(--color-neutrals-background-disabled);color:var(--color-neutrals-text-medium);cursor:not-allowed}.date-card{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:var(--sp-2) var(--sp-3);border:1px solid var(--color-neutrals-border-disabled);background:var(--color-white);border-radius:var(--border-radius-lg);transition:all .2s;min-width:var(--sp-16);height:var(--sp-18);flex:1}.date-weekday{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);text-transform:capitalize}.date-day{font-size:var(--text-xl);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default)}.date-month{font-size:var(--text-sm);line-height:var(--text-sm--line-height);font-weight:var(--font-weight-normal);color:var(--color-neutrals-text-default);text-transform:capitalize}.time-slots-container{display:contents}.time-slots-column{display:flex;flex-direction:column;gap:var(--sp-2)}.time-slot{padding:var(--sp-2) var(--sp-1);border:1px solid var(--color-border);background:var(--color-muted);border-radius:var(--border-radius-md);cursor:pointer;transition:all .2s;font-family:var(--font-body);font-size:var(--text-sm);font-weight:var(--font-weight-medium);color:var(--color-neutrals-text-default);text-align:center;min-width:var(--sp-16);height:var(--sp-11)}.time-slot:hover{background:var(--color-primary-light)}.time-slot.selected{border-color:var(--color-primary);background:var(--color-primary);color:var(--color-white);font-weight:var(--font-weight-bold)}.empty-state{display:flex;align-items:center;justify-content:center;padding:var(--sp-12) var(--sp-6);text-align:center;grid-column:1/-1;font-size:var(--text-sm);color:var(--color-neutrals-text-weak)}`;class WindowChangeEvent extends Event{static{this.eventName="window-change"}constructor(t){super(WindowChangeEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}class SlotSelectEvent extends Event{static{this.eventName="slot-select"}constructor(t){super(SlotSelectEvent.eventName,{bubbles:!0,composed:!0}),this.detail=t}}let f=class MqTimeSlotPicker extends s{constructor(){super(...arguments),this.locale="es-ES",this.slots=[],this.visibleDays=4,this.isLoading=!1,this.handlePrevious=()=>{if(!this.canGoPrevious)return;const t=u(this.getStartDate(),-this.visibleDays),e=c(new Date),a=t<e?e:t,i=this.formatDate(a);this.dispatchEvent(new WindowChangeEvent({windowStartDate:i}))},this.handleNext=()=>{const t=u(this.getStartDate(),this.visibleDays),e=this.formatDate(t);this.dispatchEvent(new WindowChangeEvent({windowStartDate:e}))},this.handleTimeSlotSelect=(t,e)=>{const a=this.formatDate(t.date);this.selectedDate=a,this.selectedSlotKey=e.key,this.dispatchEvent(new SlotSelectEvent({slot:{key:e.key,date:e.date}}))}}static{this.styles=[y]}getStartDate(){return this.windowStartDate?c(d(this.windowStartDate)):c(new Date)}get slotsByDate(){const t=new Map;for(const e of this.slots){const{dateKey:a,label:i}=g(e.date,this.timezone);t.has(a)||t.set(a,[]),t.get(a)?.push({key:e.key,label:i,date:e.date})}for(const e of t.values())e.sort((t,e)=>{const a=d(t.date),i=d(e.date);return a.getTime()-i.getTime()});return t}get visibleDaysList(){const t=this.getStartDate(),e=[],a=this.slotsByDate;for(let i=0;i<this.visibleDays;i++){const s=u(t,i),r=this.formatDate(s),o=a.get(r)||[];e.push({date:s,slots:o})}return e}get canGoPrevious(){return this.getStartDate()>c(new Date)}formatDate(t){return m(t,"yyyy-MM-dd")}formatDayHeader(t){return{weekday:new Intl.DateTimeFormat(this.locale,{weekday:"short"}).format(t),day:new Intl.DateTimeFormat(this.locale,{day:"numeric"}).format(t),month:new Intl.DateTimeFormat(this.locale,{month:"short"}).format(t)}}isDateSelected(t){if(!this.selectedDate)return!1;const e=d(this.selectedDate);return p(t,e)}isTimeSlotSelected(t,e){return this.isDateSelected(t.date)&&this.selectedSlotKey===e.key}get hasSlots(){return this.slots.length>0}renderSkeletonSlots(){return a`${Array.from({length:this.visibleDays}).map((t,e)=>{const i=[2,3,4,3],s=i[e%i.length]??3;return a`<div class="time-slots-column">${Array.from({length:s}).map(()=>a`<mq-skeleton width="100%" height="40px" border-radius="md"></mq-skeleton>`)}</div>`})}`}renderEmptyState(){return a`<div class="empty-state">${v("No hay horarios disponibles")}</div>`}render(){const t=this.canGoPrevious,e=!this.isLoading&&!this.hasSlots;return a`<div class="${o({"time-slot-picker":!0,"is-loading":this.isLoading})}" style="--visible-days:${this.visibleDays}"><div class="picker-content"><div class="columns-wrapper">${t?a`<button class="nav-button nav-button-prev" @click="${this.handlePrevious}" ?disabled="${this.isLoading}" aria-label="${v("Fechas anteriores")}">${a`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1510_1791)"><path d="M8.05454 11.9155L2.72136 6.29527C2.69487 6.26742 2.67385 6.23433 2.65951 6.19791C2.64517 6.16149 2.63779 6.12245 2.63779 6.08302C2.63779 6.04359 2.64517 6.00454 2.65951 5.96812C2.67385 5.9317 2.69487 5.89862 2.72136 5.87077L8.2124 0.0844726L8.61523 0.508968L3.32539 6.08302L8.45738 11.491L8.05454 11.9155Z" fill="currentColor"/></g><defs><clipPath id="clip0_1510_1791"><rect width="11.831" height="11.2273" fill="currentColor" transform="translate(11.2402 0.0844727) rotate(90)"/></clipPath></defs></svg>`}</button>`:null} ${a`<button class="nav-button nav-button-next" @click="${this.handleNext}" ?disabled="${this.isLoading}" aria-label="${v("Fechas siguientes")}">${a`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_1510_474)"><path d="M3.94546 0.0845423L9.27864 5.70473C9.30513 5.73258 9.32615 5.76566 9.34049 5.80209C9.35483 5.83851 9.36221 5.87755 9.36221 5.91698C9.36221 5.95641 9.35483 5.99546 9.34049 6.03188C9.32615 6.0683 9.30513 6.10138 9.27864 6.12923L3.7876 11.9155L3.38477 11.491L8.67461 5.91698L3.54262 0.509039L3.94546 0.0845423Z" fill="currentColor"/></g><defs><clipPath id="clip0_1510_474"><rect width="11.831" height="11.2273" fill="currentColor" transform="translate(0.759766 11.9155) rotate(-90)"/></clipPath></defs></svg>`}</button>`}<div class="grid-container"><div class="dates-header">${this.visibleDaysList.map(t=>{const{weekday:e,day:i,month:s}=this.formatDayHeader(t.date);return a`<div class="date-card"><div class="date-weekday">${e}</div><div class="date-day">${i}</div><div class="date-month">${s}</div></div>`})}</div><div class="time-slots-container">${e?this.renderEmptyState():this.isLoading?this.renderSkeletonSlots():this.visibleDaysList.map(t=>{const e=this.isDateSelected(t.date);return a`<div class="${o({"time-slots-column":!0,active:e})}">${t.slots.map(e=>{const i=this.isTimeSlotSelected(t,e);return a`<button class="${o({"time-slot":!0,selected:i})}" @click="${()=>this.handleTimeSlotSelect(t,e)}">${e.label}</button>`})}</div>`})}</div></div></div></div></div>`}};t([r({type:String})],f.prototype,"locale",void 0),t([r({type:String})],f.prototype,"timezone",void 0),t([r({type:Array})],f.prototype,"slots",void 0),t([r({type:String,attribute:"selected-date"})],f.prototype,"selectedDate",void 0),t([r({type:String,attribute:"selected-slot-key"})],f.prototype,"selectedSlotKey",void 0),t([r({type:String,attribute:"window-start-date"})],f.prototype,"windowStartDate",void 0),t([r({type:Number,attribute:"visible-days"})],f.prototype,"visibleDays",void 0),t([r({type:Boolean,attribute:"is-loading"})],f.prototype,"isLoading",void 0),f=t([h(),e("mq-time-slot-picker")],f);export{f as M,SlotSelectEvent as S,WindowChangeEvent as W,u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as r}from"./parseISO-jT42c8Ob.js";function t(t,o){return+r(t)<+r(o)}export{t as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as s,s as n}from"./parseISO-jT42c8Ob.js";function r(r,o,t){const[a,i]=s(t?.in,r,o);return+n(a)===+n(i)}export{r as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),r=new WeakMap;let o=class n{constructor(t,e,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=r.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&r.set(s,t))}return t}toString(){return this.cssText}};const h=t=>new o("string"==typeof t?t:t+"",void 0,s),a=(t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1],t[0]);return new o(r,t,s)},l=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return h(e)})(t):t,{is:c,defineProperty:d,getOwnPropertyDescriptor:p,getOwnPropertyNames:u,getOwnPropertySymbols:$,getPrototypeOf:_}=Object,f=globalThis,A=f.trustedTypes,m=A?A.emptyScript:"",g=f.reactiveElementPolyfillSupport,v=(t,e)=>t,E={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},S=(t,e)=>!c(t,e),b={attribute:!0,type:String,converter:E,reflect:!1,useDefault:!1,hasChanged:S};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;let w=class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&d(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:o}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const h=r?.call(this);o?.call(this,e),this.requestUpdate(t,h,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=_(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...u(t),...$(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const s=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((s,r)=>{if(e)s.adoptedStyleSheets=r.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of r){const r=document.createElement("style"),o=t.litNonce;void 0!==o&&r.setAttribute("nonce",o),r.textContent=e.cssText,s.appendChild(r)}})(s,this.constructor.elementStyles),s}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:E).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:E;this._$Em=r;const h=o.fromAttribute(e,t.type);this[r]=h??this._$Ej?.get(r)??h,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const r=this.constructor,o=this[t];if(s??=r.getPropertyOptions(t),!((s.hasChanged??S)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:o},h){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,h??e??this[t]),!0!==o||void 0!==h)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[v("elementProperties")]=new Map,w[v("finalized")]=new Map,g?.({ReactiveElement:w}),(f.reactiveElementVersions??=[]).push("2.1.1");const C=globalThis,P=C.trustedTypes,x=P?P.createPolicy("lit-html",{createHTML:t=>t}):void 0,U="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+O,D=`<${T}>`,j=document,B=()=>j.createComment(""),W=t=>null===t||"object"!=typeof t&&"function"!=typeof t,V=Array.isArray,q="[ \t\n\f\r]",J=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,K=/-->/g,Z=/>/g,F=RegExp(`>|${q}(?:([^\\s"'>=/]+)(${q}*=${q}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),G=/'/g,Q=/"/g,X=/^(?:script|style|textarea|title)$/i,Y=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),tt=Symbol.for("lit-noChange"),et=Symbol.for("lit-nothing"),st=new WeakMap,it=j.createTreeWalker(j,129);function nt(t,e){if(!V(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const rt=(t,e)=>{const s=t.length-1,r=[];let o,h=2===e?"<svg>":3===e?"<math>":"",a=J;for(let e=0;e<s;e++){const s=t[e];let l,c,d=-1,p=0;for(;p<s.length&&(a.lastIndex=p,c=a.exec(s),null!==c);)p=a.lastIndex,a===J?"!--"===c[1]?a=K:void 0!==c[1]?a=Z:void 0!==c[2]?(X.test(c[2])&&(o=RegExp("</"+c[2],"g")),a=F):void 0!==c[3]&&(a=F):a===F?">"===c[0]?(a=o??J,d=-1):void 0===c[1]?d=-2:(d=a.lastIndex-c[2].length,l=c[1],a=void 0===c[3]?F:'"'===c[3]?Q:G):a===Q||a===G?a=F:a===K||a===Z?a=J:(a=F,o=void 0);const u=a===F&&t[e+1].startsWith("/>")?" ":"";h+=a===J?s+D:d>=0?(r.push(l),s.slice(0,d)+U+s.slice(d)+O+u):s+O+(-2===d?e:u)}return[nt(t,h+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]};class N{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let o=0,h=0;const a=t.length-1,l=this.parts,[c,d]=rt(t,e);if(this.el=N.createElement(c,s),it.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=it.nextNode())&&l.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(U)){const e=d[h++],s=r.getAttribute(t).split(O),a=/([.?@])?(.*)/.exec(e);l.push({type:1,index:o,name:a[2],strings:s,ctor:"."===a[1]?H:"?"===a[1]?I:"@"===a[1]?L:k}),r.removeAttribute(t)}else t.startsWith(O)&&(l.push({type:6,index:o}),r.removeAttribute(t));if(X.test(r.tagName)){const t=r.textContent.split(O),e=t.length-1;if(e>0){r.textContent=P?P.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],B()),it.nextNode(),l.push({type:2,index:++o});r.append(t[e],B())}}}else if(8===r.nodeType)if(r.data===T)l.push({type:2,index:o});else{let t=-1;for(;-1!==(t=r.data.indexOf(O,t+1));)l.push({type:7,index:o}),t+=O.length-1}o++}}static createElement(t,e){const s=j.createElement("template");return s.innerHTML=t,s}}function ot(t,e,s=t,r){if(e===tt)return e;let o=void 0!==r?s._$Co?.[r]:s._$Cl;const h=W(e)?void 0:e._$litDirective$;return o?.constructor!==h&&(o?._$AO?.(!1),void 0===h?o=void 0:(o=new h(t),o._$AT(t,s,r)),void 0!==r?(s._$Co??=[])[r]=o:s._$Cl=o),void 0!==o&&(e=ot(t,o._$AS(t,e.values),o,r)),e}class M{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??j).importNode(e,!0);it.currentNode=r;let o=it.nextNode(),h=0,a=0,l=s[0];for(;void 0!==l;){if(h===l.index){let e;2===l.type?e=new R(o,o.nextSibling,this,t):1===l.type?e=new l.ctor(o,l.name,l.strings,this,t):6===l.type&&(e=new z(o,this,t)),this._$AV.push(e),l=s[++a]}h!==l?.index&&(o=it.nextNode(),h++)}return it.currentNode=j,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=et,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ot(this,t,e),W(t)?t===et||null==t||""===t?(this._$AH!==et&&this._$AR(),this._$AH=et):t!==this._$AH&&t!==tt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>V(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==et&&W(this._$AH)?this._$AA.nextSibling.data=t:this.T(j.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(nt(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new M(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=st.get(t.strings);return void 0===e&&st.set(t.strings,e=new N(t)),e}k(t){V(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const o of t)r===e.length?e.push(s=new R(this.O(B()),this.O(B()),this,this.options)):s=e[r],s._$AI(o),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,o){this.type=1,this._$AH=et,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=et}_$AI(t,e=this,s,r){const o=this.strings;let h=!1;if(void 0===o)t=ot(this,t,e,0),h=!W(t)||t!==this._$AH&&t!==tt,h&&(this._$AH=t);else{const r=t;let a,l;for(t=o[0],a=0;a<o.length-1;a++)l=ot(this,r[s+a],e,a),l===tt&&(l=this._$AH[a]),h||=!W(l)||l!==this._$AH[a],l===et?t=et:t!==et&&(t+=(l??"")+o[a+1]),this._$AH[a]=l}h&&!r&&this.j(t)}j(t){t===et?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===et?void 0:t}}class I extends k{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==et)}}class L extends k{constructor(t,e,s,r,o){super(t,e,s,r,o),this.type=5}_$AI(t,e=this){if((t=ot(this,t,e,0)??et)===tt)return;const s=this._$AH,r=t===et&&s!==et||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==et&&(s===et||r);r&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class z{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){ot(this,t)}}const ht=C.litHtmlPolyfillSupport;ht?.(N,R),(C.litHtmlVersions??=[]).push("3.3.1");const at=globalThis;class i extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const r=s?.renderBefore??e;let o=r._$litPart$;if(void 0===o){const t=s?.renderBefore??null;r._$litPart$=o=new R(e.insertBefore(B(),t),t,void 0,s??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tt}}i._$litElement$=!0,i.finalized=!0,at.litElementHydrateSupport?.({LitElement:i});const lt=at.litElementPolyfillSupport;lt?.({LitElement:i}),(at.litElementVersions??=[]).push("4.2.1");export{et as E,tt as T,i as a,S as f,a as i,h as r,E as u,Y as x};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as a}from"./task-Bj8p7kJX.js";var s=class extends a{constructor(a,s,t){super(a,{task:async([a,t])=>await s.auth.loginToken({api_key:a,token:t}),...t})}};export{s as L};
|