1var Rc=Object.defineProperty;var vn=t=>{throw TypeError(t)};var Tc=(t,s,a)=>s in t?Rc(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var da=(t,s,a)=>Tc(t,typeof s!="symbol"?s+"":s,a),br=(t,s,a)=>s.has(t)||vn("Cannot "+a);var O=(t,s,a)=>(br(t,s,"read from private field"),a?a.call(t):s.get(t)),_e=(t,s,a)=>s.has(t)?vn("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,a),je=(t,s,a,r)=>(br(t,s,"write to private field"),r?r.call(t,a):s.set(t,a),a),it=(t,s,a)=>(br(t,s,"access private method"),a);var Oa=(t,s,a,r)=>({set _(n){je(t,s,n,a)},get _(){return O(t,s,r)}});import{j as e,P as Qe,c as na,a as la,u as st,A as er,b as Pe,d as tr,D as Hr,C as Vr,e as Gr,f as gl,S as Ic,g as pl,h as fl,i as Dc,k as jl,I as bl,l as yl,m as vl,R as Nl,L as wl,n as kl,o as Mc,T as Fc,p as Sl,q as Cl,r as _l,F as Pl,s as El,t as Al,v as pa,w as Rl,x as sr,y as Tl,z as Il,B as Dl,E as Bc,O as Wr,G as Kr,H as Qr,J as Yr,K as Jr,M as Ml,N as Fl,Q as Bl,U as Oc,V as gs,W as Lc,X as qc,Y as Ol,Z as $c,_ as Ll}from"./ui-BGYSU3IC.js";import{a as Xr,r as l,c as ae,b as Uc}from"./vendor-BzX9eK2F.js";import{u as $s,N as Ns,a as vt,L as ct,b as zc,B as Hc,R as Vc,c as Ye}from"./router-C4Z68Wq6.js";import{c as Gc}from"./supabase-B57OsshV.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))r(n);new MutationObserver(n=>{for(const i of n)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function a(n){const i={};return n.integrity&&(i.integrity=n.integrity),n.referrerPolicy&&(i.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?i.credentials="include":n.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(n){if(n.ep)return;n.ep=!0;const i=a(n);fetch(n.href,i)}})();var ql,Nn=Xr;ql=Nn.createRoot,Nn.hydrateRoot;var wn=["light","dark"],Wc="(prefers-color-scheme: dark)",Kc=l.createContext(void 0),Qc={setTheme:t=>{},themes:[]},Yc=()=>{var t;return(t=l.useContext(Kc))!=null?t:Qc};l.memo(({forcedTheme:t,storageKey:s,attribute:a,enableSystem:r,enableColorScheme:n,defaultTheme:i,value:o,attrs:c,nonce:d})=>{let h=i==="system",u=a==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(v=>`'${v}'`).join(",")})`};`:`var d=document.documentElement,n='${a}',s='setAttribute';`,p=n?wn.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",f=(v,x=!1,g=!0)=>{let j=o?o[v]:v,b=x?v+"|| ''":`'${j}'`,N="";return n&&g&&!x&&wn.includes(v)&&(N+=`d.style.colorScheme = '${v}';`),a==="class"?x||j?N+=`c.add(${b})`:N+="null":j&&(N+=`d[s](n,${b})`),N},m=t?`!function(){${u}${f(t)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${s}');if('system'===e||(!e&&${h})){var t='${Wc}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f("dark")}}else{${f("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}${h?"":"else{"+f(i,!1,!1)+"}"}${p}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${s}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${f(o?"x[e]":"e",!0)}}else{${f(i,!1,!1)};}${p}}catch(t){}}();`;return l.createElement("script",{nonce:d,dangerouslySetInnerHTML:{__html:m}})});var Jc=t=>{switch(t){case"success":return ed;case"info":return sd;case"warning":return td;case"error":return ad;default:return null}},Xc=Array(12).fill(0),Zc=({visible:t,className:s})=>ae.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},ae.createElement("div",{className:"sonner-spinner"},Xc.map((a,r)=>ae.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),ed=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),td=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),sd=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),ad=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ae.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),rd=ae.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ae.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ae.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),nd=()=>{let[t,s]=ae.useState(document.hidden);return ae.useEffect(()=>{let a=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",a),()=>window.removeEventListener("visibilitychange",a)},[]),t},kr=1,ld=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;let{message:a,...r}=t,n=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:kr++,i=this.toasts.find(c=>c.id===n),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(n)&&this.dismissedToasts.delete(n),i?this.toasts=this.toasts.map(c=>c.id===n?(this.publish({...c,...t,id:n,title:a}),{...c,...t,id:n,dismissible:o,title:a}):c):this.addToast({title:a,...r,dismissible:o,id:n}),n},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(s=>{this.subscribers.forEach(a=>a({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:t,dismiss:!0})),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let a;s.loading!==void 0&&(a=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=t instanceof Promise?t:t(),n=a!==void 0,i,o=r.then(async d=>{if(i=["resolve",d],ae.isValidElement(d))n=!1,this.create({id:a,type:"default",message:d});else if(od(d)&&!d.ok){n=!1;let h=typeof s.error=="function"?await s.error(`HTTP error! status: ${d.status}`):s.error,u=typeof s.description=="function"?await s.description(`HTTP error! status: ${d.status}`):s.description;this.create({id:a,type:"error",message:h,description:u})}else if(s.success!==void 0){n=!1;let h=typeof s.success=="function"?await s.success(d):s.success,u=typeof s.description=="function"?await s.description(d):s.description;this.create({id:a,type:"success",message:h,description:u})}}).catch(async d=>{if(i=["reject",d],s.error!==void 0){n=!1;let h=typeof s.error=="function"?await s.error(d):s.error,u=typeof s.description=="function"?await s.description(d):s.description;this.create({id:a,type:"error",message:h,description:u})}}).finally(()=>{var d;n&&(this.dismiss(a),a=void 0),(d=s.finally)==null||d.call(s)}),c=()=>new Promise((d,h)=>o.then(()=>i[0]==="reject"?h(i[1]):d(i[1])).catch(h));return typeof a!="string"&&typeof a!="number"?{unwrap:c}:Object.assign(a,{unwrap:c})},this.custom=(t,s)=>{let a=(s==null?void 0:s.id)||kr++;return this.create({jsx:t(a),id:a,...s}),a},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},ft=new ld,id=(t,s)=>{let a=(s==null?void 0:s.id)||kr++;return ft.addToast({title:t,...s,id:a}),a},od=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",cd=id,dd=()=>ft.toasts,md=()=>ft.getActiveToasts();Object.assign(cd,{success:ft.success,info:ft.info,warning:ft.warning,error:ft.error,custom:ft.custom,message:ft.message,promise:ft.promise,dismiss:ft.dismiss,loading:ft.loading},{getHistory:dd,getToasts:md});function hd(t,{insertAt:s}={}){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",s==="top"&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}hd(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;
1left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}
1:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);
1--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} 2`);function La(t){return t.label!==void 0}var ud=3,xd="32px",gd="16px",kn=4e3,pd=356,fd=14,jd=20,bd=200;function Tt(...t){return t.filter(Boolean).join(" ")}function yd(t){let[s,a]=t.split("-"),r=[];return s&&r.push(s),a&&r.push(a),r}var vd=t=>{var s,a,r,n,i,o,c,d,h,u,p;let{invert:f,toast:m,unstyled:v,interacting:x,setHeights:g,visibleToasts:j,heights:b,index:N,toasts:I,expanded:y,removeToast:w,defaultRichColors:k,closeButton:_,style:M,cancelButtonStyle:q,actionButtonStyle:D,className:F="",descriptionClassName:S="",duration:$,position:J,gap:V,loadingIcon:R,expandByDefault:se,classNames:C,icons:Y,closeButtonAriaLabel:ne="Close toast",pauseWhenPageIsHidden:re}=t,[me,he]=ae.useState(null),[E,ce]=ae.useState(null),[B,le]=ae.useState(!1),[Q,ie]=ae.useState(!1),[G,oe]=ae.useState(!1),[xe,ue]=ae.useState(!1),[Ee,ve]=ae.useState(!1),[qe,tt]=ae.useState(0),[He,at]=ae.useState(0),rt=ae.useRef(m.duration||$||kn),te=ae.useRef(null),fe=ae.useRef(null),Fe=N===0,Ve=N+1<=j,De=m.type,T=m.dismissible!==!1,pe=m.className||"",Ne=m.descriptionClassName||"",$e=ae.useMemo(()=>b.findIndex(ge=>ge.toastId===m.id)||0,[b,m.id]),Ct=ae.useMemo(()=>{var ge;return(ge=m.closeButton)!=null?ge:_},[m.closeButton,_]),_t=ae.useMemo(()=>m.duration||$||kn,[m.duration,$]),Bt=ae.useRef(0),H=ae.useRef(0),ye=ae.useRef(0),Me=ae.useRef(null),[wt,Pt]=J.split("-"),ys=ae.useMemo(()=>b.reduce((ge,Ae,Ue)=>Ue>=$e?ge:ge+Ae.height,0),[b,$e]),rs=nd(),Us=m.invert||f,yt=De==="loading";H.current=ae.useMemo(()=>$e*V+ys,[$e,ys]),ae.useEffect(()=>{rt.current=_t},[_t]),ae.useEffect(()=>{le(!0)},[]),ae.useEffect(()=>{let ge=fe.current;if(ge){let Ae=ge.getBoundingClientRect().height;return at(Ae),g(Ue=>[{toastId:m.id,height:Ae,position:m.position},...Ue]),()=>g(Ue=>Ue.filter(mt=>mt.toastId!==m.id))}},[g,m.id]),ae.useLayoutEffect(()=>{if(!B)return;let ge=fe.current,Ae=ge.style.height;ge.style.height="auto";let Ue=ge.getBoundingClientRect().height;ge.style.height=Ae,at(Ue),g(mt=>mt.find(pt=>pt.toastId===m.id)?mt.map(pt=>pt.toastId===m.id?{...pt,height:Ue}:pt):[{toastId:m.id,height:Ue,position:m.position},...mt])},[B,m.title,m.description,g,m.id]);let Ot=ae.useCallback(()=>{ie(!0),tt(H.current),g(ge=>ge.filter(Ae=>Ae.toastId!==m.id)),setTimeout(()=>{w(m)},bd)},[m,w,g,H]);ae.useEffect(()=>{if(m.promise&&De==="loading"||m.duration===1/0||m.type==="loading")return;let ge;return y||x||re&&rs?(()=>{if(ye.current<Bt.current){let Ae=new Date().getTime()-Bt.current;rt.current=rt.current-Ae}
2ye.current=new Date().getTime()})():rt.current!==1/0&&(Bt.current=new Date().getTime(),ge=setTimeout(()=>{var Ae;(Ae=m.onAutoClose)==null||Ae.call(m,m),Ot()},rt.current)),()=>clearTimeout(ge)},[y,x,m,De,re,rs,Ot]),ae.useEffect(()=>{m.delete&&Ot()},[Ot,m.delete]);function Ba(){var ge,Ae,Ue;return Y!=null&&Y.loading?ae.createElement("div",{className:Tt(C==null?void 0:C.loader,(ge=m==null?void 0:m.classNames)==null?void 0:ge.loader,"sonner-loader"),"data-visible":De==="loading"},Y.loading):R?ae.createElement("div",{className:Tt(C==null?void 0:C.loader,(Ae=m==null?void 0:m.classNames)==null?void 0:Ae.loader,"sonner-loader"),"data-visible":De==="loading"},R):ae.createElement(Zc,{className:Tt(C==null?void 0:C.loader,(Ue=m==null?void 0:m.classNames)==null?void 0:Ue.loader),visible:De==="loading"})}return ae.createElement("li",{tabIndex:0,ref:fe,className:Tt(F,pe,C==null?void 0:C.toast,(s=m==null?void 0:m.classNames)==null?void 0:s.toast,C==null?void 0:C.default,C==null?void 0:C[De],(a=m==null?void 0:m.classNames)==null?void 0:a[De]),"data-sonner-toast":"","data-rich-colors":(r=m.richColors)!=null?r:k,"data-styled":!(m.jsx||m.unstyled||v),"data-mounted":B,"data-promise":!!m.promise,"data-swiped":Ee,"data-removed":Q,"data-visible":Ve,"data-y-position":wt,"data-x-position":Pt,"data-index":N,"data-front":Fe,"data-swiping":G,"data-dismissible":T,"data-type":De,"data-invert":Us,"data-swipe-out":xe,"data-swipe-direction":E,"data-expanded":!!(y||se&&B),style:{"--index":N,"--toasts-before":N,"--z-index":I.length-N,"--offset":`${Q?qe:H.current}px`,"--initial-height":se?"auto":`${He}px`,...M,...m.style},onDragEnd:()=>{oe(!1),he(null),Me.current=null},onPointerDown:ge=>{yt||!T||(te.current=new Date,tt(H.current),ge.target.setPointerCapture(ge.pointerId),ge.target.tagName!=="BUTTON"&&(oe(!0),Me.current={x:ge.clientX,y:ge.clientY}))},onPointerUp:()=>{var ge,Ae,Ue,mt;if(xe||!T)return;Me.current=null;let pt=Number(((ge=fe.current)==null?void 0:ge.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Et=Number(((Ae=fe.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),At=new Date().getTime()-((Ue=te.current)==null?void 0:Ue.getTime()),Be=me==="x"?pt:Et,nt=Math.abs(Be)/At;if(Math.abs(Be)>=jd||nt>.11){tt(H.current),(mt=m.onDismiss)==null||mt.call(m,m),ce(me==="x"?pt>0?"right":"left":Et>0?"down":"up"),Ot(),ue(!0),ve(!1);return}oe(!1),he(null)},onPointerMove:ge=>{var Ae,Ue,mt,pt;if(!Me.current||!T||((Ae=window.getSelection())==null?void 0:Ae.toString().length)>0)return;let Et=ge.clientY-Me.current.y,At=ge.clientX-Me.current.x,Be=(Ue=t.swipeDirections)!=null?Ue:yd(J);!me&&(Math.abs(At)>1||Math.abs(Et)>1)&&he(Math.abs(At)>Math.abs(Et)?"x":"y");let nt={x:0,y:0};me==="y"?(Be.includes("top")||Be.includes("bottom"))&&(Be.includes("top")&&Et<0||Be.includes("bottom")&&Et>0)&&(nt.y=Et):me==="x"&&(Be.includes("left")||Be.includes("right"))&&(Be.includes("left")&&At<0||Be.includes("right")&&At>0)&&(nt.x=At),(Math.abs(nt.x)>0||Math.abs(nt.y)>0)&&ve(!0),(mt=fe.current)==null||mt.style.setProperty("--swipe-amount-x",`${nt.x}px`),(pt=fe.current)==null||pt.style.setProperty("--swipe-amount-y",`${nt.y}px`)}},Ct&&!m.jsx?ae.createElement("button",{"aria-label":ne,"data-disabled":yt,"data-close-button":!0,onClick:yt||!T?()=>{}:()=>{var ge;Ot(),(ge=m.onDismiss)==null||ge.call(m,m)},className:Tt(C==null?void 0:C.closeButton,(n=m==null?void 0:m.classNames)==null?void 0:n.closeButton)},(i=Y==null?void 0:Y.close)!=null?i:rd):null,m.jsx||l.isValidElement(m.title)?m.jsx?m.jsx:typeof m.title=="function"?m.title():m.title:ae.createElement(ae.Fragment,null,De||m.icon||m.promise?ae.createElement("div",{"data-icon":"",className:Tt(C==null?void 0:C.icon,(o=m==null?void 0:m.classNames)==null?void 0:o.icon)},m.promise||m.type==="loading"&&!m.icon?m.icon||Ba():null,m.type!=="loading"?m.
2icon||(Y==null?void 0:Y[De])||Jc(De):null):null,ae.createElement("div",{"data-content":"",className:Tt(C==null?void 0:C.content,(c=m==null?void 0:m.classNames)==null?void 0:c.content)},ae.createElement("div",{"data-title":"",className:Tt(C==null?void 0:C.title,(d=m==null?void 0:m.classNames)==null?void 0:d.title)},typeof m.title=="function"?m.title():m.title),m.description?ae.createElement("div",{"data-description":"",className:Tt(S,Ne,C==null?void 0:C.description,(h=m==null?void 0:m.classNames)==null?void 0:h.description)},typeof m.description=="function"?m.description():m.description):null),l.isValidElement(m.cancel)?m.cancel:m.cancel&&La(m.cancel)?ae.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||q,onClick:ge=>{var Ae,Ue;La(m.cancel)&&T&&((Ue=(Ae=m.cancel).onClick)==null||Ue.call(Ae,ge),Ot())},className:Tt(C==null?void 0:C.cancelButton,(u=m==null?void 0:m.classNames)==null?void 0:u.cancelButton)},m.cancel.label):null,l.isValidElement(m.action)?m.action:m.action&&La(m.action)?ae.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||D,onClick:ge=>{var Ae,Ue;La(m.action)&&((Ue=(Ae=m.action).onClick)==null||Ue.call(Ae,ge),!ge.defaultPrevented&&Ot())},className:Tt(C==null?void 0:C.actionButton,(p=m==null?void 0:m.classNames)==null?void 0:p.actionButton)},m.action.label):null))};function Sn(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Nd(t,s){let a={};return[t,s].forEach((r,n)=>{let i=n===1,o=i?"--mobile-offset":"--offset",c=i?gd:xd;function d(h){["top","right","bottom","left"].forEach(u=>{a[`${o}-${u}`]=typeof h=="number"?`${h}px`:h})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(h=>{r[h]===void 0?a[`${o}-${h}`]=c:a[`${o}-${h}`]=typeof r[h]=="number"?`${r[h]}px`:r[h]}):d(c)}),a}var wd=l.forwardRef(function(t,s){let{invert:a,position:r="bottom-right",hotkey:n=["altKey","KeyT"],expand:i,closeButton:o,className:c,offset:d,mobileOffset:h,theme:u="light",richColors:p,duration:f,style:m,visibleToasts:v=ud,toastOptions:x,dir:g=Sn(),gap:j=fd,loadingIcon:b,icons:N,containerAriaLabel:I="Notifications",pauseWhenPageIsHidden:y}=t,[w,k]=ae.useState([]),_=ae.useMemo(()=>Array.from(new Set([r].concat(w.filter(re=>re.position).map(re=>re.position)))),[w,r]),[M,q]=ae.useState([]),[D,F]=ae.useState(!1),[S,$]=ae.useState(!1),[J,V]=ae.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),R=ae.useRef(null),se=n.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=ae.useRef(null),Y=ae.useRef(!1),ne=ae.useCallback(re=>{k(me=>{var he;return(he=me.find(E=>E.id===re.id))!=null&&he.delete||ft.dismiss(re.id),me.filter(({id:E})=>E!==re.id)})},[]);return ae.useEffect(()=>ft.subscribe(re=>{if(re.dismiss){k(me=>me.map(he=>he.id===re.id?{...he,delete:!0}:he));return}setTimeout(()=>{Uc.flushSync(()=>{k(me=>{let he=me.findIndex(E=>E.id===re.id);return he!==-1?[...me.slice(0,he),{...me[he],...re},...me.slice(he+1)]:[re,...me]})})})}),[]),ae.useEffect(()=>{if(u!=="system"){V(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window>"u")return;let re=window.matchMedia("(prefers-color-scheme: dark)");try{re.addEventListener("change",({matches:me})=>{V(me?"dark":"light")})}catch{re.addListener(({matches:he})=>{try{V(he?"dark":"light")}catch(E){console.error(E)}})}},[u]),ae.useEffect(()=>{w.length<=1&&F(!1)},[w]),ae.useEffect(()=>{let re=me=>{var he,E;n.every(ce=>me[ce]||me.code===ce)&&(F(!0),(he=R.current)==null||he.focus()),me.code==="Escape"&&(document.activeElement===R.current||(E=R.current)!=null&&E.contains(document.activeElement))&&F(!1)};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[n]),ae.useEffect(()=>{if(R.current)return()=>{C.current&&(C.current.focus({preventScroll:!0}
2),C.current=null,Y.current=!1)}},[R.current]),ae.createElement("section",{ref:s,"aria-label":`${I} ${se}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((re,me)=>{var he;let[E,ce]=re.split("-");return w.length?ae.createElement("ol",{key:re,dir:g==="auto"?Sn():g,tabIndex:-1,ref:R,className:c,"data-sonner-toaster":!0,"data-theme":J,"data-y-position":E,"data-lifted":D&&w.length>1&&!i,"data-x-position":ce,style:{"--front-toast-height":`${((he=M[0])==null?void 0:he.height)||0}px`,"--width":`${pd}px`,"--gap":`${j}px`,...m,...Nd(d,h)},onBlur:B=>{Y.current&&!B.currentTarget.contains(B.relatedTarget)&&(Y.current=!1,C.current&&(C.current.focus({preventScroll:!0}),C.current=null))},onFocus:B=>{B.target instanceof HTMLElement&&B.target.dataset.dismissible==="false"||Y.current||(Y.current=!0,C.current=B.relatedTarget)},onMouseEnter:()=>F(!0),onMouseMove:()=>F(!0),onMouseLeave:()=>{S||F(!1)},onDragEnd:()=>F(!1),onPointerDown:B=>{B.target instanceof HTMLElement&&B.target.dataset.dismissible==="false"||$(!0)},onPointerUp:()=>$(!1)},w.filter(B=>!B.position&&me===0||B.position===re).map((B,le)=>{var Q,ie;return ae.createElement(vd,{key:B.id,icons:N,index:le,toast:B,defaultRichColors:p,duration:(Q=x==null?void 0:x.duration)!=null?Q:f,className:x==null?void 0:x.className,descriptionClassName:x==null?void 0:x.descriptionClassName,invert:a,visibleToasts:v,closeButton:(ie=x==null?void 0:x.closeButton)!=null?ie:o,interacting:S,position:re,style:x==null?void 0:x.style,unstyled:x==null?void 0:x.unstyled,classNames:x==null?void 0:x.classNames,cancelButtonStyle:x==null?void 0:x.cancelButtonStyle,actionButtonStyle:x==null?void 0:x.actionButtonStyle,removeToast:ne,toasts:w.filter(G=>G.position==B.position),heights:M.filter(G=>G.position==B.position),setHeights:q,expandByDefault:i,gap:j,loadingIcon:b,expanded:D,pauseWhenPageIsHidden:y,swipeDirections:t.swipeDirections})})):null}))});const kd=({...t})=>{const{theme:s="system"}=Yc();return e.jsx(wd,{theme:s,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})},Sd=()=>{l.useEffect(()=>{const t=()=>{document.querySelectorAll("section").forEach((a,r)=>{const n=a.querySelectorAll("div");let i=null;if(n.forEach(h=>{const u=h.getAttribute("style");u&&u.includes("background-image")&&(i=h)}),!i)return;const o=a.getBoundingClientRect(),c=o.top,d=window.innerHeight;if(c<d&&c>-o.height){const u=(d-c)/(d+o.height)*300;i.style.transform=`translateY(${u}px)`}})};return window.addEventListener("scroll",t,{passive:!0}),setTimeout(t,100),()=>{window.removeEventListener("scroll",t)}},[])};var $l=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Cd="VisuallyHidden",Ul=l.forwardRef((t,s)=>e.jsx(Qe.span,{...t,ref:s,style:{...$l,...t.style}}));Ul.displayName=Cd;var _d=Ul,[ar,Bg]=na("Tooltip",[la]),Zr=la(),zl="TooltipProvider",Pd=700,Cn="tooltip.open",[Ed,Hl]=ar(zl),Vl=t=>{const{__scopeTooltip:s,delayDuration:a=Pd,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:i}=t,o=l.useRef(!0),c=l.useRef(!1),d=l.useRef(0);return l.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),e.jsx(Ed,{scope:s,isOpenDelayedRef:o,delayDuration:a,onOpen:l.useCallback(()=>{window.clearTimeout(d.current),o.current=!1},[]),onClose:l.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:l.useCallback(h=>{c.current=h},[]),disableHoverableContent:n,children:i})};Vl.displayName=zl;var Gl="Tooltip",[Og,rr]=ar(Gl),Sr="TooltipTrigger",Ad=l.forwardRef((t,s)=>{const{__scopeTooltip:a,...r}=t,n=rr(Sr,a),i=Hl(Sr,a),o=Zr(a),c=l.useRef(null),d=st(s,c,n.onTriggerChange),h=l.useRef(!1),u=l.useRef(!1),p=l.useCallback(()=>h.current=!1,[]);return l.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),e.jsx(er,{asChild:!0,...o,children:e.jsx(Qe.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:d,onPointerMove:Pe(t.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:Pe(t.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:Pe(t.onPointerDown,()=>{n.open&&n.onClose(),h.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:Pe(t.onFocus,()=>{h.current||n.onOpen()}),onBlur:Pe(t.onBlur,n.onClose),onClick:Pe(t.onClick,n.onClose)})})});Ad.displayName=Sr;var Rd="TooltipPortal",[Lg,Td]=ar(Rd,{forceMount:void 0}),ta="TooltipContent",Wl=l.forwardRef((t,s)=>{const a=Td(ta,t.__scopeTooltip),{forceMount:r=a.forceMount,side:n="top",...i}=t,o=rr(ta,t.__scopeTooltip);return e.jsx(tr,{present:r||o.open,children:o.disableHoverableContent?e.jsx(Kl,{side:n,...i,ref:s}):e.jsx(Id,{side:n,...i,ref:s})})}),Id=l.forwardRef((t,s)=>{const a=rr(ta,t.__scopeTooltip),r=Hl(ta,t.__scopeTooltip),n=l.useRef(null),i=st(s,n),[o,c]=l.useState(null),{trigger:d,onClose:h}=a,u=n.current,{onPointerInTransitChange:p}=r,f=l.useCallback(()=>{c(null),p(!1)},[p]),m=l.useCallback((v,x)=>{const g=v.currentTarget,j={x:v.clientX,y:v.clientY},b=Od(j,g.getBoundingClientRect()),N=Ld(j,b),I=qd(x.getBoundingClientRect()),y=Ud([...N,...I]);c(y),p(!0)},[p]);return l.useEffect(()=>()=>f(),[f]),l.useEffect(()=>{if(d&&u){const v=g=>m(g,u),x=g=>m(g,d);return d.addEventListener("pointerleave",v),u.addEventListener("pointerleave",x),()=>{d.removeEventListener("pointerleave",v),u.removeEventListener("pointerleave",x)}}},[d,u,m,f]),l.useEffect(()=>
vendor: 4,111 bytes, line 2
2{if(o){const v=x=>{const g=x.target,j={x:x.clientX,y:x.clientY},b=(d==null?void 0:d.contains(g))||(u==null?void 0:u.contains(g)),N=!$d(j,o);b?f():N&&(f(),h())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[d,u,o,h,f]),e.jsx(Kl,{...t,ref:i})}),[Dd,Md]=ar(Gl,{isInside:!1}),Fd=gl("TooltipContent"),Kl=l.forwardRef((t,s)=>{const{__scopeTooltip:a,children:r,"aria-label":n,onEscapeKeyDown:i,onPointerDownOutside:o,...c}=t,d=rr(ta,a),h=Zr(a),{onClose:u}=d;return l.useEffect(()=>(document.addEventListener(Cn,u),()=>document.removeEventListener(Cn,u)),[u]),l.useEffect(()=>{if(d.trigger){const p=f=>{const m=f.target;m!=null&&m.contains(d.trigger)&&u()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[d.trigger,u]),e.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:p=>p.preventDefault(),onDismiss:u,children:e.jsxs(Vr,{"data-state":d.stateAttribute,...h,...c,ref:s,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[e.jsx(Fd,{children:r}),e.jsx(Dd,{scope:a,isInside:!0,children:e.jsx(_d,{id:d.contentId,role:"tooltip",children:n||r})})]})})});Wl.displayName=ta;var Ql="TooltipArrow",Bd=l.forwardRef((t,s)=>{const{__scopeTooltip:a,...r}=t,n=Zr(a);return Md(Ql,a).isInside?null:e.jsx(Gr,{...n,...r,ref:s})});Bd.displayName=Ql;function Od(t,s){const a=Math.abs(s.top-t.y),r=Math.abs(s.bottom-t.y),n=Math.abs(s.right-t.x),i=Math.abs(s.left-t.x);switch(Math.min(a,r,n,i)){case i:return"left";case n:return"right";case a:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Ld(t,s,a=5){const r=[];switch(s){case"top":r.push({x:t.x-a,y:t.y+a},{x:t.x+a,y:t.y+a});break;case"bottom":r.push({x:t.x-a,y:t.y-a},{x:t.x+a,y:t.y-a});break;case"left":r.push({x:t.x+a,y:t.y-a},{x:t.x+a,y:t.y+a});break;case"right":r.push({x:t.x-a,y:t.y-a},{x:t.x-a,y:t.y+a});break}return r}function qd(t){const{top:s,right:a,bottom:r,left:n}=t;return[{x:n,y:s},{x:a,y:s},{x:a,y:r},{x:n,y:r}]}function $d(t,s){const{x:a,y:r}=t;let n=!1;for(let i=0,o=s.length-1;i<s.length;o=i++){const c=s[i],d=s[o],h=c.x,u=c.y,p=d.x,f=d.y;u>r!=f>r&&a<(p-h)*(r-u)/(f-u)+h&&(n=!n)}return n}function Ud(t){const s=t.slice();return s.sort((a,r)=>a.x<r.x?-1:a.x>r.x?1:a.y<r.y?-1:a.y>r.y?1:0),zd(s)}function zd(t){if(t.length<=1)return t.slice();const s=[];for(let r=0;r<t.length;r++){const n=t[r];for(;s.length>=2;){const i=s[s.length-1],o=s[s.length-2];if((i.x-o.x)*(n.y-o.y)>=(i.y-o.y)*(n.x-o.x))s.pop();else break}s.push(n)}s.pop();const a=[];for(let r=t.length-1;r>=0;r--){const n=t[r];for(;a.length>=2;){const i=a[a.length-1],o=a[a.length-2];if((i.x-o.x)*(n.y-o.y)>=(i.y-o.y)*(n.x-o.x))a.pop();else break}a.push(n)}return a.pop(),s.length===1&&a.length===1&&s[0].x===a[0].x&&s[0].y===a[0].y?s:s.concat(a)}var Hd=Vl,Yl=Wl;function Jl(t){var s,a,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var n=t.length;for(s=0;s<n;s++)t[s]&&(a=Jl(t[s]))&&(r&&(r+=" "),r+=a)}else for(a in t)t[a]&&(r&&(r+=" "),r+=a);return r}function Xl(){for(var t,s,a=0,r="",n=arguments.length;a<n;a++)(t=arguments[a])&&(s=Jl(t))&&(r&&(r+=" "),r+=s);return r}const en="-",Vd=t=>{const s=Wd(t),{conflictingClassGroups:a,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const c=o.split(en);return c[0]===""&&c.length!==1&&c.shift(),Zl(c,s)||Gd(o)},getConflictingClassGroupIds:(o,c)=>{const d=a[o]||[];return c&&r[o]?[...d,...r[o]]:d}}},Zl=(t,s)=>{var o;if(t.length===0)return s.classGroupId;const a=t[0],r=s.nextPart.get(a),n=r?Zl(t.slice(1),r):void 0;if(n)return n;if(s.validators.length===0)return;const i=t.join(en);return(o=s.validators.find(({validator:c}
vendor: 4,815 bytes, line 2
2)=>c(i)))==null?void 0:o.classGroupId},_n=/^\[(.+)\]$/,Gd=t=>{if(_n.test(t)){const s=_n.exec(t)[1],a=s==null?void 0:s.substring(0,s.indexOf(":"));if(a)return"arbitrary.."+a}},Wd=t=>{const{theme:s,prefix:a}=t,r={nextPart:new Map,validators:[]};return Qd(Object.entries(t.classGroups),a).forEach(([i,o])=>{Cr(o,r,i,s)}),r},Cr=(t,s,a,r)=>{t.forEach(n=>{if(typeof n=="string"){const i=n===""?s:Pn(s,n);i.classGroupId=a;return}if(typeof n=="function"){if(Kd(n)){Cr(n(r),s,a,r);return}s.validators.push({validator:n,classGroupId:a});return}Object.entries(n).forEach(([i,o])=>{Cr(o,Pn(s,i),a,r)})})},Pn=(t,s)=>{let a=t;return s.split(en).forEach(r=>{a.nextPart.has(r)||a.nextPart.set(r,{nextPart:new Map,validators:[]}),a=a.nextPart.get(r)}),a},Kd=t=>t.isThemeGetter,Qd=(t,s)=>s?t.map(([a,r])=>{const n=r.map(i=>typeof i=="string"?s+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,c])=>[s+o,c])):i);return[a,n]}):t,Yd=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,a=new Map,r=new Map;const n=(i,o)=>{a.set(i,o),s++,s>t&&(s=0,r=a,a=new Map)};return{get(i){let o=a.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return n(i,o),o},set(i,o){a.has(i)?a.set(i,o):n(i,o)}}},ei="!",Jd=t=>{const{separator:s,experimentalParseClassName:a}=t,r=s.length===1,n=s[0],i=s.length,o=c=>{const d=[];let h=0,u=0,p;for(let g=0;g<c.length;g++){let j=c[g];if(h===0){if(j===n&&(r||c.slice(g,g+i)===s)){d.push(c.slice(u,g)),u=g+i;continue}if(j==="/"){p=g;continue}}j==="["?h++:j==="]"&&h--}const f=d.length===0?c:c.substring(u),m=f.startsWith(ei),v=m?f.substring(1):f,x=p&&p>u?p-u:void 0;return{modifiers:d,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:x}};return a?c=>a({className:c,parseClassName:o}):o},Xd=t=>{if(t.length<=1)return t;const s=[];let a=[];return t.forEach(r=>{r[0]==="["?(s.push(...a.sort(),r),a=[]):a.push(r)}),s.push(...a.sort()),s},Zd=t=>({cache:Yd(t.cacheSize),parseClassName:Jd(t),...Vd(t)}),em=/\s+/,tm=(t,s)=>{const{parseClassName:a,getClassGroupId:r,getConflictingClassGroupIds:n}=s,i=[],o=t.trim().split(em);let c="";for(let d=o.length-1;d>=0;d-=1){const h=o[d],{modifiers:u,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:m}=a(h);let v=!!m,x=r(v?f.substring(0,m):f);if(!x){if(!v){c=h+(c.length>0?" "+c:c);continue}if(x=r(f),!x){c=h+(c.length>0?" "+c:c);continue}v=!1}const g=Xd(u).join(":"),j=p?g+ei:g,b=j+x;if(i.includes(b))continue;i.push(b);const N=n(x,v);for(let I=0;I<N.length;++I){const y=N[I];i.push(j+y)}c=h+(c.length>0?" "+c:c)}return c};function sm(){let t=0,s,a,r="";for(;t<arguments.length;)(s=arguments[t++])&&(a=ti(s))&&(r&&(r+=" "),r+=a);return r}const ti=t=>{if(typeof t=="string")return t;let s,a="";for(let r=0;r<t.length;r++)t[r]&&(s=ti(t[r]))&&(a&&(a+=" "),a+=s);return a};function am(t,...s){let a,r,n,i=o;function o(d){const h=s.reduce((u,p)=>p(u),t());return a=Zd(h),r=a.cache.get,n=a.cache.set,i=c,c(d)}function c(d){const h=r(d);if(h)return h;const u=tm(d,a);return n(d,u),u}return function(){return i(sm.apply(null,arguments))}}const Ge=t=>{const s=a=>a[t]||[];return s.isThemeGetter=!0,s},si=/^\[(?:([a-z-]+):)?(.+)\]$/i,rm=/^\d+\/\d+$/,nm=new Set(["px","full","screen"]),lm=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,im=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,om=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,cm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wt=t=>Vs(t)||nm.has(t)||rm.test(t),ns=t=>ia(t,"length",jm),Vs=t=>!!t&&!Number.isNaN(Number(t)),yr=t=>ia(t,"number",Vs),ma=t=>!!t&&Number.isInteger(Number(t)),mm=t=>t.endsWith("%")&&Vs(t.slice(0,-1)),be=t=>si.test(t),ls=t=>lm.test(t),hm=new Set(["length","size","percentage"]),um=t=>ia(t,hm,ai),xm=t=>ia(t,"position",ai),gm=new Set(["image","url"]),pm=t=>ia(t,gm,ym),fm=t=>ia(t,"",bm),ha=()=>!0,ia=(t,s,a)=>{const r=si.exec(t);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):a(r[2]):!1},jm=t=>im.test(t)&&!om.test(t),ai=()=>!1,bm=t=>cm.test(t),ym=t=>dm.test(t),vm=()=>{const t=Ge("colors"),s=Ge("spacing"),a=Ge("blur"),r=Ge("brightness"),n=Ge("borderColor"),i=Ge("borderRadius"),o=Ge("borderSpacing"),c=Ge("borderWidth"),d=Ge("contrast"),h=Ge("grayscale"),u=Ge("hueRotate"),p=Ge("invert"),f=Ge("gap"),m=Ge("gradientColorStops"),v=Ge("gradientColorStopPositions"),x=Ge("inset"),g=Ge("margin"),j=Ge("opacity"),b=Ge("padding"),N=Ge("saturate"),I=Ge("scale"),y=Ge("sepia"),w=Ge("skew"),k=Ge("space"),_=Ge("translate"),M=()=>["auto","contain","none"],q=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",be,s],F=()=>[be,s],S=()=>["",Wt,ns],$=()=>["auto",Vs,be],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],
vendor: 12,085 bytes, line 2
2V=()=>["solid","dashed","dotted","double","none"],R=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>["start","end","center","between","around","evenly","stretch"],C=()=>["","0",be],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ne=()=>[Vs,be];return{cacheSize:500,separator:":",theme:{colors:[ha],spacing:[Wt,ns],blur:["none","",ls,be],brightness:ne(),borderColor:[t],borderRadius:["none","","full",ls,be],borderSpacing:F(),borderWidth:S(),contrast:ne(),grayscale:C(),hueRotate:ne(),invert:C(),gap:F(),gradientColorStops:[t],gradientColorStopPositions:[mm,ns],inset:D(),margin:D(),opacity:ne(),padding:F(),saturate:ne(),scale:ne(),sepia:C(),skew:ne(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[ls]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...J(),be]}],overflow:[{overflow:q()}],"overflow-x":[{"overflow-x":q()}],"overflow-y":[{"overflow-y":q()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ma,be]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",be]}],grow:[{grow:C()}],shrink:[{shrink:C()}],order:[{order:["first","last","none",ma,be]}],"grid-cols":[{"grid-cols":[ha]}],"col-start-end":[{col:["auto",{span:["full",ma,be]},be]}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":[ha]}],"row-start-end":[{row:["auto",{span:[ma,be]},be]}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...se()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...se(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...se(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[k]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[k]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",be,s]}],"min-w":[{"min-w":[be,s,"min","max","fit"]}],"max-w":[{"max-w":[be,s,"none","full","min","max","fit","prose",{screen:[ls]},ls]}],h:[{h:[be,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[be,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[be,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[be,s,"auto","min","max","fit"]}],"font-size":[{text:["base",ls,ns]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yr]}],"font-family":[{font:[ha]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",be]}],"line-clamp":[{"line-clamp":["none",Vs,yr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Wt,be]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[j]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[j]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Wt,ns]}],"underline-offset":[{"underline-offset":["auto",Wt,be]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[j]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),xm]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",um]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},pm]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[j]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[j]}],"divide-style":[{divide:V()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Wt,be]}],"outline-w":[{outline:[Wt,ns]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:S()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[j]}],"ring-offset-w":[{"ring-offset":[Wt,ns]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ls,fm]}],"shadow-color":[{shadow:[ha]}],opacity:[{opacity:[j]}],"mix-blend":[{"mix-blend":[...R(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":R()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",ls,be]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[p]}],saturate:[{saturate:[N]}],sepia:[{sepia:[y]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[j]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",be]}],duration:[{duration:ne()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:ne()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[I]}],"scale-x":[{"scale-x":[I]}],"scale-y":[{"scale-y":[I]}],rotate:[{rotate:[ma,be]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[w]}],"skew-y":[{"skew-y":[w]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",be]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}
2],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Wt,ns,yr]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Nm=am(vm);function de(...t){return Nm(Xl(t))}function ri(t){if(!t)return"/placeholder.svg";if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/room-images/"))return t;const s=t.match(/([^\/]+\.(jpg|jpeg|png|webp))$/i);return s?`/room-images/${s[1]}`:t.startsWith("/")?t:`/${t}`}function wm(t){return!t||!Array.isArray(t)?[]:t.map(ri).filter(Boolean)}const km=Hd,Sm=l.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Yl,{ref:r,sideOffset:s,className:de("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));Sm.displayName=Yl.displayName;var nr=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},lr=typeof window>"u"||"Deno"in globalThis;function Dt(){}function Cm(t,s){return typeof t=="function"?t(s):t}function _m(t){return typeof t=="number"&&t>=0&&t!==1/0}function Pm(t,s){return Math.max(t+(s||0)-Date.now(),0)}function _r(t,s){return typeof t=="function"?t(s):t}function Em(t,s){return typeof t=="function"?t(s):t}function En(t,s){const{type:a="all",exact:r,fetchStatus:n,predicate:i,queryKey:o,stale:c}=t;if(o){if(r){if(s.queryHash!==tn(o,s.options))return!1}else if(!ja(s.queryKey,o))return!1}if(a!=="all"){const d=s.isActive();if(a==="active"&&!d||a==="inactive"&&d)return!1}return!(typeof c=="boolean"&&s.isStale()!==c||n&&n!==s.state.fetchStatus||i&&!i(s))}function An(t,s){const{exact:a,status:r,predicate:n,mutationKey:i}=t;if(i){if(!s.options.mutationKey)return!1;if(a){if(fa(s.options.mutationKey)!==fa(i))return!1}else if(!ja(s.options.mutationKey,i))return!1}return!(r&&s.state.status!==r||n&&!n(s))}function tn(t,s){return((s==null?void 0:s.queryKeyHashFn)||fa)(t)}function fa(t){return JSON.stringify(t,(s,a)=>Pr(a)?Object.keys(a).sort().reduce((r,n)=>(r[n]=a[n],r),{}):a)}
vendor: 17,282 bytes, line 2
2function ja(t,s){return t===s?!0:typeof t!=typeof s?!1:t&&s&&typeof t=="object"&&typeof s=="object"?Object.keys(s).every(a=>ja(t[a],s[a])):!1}function ni(t,s){if(t===s)return t;const a=Rn(t)&&Rn(s);if(a||Pr(t)&&Pr(s)){const r=a?t:Object.keys(t),n=r.length,i=a?s:Object.keys(s),o=i.length,c=a?[]:{},d=new Set(r);let h=0;for(let u=0;u<o;u++){const p=a?u:i[u];(!a&&d.has(p)||a)&&t[p]===void 0&&s[p]===void 0?(c[p]=void 0,h++):(c[p]=ni(t[p],s[p]),c[p]===t[p]&&t[p]!==void 0&&h++)}return n===o&&h===n?t:c}return s}function Rn(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Pr(t){if(!Tn(t))return!1;const s=t.constructor;if(s===void 0)return!0;const a=s.prototype;return!(!Tn(a)||!a.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function Tn(t){return Object.prototype.toString.call(t)==="[object Object]"}function Am(t){return new Promise(s=>{setTimeout(s,t)})}function Rm(t,s,a){return typeof a.structuralSharing=="function"?a.structuralSharing(t,s):a.structuralSharing!==!1?ni(t,s):s}function Tm(t,s,a=0){const r=[...t,s];return a&&r.length>a?r.slice(1):r}function Im(t,s,a=0){const r=[s,...t];return a&&r.length>a?r.slice(0,-1):r}var sn=Symbol();function li(t,s){return!t.queryFn&&(s!=null&&s.initialPromise)?()=>s.initialPromise:!t.queryFn||t.queryFn===sn?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Ss,cs,Ws,il,Dm=(il=class extends nr{constructor(){super();_e(this,Ss);_e(this,cs);_e(this,Ws);je(this,Ws,s=>{if(!lr&&window.addEventListener){const a=()=>s();return window.addEventListener("visibilitychange",a,!1),()=>{window.removeEventListener("visibilitychange",a)}}})}onSubscribe(){O(this,cs)||this.setEventListener(O(this,Ws))}onUnsubscribe(){var s;this.hasListeners()||((s=O(this,cs))==null||s.call(this),je(this,cs,void 0))}setEventListener(s){var a;je(this,Ws,s),(a=O(this,cs))==null||a.call(this),je(this,cs,s(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(s){O(this,Ss)!==s&&(je(this,Ss,s),this.onFocus())}onFocus(){const s=this.isFocused();this.listeners.forEach(a=>{a(s)})}isFocused(){var s;return typeof O(this,Ss)=="boolean"?O(this,Ss):((s=globalThis.document)==null?void 0:s.visibilityState)!=="hidden"}},Ss=new WeakMap,cs=new WeakMap,Ws=new WeakMap,il),ii=new Dm,Ks,ds,Qs,ol,Mm=(ol=class extends nr{constructor(){super();_e(this,Ks,!0);_e(this,ds);_e(this,Qs);je(this,Qs,s=>{if(!lr&&window.addEventListener){const a=()=>s(!0),r=()=>s(!1);return window.addEventListener("online",a,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",a),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,ds)||this.setEventListener(O(this,Qs))}onUnsubscribe(){var s;this.hasListeners()||((s=O(this,ds))==null||s.call(this),je(this,ds,void 0))}setEventListener(s){var a;je(this,Qs,s),(a=O(this,ds))==null||a.call(this),je(this,ds,s(this.setOnline.bind(this)))}setOnline(s){O(this,Ks)!==s&&(je(this,Ks,s),this.listeners.forEach(r=>{r(s)}))}isOnline(){return O(this,Ks)}},Ks=new WeakMap,ds=new WeakMap,Qs=new WeakMap,ol),Va=new Mm;function Fm(){let t,s;const a=new Promise((n,i)=>{t=n,s=i});a.status="pending",a.catch(()=>{});function r(n){Object.assign(a,n),delete a.resolve,delete a.reject}return a.resolve=n=>{r({status:"fulfilled",value:n}),t(n)},a.reject=n=>{r({status:"rejected",reason:n}),s(n)},a}function Bm(t){return Math.min(1e3*2**t,3e4)}function oi(t){return(t??"online")==="online"?Va.isOnline():!0}var ci=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function vr(t){return t instanceof ci}function di(t){let s=!1,a=0,r=!1,n;const i=Fm(),o=x=>{var g;r||(f(new ci(x)),(g=t.abort)==null||g.call(t))},c=()=>{s=!0},d=()=>{s=!1},h=()=>ii.isFocused()&&(t.networkMode==="always"||Va.isOnline())&&t.canRun(),u=()=>oi(t.networkMode)&&t.canRun(),p=x=>{var g;r||(r=!0,(g=t.onSuccess)==null||g.call(t,x),n==null||n(),i.resolve(x))},f=x=>{var g;r||(r=!0,(g=t.onError)==null||g.call(t,x),n==null||n(),i.reject(x))},m=()=>new Promise(x=>{var g;n=j=>{(r||h())&&x(j)},(g=t.onPause)==null||g.call(t)}).then(()=>{var x;n=void 0,r||(x=t.onContinue)==null||x.call(t)}),v=()=>{if(r)return;let x;const g=a===0?t.initialPromise:void 0;try{x=g??t.fn()}catch(j){x=Promise.reject(j)}Promise.resolve(x).then(p).catch(j=>{var w;if(r)return;const b=t.retry??(lr?0:3),N=t.retryDelay??Bm,I=typeof N=="function"?N(a,j):N,y=b===!0||typeof b=="number"&&a<b||typeof b=="function"&&b(a,j);if(s||!y){f(j);return}a++,(w=t.onFail)==null||w.call(t,a,j),Am(I).then(()=>h()?void 0:m()).then(()=>{s?f(j):v()})})};return{promise:i,cancel:o,continue:()=>(n==null||n(),i),cancelRetry:c,continueRetry:d,canStart:u,start:()=>(u()?v():m().then(v),i)}}var Om=t=>setTimeout(t,0);function Lm(){let t=[],s=0,a=c=>{c()},r=c=>{c()},n=Om;const i=c=>{s?t.push(c):n(()=>{a(c)})},o=()=>{const c=t;t=[],c.length&&n(()=>{r(()=>{c.forEach(d=>{a(d)})})})};return{batch:c=>{let d;s++;try{d=c()}finally{s--,s||o()}return d},batchCalls:c=>(...d)=>{i(()=>{c(...d)})},schedule:i,setNotifyFunction:c=>{a=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{n=c}}}var xt=Lm(),Cs,cl,mi=(cl=class{constructor(){_e(this,Cs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),_m(this.gcTime)&&je(this,Cs,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(lr?1/0:5*60*1e3))}clearGcTimeout(){O(this,Cs)&&(clearTimeout(O(this,Cs)),je(this,Cs,void 0))}},Cs=new WeakMap,cl),Ys,_s,St,Ps,ot,Na,Es,Mt,Kt,dl,qm=(dl=class extends mi{constructor(s){super();_e(this,Mt);_e(this,Ys);_e(this,_s);_e(this,St);_e(this,Ps);_e(this,ot);_e(this,Na);_e(this,Es);je(this,Es,!1),je(this,Na,s.defaultOptions),this.setOptions(s.options),this.observers=[],je(this,Ps,s.client),je(this,St,O(this,Ps).getQueryCache()),this.queryKey=s.queryKey,this.queryHash=s.queryHash,je(this,Ys,Um(this.options)),this.state=s.state??O(this,Ys),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var s;return(s=O(this,ot))==null?void 0:s.promise}setOptions(s){this.options={...O(this,Na),...s},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,St).remove(this)}setData(s,a){const r=Rm(this.state.data,s,this.options);return it(this,Mt,Kt).call(this,{data:r,type:"success",dataUpdatedAt:a==null?void 0:a.updatedAt,manual:a==null?void 0:a.manual}),r}setState(s,a){it(this,Mt,Kt).call(this,{type:"setState",state:s,setStateOptions:a})}cancel(s){var r,n;const a=(r=O(this,ot))==null?void 0:r.promise;return(n=O(this,ot))==null||n.cancel(s),a?a.then(Dt).catch(Dt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,Ys))}isActive(){return this.observers.some(s=>Em(s.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===sn||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(s=>_r(s.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(s=>s.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(s=0){return this.state.data===void 0?!0:s==="static"?!1:this.state.isInvalidated?!0:!Pm(this.state.dataUpdatedAt,s)}onFocus(){var a;const s=this.observers.find(r=>r.shouldFetchOnWindowFocus());s==null||s.refetch({cancelRefetch:!1}),(a=O(this,ot))==null||a.continue()}onOnline(){var a;const s=this.observers.find(r=>r.shouldFetchOnReconnect());s==null||s.refetch({cancelRefetch:!1}),(a=O(this,ot))==null||a.continue()}addObserver(s){this.observers.includes(s)||(this.observers.push(s),this.clearGcTimeout(),O(this,St).notify({type:"observerAdded",query:this,observer:s}))}removeObserver(s){this.observers.includes(s)&&(this.observers=this.observers.filter(a=>a!==s),this.observers.length||(O(this,ot)&&(O(this,Es)?O(this,ot).cancel({revert:!0}):O(this,ot).cancelRetry()),this.scheduleGc()),O(this,St).notify({type:"observerRemoved",query:this,observer:s}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||it(this,Mt,Kt).call(this,{type:"invalidate"})}fetch(s,a){var h,u,p;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(a!=null&&a.cancelRefetch))this.cancel({silent:!0});else if(O(this,ot))return O(this,ot).continueRetry(),O(this,ot).promise}if(s&&this.setOptions(s),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,n=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(je(this,Es,!0),r.signal)})},i=()=>{const f=li(this.options,a),v=(()=>{const x={client:O(this,Ps),queryKey:this.queryKey,meta:this.meta};return n(x),x})();return je(this,Es,!1),this.options.persister?this.options.persister(f,v,this):f(v)},c=(()=>{const f={fetchOptions:a,options:this.options,queryKey:this.queryKey,client:O(this,Ps),state:this.state,fetchFn:i};return n(f),f})();(h=this.options.behavior)==null||h.onFetch(c,this),je(this,_s,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=c.fetchOptions)==null?void 0:u.meta))&&it(this,Mt,Kt).call(this,{type:"fetch",meta:(p=c.fetchOptions)==null?void 0:p.meta});const d=f=>{var m,v,x,g;vr(f)&&f.silent||it(this,Mt,Kt).call(this,{type:"error",error:f}),vr(f)||((v=(m=O(this,St).config).onError)==null||v.call(m,f,this),(g=(x=O(this,St).config).onSettled)==null||g.call(x,this.state.data,f,this)),this.scheduleGc()};return je(this,ot,di({initialPromise:a==null?void 0:a.initialPromise,fn:c.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var m,v,x,g;if(f===void 0){d(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(j){d(j);return}(v=(m=O(this,St).config).onSuccess)==null||v.call(m,f,this),(g=(x=O(this,St).config).onSettled)==null||g.call(x,f,this.state.error,this),this.scheduleGc()},onError:d,onFail:(f,m)=>{it(this,Mt,Kt).call(this,{type:"failed",failureCount:f,error:m})},onPause:()=>{it(this,Mt,Kt).call(this,{type:"pause"})},onContinue:()=>{it(this,Mt,Kt).call(this,{type:"continue"})},retry:c.options.retry,retryDelay:c.options.retryDelay,networkMode:c.options.networkMode,canRun:()=>!0})),O(this,ot).start()}},Ys=new WeakMap,_s=new WeakMap,St=new WeakMap,Ps=new WeakMap,ot=new WeakMap,Na=new WeakMap,Es=new WeakMap,Mt=new WeakSet,Kt=function(s){const a=r=>{switch(s.type){case"failed":return{...r,fetchFailureCount:s.failureCount,fetchFailureReason:s.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...$m(r.data,this.options),fetchMeta:s.meta??null};case"success":return je(this,_s,void 0),{...r,data:s.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:s.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!s.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const n=s.error;return vr(n)&&n.revert&&O(this,_s)?{...O(this,_s),fetchStatus:"idle"}:{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...s.state}}};this.state=a(this.state),xt.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,St).notify({query:this,type:"updated",action:s})})},dl);function $m(t,s){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:oi(s.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function Um(t){const s=typeof t.initialData=="function"?t.initialData():t.initialData,a=s!==void 0,r=a?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:a?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:a?"success":"pending",fetchStatus:"idle"}}var Lt,ml,zm=(ml=class extends nr{constructor(s={}){super();_e(this,Lt);this.config=s,je(this,Lt,new Map)}build(s,a,r){const n=a.queryKey,i=a.queryHash??tn(n,a);let o=this.get(i);return o||(o=new qm({client:s,queryKey:n,queryHash:i,options:s.defaultQueryOptions(a),state:r,defaultOptions:s.getQueryDefaults(n)}),this.add(o)),o}add(s){O(this,Lt).has(s.queryHash)||(O(this,Lt).set(s.queryHash,s),this.notify({type:"added",query:s}))}remove(s){const a=O(this,Lt).get(s.queryHash);a&&(s.destroy(),a===s&&O(this,Lt).delete(s.queryHash),this.notify({type:"removed",query:s}))}clear(){xt.batch(()=>{this.getAll().forEach(s=>{this.remove(s)})})}get(s){return O(this,Lt).get(s)}getAll(){return[...O(this,Lt).values()]}find(s){const a={exact:!0,...s};return this.getAll().find(r=>En(a,r))}findAll(s={}){const a=this.getAll();return Object.keys(s).length>0?a.filter(r=>En(s,r)):a}notify(s){xt.batch(()=>{this.listeners.forEach(a=>{a(s)})})}onFocus(){xt.batch(()=>{this.getAll().forEach(s=>{s.onFocus()})})}onOnline(){xt.batch(()=>{this.getAll().forEach(s=>{s.onOnline()})})}},Lt=new WeakMap,ml),qt,ht,As,$t,is,hl,Hm=(hl=class extends mi{constructor(s){super();_e(this,$t);_e(this,qt);_e(this,ht);_e(this,As);this.mutationId=s.mutationId,je(this,ht,s.mutationCache),je(this,qt,[]),this.state=s.state||Vm(),this.setOptions(s.options),this.scheduleGc()}setOptions(s){this.options=s,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(s){O(this,qt).includes(s)||(O(this,qt).push(s),this.clearGcTimeout(),O(this,ht).notify({type:"observerAdded",mutation:this,observer:s}))}removeObserver(s){je(this,qt,O(this,qt).filter(a=>a!==s)),this.scheduleGc(),O(this,ht).notify({type:"observerRemoved",mutation:this,observer:s})}optionalRemove(){O(this,qt).length||(this.state.status==="pending"?this.scheduleGc():O(this,ht).remove(this))}continue(){var s;return((s=O(this,As))==null?void 0:s.continue())??this.execute(this.state.variables)}async execute(s){var i,o,c,d,h,u,p,f,m,v,x,g,j,b,N,I,y,w,k,_;const a=()=>{it(this,$t,is).call(this,{type:"continue"})};je(this,As,di({fn:()=>this.options.mutationFn?this.options.mutationFn(s):Promise.reject(new Error("No mutationFn found")),onFail:(M,q)=>{it(this,$t,is).call(this,{type:"failed",failureCount:M,error:q})},onPause:()=>{it(this,$t,is).call(this,{type:"pause"})},onContinue:a,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ht).canRun(this)}));const r=this.state.status==="pending",n=!O(this,As).canStart();try{if(r)a();else{it(this,$t,is).call(this,{type:"pending",variables:s,isPaused:n}),await((o=(i=O(this,ht).config).onMutate)==null?void 0:o.call(i,s,this));const q=await((d=(c=this.options).onMutate)==null?void 0:d.call(c,s));q!==this.state.context&&it(this,$t,is).call(this,{type:"pending",context:q,variables:s,isPaused:n})}const M=await O(this,As).start();return await((u=(h=O(this,ht).config).onSuccess)==null?void 0:u.call(h,M,s,this.state.context,this)),await((f=(p=this.options).onSuccess)==null?void 0:f.call(p,M,s,this.state.context)),await((v=(m=O(this,ht).config).onSettled)==null?void 0:v.call(m,M,null,this.state.variables,this.state.context,this)),await((g=(x=this.options).onSettled)==null?void 0:g.call(x,M,null,s,this.state.context)),it(this,$t,is).call(this,{type:"success",data:M}),M}catch(M){try{throw await((b=(j=O(this,ht).config).onError)==null?void 0:b.call(j,M,s,this.state.context,this)),await((I=(N=this.options).onError)==null?void 0:I.call(N,M,s,this.state.context)),await((w=(y=O(this,ht).config).onSettled)==null?void 0:w.call(y,void 0,M,this.state.variables,this.state.context,this)),await((_=(k=this.options).onSettled)==null?void 0:_.call(k,void 0,M,s,this.state.context)),M}finally{it(this,$t,is).call(this,{type:"error",error:M})}}finally{O(this,ht).runNext(this)}}},qt=new WeakMap,ht=new WeakMap,As=new WeakMap,$t=new WeakSet,is=function(s){const a=r=>{switch(s.type){case"failed":return{...r,failureCount:s.failureCount,failureReason:s.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:s.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:s.isPaused,status:"pending",variables:s.variables,submittedAt:Date.now()};case"success":return{...r,data:s.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:s.error,failureCount:r.failureCount+1,failureReason:s.error,isPaused:!1,status:"error"}}};this.state=a(this.state),xt.batch(()=>{O(this,qt).forEach(r=>{r.onMutationUpdate(s)}),O(this,ht).notify({mutation:this,type:"updated",action:s})})},hl);function Vm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Qt,Ft,wa,ul,Gm=(ul=class extends nr{constructor(s={}){super();_e(this,Qt);_e(this,Ft);_e(this,wa);this.config=s,je(this,Qt,new Set),je(this,Ft,new Map),je(this,wa,0)}build(s,a,r){const n=new Hm({mutationCache:this,mutationId:++Oa(this,wa)._,options:s.defaultMutationOptions(a),state:r});return this.add(n),n}add(s){O(this,Qt).add(s);const a=qa(s);
2if(typeof a=="string"){const r=O(this,Ft).get(a);r?r.push(s):O(this,Ft).set(a,[s])}this.notify({type:"added",mutation:s})}remove(s){if(O(this,Qt).delete(s)){const a=qa(s);if(typeof a=="string"){const r=O(this,Ft).get(a);if(r)if(r.length>1){const n=r.indexOf(s);n!==-1&&r.splice(n,1)}else r[0]===s&&O(this,Ft).delete(a)}}this.notify({type:"removed",mutation:s})}canRun(s){const a=qa(s);if(typeof a=="string"){const r=O(this,Ft).get(a),n=r==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===s}else return!0}runNext(s){var r;const a=qa(s);if(typeof a=="string"){const n=(r=O(this,Ft).get(a))==null?void 0:r.find(i=>i!==s&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){xt.batch(()=>{O(this,Qt).forEach(s=>{this.notify({type:"removed",mutation:s})}),O(this,Qt).clear(),O(this,Ft).clear()})}getAll(){return Array.from(O(this,Qt))}find(s){const a={exact:!0,...s};return this.getAll().find(r=>An(a,r))}findAll(s={}){return this.getAll().filter(a=>An(s,a))}notify(s){xt.batch(()=>{this.listeners.forEach(a=>{a(s)})})}resumePausedMutations(){const s=this.getAll().filter(a=>a.state.isPaused);return xt.batch(()=>Promise.all(s.map(a=>a.continue().catch(Dt))))}},Qt=new WeakMap,Ft=new WeakMap,wa=new WeakMap,ul);function qa(t){var s;return(s=t.options.scope)==null?void 0:s.id}function In(t){return{onFetch:(s,a)=>{var u,p,f,m,v;const r=s.options,n=(f=(p=(u=s.fetchOptions)==null?void 0:u.meta)==null?void 0:p.fetchMore)==null?void 0:f.direction,i=((m=s.state.data)==null?void 0:m.pages)||[],o=((v=s.state.data)==null?void 0:v.pageParams)||[];let c={pages:[],pageParams:[]},d=0;const h=async()=>{let x=!1;const g=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(s.signal.aborted?x=!0:s.signal.addEventListener("abort",()=>{x=!0}),s.signal)})},j=li(s.options,s.fetchOptions),b=async(N,I,y)=>{if(x)return Promise.reject();if(I==null&&N.pages.length)return Promise.resolve(N);const k=(()=>{const D={client:s.client,queryKey:s.queryKey,pageParam:I,direction:y?"backward":"forward",meta:s.options.meta};return g(D),D})(),_=await j(k),{maxPages:M}=s.options,q=y?Im:Tm;return{pages:q(N.pages,_,M),pageParams:q(N.pageParams,I,M)}};if(n&&i.length){const N=n==="backward",I=N?Wm:Dn,y={pages:i,pageParams:o},w=I(r,y);c=await b(y,w,N)}else{const N=t??i.length;do{const I=d===0?o[0]??r.initialPageParam:Dn(r,c);if(d>0&&I==null)break;c=await b(c,I),d++}while(d<N)}return c};s.options.persister?s.fetchFn=()=>{var x,g;return(g=(x=s.options).persister)==null?void 0:g.call(x,h,{client:s.client,queryKey:s.queryKey,meta:s.options.meta,signal:s.signal},a)}:s.fetchFn=h}}}function Dn(t,{pages:s,pageParams:a}){const r=s.length-1;return s.length>0?t.getNextPageParam(s[r],s,a[r],a):void 0}function Wm(t,{pages:s,pageParams:a}){var r;return s.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,s[0],s,a[0],a):void 0}var Ze,ms,hs,Js,Xs,us,Zs,ea,xl,Km=(xl=class{constructor(t={}){_e(this,Ze);_e(this,ms);_e(this,hs);_e(this,Js);_e(this,Xs);_e(this,us);_e(this,Zs);_e(this,ea);je(this,Ze,t.queryCache||new zm),je(this,ms,t.mutationCache||new Gm),je(this,hs,t.defaultOptions||{}),je(this,Js,new Map),je(this,Xs,new Map),je(this,us,0)}mount(){Oa(this,us)._++,O(this,us)===1&&(je(this,Zs,ii.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,Ze).onFocus())})),je(this,ea,Va.subscribe(async t=>{t&&(await this.resumePausedMutations(),O(this,Ze).onOnline())})))}unmount(){var t,s;Oa(this,us)._--,O(this,us)===0&&((t=O(this,Zs))==null||t.call(this),je(this,Zs,void 0),(s=O(this,ea))==null||s.call(this),je(this,ea,void 0))}isFetching(t){return O(this,Ze).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return O(this,ms).findAll({...t,status:"pending"}).length}getQueryData(t){var a;const s=this.defaultQueryOptions({queryKey:t});return(a=O(this,Ze).get(s.queryHash))==null?void 0:a.state.data}ensureQueryData(t){const s=this.defaultQueryOptions(t),a=O(this,Ze).build(this,s),r=a.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&a.isStaleByTime(_r(s.staleTime,a))&&this.prefetchQuery(s),Promise.resolve(r))}getQueriesData(t){return O(this,Ze).findAll(t).map(({queryKey:s,state:a})=>{const r=a.data;return[s,r]})}setQueryData(t,s,a){const r=this.defaultQueryOptions({queryKey:t}),n=O(this,Ze).get(r.queryHash),i=n==null?void 0:n.state.data,o=Cm(s,i);if(o!==void 0)return O(this,Ze).build(this,r).setData(o,{...a,manual:!0})}
2setQueriesData(t,s,a){return xt.batch(()=>O(this,Ze).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,s,a)]))}getQueryState(t){var a;const s=this.defaultQueryOptions({queryKey:t});return(a=O(this,Ze).get(s.queryHash))==null?void 0:a.state}removeQueries(t){const s=O(this,Ze);xt.batch(()=>{s.findAll(t).forEach(a=>{s.remove(a)})})}resetQueries(t,s){const a=O(this,Ze);return xt.batch(()=>(a.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},s)))}cancelQueries(t,s={}){const a={revert:!0,...s},r=xt.batch(()=>O(this,Ze).findAll(t).map(n=>n.cancel(a)));return Promise.all(r).then(Dt).catch(Dt)}invalidateQueries(t,s={}){return xt.batch(()=>(O(this,Ze).findAll(t).forEach(a=>{a.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},s)))}refetchQueries(t,s={}){const a={...s,cancelRefetch:s.cancelRefetch??!0},r=xt.batch(()=>O(this,Ze).findAll(t).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,a);return a.throwOnError||(i=i.catch(Dt)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Dt)}fetchQuery(t){const s=this.defaultQueryOptions(t);s.retry===void 0&&(s.retry=!1);const a=O(this,Ze).build(this,s);return a.isStaleByTime(_r(s.staleTime,a))?a.fetch(s):Promise.resolve(a.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Dt).catch(Dt)}fetchInfiniteQuery(t){return t.behavior=In(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Dt).catch(Dt)}ensureInfiniteQueryData(t){return t.behavior=In(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Va.isOnline()?O(this,ms).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Ze)}getMutationCache(){return O(this,ms)}getDefaultOptions(){return O(this,hs)}setDefaultOptions(t){je(this,hs,t)}setQueryDefaults(t,s){O(this,Js).set(fa(t),{queryKey:t,defaultOptions:s})}getQueryDefaults(t){const s=[...O(this,Js).values()],a={};return s.forEach(r=>{ja(t,r.queryKey)&&Object.assign(a,r.defaultOptions)}),a}setMutationDefaults(t,s){O(this,Xs).set(fa(t),{mutationKey:t,defaultOptions:s})}getMutationDefaults(t){const s=[...O(this,Xs).values()],a={};return s.forEach(r=>{ja(t,r.mutationKey)&&Object.assign(a,r.defaultOptions)}),a}defaultQueryOptions(t){if(t._defaulted)return t;const s={...O(this,hs).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return s.queryHash||(s.queryHash=tn(s.queryKey,s)),s.refetchOnReconnect===void 0&&(s.refetchOnReconnect=s.networkMode!=="always"),s.throwOnError===void 0&&(s.throwOnError=!!s.suspense),!s.networkMode&&s.persister&&(s.networkMode="offlineFirst"),s.queryFn===sn&&(s.enabled=!1),s}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...O(this,hs).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){O(this,Ze).clear(),O(this,ms).clear()}},Ze=new WeakMap,ms=new WeakMap,hs=new WeakMap,Js=new WeakMap,Xs=new WeakMap,us=new WeakMap,Zs=new WeakMap,ea=new WeakMap,xl),Qm=l.createContext(void 0),Ym=({client:t,children:s})=>(l.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),e.jsx(Qm.Provider,{value:t,children:s}));const Jm="https://ckjiwgyeseqtkpgftubq.supabase.co",Xm="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNraml3Z3llc2VxdGtwZ2Z0dWJxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTYyOTAwMzgsImV4cCI6MjA3MTg2NjAzOH0.K4zfl-vnamPUMHXPjd7UUr-tZ0YV3JQXYXEwVo8aJ30",U=Gc(Jm,Xm,{auth:{persistSession:!0,autoRefreshToken:!0}}),hi=l.createContext(void 0),Nt=()=>{const t=l.useContext(hi);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},Zm=({children:t})=>{const[s,a]=l.useState(null),[r,n]=l.useState(null),[i,o]=l.useState(!0);l.useEffect(()=>{let f=!0;U.auth.getSession().then(({data:{session:v}})=>{f&&(n(v),a((v==null?void 0:v.user)??null))}).catch(v=>{console.error("Failed to get auth session:",v)}).finally(()=>{f&&o(!1)});const{data:{subscription:m}}=U.auth.onAuthStateChange((v,x)=>{f&&(n(x),a((x==null?void 0:x.user)??null),o(!1))});return()=>{f=!1,m.unsubscribe()}},[]);const p={user:s,session:r,loading:i,signIn:async(f,m)=>{const{error:v}=await U.auth.signInWithPassword({email:f,password:m});return{error:v}},signUp:async(f,m,v)=>{const x=typeof v=="string"?{full_name:v}:v||{},{data:g,error:j}=await U.auth.signUp({email:f,password:m,options:{data:{full_name:x.full_name||f.split("@")[0],...x.phone&&{phone:x.phone},...x.address&&{address:x.address},...x.city&&{city:x.city},...x.country&&{country:x.country},...x.passport_number&&{passport_number:x.passport_number}}}});return{data:g,error:j}},signOut:async()=>{await U.auth.signOut()},resetPassword:async f=>{const{error:m}=await U.auth.resetPasswordForEmail(f,{redirectTo:`${window.location.origin}/reset-password`});return{error:m}}};return e.jsx(hi.Provider,{value:p,children:t})},eh=8e3,ir=()=>{const{user:t,loading:s}=Nt(),[a,r]=l.useState(!1),[n,i]=l.useState(!0);return l.useEffect(()=>{let o=!1;return(async()=>
2{if(s){i(!0);return}if(!t){o||(r(!1),i(!1));return}i(!0);try{const d=U.from("admin_users").select("role").eq("id",t.id).maybeSingle(),h=new Promise(f=>{setTimeout(()=>f({data:null,error:{message:"Admin check timed out"}}),eh)}),{data:u,error:p}=await Promise.race([d,h]);if(o)return;p?(console.error("Error checking admin status:",p),r(!1)):r((u==null?void 0:u.role)==="admin")}catch(d){console.error("Error checking admin status:",d),o||r(!1)}finally{o||i(!1)}})(),()=>{o=!0}},[t,s]),{isAdmin:a,loading:n}};async function an(){try{const{data:t,error:s}=await U.from("agent_settings").select("*").eq("id",1).maybeSingle();if(s)throw s;return{data:t,error:null}}catch(t){return{data:null,error:t instanceof Error?t.message:"Failed to load agent settings"}}}async function th(t){try{const{data:s,error:a}=await U.from("agent_settings").update({...t,updated_at:new Date().toISOString()}).eq("id",1).select("*").single();if(a)throw a;return{data:s,error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to update settings"}}}async function Mn(){try{const{data:t}=await U.auth.getUser();if(!t.user)return{data:null,error:null};const{data:s,error:a}=await U.from("agents").select("*").eq("user_id",t.user.id).maybeSingle();if(a)throw a;return{data:s,error:null}}catch(t){return{data:null,error:t instanceof Error?t.message:"Failed to load agent"}}}async function sh(t){try{const{data:s,error:a}=await U.rpc("resolve_approved_agent",{p_code:t});if(a)throw a;return{agentId:s??null,error:null}}catch(s){return{agentId:null,error:s instanceof Error?s.message:"Failed to resolve referral code"}}}async function ah(t){var s,a,r,n,i,o,c;try{const{data:d,error:h}=await U.auth.getUser();if(h||!d.user)return{data:null,error:"You must be signed in to apply"};let u=`SAMUI-${crypto.randomUUID().replace(/-/g,"").slice(0,6).toUpperCase()}`;try{const{data:m}=await U.rpc("generate_agent_referral_code");m&&(u=m)}catch{}const{data:p,error:f}=await U.from("agents").insert({user_id:d.user.id,referral_code:u,status:"pending_kyc",display_name:t.display_name.trim(),company_name:((s=t.company_name)==null?void 0:s.trim())||null,phone:((a=t.phone)==null?void 0:a.trim())||null,country:((r=t.country)==null?void 0:r.trim())||null,bank_name:((n=t.bank_name)==null?void 0:n.trim())||null,bank_account_name:((i=t.bank_account_name)==null?void 0:i.trim())||null,bank_account_number:((o=t.bank_account_number)==null?void 0:o.trim())||null,bank_swift:((c=t.bank_swift)==null?void 0:c.trim())||null}).select("*").single();if(f)throw f;return{data:p,error:null}}catch(d){return{data:null,error:d instanceof Error?d.message:"Failed to create application"}}}async function rh(t){var s,a,r,n,i,o,c,d,h,u,p,f,m,v,x,g,j,b;try{const N=t.email.trim().toLowerCase();if(!N||!t.display_name.trim())return{data:null,error:"Email and display name are required"};const{data:I}=await U.auth.getSession(),y=(s=I.session)==null?void 0:s.access_token;if(!y)return{data:null,error:"You must be signed in as admin"};const{data:w}=await U.from("users").select("id, email").ilike("email",N).maybeSingle();if(w!=null&&w.id){const{data:q}=await U.from("agents").select("id").eq("user_id",w.id).maybeSingle();if(q)return{data:null,error:"This user already has an agent profile"};let D=((a=t.referral_code)==null?void 0:a.trim().toUpperCase())||`SAMUI-${crypto.randomUUID().replace(/-/g,"").slice(0,6).toUpperCase()}`;try{const{data:J}=await U.rpc("generate_agent_referral_code");!t.referral_code&&J&&(D=J)}catch{}const{data:F}=await U.auth.getUser(),{data:S,error:$}=await U.from("agents").insert({user_id:w.id,referral_code:D,status:"approved",display_name:t.display_name.trim(),company_name:((r=t.company_name)==null?void 0:r.trim())||null,phone:((n=t.phone)==null?void 0:n.trim())||null,country:((i=t.country)==null?void 0:i.trim())||null,commission_percent:t.commission_percent===void 0||t.commission_percent===null?null:t.commission_percent,bank_name:((o=t.bank_name)==null?void 0:o.trim())||null,bank_account_name:((c=t.bank_account_name)==null?void 0:c.trim())||null,bank_account_number:((d=t.bank_account_number)==null?void 0:d.trim())||null,bank_swift:((h=t.bank_swift)==null?void 0:h.trim())||null,reviewed_by:((u=F.user)==null?void 0:u.id)||null,reviewed_at:new Date().toISOString(),rejection_reason:null}).select("*").single();if($)throw $;return{data:S,error:null,invited:!1}}const k="https://ckjiwgyeseqtkpgftubq.supabase.co".replace(/\/$/,""),_=await fetch(`${k}/functions/v1/admin-create-agent`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${y}`},body:JSON.stringify({email:N,display_name:t.display_name.trim(),company_name:((p=t.company_name)==null?void 0:p.trim())||null,phone:((f=t.phone)==null?void 0:f.trim())||null,country:((m=t.country)==null?void 0:m.trim())||null,commission_percent:t.commission_percent??null,bank_name:((v=t.bank_name)==null?void 0:v.trim())||null,bank_account_name:((x=t.bank_account_name)==null?void 0:x.trim())||null,bank_account_number:((g=t.bank_account_number)==null?void 0:g.trim())||null,bank_swift:((j=t.bank_swift)==null?void 0:j.trim())||null,referral_code:((b=t.referral_code)==null?void 0:b.trim())||null,send_invite:t.sendInviteEmail!==!1})}),M=await _.json().catch(()=>({}));return!_.ok||!M.success?{data:null,error:M.error||`Could not create agent (${_.status}). User must exist in the app, or deploy admin-create-agent.`}:{data:M.agent,error:null,invited:!!M.invited}}catch(N){return{data:null,error:N instanceof Error?N.message:"Failed to create agent"}}}async function rn(t,s){try{const{data:a,error:r}=await U.from("agents").update(s).eq("id",t).select("*").single();if(r)throw r;return{data:a,error:null}}catch(a){return{data:null,error:a instanceof Error?a.message:"Failed to update agent"}}}async function nh(t){const{error:s}=await rn(t,{status:"pending_review"});return{error:s}}async function lh(t,s,a,r){try{const n=r.name.split(".").pop()||"bin",i=`${s}/${t}/${a}.${n}`,{error:o}=await U.storage.from("agent-kyc").upload(i,r,{upsert:!0,contentType:r.type});if(o)throw o;const{data:c,error:d}=await U.from("agent_kyc_documents").upsert({agent_id:t,doc_type:a,storage_path:i,file_name:r.name,mime_type:r.type,uploaded_at:new Date().toISOString()},{onConflict:"agent_id,doc_type"}).select("*").single();if(d)throw d;return{data:c,error:null}}catch(n){return{data:null,error:n instanceof Error?n.message:"Failed to upload document"}}}async function ui(t){try{const{data:s,error:a}=await U.from("agent_kyc_documents").select("*").eq("agent_id",t).order("uploaded_at",{ascending:!1});if(a)throw a;return{data:s,error:null}}
2catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to load KYC documents"}}}async function ih(t){try{const{data:s,error:a}=await U.storage.from("agent-kyc").createSignedUrl(t,3600);if(a)throw a;return{url:s.signedUrl,error:null}}catch(s){return{url:null,error:s instanceof Error?s.message:"Failed to create signed URL"}}}async function oh(){try{const{data:t,error:s}=await U.from("agents").select("*").order("created_at",{ascending:!1});if(s)throw s;return{data:t,error:null}}catch(t){return{data:null,error:t instanceof Error?t.message:"Failed to load agents"}}}async function Ga(t,s){try{const{data:a,error:r}=await U.from("agents").update(s).eq("id",t).select("*").single();if(r)throw r;return{data:a,error:null}}catch(a){return{data:null,error:a instanceof Error?a.message:"Failed to update agent"}}}async function ch(t,s){return Ga(t,{status:"approved",reviewed_by:s,reviewed_at:new Date().toISOString(),rejection_reason:null})}async function dh(t,s,a){return Ga(t,{status:"rejected",reviewed_by:s,reviewed_at:new Date().toISOString(),rejection_reason:a})}async function xi(t){try{let s=U.from("commission_ledger").select("*").order("created_at",{ascending:!1});t!=null&&t.agentId&&(s=s.eq("agent_id",t.agentId)),t!=null&&t.status&&(s=s.eq("status",t.status));const{data:a,error:r}=await s;if(r)throw r;return{data:a,error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to load commissions"}}}async function mh(t){try{const{data:s,error:a}=await U.from("bookings").select(` 3 *, 4 rooms:room_id ( name, image, price_per_night ), 5 guest_info:guest_info_id ( full_name, email, phone ) 6 `).eq("agent_id",t).order("created_at",{ascending:!1});if(a)throw a;return{data:s||[],error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to load agent bookings"}}}async function gi(t){try{let s=U.from("agent_payouts").select("*").order("created_at",{ascending:!1});t&&(s=s.eq("agent_id",t));const{data:a,error:r}=await s;if(r)throw r;return{data:a,error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to load payouts"}}}async function hh(t){try{const{data:s,error:a}=await U.from("commission_ledger").select("*").in("id",t.ledgerIds).eq("agent_id",t.agentId).eq("status","payable");if(a)throw a;if(!(s!=null&&s.length))return{data:null,error:"No payable commission lines selected"};const r=s.reduce((c,d)=>c+Number(d.commission_amount),0),{data:n,error:i}=await U.from("agent_payouts").insert({agent_id:t.agentId,amount:r,currency:"THB",status:"pending",notes:t.notes||null,created_by:t.adminUserId}).select("*").single();if(i)throw i;const{error:o}=await U.from("commission_ledger").update({payout_id:n.id}).in("id",s.map(c=>c.id));if(o)throw o;return{data:n,error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to create payout"}}}async function uh(t){try{const s=new Date().toISOString(),{data:a,error:r}=await U.from("agent_payouts").update({status:"paid",paid_at:s,payment_reference:t.payment_reference,notes:t.notes??void 0}).eq("id",t.payoutId).select("*").single();if(r)throw r;return await U.from("commission_ledger").update({status:"paid",paid_at:s}).eq("payout_id",t.payoutId).eq("status","payable"),{data:a,error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to mark payout paid"}}}const or=()=>{const{user:t,loading:s}=Nt(),[a,r]=l.useState(null),[n,i]=l.useState(!0),[o,c]=l.useState(null),d=async()=>{if(s){i(!0);return}if(!t){r(null),i(!1),c(null);return}i(!0);const{data:u,error:p}=await Mn();r(u),c(p),i(!1)};l.useEffect(()=>{let u=!1;return(async()=>{if(s){i(!0);return}if(!t){u||(r(null),i(!1),c(null));return}i(!0);const{data:f,error:m}=await Mn();u||(r(f),c(m),i(!1))})(),()=>{u=!0}},[t,s]);const h=(a==null?void 0:a.status)==="approved";return{agent:a,isApprovedAgent:h,loading:n,error:o,refetch:d}},zs=({children:t,requireAuth:s=!1,requireAdmin:a=!1,requireAgent:r=!1,redirectTo:n})=>{const{user:i,loading:o}=Nt(),{isAdmin:c,loading:d}=ir(),{isApprovedAgent:h,loading:u}=or(),p=$s();return o?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading..."})]})}):a&&i&&d?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Checking admin access..."})]})}):r&&i&&u?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Checking agent access..."})]})}):s&&!i?e.jsx(Ns,{to:"/login",state:{from:p},replace:!0}
6):a&&!c?e.jsx(Ns,{to:"/dashboard",replace:!0}):r&&!h?e.jsx(Ns,{to:"/agents/apply",replace:!0}):i&&p.pathname==="/login"?d||u?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading..."})]})}):c?e.jsx(Ns,{to:n||"/admin",replace:!0}):h?e.jsx(Ns,{to:n||"/agent",replace:!0}):e.jsx(Ns,{to:n||"/dashboard",replace:!0}):e.jsx(e.Fragment,{children:t})},pi="agent_referral_code",fi="agent_referral_stored_at",ji="agent_ref";function bi(t){return t*24*60*60*1e3}function xh(t,s,a){const r=new Date(Date.now()+bi(a)).toUTCString();document.cookie=`${t}=${encodeURIComponent(s)}; expires=${r}; path=/; SameSite=Lax`}function gh(t){const s=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return s?decodeURIComponent(s[1]):null}function ph(t=30){var r;if(typeof window>"u")return null;const a=(r=new URLSearchParams(window.location.search).get("ref"))==null?void 0:r.trim().toUpperCase();if(!a)return yi(t);try{localStorage.setItem(pi,a),localStorage.setItem(fi,String(Date.now())),xh(ji,a,t)}catch{}return a}function yi(t=30){if(typeof window>"u")return null;try{const a=localStorage.getItem(pi),r=Number(localStorage.getItem(fi)||0);if(a&&r&&Date.now()-r<=bi(t))return a}catch{}const s=gh(ji);return s?s.toUpperCase():null}function fh(t,s){return`${typeof window<"u"?window.location.origin:""}/?ref=${encodeURIComponent(t)}`}function jh(){const t=$s();return l.useEffect(()=>{let s=30;an().then(({data:a})=>{a!=null&&a.cookie_days&&(s=a.cookie_days),ph(s)})},[t.search]),null}/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const bh=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),vi=(...t)=>t.filter((s,a,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===a).join(" ").trim();/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */var yh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const vh=l.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:a=2,absoluteStrokeWidth:r,className:n="",children:i,iconNode:o,...c},d)=>l.createElement("svg",{ref:d,...yh,width:s,height:s,stroke:t,strokeWidth:r?Number(a)*24/Number(s):a,className:vi("lucide",n),...c},[...o.map(([h,u])=>l.createElement(h,u)),...Array.isArray(i)?i:[i]]));/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const ee=(t,s)=>{const a=l.forwardRef(({className:r,...n},i)=>l.createElement(vh,{ref:i,iconNode:s,className:vi(`lucide-${bh(t)}`,r),...n}));return a.displayName=`${t}`,a};/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const xa=ee("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** 32 * @license lucide-react v0.462.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */const nn=ee("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** 37 * @license lucide-react v0.462.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */const vs=ee("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** 42 * @license lucide-react v0.462.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */const Nh=ee("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** 47 * @license lucide-react v0.462.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree.
51 */const Wa=ee("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** 52 * @license lucide-react v0.462.0 - ISC 53 * 54 * This source code is licensed under the ISC license. 55 * See the LICENSE file in the root directory of this source tree. 56 */const wh=ee("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** 57 * @license lucide-react v0.462.0 - ISC 58 * 59 * This source code is licensed under the ISC license. 60 * See the LICENSE file in the root directory of this source tree. 61 */const Fn=ee("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** 62 * @license lucide-react v0.462.0 - ISC 63 * 64 * This source code is licensed under the ISC license. 65 * See the LICENSE file in the root directory of this source tree. 66 */const Er=ee("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** 67 * @license lucide-react v0.462.0 - ISC 68 * 69 * This source code is licensed under the ISC license. 70 * See the LICENSE file in the root directory of this source tree. 71 */const Bn=ee("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** 72 * @license lucide-react v0.462.0 - ISC 73 * 74 * This source code is licensed under the ISC license. 75 * See the LICENSE file in the root directory of this source tree. 76 */const Re=ee("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** 77 * @license lucide-react v0.462.0 - ISC 78 * 79 * This source code is licensed under the ISC license. 80 * See the LICENSE file in the root directory of this source tree. 81 */const Ka=ee("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** 82 * @license lucide-react v0.462.0 - ISC 83 * 84 * This source code is licensed under the ISC license. 85 * See the LICENSE file in the root directory of this source tree. 86 */const ua=ee("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** 87 * @license lucide-react v0.462.0 - ISC 88 * 89 * This source code is licensed under the ISC license. 90 * See the LICENSE file in the root directory of this source tree. 91 */const ln=ee("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** 92 * @license lucide-react v0.462.0 - ISC 93 * 94 * This source code is licensed under the ISC license. 95 * See the LICENSE file in the root directory of this source tree. 96 */const Qa=ee("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** 97 * @license lucide-react v0.462.0 - ISC 98 * 99 * This source code is licensed under the ISC license. 100 * See the LICENSE file in the root directory of this source tree. 101 */const on=ee("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** 102 * @license lucide-react v0.462.0 - ISC 103 * 104 * This source code is licensed under the ISC license. 105 * See the LICENSE file in the root directory of this source tree. 106 */const ka=ee("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** 107 * @license lucide-react v0.462.0 - ISC 108 * 109 * This source code is licensed under the ISC license. 110 * See the LICENSE file in the root directory of this source tree. 111 */const kh=ee("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** 112 * @license lucide-react v0.462.0 - ISC 113 * 114 * This source code is licensed under the ISC license. 115 * See the LICENSE file in the root directory of this source tree. 116 */const sa=ee("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** 117 * @license lucide-react v0.462.0 - ISC 118 * 119 * This source code is licensed under the ISC license. 120 * See the LICENSE file in the root directory of this source tree. 121 */const jt=ee("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** 122 * @license lucide-react v0.462.0 - ISC 123 * 124 * This source code is licensed under the ISC license. 125 * See the LICENSE file in the root directory of this source tree. 126 */const gt=ee("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** 127 * @license lucide-react v0.462.0 - ISC 128 * 129 * This source code is licensed under the ISC license. 130 * See the LICENSE file in the root directory of this source tree. 131 */const ps=ee("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** 132 * @license lucide-react v0.462.0 - ISC 133 * 134 * This source code is licensed under the ISC license. 135 * See the LICENSE file in the root directory of this source tree. 136 */const Sh=ee("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 137 * @license lucide-react v0.462.0 - ISC 138 * 139 * This source code is licensed under the ISC license. 140 * See the LICENSE file in the root directory of this source tree. 141 */const Ie=ee("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** 142 * @license lucide-react v0.462.0 - ISC 143 * 144 * This source code is licensed under the ISC license. 145 * See the LICENSE file in the root directory of this source tree. 146 */const Ch=ee("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",ke
146y:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 147 * @license lucide-react v0.462.0 - ISC 148 * 149 * This source code is licensed under the ISC license. 150 * See the LICENSE file in the root directory of this source tree. 151 */const cn=ee("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** 152 * @license lucide-react v0.462.0 - ISC 153 * 154 * This source code is licensed under the ISC license. 155 * See the LICENSE file in the root directory of this source tree. 156 */const Ar=ee("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** 157 * @license lucide-react v0.462.0 - ISC 158 * 159 * This source code is licensed under the ISC license. 160 * See the LICENSE file in the root directory of this source tree. 161 */const dn=ee("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** 162 * @license lucide-react v0.462.0 - ISC 163 * 164 * This source code is licensed under the ISC license. 165 * See the LICENSE file in the root directory of this source tree. 166 */const _h=ee("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** 167 * @license lucide-react v0.462.0 - ISC 168 * 169 * This source code is licensed under the ISC license. 170 * See the LICENSE file in the root directory of this source tree. 171 */const mn=ee("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** 172 * @license lucide-react v0.462.0 - ISC 173 * 174 * This source code is licensed under the ISC license. 175 * See the LICENSE file in the root directory of this source tree. 176 */const Rr=ee("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** 177 * @license lucide-react v0.462.0 - ISC 178 * 179 * This source code is licensed under the ISC license. 180 * See the LICENSE file in the root directory of this source tree. 181 */const Ds=ee("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 182 * @license lucide-react v0.462.0 - ISC 183 * 184 * This source code is licensed under the ISC license. 185 * See the LICENSE file in the root directory of this source tree. 186 */const Tr=ee("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** 187 * @license lucide-react v0.462.0 - ISC 188 * 189 * This source code is licensed under the ISC license. 190 * See the LICENSE file in the root directory of this source tree. 191 */const On=ee("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** 192 * @license lucide-react v0.462.0 - ISC 193 * 194 * This source code is licensed under the ISC license. 195 * See the LICENSE file in the root directory of this source tree. 196 */const $a=ee("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** 197 * @license lucide-react v0.462.0 - ISC 198 * 199 * This source code is licensed under the ISC license. 200 * See the LICENSE file in the root directory of this source tree. 201 */const Ph=ee("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** 202 * @license lucide-react v0.462.0 - ISC 203 * 204 * This source code is licensed under the ISC license. 205 * See the LICENSE file in the root directory of this source tree. 206 */const Ua=ee("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** 207 * @license lucide-react v0.462.0 - ISC 208 * 209 * This source code is licensed under the ISC license. 210 * See the LICENSE file in the root directory of this source tree. 211 */const Ln=ee("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** 212 * @license lucide-react v0.462.0 - ISC 213 * 214 * This source code is licensed under the ISC license. 215 * See the LICENSE file in the root directory of this source tree. 216 */const Eh=ee("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** 217 * @license lucide-react v0.462.0 - ISC 218 * 219 * This source code is licensed under the ISC license. 220 * See the LICENSE file in the root directory of this source tree. 221 */const es=ee("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** 222 * @license lucide-react v0.462.0 - ISC 223 * 224 * This source code is licensed under the ISC license. 225 * See the LICENSE file in the root directory of this source tree. 226 */const Ah=ee("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** 227 * @license lucide-react v0.462.0 - ISC 228 * 229 * This source code is licensed under the ISC license. 230 * See the LICENSE file in the root directory of this source tree.
231 */const qn=ee("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** 232 * @license lucide-react v0.462.0 - ISC 233 * 234 * This source code is licensed under the ISC license. 235 * See the LICENSE file in the root directory of this source tree. 236 */const Rh=ee("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** 237 * @license lucide-react v0.462.0 - ISC 238 * 239 * This source code is licensed under the ISC license. 240 * See the LICENSE file in the root directory of this source tree. 241 */const Ht=ee("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** 242 * @license lucide-react v0.462.0 - ISC 243 * 244 * This source code is licensed under the ISC license. 245 * See the LICENSE file in the root directory of this source tree. 246 */const $n=ee("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** 247 * @license lucide-react v0.462.0 - ISC 248 * 249 * This source code is licensed under the ISC license. 250 * See the LICENSE file in the root directory of this source tree. 251 */const Un=ee("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** 252 * @license lucide-react v0.462.0 - ISC 253 * 254 * This source code is licensed under the ISC license. 255 * See the LICENSE file in the root directory of this source tree. 256 */const Ir=ee("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** 257 * @license lucide-react v0.462.0 - ISC 258 * 259 * This source code is licensed under the ISC license. 260 * See the LICENSE file in the root directory of this source tree. 261 */const ts=ee("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** 262 * @license lucide-react v0.462.0 - ISC 263 * 264 * This source code is licensed under the ISC license. 265 * See the LICENSE file in the root directory of this source tree. 266 */const Je=ee("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** 267 * @license lucide-react v0.462.0 - ISC 268 * 269 * This source code is licensed under the ISC license. 270 * See the LICENSE file in the root directory of this source tree. 271 */const Th=ee("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** 272 * @license lucide-react v0.462.0 - ISC 273 * 274 * This source code is licensed under the ISC license. 275 * See the LICENSE file in the root directory of this source tree. 276 */const Ih=ee("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** 277 * @license lucide-react v0.462.0 - ISC 278 * 279 * This source code is licensed under the ISC license. 280 * See the LICENSE file in the root directory of this source tree. 281 */const Dr=ee("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** 282 * @license lucide-react v0.462.0 - ISC 283 * 284 * This source code is licensed under the ISC license. 285 * See the LICENSE file in the root directory of this source tree. 286 */const Dh=ee("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** 287 * @license lucide-react v0.462.0 - ISC 288 * 289 * This source code is licensed under the ISC license. 290 * See the LICENSE file in the root directory of this source tree. 291 */const Mr=ee("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** 292 * @license lucide-react v0.462.0 - ISC 293 * 294 * This source code is licensed under the ISC license. 295 * See the LICENSE file in the root directory of this source tree.
296 */const Mh=ee("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** 297 * @license lucide-react v0.462.0 - ISC 298 * 299 * This source code is licensed under the ISC license. 300 * See the LICENSE file in the root directory of this source tree. 301 */const lt=ee("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** 302 * @license lucide-react v0.462.0 - ISC 303 * 304 * This source code is licensed under the ISC license. 305 * See the LICENSE file in the root directory of this source tree. 306 */const Fh=ee("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** 307 * @license lucide-react v0.462.0 - ISC 308 * 309 * This source code is licensed under the ISC license. 310 * See the LICENSE file in the root directory of this source tree. 311 */const ut=ee("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** 312 * @license lucide-react v0.462.0 - ISC 313 * 314 * This source code is licensed under the ISC license. 315 * See the LICENSE file in the root directory of this source tree. 316 */const bt=ee("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** 317 * @license lucide-react v0.462.0 - ISC 318 * 319 * This source code is licensed under the ISC license. 320 * See the LICENSE file in the root directory of this source tree. 321 */const Bh=ee("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** 322 * @license lucide-react v0.462.0 - ISC 323 * 324 * This source code is licensed under the ISC license. 325 * See the LICENSE file in the root directory of this source tree. 326 */const Oh=ee("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** 327 * @license lucide-react v0.462.0 - ISC 328 * 329 * This source code is licensed under the ISC license. 330 * See the LICENSE file in the root directory of this source tree. 331 */const Ni=ee("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** 332 * @license lucide-react v0.462.0 - ISC 333 * 334 * This source code is licensed under the ISC license. 335 * See the LICENSE file in the root directory of this source tree. 336 */const Lh=ee("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** 337 * @license lucide-react v0.462.0 - ISC 338 * 339 * This source code is licensed under the ISC license. 340 * See the LICENSE file in the root directory of this source tree. 341 */const ba=ee("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 342 * @license lucide-react v0.462.0 - ISC 343 * 344 * This source code is licensed under the ISC license. 345 * See the LICENSE file in the root directory of this source tree. 346 */const Rs=ee("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
346y:"oel41y"}]]);/** 347 * @license lucide-react v0.462.0 - ISC 348 * 349 * This source code is licensed under the ISC license. 350 * See the LICENSE file in the root directory of this source tree. 351 */const Ts=ee("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** 352 * @license lucide-react v0.462.0 - ISC 353 * 354 * This source code is licensed under the ISC license. 355 * See the LICENSE file in the root directory of this source tree. 356 */const wi=ee("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** 357 * @license lucide-react v0.462.0 - ISC 358 * 359 * This source code is licensed under the ISC license. 360 * See the LICENSE file in the root directory of this source tree. 361 */const dt=ee("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** 362 * @license lucide-react v0.462.0 - ISC 363 * 364 * This source code is licensed under the ISC license. 365 * See the LICENSE file in the root directory of this source tree. 366 */const zn=ee("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** 367 * @license lucide-react v0.462.0 - ISC 368 * 369 * This source code is licensed under the ISC license. 370 * See the LICENSE file in the root directory of this source tree. 371 */const Sa=ee("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** 372 * @license lucide-react v0.462.0 - ISC 373 * 374 * This source code is licensed under the ISC license. 375 * See the LICENSE file in the root directory of this source tree. 376 */const ss=ee("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** 377 * @license lucide-react v0.462.0 - ISC 378 * 379 * This source code is licensed under the ISC license. 380 * See the LICENSE file in the root directory of this source tree. 381 */const ki=ee("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** 382 * @license lucide-react v0.462.0 - ISC 383 * 384 * This source code is licensed under the ISC license. 385 * See the LICENSE file in the root directory of this source tree. 386 */const Ms=ee("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** 387 * @license lucide-react v0.462.0 - ISC 388 * 389 * This source code is licensed under the ISC license. 390 * See the LICENSE file in the root directory of this source tree. 391 */const qh=ee("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** 392 * @license lucide-react v0.462.0 - ISC 393 * 394 * This source code is licensed under the ISC license. 395 * See the LICENSE file in the root directory of this source tree. 396 */const Ya=ee("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** 397 * @license lucide-react v0.462.0 - ISC 398 * 399 * This source code is licensed under the ISC license. 400 * See the LICENSE file in the root directory of this source tree. 401 */const Xe=ee("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** 402 * @license lucide-react v0.462.0 - ISC 403 * 404 * This source code is licensed under the ISC license. 405 * See the LICENSE file in the root directory of this source tree. 406 */const Hn=ee("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}
vendor: 4,354 bytes, lines 406-426
406],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** 407 * @license lucide-react v0.462.0 - ISC 408 * 409 * This source code is licensed under the ISC license. 410 * See the LICENSE file in the root directory of this source tree. 411 */const $h=ee("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** 412 * @license lucide-react v0.462.0 - ISC 413 * 414 * This source code is licensed under the ISC license. 415 * See the LICENSE file in the root directory of this source tree. 416 */const Jt=ee("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** 417 * @license lucide-react v0.462.0 - ISC 418 * 419 * This source code is licensed under the ISC license. 420 * See the LICENSE file in the root directory of this source tree. 421 */const et=ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** 422 * @license lucide-react v0.462.0 - ISC 423 * 424 * This source code is licensed under the ISC license. 425 * See the LICENSE file in the root directory of this source tree. 426 */const Vn=ee("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Gn=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,Wn=Xl,cr=(t,s)=>a=>{var r;if((s==null?void 0:s.variants)==null)return Wn(t,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:n,defaultVariants:i}=s,o=Object.keys(n).map(h=>{const u=a==null?void 0:a[h],p=i==null?void 0:i[h];if(u===null)return null;const f=Gn(u)||Gn(p);return n[h][f]}),c=a&&Object.entries(a).reduce((h,u)=>{let[p,f]=u;return f===void 0||(h[p]=f),h},{}),d=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((h,u)=>{let{class:p,className:f,...m}=u;return Object.entries(m).every(v=>{let[x,g]=v;return Array.isArray(g)?g.includes({...i,...c}[x]):{...i,...c}[x]===g})?[...h,p,f]:h},[]);return Wn(t,o,d,a==null?void 0:a.class,a==null?void 0:a.className)},hn=cr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),P=l.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},i)=>{const o=r?Ic:"button";return e.jsx(o,{className:de(hn({variant:s,size:a,className:t})),ref:i,...n})});P.displayName="Button";const Uh=Mc,zh=Fc,Hh=l.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(pl,{ref:n,className:de("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",t),...r,children:[a,e.jsx(ka,{className:"ml-auto h-4 w-4"})]}));Hh.displayName=pl.displayName;const Vh=l.forwardRef(({className:t,...s},a)=>e.jsx(fl,{ref:a,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:sli
426de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));Vh.displayName=fl.displayName;const Si=l.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Dc,{children:e.jsx(jl,{ref:r,sideOffset:s,className:de("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));Si.displayName=jl.displayName;const ws=l.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(bl,{ref:r,className:de("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));ws.displayName=bl.displayName;const Gh=l.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(yl,{ref:n,className:de("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(vl,{children:e.jsx(ln,{className:"h-4 w-4"})})}),s]}));Gh.displayName=yl.displayName;const Wh=l.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Nl,{ref:r,className:de("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(vl,{children:e.jsx(Sh,{className:"h-2 w-2 fill-current"})})}),s]}));Wh.displayName=Nl.displayName;const Ci=l.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(wl,{ref:r,className:de("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));Ci.displayName=wl.displayName;const Fr=l.forwardRef(({className:t,...s},a)=>e.jsx(kl,{ref:a,className:de("-mx-1 my-1 h-px bg-muted",t),...s}));Fr.displayName=kl.displayName;const We=()=>{var I,y;const[t,s]=l.useState(!1),[a,r]=l.useState(!1),n=$s(),i=vt(),{user:o,signOut:c}=Nt(),{isAdmin:d}=ir(),{isApprovedAgent:h,agent:u}=or(),[p,f]=l.useState(null),[m,v]=l.useState(!1);l.useEffect(()=>{const w=()=>{r(window.scrollY>50)};return window.addEventListener("scroll",w,{passive:!0}),()=>window.removeEventListener("scroll",w)},[]);const x=[{name:"Home",href:"/",isAnchor:!1,hasDropdown:!1},{name:"Our Resort",href:"#",isAnchor:!1,hasDropdown:!0,dropdownItems:[{name:"Rooms",href:"/rooms",isAnchor:!1},{name:"Restaurant",href:"/restaurant",isAnchor:!1},{name:"Waterpark",href:"/waterpark",isAnchor:!1}]},{name:"Fullmoon Party",href:"#",isAnchor:!1,hasDropdown:!0,dropdownItems:[{name:"Fullmoon Party",href:"/fullmoon-party",isAnchor:!1},{name:"Fullmoon Safety Tips",href:"/fullmoon-safety",isAnchor:!1},{name:"Fullmoon Boat Charter",href:"/fullmoon-boat-charter",isAnchor:!1}]},{name:"Attractions",href:"#",isAnchor:!1,hasDropdown:!0,dropdownItems:[{name:"10 Things to do in Koh Samui",href:"/koh-samui-things-to-do",isAnchor:!1},{name:"Top 10 Tours",href:"/top-10-tours",isAnchor:!1},{name:"Watersports",href:"/watersports",isAnchor:!1},{name:"Close to the resort",href:"/nearby-attractions",isAnchor:!1}]},{name:"Contact Us",href:"#",isAnchor:!1,hasDropdown:!0,dropdownItems:[{name:"Contact",href:"/contact",isAnchor:!1},{name:"Blog",href:"/blog",isAnchor:!1}]}],g=w=>w==="/"?n.pathname==="/":n.pathname.startsWith(w),j=async()=>{v(!0);try{await c(),s(!1),i("/")}finally{v(!1)}},b=((I=o==null?void 0:o.user_metadata)==null?void 0:I.full_name)||((y=o==null?void 0:o.email)==null?void 0:y.split("@")[0])||"Account",N=w=>
426w.hasDropdown?e.jsxs("div",{className:"relative group",onMouseEnter:()=>f(w.name),onMouseLeave:()=>f(null),children:[e.jsxs("button",{className:"flex items-center transition-all duration-300 font-medium text-white hover:text-sunset-orange group text-sm",children:[w.name,e.jsx(Qa,{className:"ml-1 h-3 w-3 transition-transform duration-300 group-hover:rotate-180"}),e.jsx("span",{className:"absolute -bottom-1 left-0 w-0 h-0.5 bg-sunset-orange transition-all duration-300 group-hover:w-full"})]}),e.jsx("div",{className:`absolute top-full left-0 mt-2 w-56 bg-white/95 backdrop-blur-md border border-white/20 shadow-2xl rounded-lg opacity-0 invisible transition-all duration-300 group-hover:opacity-100 group-hover:visible ${p===w.name?"opacity-100 visible":""}`,children:e.jsx("div",{className:"py-1",children:w.dropdownItems.map(k=>e.jsx(ct,{to:k.href,className:`block px-3 py-2 text-xs transition-colors duration-300 ${g(k.href)?"text-sunset-orange bg-orange-50":"text-gray-700 hover:text-sunset-orange hover:bg-orange-50"}`,onClick:()=>f(null),children:k.name},k.name))})})]}):w.isAnchor?e.jsxs("a",{href:w.href,className:"transition-all duration-300 font-medium relative group text-white hover:text-sunset-orange text-sm",children:[w.name,e.jsx("span",{className:"absolute -bottom-1 left-0 w-0 h-0.5 bg-sunset-orange transition-all duration-300 group-hover:w-full"})]}):e.jsxs(ct,{to:w.href,className:`transition-all duration-300 font-medium relative group text-sm ${g(w.href)?"text-sunset-orange":"text-white hover:text-sunset-orange"}`,children:[w.name,e.jsx("span",{className:`absolute -bottom-1 left-0 h-0.5 bg-sunset-orange transition-all duration-300 ${g(w.href)?"w-full":"w-0 group-hover:w-full"}`})]});return e.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 transition-all duration-300 bg-black/40 backdrop-blur-md border-b border-white/20 shadow-2xl",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsx("div",{className:"flex items-center",children:e.jsx(ct,{to:"/",children:e.jsx("img",{src:"/logo.png",alt:"Samui Pier Resort",className:"h-24 w-auto"})})}),e.jsxs("div",{className:"hidden lg:flex items-center space-x-6",children:[x.map(w=>e.jsx("div",{children:N(w)},w.name)),e.jsxs("div",{className:"flex items-center text-xs transition-colors duration-300 text-white/90",children:[e.jsx(lt,{className:"h-3 w-3 mr-1.5 text-sunset-orange"}),e.jsx("span",{className:"font-medium",children:"+66 (0)81 978 9085"})]}),e.jsxs("a",{href:"https://wa.me/66819789085",target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-xs transition-colors duration-300 text-white/90 hover:text-green-400 hover:scale-105",title:"WhatsApp us",children:[e.jsx(Dr,{className:"h-3 w-3 mr-1.5 text-green-400"}),e.jsx("span",{className:"font-medium",children:"WhatsApp"})]}),e.jsxs("a",{href:"https://www.facebook.com/samuipier",target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-xs transition-colors duration-300 text-white/90 hover:text-blue-400 hover:scale-105",title:"Follow us on Facebook",children:[e.jsx(Tr,{className:"h-3 w-3 mr-1.5 text-blue-400"}),e.jsx("span",{className:"font-medium",children:"Facebook"})]}),o?e.jsxs(Uh,{children:[e.jsx(zh,{asChild:!0,children:e.jsxs(P,{size:"sm",variant:"outline",className:"border-white/40 bg-white/10 text-white hover:bg-white/20 hover:text-white text-xs px-3 py-1.5 h-8",children:[e.jsx(Ya,{className:"h-3 w-3 mr-1.5"}),e.jsx("span",{className:"max-w-[100px] truncate",children:b}),e.jsx(Qa,{className:"h-3 w-3 ml-1 opacity-80"})]})}),e.jsxs(Si,{align:"end",className:"w-56 bg-white text-gray-900 border border-gray-200 shadow-xl",children:[e.jsxs(Ci,{className:"font-normal",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:b}),e.jsx("div",{className:"text-xs text-gray-500 truncate",children:o.email})]}),e.jsx(Fr,{className:"bg-gray-200"}),e.jsxs(ws,{onClick:()=>i("/dashboard"),className:"cursor-pointer focus:bg-orange-50 focus:text-gray-900",children:[e.jsx(qn,{
426className:"h-4 w-4 mr-2"}),"Dashboard"]}),e.jsxs(ws,{onClick:()=>i("/bookings"),className:"cursor-pointer focus:bg-orange-50 focus:text-gray-900",children:[e.jsx(Bn,{className:"h-4 w-4 mr-2"}),"My bookings"]}),d&&e.jsxs(ws,{onClick:()=>i("/admin"),className:"cursor-pointer focus:bg-orange-50 focus:text-gray-900",children:[e.jsx(ba,{className:"h-4 w-4 mr-2"}),"Admin"]}),h?e.jsxs(ws,{onClick:()=>i("/agent"),className:"cursor-pointer focus:bg-orange-50 focus:text-gray-900",children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),"Agent portal"]}):e.jsxs(ws,{onClick:()=>i("/agents/apply"),className:"cursor-pointer focus:bg-orange-50 focus:text-gray-900",children:[e.jsx(Ua,{className:"h-4 w-4 mr-2"}),u?"Agent application":"Become an agent"]}),e.jsx(Fr,{className:"bg-gray-200"}),e.jsxs(ws,{onClick:j,disabled:m,className:"cursor-pointer text-red-600 focus:bg-red-50 focus:text-red-700",children:[e.jsx(Ir,{className:"h-4 w-4 mr-2"}),m?"Signing outâ¦":"Log out"]})]})]}):e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>i("/login"),className:"border-white/40 bg-white/10 text-white hover:bg-white/20 hover:text-white text-xs px-3 py-1.5 h-8",children:[e.jsx(Un,{className:"h-3 w-3 mr-1.5"}),"Sign in"]}),e.jsx(P,{size:"sm",onClick:()=>i("/rooms"),className:"bg-sunset-orange hover:bg-orange-500 text-white font-semibold transition-all duration-300 hover:scale-105 shadow-lg rounded-md text-xs px-3 py-1.5 h-8",children:"Book Now"})]}),e.jsx("button",{className:"lg:hidden p-2 transition-colors duration-300 hover:bg-white/20 rounded-md text-white",onClick:()=>s(!t),children:t?e.jsx(et,{className:"h-6 w-6"}):e.jsx(Ih,{className:"h-6 w-6"})})]}),t&&e.jsxs("div",{className:"lg:hidden py-4 border-t border-white/20 transition-all duration-300",children:[x.map(w=>
426e.jsx("div",{children:w.hasDropdown?e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-white font-medium py-1.5 text-sm",children:w.name}),e.jsx("div",{className:"pl-4 space-y-0.5",children:w.dropdownItems.map(k=>e.jsx(ct,{to:k.href,className:`block py-1.5 text-xs transition-colors duration-300 ${g(k.href)?"text-sunset-orange":"text-white/80 hover:text-sunset-orange"}`,onClick:()=>s(!1),children:k.name},k.name))})]}):w.isAnchor?e.jsx("a",{href:w.href,className:"block py-2 transition-colors duration-300 text-white hover:text-sunset-orange text-sm",onClick:()=>s(!1),children:w.name}):e.jsx(ct,{to:w.href,className:`block py-2 transition-colors duration-300 text-sm ${g(w.href)?"text-sunset-orange":"text-white hover:text-sunset-orange"}`,onClick:()=>s(!1),children:w.name})},w.name)),e.jsxs("div",{className:"pt-4 border-t mt-4",children:[e.jsxs("div",{className:"flex items-center text-xs mb-3 text-white/90",children:[e.jsx(lt,{className:"h-3 w-3 mr-1.5 text-sunset-orange"}),e.jsx("span",{className:"font-medium",children:"+66 (0)81 978 9085"})]}),e.jsxs("div",{className:"flex items-center space-x-4 mb-3",children:[e.jsxs("a",{href:"https://wa.me/66819789085",target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-xs transition-colors duration-300 text-white/90 hover:text-green-400",children:[e.jsx(Dr,{className:"h-3 w-3 mr-1.5 text-green-400"}),e.jsx("span",{children:"WhatsApp"})]}),e.jsxs("a",{href:"https://www.facebook.com/samuipier",target:"_blank",rel:"noopener noreferrer",className:"flex items-center text-xs transition-colors duration-300 text-white/90 hover:text-blue-400",children:[e.jsx(Tr,{className:"h-3 w-3 mr-1.5 text-blue-400"}),e.jsx("span",{children:"Facebook"})]})]}),o?e.jsxs("div",{className:"space-y-2 mb-3",children:[e.jsxs("div",{className:"text-xs text-white/70 px-1",children:["Signed in as ",e.jsx("span",{className:"text-white font-medium",children:o.email})]}),e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>{i("/dashboard"),s(!1)},className:"w-full border-white/40 bg-white/10 text-white hover:bg-white/20 text-xs",children:[e.jsx(qn,{
426className:"h-3 w-3 mr-1.5"}),"Dashboard"]}),e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>{i("/bookings"),s(!1)},className:"w-full border-white/40 bg-white/10 text-white hover:bg-white/20 text-xs",children:[e.jsx(Bn,{className:"h-3 w-3 mr-1.5"}),"My bookings"]}),d&&e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>{i("/admin"),s(!1)},className:"w-full border-white/40 bg-white/10 text-white hover:bg-white/20 text-xs",children:[e.jsx(ba,{className:"h-3 w-3 mr-1.5"}),"Admin"]}),h?e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>{i("/agent"),s(!1)},className:"w-full border-white/40 bg-white/10 text-white hover:bg-white/20 text-xs",children:[e.jsx(Ua,{className:"h-3 w-3 mr-1.5"}),"Agent portal"]}):e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>{i("/agents/apply"),s(!1)},className:"w-full border-white/40 bg-white/10 text-white hover:bg-white/20 text-xs",children:[e.jsx(Ua,{className:"h-3 w-3 mr-1.5"}),u?"Agent application":"Become an agent"]}),e.jsxs(P,{size:"sm",variant:"outline",onClick:j,disabled:m,className:"w-full border-red-400/50 bg-red-500/10 text-red-200 hover:bg-red-500/20 text-xs",children:[e.jsx(Ir,{className:"h-3 w-3 mr-1.5"}),m?"Signing outâ¦":"Log out"]})]}):e.jsxs(P,{size:"sm",variant:"outline",onClick:()=>{i("/login"),s(!1)},className:"mb-2 w-full border-white/40 bg-white/10 text-white hover:bg-white/20 text-xs",children:[e.jsx(Un,{className:"h-3 w-3 mr-1.5"}),"Sign in"]}),e.jsx(P,{size:"sm",onClick:()=>{i("/rooms"),s(!1)},className:"w-full bg-sunset-orange hover:bg-orange-500 text-white rounded-md text-xs py-2 h-8",children:"Book Now"})]})]})]})})},Kh=({src:t,className:s="",poster:a,autoPlay:r=!1,loop:n=!1,muted:i=!0,playsInline:o=!0,onLoad:c,onError:d})=>{const[h,u]=l.useState(!1),[p,f]=l.useState(!1),m=l.useRef(null),v=()=>{console.log("Simple video data loaded successfully"),u(!0),c==null||c()},x=g=>{console.error("Simple video loading error:",g),f(!0),d==null||d()};return e.jsxs("div",{className:`relative overflow-hidden ${s}`,children:[!h&&!p&&e.jsx("div",{className:"absolute inset-0 bg-gray-200 animate-pulse flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"})}),p&&e.jsx("div",{className:"absolute inset-0 bg-gray-200 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-gray-600 mb-2",children:"Video failed to load"}),e.jsx("button",{onClick:()=>{f(!1),u(!1),m.current&&m.current.load()},className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Retry"})]})}),e.jsx("video",{ref:m,src:t,className:`w-full h-full object-cover transition-opacity duration-300 ${h?"opacity-100":"opacity-0"}`,poster:a,autoPlay:r,loop:n,muted:i,playsInline:o,preload:"metadata",onLoadedData:v,onError:x})]})},Qh=()=>(vt(),e.jsxs("section",{id:"home",className:"relative min-h-screen flex items-center justify-center overflow-hidden -mt-20 pt-20 pb-20",style:{backgroundAttachment:"fixed"},children:[e.jsx("div",{className:"absolute inset-0 w-full h-full bg-gradient-to-br from-blue-900 to-blue-700",children:e.jsx(Kh,{src:"/landing.mp4",className:"w-full h-full",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,poster:"/bg01.jpg"})}),e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:"absolute top-32 right-16 w-40 h-40 opacity-8 animate-float",children:e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-sunset-orange/20 to-transparent rounded-full blur-2xl"})}),e.jsx("div",{className:"absolute bottom-40 left-20 w-32 h-32 opacity-6 animate-float",style:{animationDelay:"-3s"},children:e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-ocean-teal/20 to-transparent rounded-full blur-2xl"})})]}),e.jsx("div",{className:"container mx-auto px-6 text-center text-white relative z-10",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("div",{className:"mb-12 animate-fade-in",children:e.jsx("img",{src:"/logo.png",alt:"Samui Pier Resort",className:"h-20 md:h-28 lg:h-36 w-auto mx-auto"})}),e.jsx("h2",{className:"text-3xl md:text-5xl lg:text-6xl opacity-85 text-shadow-sm/20 font-black text-white mb-8 text-shadow-2xl font-premium-heading tracking-tight leading-tight",children:"Welcome to Samui Pier Resort "}),e.jsxs("div",{className:"mt-20 flex flex-col sm:flex-row items-center justify-center gap-6 text-white/90",children:[e.jsxs("div",{className:"flex items-center gap-3 bg-white/10 border border-white/20 px-6 py-3 text-shadow-sm shadow-xl rounded-xl hover:bg-white/15 transition-all duration-300",children:[e.jsx(lt,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-lg font-medium tracking-wide",children:"+66 (0)81 978 9085"})]}),e.jsxs("div",{className:"flex items-center gap-3 bg-white/10 border border-white/20 px-6 py-3 text-shadow-sm shadow-xl rounded-xl hover:bg-white/15 transition-all duration-300",children:[e.jsx(dt,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-lg font-medium tracking-wide",children:"8/10 Guest Rating"})]})]})]})})]})),z=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:de("rounded-lg border bg-card text-card-foreground shadow-sm",t),...s}));
426z.displayName="Card";const X=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:de("flex flex-col space-y-1.5 p-6",t),...s}));X.displayName="CardHeader";const Z=l.forwardRef(({className:t,...s},a)=>e.jsx("h3",{ref:a,className:de("text-2xl font-semibold leading-none tracking-tight",t),...s}));Z.displayName="CardTitle";const ke=l.forwardRef(({className:t,...s},a)=>e.jsx("p",{ref:a,className:de("text-sm text-muted-foreground",t),...s}));ke.displayName="CardDescription";const K=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:de("p-6 pt-0",t),...s}));K.displayName="CardContent";const Yh=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:de("flex items-center p-6 pt-0",t),...s}));Yh.displayName="CardFooter";const Jh=cr("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Te({className:t,variant:s,...a}){return e.jsx("div",{className:de(Jh({variant:s}),t),...a})}function kt(t){if(t==null)return[];if(Array.isArray(t)){const s=[];for(const a of t){const r=kt(a);s.push(...r)}return s}if(typeof t=="string"){let s=t,a=0;const r=10;for(;a<r&&typeof s=="string";){const n=s.trim();if(n.startsWith("[")&&n.endsWith("]")||n.startsWith('"[')&&n.endsWith(']"'))try{s=JSON.parse(s),a++}catch{return[t]}else break}if(Array.isArray(s))return kt(s);if(typeof s=="string")return[s]}return[String(t)]}function dr(t){var i;const s=t.image_storage_path||t.image||"",a=kt(t.gallery_storage_paths||t.gallery),r=ri(s),n=wm(a);return{id:t.id,name:t.name,shortDescription:t.short_description||"",longDescription:t.long_description||"",price:t.price||`฿${((i=t.price_per_night)==null?void 0:i.toLocaleString())||0}/night`,pricePerNight:t.price_per_night||0,image:r,imageStoragePath:t.image_storage_path||t.image||"",gallery:n,galleryStoragePaths:kt(t.gallery_storage_paths||t.gallery),amenities:kt(t.amenities),capacity:t.capacity||`${t.max_guests} guests`,maxGuests:t.max_guests,bedrooms:t.bedrooms,bathrooms:t.bathrooms,size:t.size||"",rating:t.rating||0,location:t.location||"",view:t.view||"",bedConfiguration:kt(t.bed_configuration),features:kt(t.features),policies:kt(t.policies),checkIn:t.check_in||"3:00 PM",checkOut:t.check_out||"11:00 AM",cancellationPolicy:t.cancellation_policy||"",includedServices:kt(t.included_services),additionalServices:kt(t.additional_services),nearbyAttractions:kt(t.nearby_attractions),specialOffers:kt(t.special_offers),isActive:t.is_active,depositType:t.deposit_type||"none",depositPercentage:t.deposit_percentage,depositFixedAmount:t.deposit_fixed_amount}}
426function Xh(t){return{name:t.name,short_description:t.shortDescription,long_description:t.longDescription,price:t.price,price_per_night:t.pricePerNight,image:t.image,image_storage_path:t.imageStoragePath||t.image_storage_path,gallery:t.gallery,gallery_storage_paths:t.galleryStoragePaths||t.gallery_storage_paths,amenities:t.amenities,capacity:t.capacity,max_guests:t.maxGuests,bedrooms:t.bedrooms,bathrooms:t.bathrooms,size:t.size,rating:t.rating,location:t.location,view:t.view,bed_configuration:t.bedConfiguration,features:t.features,policies:t.policies,check_in:t.checkIn,check_out:t.checkOut,cancellation_policy:t.cancellationPolicy,included_services:t.includedServices,additional_services:t.additionalServices,nearby_attractions:t.nearbyAttractions,special_offers:t.specialOffers,is_active:t.isActive!==void 0?t.isActive:!0,deposit_type:t.depositType||"none",deposit_percentage:t.depositPercentage,deposit_fixed_amount:t.depositFixedAmount}}async function Kn(t=!1){try{let s=U.from("rooms").select("*").order("created_at",{ascending:!1});t||(s=s.eq("is_active",!0));const{data:a,error:r}=await s;return r?(console.error("Error fetching rooms:",r),{data:null,error:r.message}):{data:(a||[]).map(dr),error:null}}catch(s){return console.error("Exception fetching rooms:",s),{data:null,error:s.message||"An unexpected error occurred"}}}async function _i(t){try{const{data:s,error:a}=await U.from("rooms").select("*").eq("id",t).single();return a?(console.error("Error fetching room:",a),{data:null,error:a.message}):s?{data:dr(s),error:null}:{data:null,error:"Room not found"}}catch(s){return console.error("Exception fetching room:",s),{data:null,error:s.message||"An unexpected error occurred"}}}async function Zh(t){try{const{data:s,error:a}=await U.from("rooms").insert([t]).select().single();return a?(console.error("Error creating room:",a),{data:null,error:a.message}):{data:dr(s),error:null}}catch(s){return console.error("Exception creating room:",s),{data:null,error:s.message||"An unexpected error occurred"}}}async function Pi(t,s){try{const{data:a,error:r}=await U.from("rooms").update(s).eq("id",t).select().single();return r?(console.error("Error updating room:",r),{data:null,error:r.message}):{data:dr(a),error:null}}catch(a){return console.error("Exception updating room:",a),{data:null,error:a.message||"An unexpected error occurred"}}}async function eu(t){try{const{error:s}=await U.from("rooms").delete().eq("id",t);return s?(console.error("Error deleting room:",s),{success:!1,error:s.message}):{success:!0,error:null}}catch(s){return console.error("Exception deleting room:",s),{success:!1,error:s.message||"An unexpected error occurred"}}}async function tu(t,s){return Pi(t,{is_active:s})}function mr(t=!1){const[s,a]=l.useState([]),[r,n]=l.useState(!0),[i,o]=l.useState(null);return l.useEffect(()=>{(async()=>{n(!0),o(null);const{data:d,error:h}=await Kn(t);h?(o(h),a([])):a(d||[]),n(!1)})()},[t]),{rooms:s,loading:r,error:i,refetch:()=>{(async()=>{n(!0),o(null);const{data:d,error:h}=await Kn(t);h?(o(h),a([])):a(d||[]),n(!1)})()}}}function su(t){const[s,a]=l.useState(null),[r,n]=l.useState(!0),[i,o]=l.useState(null);return l.useEffect(()=>{if(!t){a(null),n(!1),o(null);return}(async()=>{n(!0),o(null);const{data:d,error:h}=await _i(t);h?(o(h),a(null)):a(d),n(!1)})()},[t]),{room:s,loading:r,error:i}}const Vt=({src:t,alt:s,className:a="",placeholder:r="/placeholder.svg",onLoad:n,onError:i})=>{const[o,c]=l.useState(!1),[d,h]=l.useState(!1),[u,p]=l.useState(!1),f=l.useRef(null);l.useEffect(()=>{const x=new IntersectionObserver(([g])=>{g.isIntersecting&&(h(!0),x.disconnect())},{threshold:.1,rootMargin:"50px"});return f.current&&x.observe(f.current),()=>x.disconnect()},[]);const m=()=>{c(!0),n==null||n()},v=()=>{p(!0),i==null||i()};return e.jsxs("div",{ref:f,className:`relative overflow-hidden ${a}`,children:[!o&&!u&&e.jsx("div",{className:"absolute inset-0 bg-gray-200 animate-pulse flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-2 border-gray-300 border-t-blue-500 rounded-full animate-spin"})}),d&&e.jsx("img",{src:u?r:t,alt:s,className:`w-full h-full object-cover transition-opacity duration-300 ${o?"opacity-100":"opacity-0"}`,onLoad:m,onError:v,loading:"lazy"})]})},au=()=>{const{rooms:t,loading:s,error:a}=mr();return e.jsxs("section",{id:"rooms",className:"relative py-32 overflow-hidden min-h-screen",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-800 to-purple-600",style:{backgroundImage:"url('/bg02.jpg')",backgroundSize:"cover",backgroundPosition:"center center",width:"100%",height:"100%",top:"0",left:"0"}}),e.jsx("div",{className:"absolute inset-0 bg-black/60"}),e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-black/30 via-black/20 to-black/30"}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"container mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-24",children:[e.jsxs("div",{className:"inline-flex items-center gap-3 bg-white/8 backdrop-blur-md border border-white/15 px-8 py-4 rounded-full mb-8",children:[e.jsx("div",{className:"w-2 h-2 bg-sunset-orange rounded-full animate-pulse"}),e.jsx("span",{className:"text-sm font-medium text-white/90 tracking-widest uppercase text-shadow-sm",children:"Accommodations"})]}),e.jsx("h2",{className:"text-5xl md:text-7xl lg:text-8xl font-black text-white mb-8 text-shadow-2xl font-premium-heading tracking-tight leading-tight",children:"Beachfront Rooms"}),e.jsx("p",{className:"text-xl md:text-2xl text-white/90 max-w-4xl mx-auto text-shadow-lg font-premium-body leading-relaxed mb-12",children:"All of our rooms are designed to offer views of the beach, ensuring you wake up to the sound of the waves and the beauty of the sea."}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-12 mb-16",children:[e.jsxs("div",{className:"text-center bg-white/10 backdrop-blur-sm rounded-2xl p-6 border border-white/20",children:[e.jsx("div",{className:"text-5xl font-bold mb-2 text-sunset-orange",children:"19"}),e.jsx("div",{className:"text-white/90 font-medium",children:"Total Rooms"})]}),e.jsxs("div",{className:"text-center bg-white/10 backdrop-blur-sm rounded-2xl p-6 border border-white/20",children:[e.jsx("div",{className:"text-5xl font-bold mb-2 text-sunset-orange",children:"8"}),e.jsx("div",{className:"text-white/90 font-medium",children:"Guest Rating"})]}),e.jsxs("div",{className:"text-center bg-white/10 backdrop-blur-sm rounded-2xl p-6 border border-white/20",children:[e.jsx("div",{className:"text-5xl font-bold mb-2 text-sunset-orange",children:"100%"}),e.jsx("div",{className:"text-white/90 font-medium",children:"Ocean Vie
426w"})]})]})]}),s?e.jsxs("div",{className:"text-center py-32",children:[e.jsx("div",{className:"animate-spin rounded-full h-16 w-16 border-b-2 border-white mx-auto mb-4"}),e.jsx("p",{className:"text-white/90",children:"Loading rooms..."})]}):a?e.jsxs("div",{className:"text-center py-32",children:[e.jsxs("p",{className:"text-white/90 mb-4",children:["Error loading rooms: ",a]}),e.jsx("p",{className:"text-white/70",children:"Please try refreshing the page."})]}):t.length===0?e.jsx("div",{className:"text-center py-32",children:e.jsx("p",{className:"text-white/90",children:"No rooms available at the moment."})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-12 mb-32",children:t.map(r=>e.jsxs(z,{className:"group bg-white/10 backdrop-blur-md border border-white/20 shadow-2xl hover:shadow-3xl transition-all duration-700 hover:scale-105 rounded-3xl overflow-hidden",children:[e.jsxs("div",{className:"relative h-80 overflow-hidden",children:[e.jsx(Vt,{src:r.image,alt:r.name,className:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent"}),e.jsx(Te,{className:"absolute top-6 right-6 bg-white/20 backdrop-blur-md text-white border border-white/25 px-4 py-2 text-lg font-bold shadow-xl rounded-2xl",children:r.price}),e.jsxs(Te,{className:"absolute top-6 left-6 bg-white/20 backdrop-blur-md text-white border border-white/25 px-3 py-2 text-xs font-medium shadow-xl rounded-2xl",children:[e.jsx(Je,{className:"h-3 w-3 mr-1"}),r.location]}),e.jsxs("div",{className:"absolute bottom-6 left-6 flex items-center gap-2 bg-white/20 backdrop-blur-md px-3 py-2 border border-white/25 shadow-xl rounded-2xl",children:[e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"}),e.jsx("span",{className:"text-sm font-bold text-white",children:r.rating})]})]}),e.jsxs(X,{className:"pb-4 px-8 pt-8",children:[e.jsx(Z,{className:"text-2xl text-white group-hover:text-sunset-orange transition-colors duration-500 font-premium-heading",children:r.name}),e.jsx(ke,{className:"text-white/90 leading-relaxed font-premium-body",children:r.shortDescription})]}),e.jsxs(K,{className:"pt-0 px-8 pb-8",children:[e.jsxs("div",{className:"flex items-center gap-8 mb-8 text-sm text-white/80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"font-medium tracking-wide",children:r.capacity})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wa,{className:"h-4 w-4 text-sunset-orange"}),e.jsxs("span",{className:"font-medium tracking-wide",children:[r.bedrooms," bedroom",r.bedrooms>1?"s":""]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-8",children:[r.amenities.slice(0,4).map(n=>e.jsx(Te,{variant:"secondary",className:"text-xs bg-white/15 backdrop-blur-md text-white/90 border border-white/20 hover:bg-white/25 transition-colors duration-300 rounded-2xl px-3 py-1",children:n},n)),r.amenities.length>4&&e.jsxs(Te,{variant:"secondary",className:"text-xs bg-white/15 backdrop-blur-md text-white/90 border border-white/20 rounded-2xl px-3 py-1",children:["+",r.amenities.length-4," more"]})]}),e.jsx(ct,{to:`/rooms/${r.id}`,children:e.jsxs(P,{className:"w-full bg-gradient-to-r from-sunset-orange to-orange-500 text-white font-bold hover:from-orange-500 hover:to-sunset-orange transition-all duration-500 h-12 text-lg hover:scale-105 shadow-xl rounded-2xl font-premium-accent",children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),"View Details & Book"]})})]})]},r.id))})]})})]})},ru=({isOpen:t,onClose:s})=>{if(!t)return null;const a=()=>{const n=document.createElement("a");n.href="/menu.pdf",n.download="The-Cashew-Tree-Restobar-Menu.pdf",document.body.appendChild(n),n.click(),document.body.removeChild(n)},r=()=>{window.open("/menu.pdf","_blank")};return e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[e.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm",onClick:s}),e.jsxs("div",{className:"relative w-full h-full max-w-7xl mx-4 my-8 bg-white rounded-2xl shadow-2xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6 bg-gradient-to-r from-sunset-orange to-orange-500 text-white",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold font-premium-heading",children:"The Cashew Tree Restobar"}
426),e.jsx("p",{className:"text-orange-100",children:"Our Complete Menu"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(P,{onClick:a,variant:"outline",size:"sm",className:"bg-white/20 border-white/30 text-white hover:bg-white/30 hover:text-white",children:[e.jsx(_h,{className:"h-4 w-4 mr-2"}),"Download"]}),e.jsxs(P,{onClick:r,variant:"outline",size:"sm",className:"bg-white/20 border-white/30 text-white hover:bg-white/30 hover:text-white",children:[e.jsx(mn,{className:"h-4 w-4 mr-2"}),"Open in New Tab"]}),e.jsx(P,{onClick:s,variant:"outline",size:"sm",className:"bg-white/20 border-white/30 text-white hover:bg-white/30 hover:text-white",children:e.jsx(et,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"h-full p-6",children:e.jsx("iframe",{src:"/menu.pdf#toolbar=1&navpanes=1&scrollbar=1&page=1&view=FitH",className:"w-full h-full border-0 rounded-lg shadow-lg",title:"The Cashew Tree Restobar Menu"})})]})]})},Qn="room-images",Br="resort-images";async function Ei(t,s,a,r="gallery"){try{if(!["image/jpeg","image/jpg","image/png","image/webp"].includes(t.type))return{path:"",url:"",error:"Invalid file type. Please upload a JPEG, PNG, or WebP image."};const i=50*1024*1024;if(t.size>i)return{path:"",url:"",error:"File size exceeds 50MB limit. Please compress the image."};const o=Date.now(),c=Math.random().toString(36).substring(7),d=t.name.split(".").pop()||"jpg",h=a||`${o}-${c}.${d}`,u=`${s}/${r}/${h}`,{data:p,error:f}=await U.storage.from(Qn).upload(u,t,{cacheControl:"3600",upsert:!1});if(f)return console.error("Upload error:",f),{path:"",url:"",error:f.message||"Failed to upload image"};const{data:m}=U.storage.from(Qn).getPublicUrl(u);return{path:u,url:m.publicUrl}}catch(n){return console.error("Upload exception:",n),{path:"",url:"",error:n.message||"An unexpected error occurred"}}}async function Ai(t,s,a="gallery",r){try{if(!["image/jpeg","image/jpg","image/png","image/webp"].includes(t.type))return{path:"",url:"",error:"Invalid file type. Please upload a JPEG, PNG, or WebP image."};const i=50*1024*1024;if(t.size>i)return{path:"",url:"",error:"File size exceeds 50MB limit. Please compress the image."};const o=Date.now(),c=Math.random().toString(36).substring(7),d=t.name.split(".").pop()||"jpg",h=r||`${o}-${c}.${d}`,u=`${s}/${a}/${h}`,{data:p,error:f}=await U.storage.from(Br).upload(u,t,{cacheControl:"3600",upsert:!1});if(f)return console.error("Upload error:",f),{path:"",url:"",error:f.message||"Failed to upload image"};const{data:m}=U.storage.from(Br).getPublicUrl(u);return{path:u,url:m.publicUrl}}catch(n){return console.error("Upload exception:",n),{path:"",url:"",error:n.message||"An unexpected error occurred"}}}async function nu(t){try{const{error:s}=await U.storage.from(Br).remove([t]);return s?(console.error("Delete error:",s),{success:!1,error:s.message||"Failed to delete image"}):{success:!0}}catch(s){return console.error("Delete exception:",s),{success:!1,error:s.message||"An unexpected error occurred"}}}function un(){return Ti("waterpark")}function Ri(){return Ti("restaurant")}function Ti(t){const[s,a]=l.useState([]),[r,n]=l.useState(!0),[i,o]=l.useState(null),c=t==="waterpark"?"waterpark_images":"restaurant_images",d=l.useCallback(async x=>{try{n(!0),o(null);let g=U.from(c).select("*");(t==="restaurant"||t==="waterpark")&&(x?g=g.eq("image_type",x):g=g.eq("image_type","gallery"));const{data:j,error:b}=await g.order("display_order",{ascending:!0});if(b)throw b;a(j||[])}catch(g){console.error(`Error fetching ${t} images:`,g),o(g.message||`Failed to fetch ${t} images`),a([])}finally{n(!1)}},[c,t]),h=l.useCallback(async(x,g)=>{try{o(null);let j=x.display_order;j===void 0&&(j=s.length>0?Math.max(...s.map(y=>y.display_order))+1:0);const b={...x,display_order:j};t==="restaurant"&&g&&(b.image_type=g);const{data:N,error:I}=await U.from(c).insert([b]).select().single();if(I)throw I;return await d(g),N}catch(j){return console.error(`Error adding ${t} image:`,j),o(j.message||`Failed to add ${t} image`),null}},[c,t,s,d]),u=l.useCallback(async(x,g)=>{try{o(null);const{error:j}=await U.from(c).update(g).eq("id",x);if(j)throw j;return await d(),!0}catch(j){return console.error(`Error updating ${t} image:`,j),o(j.message||`Failed to update ${t} image`),!1}},[c,t,d]),p=l.useCallback(async x=>{try{o(null);const g=s.find(N=>N.id===x);if(!g)throw new Error("Image not found");const j=await nu(g.storage_path);j.success||console.warn("Failed to delete from storage:",j.error);const{error:b}=await U.from(c).delete().eq("id",x);if(b)throw b;return await d(),!0}catch(g){return console.error(`Error deleting ${t} image:`,g),o(g.message||`Failed to delete ${t} image`),!1}},[c,t,s,d]),f=l.useCallback(async x=>{try{o(null);const g=x.map((N,I)=>U.from(c).update({display_order:I}).eq("id",N));if((await Promise.all(g)).some(N=>N.error))throw new Error("Failed to reorder some images");return await d(),!0}catch(g){return console.error(`Error reordering ${t} images:`,g),o(g.message||`Failed to reorder ${t} images`),!1}},[c,t,d]),m=l.useCallback(async(x,g="gallery",j)=>{try{o(null);const b=await Ai(x,t,g);if(b.error||!b.url||!b.path)throw new Error(b.error||"Failed to upload image");const N={image_url:b.url,storage_path:b.path,alt_text:j||x.name};return await h(N,t==="restaurant"||t==="waterpark"?g:void 0)}catch(b){return console.error(`Error uploading ${t} image:`,b),o(b.message||`Failed to upload ${t} image`),null}},[t,h]);l.useEffect(()=>{d()},[d]);const v=l.useCallback(async()=>
426{if(t!=="restaurant"&&t!=="waterpark")return null;try{const{data:x,error:g}=await U.from(c).select("*").eq("image_type","hero").order("display_order",{ascending:!0}).limit(1).maybeSingle();return g?(console.error("Error fetching hero image:",g),null):x}catch(x){return console.error("Error fetching hero image:",x),null}},[c,t]);return{images:s,loading:r,error:i,fetchImages:d,addImage:h,updateImage:u,deleteImage:p,reorderImages:f,uploadAndAddImage:m,getHeroImage:t==="restaurant"||t==="waterpark"?v:void 0}}const Ii=()=>{const t=vt(),[s,a]=l.useState(!1),{images:r,loading:n,getHeroImage:i}=Ri(),[o,c]=l.useState(null),[d,h]=l.useState(!0),u=[{src:"/restaurant01.jpg",alt:"Restaurant 1"},{src:"/restaurant02.jpg",alt:"Restaurant 2"},{src:"/restaurant03.jpg",alt:"Restaurant 3"}],p=r.length>0?r.map((x,g)=>({src:x.image_url,alt:x.alt_text||`Restaurant Image ${g+1}`})):u;l.useEffect(()=>{!n&&!d&&(console.log("ð½ï¸ RestaurantSection - Database gallery images:",r.length),console.log("ð½ï¸ RestaurantSection - Using database:",r.length>0?"YES":"NO (fallback)"),console.log("ð½ï¸ RestaurantSection - Hero image from DB:",o?"YES":"NO (fallback)"),r.length>0&&console.log("ð½ï¸ RestaurantSection - Image URLs:",r.map(x=>x.image_url)))},[n,d,r,o]);const f=()=>{t("/contact")},m=()=>{window.open("tel:+66819789085")},v=()=>{a(!0)};return l.useEffect(()=>{(async()=>{if(i){h(!0);const g=await i();c(g?g.image_url:"/menu2.jpg"),h(!1)}else c("/menu2.jpg"),h(!1)})()},[i]),e.jsxs("section",{id:"restaurant",className:"relative py-32 overflow-hidden min-h-screen",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-800 to-amber-600",style:{backgroundImage:o?`url('${o}
426')`:"url('/menu2.jpg')",backgroundSize:"cover",backgroundPosition:"center center",backgroundAttachment:"fixed",filter:"blur(3px)",width:"100%",height:"100%",top:"0",left:"0"}}),e.jsx("div",{className:"absolute inset-0 bg-black/60"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-black/50 via-black/30 to-black/50"}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"container mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-24",children:[e.jsxs("div",{className:"inline-flex items-center gap-3 bg-white/8 backdrop-blur-md border border-white/15 px-8 py-4 rounded-full mb-8",children:[e.jsx("div",{className:"w-2 h-2 bg-sunset-orange rounded-full animate-pulse"}),e.jsx("span",{className:"text-sm font-medium text-white/90 tracking-widest uppercase text-shadow-sm",children:"Culinary Experience"})]}),e.jsxs("h2",{className:"text-5xl md:text-7xl lg:text-8xl font-black text-white mb-8 text-shadow-2xl font-premium-heading tracking-tight leading-tight",children:["The Cashew Tree",e.jsx("span",{className:"block text-3xl md:text-4xl lg:text-5xl font-light text-white/80 mt-4 tracking-widest",children:"RESTOBAR"})]}),e.jsx("p",{className:"text-xl md:text-2xl text-white/90 max-w-4xl mx-auto text-shadow-lg font-premium-body leading-relaxed",children:"Savor exquisite cuisine while enjoying breathtaking ocean views at our beachfront restaurant, where every meal becomes a memorable experience."}),e.jsxs(P,{size:"lg",className:"bg-gradient-to-r mt-20 from-orange-500 to-orange-600 text-white font-semibold hover:from-orange-600 hover:to-orange-700 transition-all duration-300 hover:scale-105 shadow-lg hover:shadow-xl px-8 py-3",onClick:v,children:[e.jsx(On,{className:"h-5 w-5 mr-2"}),"View Our Menu"]})]}),e.jsxs("div",{className:"mt-20 mb-20",children:[e.jsx("div",{className:"text-center mb-12",children:e.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"See what makes our water park the ultimate destination for family fun and adventure"})}),n?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[1,2,3].map(x=>e.jsx("div",{className:"relative overflow-hidden rounded-2xl shadow-2xl bg-gray-200 animate-pulse h-80"},x))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:p.slice(0,3).map((x,g)=>e.jsx("div",{className:"group",children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl shadow-2xl",children:[e.jsx(Vt,{src:x.src,alt:x.alt,className:"w-full h-80 object-cover transition-transform duration-700 group-hover:scale-110"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),e.jsx("div",{className:"absolute bottom-4 left-4 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-300"})]})},g))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-16 mb-32",children:[e.jsxs("div",{className:"text-center group",children:[e.jsx("div",{className:"bg-white/15 backdrop-blur-md border border-white/25 w-28 h-28 rounded-full flex items-center justify-center mx-auto mb-8 group-hover:scale-110 transition-transform duration-500 shadow-xl",children:e.jsx(Jt,{className:"h-14 w-14 text-sunset-orange"})}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-6 font-premium-heading",children:"Ocean Views"}),e.jsx("p",{className:"text-white/90 leading-relaxed text-lg",children:"Every table offers stunning panoramic ocean vistas, creating the perfect backdrop for your dining experience."})]}),e.jsxs("div",{className:"text-center group",children:[e.jsx("div",{className:"bg-white/15 backdrop-blur-md border border-white/25 w-28 h-28 rounded-full flex items-center justify-center mx-auto mb-8 group-hover:scale-110 transition-transform duration-500 shadow-xl",children:e.jsx(Hn,{className:"h-14 w-14 text-sunset-orange"})}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-6 font-premium-heading",children:"Fresh Ingredients"}),e.jsx("p",{className:"text-white/90 leading-relaxed text-lg",children:"Locally sourced, fresh ingredients in every dish, ensuring authentic flavors and sustainable dining."})]}),e.jsxs("div",{className:"text-center group",children:[e.jsx("div",{className:"bg-white/15 backdrop-blur-md border border-white/25 w-28 h-28 rounded-full flex items-center justify-center mx-auto mb-8 group-hover:scale-110 transition-transform duration-500 shadow-xl",children:e.jsx(dt,{className:"h-14 w-14 text-sunset-orange"})}),e.jsx("h3",{className:"text-2xl font-bold text-white mb-6 font-premium-heading",children:"Fine Dining"}),e.jsx("p",{className:"text-white/90 leading-relaxed text-lg",children:"Elegant atmosphere with world-class service, creating unforgettable moments for every guest."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-20 items-center mb-32",children:[e.jsxs("div",{className:"text-white",children:[e.jsx("h3",{className:"text-3xl md:text-4xl font-black text-white mb-10 font-premium-heading",children:"International Cuisine Excellence"}),e.jsxs("div",{className:"space-y-10",children:[e.jsxs("div",{className:"flex items-start space-x-8",children:[e.jsx("div",{className:"bg-white/15 backdrop-blur-md p-5 border border-white/25 rounded-2xl shadow-xl",children:e.jsx(Hn,{className:"h-10 w-10 text-sunset-orange"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xl font-bold text-white mb-4 font-premium-heading",children:"Authentic Thai Flavors"}),e.jsx("p",{className:"text-white/90 leading-relaxed text-lg",children:"From traditional Pad Thai to spicy Tom Yum, experience the authentic taste of Thailand"})]})]}),e.jsxs("div",{className:"flex items-start space-x-8",children:[e.jsx("div",{className:"bg-white/15 backdrop-blur-md p-5 border border-white/25 rounded-2xl shadow-xl",children:e.jsx(Je,{className:"h-10 w-10 text-sunset-orange"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xl font-bold text-white mb-4 font-premium-heading",children:"Beachfront Ambiance"}),e.jsx("p",{className:"text-white/90 leading-relaxed text-lg",children:"Every meal is enhanced by the sound of waves gently caressing the shore"})]})]}),e.jsxs("div",{className:"flex items-start space-x-8",children:[e.jsx("div",{className:"bg-white/15 backdrop-blur-md p-5 border border-white/25 rounded-2xl shadow-xl",children:e.jsx(Ie,{className:"h-10 w-10 text-sunset-orange"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-xl font-bold text-white mb-4 font-premium-heading",children:"All Day Dining"}),e.jsx("p",{className:"text-white/90 leading-relaxed text-lg",children:"Enjoy breakfast, lunch, and dinner with our extensive international menu"})]})]})]})]}),e.jsx("div",{className:"relative",children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl shadow-2xl",children:[d?e.jsx("div",{className:"w-full h-96 lg:h-[500px] bg-gray-200 animate-pulse"}):e.jsx(Vt,{src:o||"/menu2.jpg",alt:"The Cashew Tree Restobar - Beachfront Dining Experience",className:"w-full h-96 lg:h-[500px] object-cover transition-transform duration-700 hover:scale-105"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/30 via-trans
426parent to-transparent"}),e.jsxs("div",{className:"absolute bottom-6 left-6 right-6",children:[e.jsx("h4",{className:"text-2xl font-bold text-white mb-2 font-premium-heading",children:"Beachfront Dining"}),e.jsx("p",{className:"text-white/90 text-lg",children:"Experience the perfect blend of authentic cuisine and stunning ocean views"})]})]})})]}),e.jsx("div",{className:"text-center mt-20",children:e.jsx(z,{className:"bg-white/8 backdrop-blur-sm border border-white/15 p-12 shadow-2xl max-w-4xl mx-auto rounded-3xl",children:e.jsxs(K,{children:[e.jsx("h3",{className:"text-4xl md:text-5xl font-black text-white mb-6 text-shadow-2xl font-premium-heading",children:"Experience Culinary Excellence"}),e.jsx("p",{className:"text-xl text-white/80 mb-8 text-shadow-lg font-premium-body leading-relaxed max-w-3xl mx-auto",children:"Join us for an unforgettable dining experience where every dish tells a story and every meal becomes a cherished memory."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-6 justify-center",children:[e.jsxs(P,{size:"lg",className:"bg-gradient-to-r from-sunset-orange to-orange-500 text-white font-bold hover:from-orange-500 hover:to-sunset-orange transition-all duration-500 h-14 text-lg hover:scale-105 shadow-2xl rounded-2xl px-8 font-premium-accent",onClick:v,children:[e.jsx(On,{className:"h-5 w-5 mr-2"}),"View Menu"]}),e.jsxs(P,{size:"lg",className:"bg-gradient-to-r from-sunset-orange to-orange-500 text-white font-bold hover:from-orange-500 hover:to-sunset-orange transition-all duration-500 h-14 text-lg hover:scale-105 shadow-2xl rounded-2xl px-8 font-premium-accent",onClick:f,children:[e.jsx(Re,{className:"h-5 w-5 mr-2"}),"Make a Reservation"]}),e.jsxs(P,{size:"lg",variant:"outline",className:"border-2 border-white/20 text-white hover:bg-white/10 hover:text-white backdrop-blur-sm transition-all duration-500 h-14 text-lg rounded-2xl px-8 font-premium-accent",onClick:m,children:[e.jsx(lt,{className:"h-5 w-5 mr-2"}),"Call to Book"]})]})]})})})]})}),e.jsx(ru,{isOpen:s,onClose:()=>a(!1)})]})},Di=()=>{vt();const{images:t,loading:s}=un(),a=[{src:"/waterpark01.jpg",alt:"Waterpark Adventure 1",label:"Inflatable Fun"},{src:"/waterpark02.jpg",alt:"Waterpark Adventure 2",label:"Sea Water Experience"},{src:"/waterpark03.jpg",alt:"Waterpark Adventure 3",label:"Family Adventure"}],r=t.length>0?t.map((n,i)=>({src:n.image_url,alt:n.alt_text||`Waterpark Adventure ${i+1}`,label:n.alt_text||`Waterpark Image ${i+1}`})):a;return l.useEffect(()=>
426{s||(console.log("ð WaterParkSection - Database images:",t.length),console.log("ð WaterParkSection - Using database:",t.length>0?"YES":"NO (fallback)"),t.length>0&&console.log("ð WaterParkSection - Image URLs:",t.map(n=>n.image_url)))},[s,t]),e.jsxs("section",{className:"relative py-24 overflow-hidden",style:{backgroundSize:"cover",backgroundPosition:"center top",backgroundAttachment:"fixed"},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-800 to-blue-600",style:{backgroundImage:"url('/bg01.jpg')",backgroundSize:"cover",backgroundPosition:"center center",backgroundAttachment:"fixed",filter:"blur(3px)",width:"100%",height:"100%",top:"0",left:"0"}}),e.jsx("div",{className:"absolute inset-0 bg-black/60"}),e.jsx("div",{className:"absolute inset-0 bg-black/40"}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-20",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/20 backdrop-blur-md border border-white/30 px-6 py-3 mb-8 rounded-full",children:[e.jsx(Jt,{className:"h-5 w-5 text-ocean-teal"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Water Adventure"})]}),e.jsx("h2",{className:"text-5xl md:text-7xl font-bold text-white mb-8 font-premium-heading",children:"Ninja Water Park"}),e.jsx("p",{className:"text-xl md:text-2xl text-white/90 max-w-4xl mx-auto leading-relaxed",children:"Dive into a world of excitement and adventure at Ninja Water Park, the only inflatable sea water park on the stunning island of Koh Samui!"})]}),e.jsxs("div",{className:"mt-20 mb-20",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h3",{className:"text-3xl md:text-4xl font-bold text-red-400 mb-4 font-premium-heading",children:"The only ocean inflatable water park on Koh Samui"}),e.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"See what makes our water park the ultimate destination for family fun and adventure"})]}),s?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[1,2,3].map(n=>e.jsx("div",{className:"relative overflow-hidden rounded-2xl shadow-2xl bg-gray-200 animate-pulse h-80"},n))}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:r.slice(0,3).map((n,i)=>e.jsx("div",{className:"group",children:e.jsxs("div",{className:"relative overflow-hidden rounded-2xl shadow-2xl",children:[e.jsx(Vt,{src:n.src,alt:n.alt,className:"w-full h-80 object-cover transition-transform duration-700 group-hover:scale-110"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),e.jsx("div",{className:"absolute bottom-4 left-4 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsx("p",{className:"text-sm font-medium",children:n.label})})]})},i))})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-20 items-start",children:[e.jsx("div",{className:"relative",children:e.jsx("div",{className:"bg-white/20 backdrop-blur-md border border-white/30 p-10 shadow-2xl rounded-2xl",children:e.jsxs("div",{className:"text-center text-white",children:[e.jsx(Jt,{className:"h-20 w-20 mx-auto mb-6 text-ocean-teal"}),e.jsx("h3",{className:"text-3xl font-bold mb-8 font-premium-heading",children:"Water Park Features"}),e.jsxs("div",{className:"space-y-6 text-left",children:[e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(ki,{className:"h-6 w-6 text-sunset-orange"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Inflatable Obstacle Courses"})]}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(Jt,{className:"h-6 w-6 text-ocean-teal"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Sea Water Experience"})]}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(dt,{className:"h-6 w-6 text-yellow-400"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Family Entertainment"})]})]})]})})}),e.jsxs("div",{className:"space-y-8",children:[e.jsx(z,{className:"bg-white/20 backdrop-blur-md border border-white/30 shadow-2xl rounded-2xl",children:e.jsx(X,{className:"pb-6",children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-4 border border-primary/30 rounded-xl",children:e.jsx(Jt,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{className:"text-white text-xl font-premium-heading",children:"Unique Sea Experience"}),e.jsx(ke,{className:"text-white/90 text-lg",children:"The only inflatable water park directly in the sea on Koh Samui"})]})]})})}),e.jsx(z,{className:"bg-white/20 backdrop-blur-md border border-white/30 shadow-2xl rounded-2xl",children:e.jsx(X,{className:"pb-6",children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-4 border border-primary/30 rounded-xl",children:e.jsx(Rs,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{className:"text-white text-xl font-premium-heading",children:"Safe & Supervised"}),e.jsx(ke,{className:"text-white/90 text-lg",children:"Professional lifeguards and safety equipment for worry-free fun"})]})]})})}),e.jsx(z,{className:"bg-white/20 backdrop-blur-md border border-white/30 shadow-2xl rounded-2xl",children:e.jsx(X,{className:"pb-6",children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-4 border border-primary/30 rounded-xl",children:e.jsx(Xe,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx(Z,{className:"text-white text-xl font-premium-heading",children:"Family Friendly"}),e.jsx(ke,{className:"text-white/90 text-lg",children:"Perfect for children and adults alike - endless entertainment for the whole family"})]})]})})})]})]})]})})]})},lu=()=>{const t=vt(),s=()=>{t("/top-10-tours")};return e.jsxs("section",{id:"beach",className:"relative py-32 overflow-hidden min-h-screen",style:{backgroundSize:"cover",backgroundPosition:"center top"},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-800 to-orange-600",style:{backgroundImage:"url('/pexels-anna-zviahina-431214732-15249164.jpg')",backgroundSize:"cover",backgroundPosition:"center center",width:"100%",height:"100%",top:"0",left:"0"}}),e.jsx("div",{className:"absolute inset-0 bg-black/60"}),e.jsx("div",{className:"absolute inset-0 bg-black/40"}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"container mx-auto px-6",children:[e.jsxs("div",{className:"text-center mb-20",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/20 backdrop-blur-md border border-white/30 px-6 py-3 mb-8 rounded-full",children:[e.jsx(zn,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Tropical Paradise"})]}),e.jsx("h2",{className:"text-5xl md:text-7xl font-bold text-white mb-8 font-premium-heading",children:"Bophut Beach Paradise"}),e.jsx("p",{className:"text-xl md:text-2xl text-white/90 max-w-4xl mx-auto leading-relaxed",children:"Bophut Beach is renowned for its breathtaking sunsets, and there's no better place to witness this natural wonder than from our resort."})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-16 items-start",children:[e.jsxs("div",{className:"text-white space-y-8",children:[e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"flex items-start space-x-6",children:[e.jsx("div",{className:"bg-sunset-orange/20 backdrop-blur-md p-4 border border-sunset-orange/30 rounded-xl",children:e.jsx(zn,{className:"h-8 w-8 text-sunset-orange"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-white mb-3",children:"Spectacular Sunsets"}),e.jsx("p",{className:"text-white/90 leading-relaxed",children:"Watch vibrant hues paint the sky as the sun dips below the horizon"})]})]}),e.jsxs("div",{className:"flex items-start space-x-6",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-4 border border-primary/30 rounded-xl",children:e.jsx(Ka,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-white mb-3",children:"Picture Perfect"}),e.jsx("p",{className:"text-white/90 leading-relaxed",children:"Create lasting memories with stunning beachfront p
426hoto opportunities"})]})]}),e.jsxs("div",{className:"flex items-start space-x-6",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-4 border border-primary/30 rounded-xl",children:e.jsx(Ln,{className:"h-8 w-8 text-primary"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-white mb-3",children:"Romantic Setting"}),e.jsx("p",{className:"text-white/90 leading-relaxed",children:"Perfect for couples seeking romance in a tropical paradise"})]})]})]}),e.jsx(z,{className:"bg-white/20 backdrop-blur-md border border-white/30 p-8 shadow-2xl rounded-2xl",children:e.jsxs(K,{className:"p-0",children:[e.jsx("div",{className:"flex items-center space-x-2 mb-4",children:[...Array(5)].map((a,r)=>e.jsx(dt,{className:"h-6 w-6 text-yellow-400 fill-current"},r))}),e.jsx("p",{className:"text-white font-medium text-lg leading-relaxed mb-3",children:'"The most beautiful beach location on Koh Samui. Every sunset is magical here."'}),e.jsx("p",{className:"text-white/80 text-sm",children:"- Happy Guest"})]})})]}),e.jsx("div",{className:"space-y-8",children:e.jsx(z,{className:"bg-white/20 backdrop-blur-md border border-white/30 p-10 shadow-2xl rounded-2xl",children:e.jsxs(K,{className:"p-0",children:[e.jsxs("div",{className:"text-center text-white mb-8",children:[e.jsx(Jt,{className:"h-20 w-20 mx-auto mb-6 text-ocean-teal"}),e.jsx("h3",{className:"text-3xl font-bold mb-6",children:"Beach Activities"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(ki,{className:"h-6 w-6 text-sunset-orange"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Beach Umbrellas & Loungers"})]}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(Jt,{className:"h-6 w-6 text-ocean-teal"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Water Sports & Swimming"})]}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(Ka,{className:"h-6 w-6 text-primary"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Sunset Photography Tours"})]}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white/10 rounded-xl",children:[e.jsx(Ln,{className:"h-6 w-6 text-sunset-orange"}),e.jsx("span",{className:"text-white/90 text-lg",children:"Romantic Beach Dinners"})]})]}),e.jsx("div",{className:"mt-8 text-center",children:e.jsx(P,{className:"bg-sunset-orange hover:bg-orange-500 text-white font-semibold transition-all duration-300 hover:scale-105 rounded-xl px-8 py-3",onClick:s,children:"Explore Beach Activities"})})]})})})]})]})})]})},W=l.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:de("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...a}));W.displayName="Input";const Is=l.forwardRef(({className:t,...s},a)=>e.jsx("textarea",{className:de("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
426ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...s}));Is.displayName="Textarea";const iu=()=>e.jsxs("section",{id:"contact",className:"relative py-24 overflow-hidden",style:{backgroundSize:"cover",backgroundPosition:"center top",backgroundAttachment:"fixed"},children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"url('/pexels-mike-to-323754-5567082.jpg')",backgroundSize:"cover",backgroundPosition:"center top",filter:"blur(8px)",width:"100%",height:"120%",top:"-10%",left:"0"}}),e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsx("div",{className:"relative z-10",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 bg-white/20 backdrop-blur-md border border-white/30 px-4 py-2 mb-6 text-shadow-sm shadow-lg rounded-md",children:[e.jsx(Dr,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-sm font-medium text-white",children:"Get In Touch"})]}),e.jsx("h2",{className:"text-4xl md:text-6xl font-bold text-white mb-6 bg-gradient-to-r from-white via-sand-beige to-white bg-clip-text text-transparent text-shadow-lg",children:"Contact Us"}),e.jsx("p",{className:"text-xl text-white/90 max-w-3xl mx-auto leading-relaxed text-shadow-md",children:"Let us be your home away from home, where every moment is designed to delight and inspire. Get in touch to plan your perfect getaway."})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(z,{className:"bg-white/20 backdrop-blur-xl border border-white/30 shadow-2xl rounded-lg",children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-3 border border-primary/30 rounded-md",children:e.jsx(lt,{className:"h-5 w-5 text-primary"})}),e.jsx(Z,{className:"text-lg text-white !text-white text-shadow-sm contact-section-title",style:{color:"white"},children:"Phone"})]})}),e.jsxs(K,{children:[e.jsx("p",{className:"text-white font-medium text-shadow-sm",children:"+66 (0)81 978 9085"}),e.jsx("p",{className:"text-sm text-white/80 mt-1 text-shadow-sm",children:"Available 24/7 for reservations"})]})]}),e.jsxs(z,{className:"bg-white/20 backdrop-blur-xl border border-white/30 shadow-2xl rounded-lg",children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-3 border border-primary/30 rounded-md",children:e.jsx(ts,{className:"h-5 w-5 text-primary"})}),e.jsx(Z,{className:"text-lg text-white !text-white text-shadow-sm contact-section-title",style:{color:"white"},children:"Email"})]})}),e.jsxs(K,{children:[e.jsx("p",{className:"text-white font-medium text-shadow-sm",children:"[email protected]"}),e.jsx("p",{className:"text-sm text-white/80 mt-1 text-shadow-sm",children:"We'll respond within 24 hours"})]})]}),e.jsxs(z,{className:"bg-white/20 backdrop-blur-xl border border-white/30 shadow-2xl rounded-lg",children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-3 border border-primary/30 rounded-md",children:e.jsx(Je,{className:"h-5 w-5 text-primary"})}),e.jsx(Z,{className:"text-lg text-white !text-white text-shadow-sm contact-section-title",style:{color:"white"},children:"Location"})]})}),e.jsxs(K,{children:[e.jsx("p",{className:"text-white font-medium text-shadow-sm",children:"30/5 Moo 4 Bophut, Samui"}),e.jsx("p",{className:"text-sm text-white/80 mt-1 text-shadow-sm",children:"Surat Thani, Thailand"})]})]}),e.jsxs(z,{className:"bg-white/20 backdrop-blur-xl border border-white/30 shadow-2xl rounded-lg",children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("div",{className:"bg-primary/20 backdrop-blur-md p-3 border border-primary/30 rounded-md",children:e.jsx(Ie,{className:"h-5 w-5 text-primary"})}),e.jsx(Z,{className:"text-lg text-white !text-white text-shadow-sm contact-section-title",style:{color:"white"},children:"Check-in / Check-out"})]})}),e.jsxs(K,{children:[e.jsx("p",{className:"text-white font-medium text-shadow-sm",children:"Check-in: 3:00 PM"}),e.jsx("p",{className:"text-white font-medium text-shadow-sm",children:"Check-out: 11:00 AM"})]})]})]}),e.jsxs(z,{className:"bg-white/20 backdrop-blur-xl border border-white/30 shadow-2xl rounded-lg",children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl text-center text-white !text-white text-shadow-sm contact-section-title",style:{color:"white"},children:"Send us a Message"})}),e.jsxs(K,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white text-shadow-sm",children:"First Name"}),e.jsx(W,{placeholder:"Your first name",className:"bg-white/20 backdrop-blur-sm border border-white/30 text-white placeholder-white/70 focus:border-sunset-orange focus:ring-2 focus:ring-sunset-orange/50 transition-all duration-300 rounded-md"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white text-shadow-sm",children:"Last Name"}),e.jsx(W,{placeholder:"Your last name",className:"bg-white/20 backdrop-blur-sm border border-white/30 text-white placeholder-white/70 focus:border-sunset-orange focus:ring-2 focus:ring-sunset-orange/50 transition-all duration-300 rounded-md"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white text-shadow-sm",children:"Email"}),e.jsx(W,{type:"email",placeholder:"[email protected]",className:"bg-white/20 backdrop-blur-sm border border-white/30 text-white placeholder-white/70 focus:border-sunset-orange focus:ring-2 focus:ring-sunset-orange/50 transition-all duration-300 rounded-md"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white text-shadow-sm",children:"Phone"}),e.jsx(W,{type:"tel",placeholder:"Your phone number",className:"bg-white/20 backdrop-blur-sm border border-white/30 text-white placeholder-white/70 focus:border-sunset-orange focus:ring-2 focus:ring-sunset-orange/50 transition-all duration-300 rounded-md"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium text-white text-shadow-sm",children:"Message"}),e.jsx(Is,{placeholder:"Tell us about your stay preferences, questions, or special requests...",className:"min-h-[120px] bg-white/20 backdrop-blur-sm border border-white/30 text-white placeholder-white/70 focus:border-sunset-orange focus:ring-2 focus:ring-sunset-orange/50 transition-all duration-300 rounded-md"})]}),e.jsxs(P,{size:"lg",className:"w-full bg-white/20 backdrop-blur-md border border-white/30 text-white font-semibold hover:bg-white/30 transition-all duration-300 hover:scale-105 rounded-md",children:[e.jsx(Lh,{className:"h-4 w-4 mr-2"}),"Send Message"]})]})]})]})]})})]}),Yn="https://ckjiwgyeseqtkpgftubq.supabase.co",Jn="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNraml3Z3llc2VxdGtwZ2Z0dWJxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTYyOTAwMzgsImV4cCI6MjA3MTg2NjAzOH0.K4zfl-vnamPUMHXPjd7UUr-tZ0YV3JQXYXEwVo8aJ30",Xn={subject:"New Contact Form Submission - Samui Pier Resort",htmlContent:t=>` 427 <h2>New Contact Form Submission</h2> 428 <p><strong>Name:</strong> ${t.firstName} ${t.lastName}</p> 429 <p><strong>Email:</strong> ${t.email}</p> 430 <p><strong>Phone:</strong> ${t.phone}</p> 431 <p><strong>Subject:</strong> ${t.subject}</p> 432 <p><strong>Message:</strong></p> 433 <p>${t.message}</p> 434 <hr> 435 <p><em>This email was sent from the Samui Pier Resort website contact form.</em></p> 436 `}
436,Zn={subject:"Thank you for contacting Samui Pier Resort",htmlContent:t=>` 437 <h2>Thank you for contacting us!</h2> 438 <p>Dear ${t.firstName},</p> 439 <p>We have received your message and will get back to you within 2 hours.</p> 440 <p><strong>Your message details:</strong></p> 441 <p><strong>Subject:</strong> ${t.subject}</p> 442 <p><strong>Message:</strong> ${t.message}</p> 443 <hr> 444 <p>If you have any urgent questions, please call us at +66 (0)81 978 9085.</p> 445 <p>Best regards,<br>The Samui Pier Resort Team</p> 446 `},el={subject:"Welcome to Samui Pier Resort Newsletter!",htmlContent:t=>` 447 <h2>Welcome to our newsletter!</h2> 448 <p>Thank you for subscribing to the Samui Pier Resort newsletter.</p> 449 <p>You'll receive updates about:</p> 450 <ul> 451 <li>Special offers and promotions</li> 452 <li>Travel tips and local insights</li> 453 <li>Resort news and events</li> 454 <li>Koh Samui attractions and activities</li> 455 </ul> 456 <p>If you wish to unsubscribe, you can do so at any time.</p> 457 <p>Best regards,<br>The Samui Pier Resort Team</p> 458 `};async function Or(t,s,a,r="[email protected]"){try{const n=`${Yn}/functions/v1/send-email`,i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Jn}`}
458,body:JSON.stringify({to:t,subject:s,htmlContent:a,replyTo:{email:"[email protected]",name:"Samui Pier Resort"}})});if(!i.ok){const c=await i.json().catch(()=>({error:"Unknown error"}));throw new Error(c.error||`Edge Function error: ${i.status}`)}const o=await i.json();return{success:o.success!==!1,data:o}}catch(n){return console.error("Email sending error:",n),{success:!1,error:n instanceof Error?n.message:String(n)}}}async function ou(t){try{const s=await Or("[email protected]",Xn.subject,Xn.htmlContent(t)),a=await Or(t.email,Zn.subject,Zn.htmlContent(t)),{error:r}=await U.from("contact_submissions").insert([{first_name:t.firstName,last_name:t.lastName,email:t.email,phone:t.phone,subject:t.subject,message:t.message,status:"new"}]);return r&&console.error("Supabase error:",r),{success:s.success&&a.success,error:s.error||a.error}}catch(s){return console.error("Contact form error:",s),{success:!1,error:s.message}}}async function Mi(t){try{const s=await Or(t,el.subject,el.htmlContent(t)),{error:a}=await U.from("newsletter_subscribers").insert([{email:t,status:"active",subscribed_at:new Date().toISOString()}]);return a&&console.error("Supabase error:",a),s}catch(s){return console.error("Newsletter error:",s),{success:!1,error:s.message}}}async function Fi(t){try{const{data:s,error:a}=await U.from("newsletter_subscribers").select("email, status").eq("email",t).single();if(a&&a.code!=="PGRST116")throw a;return{subscribed:!!s,status:s==null?void 0:s.status}}catch(s){return console.error("Subscription check error:",s),{subscribed:!1,status:null}}}const Ke=()=>{const t=new Date().getFullYear(),[s,a]=l.useState(""),[r,n]=l.useState(!1),[i,o]=l.useState("idle"),[c,d]=l.useState(""),h=async u=>{if(u.preventDefault(),!!s){n(!0),o("idle");try{const{subscribed:p}=await Fi(s);if(p){o("already_subscribed"),d("This email is already subscribed to our newsletter!");return}(await Mi(s)).success?(o("success"),d("Thank you for subscribing! Please check your email for confirmation."),a("")):(o("error"),d("Sorry, there was an error subscribing. Please try again."))}catch{o("error"),d("Sorry, there was an error subscribing. Please try again.")}finally{n(!1)}}};return e.jsxs("footer",{className:"relative bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900 text-white overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 opacity-5",children:e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.1'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`}})}),e.jsxs("div",{className:"relative z-10",children:[e.jsx("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8 py-16",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 sm:gap-12",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("div",{className:"flex items-center mb-6",children:e.jsx("img",{src:"/logo.png",alt:"Samui Pier Resort",className:"h-36 w-auto"})}),e.jsx("p",{className:"text-gray-300 mb-6 leading-relaxed max-w-md text-shadow-sm",children:"Experience luxury beachfront living where families, couples, and travelers create lasting memories on the sun-kissed shores of Bophut, Samui."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx("div",{className:"flex space-x-4",children:[{icon:Ah,href:"https://www.instagram.com/samuipierresort/",label:"Instagram"},{icon:Tr,href:"https://www.facebook.com/samuipier",label:"Facebook"},{icon:Th,href:"https://www.google.com/maps/place/Samui+Pier+Beach+front+Resort/@9.5585674,100.0563758,861m/data=!3m1!1e3!4m21!1m11!3m10!1s0x3054f652ad1082d7:0x7c6531ef3f1bb396!2sSamui+Pier+Beach+front+Resort!5m2!4m1!1i2!8m2!3d9.5585674!4d100.0563758!10e1!16s%2Fg%2F1vmq6dl4!3m8!1s0x3054f652ad1082d7:0x7c6531ef3f1bb396!5m2!4m1!1i2!8m2!3d9.5585674!4d100.0563758!16s%2Fg%2F1vmq6dl4?entry=ttu&g_ep=EgoyMDI1MDgyNS4wIKXMDSoASAFQAw%3D%3D",label:"Google Maps"}].map(u=>e.jsx("a",{href:u.href,target:"_blank",rel:"noopener noreferrer",className:"w-10 h-10 rounded-full bg-white/10 hover:bg-sunset-orange transition-all duration-300 flex items-center justify-center group","aria-label":u.label,children:e.jsx(u.icon,{className:"h-5 w-5 text-gray-300 group-hover:text-white transition-colors"})},u.label))}),e.jsxs("a",{href:"https://www.booking.com/hotel/th/samui-pier-beach-front.en-gb.html?aid=356980&label=gog235jc-10CAso3QFCFnNhbXVpLXBpZXItYmVhY2gtZnJvbnRIEVgDaN0BiAEBmAEzuAEHyAEN2AED6AEB-AEBiAIBqAIBuAKM_dXFBsACAdICJDY1MGQwZDRiLTYyNGUtNDhmNi1iYjdhLWI3NzQ3NjAwYjI3YtgCAeACAQ&sid=59fe93507f53ebb3a534c3424113cee7&dist=0&keep_landing=1&sb_price_type=total&t
458ype=total&",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 bg-blue-600 hover:bg-blue-700 text-white font-semibold px-4 py-2 rounded-lg transition-all duration-300 hover:scale-105 shadow-lg hover:shadow-xl text-sm",children:[e.jsx(mn,{className:"h-4 w-4"}),"Book on Booking.com"]})]})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-lg font-semibold mb-6 text-sunset-orange",children:"Quick Links"}),e.jsx("ul",{className:"space-y-3",children:[{label:"Rooms & Villas",to:"/rooms"},{label:"Restaurant & Bar",to:"/restaurant"},{label:"Water Park",to:"/waterpark"},{label:"Beach Activities",to:"/watersports"},{label:"Partner Agent Program",to:"/agents/apply"},{label:"Agent Portal",to:"/agent"},{label:"Spa & Wellness",to:"#"},{label:"Events & Weddings",to:"#"}].map(u=>e.jsx("li",{children:u.to==="#"?e.jsx("a",{href:"#",className:"text-gray-300 hover:text-sunset-orange transition-colors duration-300 hover:translate-x-1 inline-block",children:u.label}):e.jsx(ct,{to:u.to,className:"text-gray-300 hover:text-sunset-orange transition-colors duration-300 hover:translate-x-1 inline-block",children:u.label})},u.label))})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-lg font-semibold mb-6 text-sunset-orange",children:"Contact Info"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start space-x-3",children:[e.jsx(Je,{className:"h-5 w-5 text-sunset-orange mt-0.5 flex-shrink-0"}),e.jsx("div",{children:e.jsxs("p",{className:"text-gray-300 text-sm leading-relaxed",children:["30/5 Moo 4 Bophut",e.jsx("br",{}),"Samui, Surat Thani",e.jsx("br",{}),"Thailand 84320"]})})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(lt,{className:"h-5 w-5 text-sunset-orange flex-shrink-0"}),e.jsx("span",{className:"text-gray-300",children:"+66 (0)81 978 9085"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(ts,{className:"h-5 w-5 text-sunset-orange flex-shrink-0"}),e.jsx("span",{className:"text-gray-300",children:e.jsx("span",{id:"email-protected",className:"cursor-pointer hover:text-sunset-orange transition-colors",onClick:()=>{navigator.clipboard.writeText("[email protected]");const p=document.getElementById("email-protected");if(p){const f=p.textContent;p.textContent="Email copied!",setTimeout(()=>{p&&(p.textContent=f)},2e3)}},children:"Click to reveal email"})})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(Ie,{className:"h-5 w-5 text-sunset-orange flex-shrink-0"}),e.jsx("span",{className:"text-gray-300",children:"24/7 Front Desk"})]})]})]})]})}),e.jsx("div",{className:"border-t border-gray-700",children:e.jsx("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8 py-12",children:e.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[e.jsx("h4",{className:"text-2xl font-bold mb-4 text-shadow-sm",children:"Stay Updated"}),e.jsx("p",{className:"text-gray-300 mb-6 text-shadow-sm",children:"Subscribe to our newsletter for exclusive offers, resort updates, and travel inspiration."}),i==="success"&&e.jsxs("div",{className:"max-w-md mx-auto mb-6 p-4 bg-green-50 border border-green-200 rounded-lg flex items-center gap-3",children:[e.jsx(jt,{className:"h-5 w-5 text-green-600"}),e.jsx("p",{className:"text-green-800",children:c})]}),i==="error"&&e.jsxs("div",{className:"max-w-md mx-auto mb-6 p-4 bg-red-50 border border-red-200 rounded-lg flex items-center gap-3",children:[e.jsx(sa,{className:"h-5 w-5 text-red-600"}),e.jsx("p",{className:"text-red-800",children:c})]}),i==="already_subscribed"&&e.jsxs("div",{className:"max-w-md mx-auto mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg flex items-center gap-3",children:[e.jsx(sa,{className:"h-5 w-5 text-blue-600"}),e.jsx("p",{className:"text-blue-800",children:c})]}),e.jsxs("form",{onSubmit:h,className:"flex flex-col sm:flex-row gap-4 max-w-md mx-auto",children:[e.jsx("input",{type:"email",value:s,onChange:u=>a(u.target.value),placeholder:"Enter your email",required:!0,className:"flex-1 px-4 py-3 rounded-lg bg-white/10 border border-gray-600 text-white placeholder-gray-400 focus:outline-none focus:border-sunset-orange focus:ring-1 focus:ring-sunset-orange transition-all"}),e.jsx(P,{type:"submit",disabled:r,className:"bg-gradient-to-r from-primary via-ocean-teal to-primary text-white font-semibold hover:shadow-tropical transition-all duration-300 hover:scale-105 disabled:opacity-50 disabled:cursor-not-allowed",children:r?"Subscribing...":"Subscribe"})]})]})})}),e.jsx("div",{className:"border-t border-gray-700",children:e.jsx("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center space-y-4 md:space-y-0",children:[e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-gray-400",children:[e.jsxs("span",{children:["© ",t," Samui Pier Resort. All rights reserved."]}),e.jsx("span",{className:"hidden sm:inline",children:"â¢"}),e.jsx("span",{className:"hidden sm:inline",children:"Privacy Policy"}),e.jsx("span",{className:"hidden sm:inline",children:"â¢"}),e.jsx("span",{className:"hidden sm:inline",children:"Terms of Service"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"}),e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"}),e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"}),e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"}),e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"})]}),e.jsx("span",{className:"text-sm text-gray-400",children:"8/10 Guest Rating"})]})]})})})]}),e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx("div",{className:"absolute top-20 right-20 w-32 h-32 opacity-5 animate-float",children:e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-sunset-orange/20 to-transparent roun
458ded-full blur-xl"})}),e.jsx("div",{className:"absolute bottom-20 left-20 w-24 h-24 opacity-5 animate-float",style:{animationDelay:"-3s"},children:e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-ocean-teal/20 to-transparent rounded-full blur-xl"})})]})]})},cu=()=>(l.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[]),e.jsxs("div",{className:"min-h-screen bg-transparent",children:[e.jsx(We,{}),e.jsxs("div",{className:"pt-20 bg-transparent",children:[" ",e.jsx(Qh,{}),e.jsx(au,{}),e.jsx(Di,{}),e.jsx(Ii,{}),e.jsx(lu,{}),e.jsx(iu,{}),e.jsx(Ke,{})]})]})),Bi=()=>{const t=$s();return l.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),e.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),e.jsx("a",{href:"/",className:"text-blue-500 hover:text-blue-700 underline",children:"Return to Home"})]})})},Oi=({items:t})=>e.jsxs("nav",{className:"flex items-center space-x-2 text-sm text-white mb-6",children:[e.jsxs(ct,{to:"/",className:"flex items-center text-white hover:text-sunset-orange transition-colors duration-200",children:[e.jsx(Eh,{className:"h-4 w-4 mr-1"}),"Home"]}),t.map((s,a)=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ka,{className:"h-4 w-4 text-white/60"}),s.href?e.jsx(ct,{to:s.href,className:"text-white hover:text-sunset-orange transition-colors duration-200",children:s.label}):e.jsx("span",{className:"text-white font-medium",children:s.label})]},a))]}),du=()=>{var i;const s=(i=$s().state)==null?void 0:i.preSelectedDates,{rooms:a,loading:r,error:n}=mr();return l.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[]),r?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading rooms..."})]})}):n?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-red-600 mb-4",children:["Error loading rooms: ",n]}),e.jsx("p",{className:"text-gray-600",children:"Please try refreshing the page."})]})}):r?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading rooms..."})]})}):n?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-red-600 mb-4",children:["Error loading rooms: ",n]}),e.jsx(P,{onClick:()=>window.location.reload(),children:"Retry"})]})}):e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"pt-20",children:[e.jsxs("div",{className:"relative py-32 bg-cover bg-center bg-no-repeat bg-fixed",style:{backgroundImage:"url(/our_rooms.jpg)"},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-black/60 via-black/40 to-black/60"}),e.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[e.jsx("div",{className:"absolute top-20 right-20 w-40 h-40 opacity-10 animate-float",children:e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-sunset-orange/20 to-transparent rounded-full blur-2xl"})}),e.jsx("div",{className:"absolute bottom-20 left-20 w-32 h-32 opacity-8 animate-float",style:{animationDelay:"-3s"},children:e.jsx("div",{className:"w-full h-full bg-gradient-to-br from-ocean-teal/20 to-transparent rounded-full blur-2xl"})})]}),e.jsxs("div",{className:"container mx-auto px-6 text-center text-white relative z-10",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold mb-6 text-shadow-lg",children:"Our Rooms & Villas"}),e.jsx("p",{className:"text-xl md:text-2xl text-white/95 max-w-3xl mx-auto leading-relaxed text-shadow-md",children:"Discover our collection of 19 beautifully designed rooms, each offering stunning ocean views and premium amenities for your perfect beach getaway."}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-12 mt-16",children:[e.jsxs("div",{className:"text-center bg-white/10 backdrop-blur-sm rounded-2xl p-6 border border-white/20",children:[e.jsx("div",{className:"text-5xl font-bold mb-2 text-sunset-orange",children:"19"}),e.jsx("div",{className:"text-white/90 font-medium",children:"Total Rooms"})]}),e.jsxs("div",{className:"text-center bg-white/10 backdrop-blur-sm rounded-2xl p-6 border border-white/20",children:[e.jsx("div",{className:"text-5xl font-bold mb-2 text-sunset-orange",children:"8"}),e.jsx("div",{className:"text-white/90 font-medium",children:"Guest Rating"})]}),e.jsxs("div",{className:"text-center bg-white/10 backdrop-blur-sm rounded-2xl p-6 border border-white/20",children:[e.jsx("div",{className:"text-5xl font-bold mb-2 text-sunset-orange",children:"100%"}),e.jsx("div",{className:"text-white/90 font-medium",children:"Ocean Vie
458w"})]})]})]})]}),e.jsxs("div",{className:"relative py-32 overflow-hidden min-h-screen",children:[e.jsx("div",{className:"absolute inset-0",style:{backgroundImage:"url('/pexels-allphoto-bangkok-1628521-12001661.jpg')",backgroundSize:"cover",backgroundPosition:"center top",width:"100%",height:"120%",top:"-10%",left:"0"}}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-black/50 via-black/30 to-black/50"}),e.jsxs("div",{className:"container mx-auto px-6 relative z-10 text-white",children:[e.jsx(Oi,{items:[{label:"Rooms"}]}),s&&e.jsx("div",{className:"mb-6 p-6 bg-gradient-to-r from-sunset-orange/10 to-orange-500/10 border border-sunset-orange/20 rounded-xl",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(Re,{className:"h-6 w-6 text-sunset-orange"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-white mb-1",children:"Pre-selected Dates from Homepage"}),e.jsxs("p",{className:"text-white",children:["Check-in: ",e.jsx("span",{className:"font-medium",children:new Date(s.checkIn).toLocaleDateString()})," ⢠Check-out: ",e.jsx("span",{className:"font-medium",children:new Date(s.checkOut).toLocaleDateString()})," ⢠Guests: ",e.jsx("span",{className:"font-medium",children:s.guests})]})]})]}),e.jsx(P,{onClick:()=>window.history.replaceState({},document.title),variant:"outline",size:"sm",className:"border-sunset-orange text-sunset-orange hover:bg-sunset-orange hover:text-white",children:"Clear"})]})}),e.jsxs("div",{className:"text-center mb-24",children:[e.jsxs("div",{className:"inline-flex items-center gap-3 bg-white/8 backdrop-blur-md border border-white/15 px-8 py-4 rounded-full mb-8",children:[e.jsx("div",{className:"w-2 h-2 bg-sunset-orange rounded-full animate-pulse"}),e.jsx("span",{className:"text-sm font-medium text-white/90 tracking-widest uppercase text-shadow-sm",children:"Accommodations"})]}),e.jsxs("h2",{className:"text-5xl md:text-7xl lg:text-8xl font-black text-white mb-8 text-shadow-2xl font-premium-heading tracking-tight leading-tight",children:["Beachfront Rooms",e.jsx("span",{className:"block text-3xl md:text-4xl lg:text-5xl font-light text-white/80 mt-4 tracking-widest",children:"& VILLAS"})]}),e.jsx("p",{className:"text-xl md:text-2xl text-white/90 max-w-4xl mx-auto text-shadow-lg font-premium-body leading-relaxed mb-12",children:"All 19 of our rooms are designed to offer views of the beach, ensuring you wake up to the sound of the waves and the beauty of the sea."}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-12",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-black text-sunset-orange text-shadow-lg mb-2",children:"19"}),e.jsx("div",{className:"text-white/80 text-sm text-shadow-sm tracking-wide uppercase",children:"Total Rooms"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-black text-sunset-orange text-shadow-lg mb-2",children:"8"}),e.jsx("div",{className:"text-white/80 text-sm text-shadow-sm tracking-wide uppercase",children:"Guest Rating"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-4xl font-black text-sunset-orange text-shadow-lg mb-2",children:"100%"}),e.jsx("div",{className:"text-white/80 text-sm text-shadow-sm tracking-wide uppercase",children:"Ocean View"})]})]})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-12 mb-32",children:a.map(o=>e.jsxs(z,{className:"group bg-white/10 backdrop-blur-md border border-white/20 shadow-2xl hover:shadow-3xl transition-all duration-700 hover:scale-105 rounded-3xl overflow-hidden",children:[e.jsxs("div",{className:"relative h-80 overflow-hidden",children:[e.jsx("img",{src:o.image,alt:o.name,className:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 via-transparent to-transparent"}),e.jsx(Te,{className:"absolute top-6 right-6 bg-white/20 backdrop-blur-md text-white border border-white/25 px-4 py-2 text-lg font-bold shadow-xl rounded-2xl",children:o.price}),e.jsxs(Te,{className:"absolute top-6 left-6 bg-white/20 backdrop-blur-md text-white border border-white/25 px-3 py-2 text-xs font-medium shadow-xl rounded-2xl",children:[e.jsx(Je,{className:"h-3 w-3 mr-1"}),o.location]}),e.jsxs("div",{className:"absolute bottom-6 left-6 flex items-center gap-2 bg-white/20 backdrop-blur-md px-3 py-2 border border-white/25 shadow-xl rounded-2xl",children:[e.jsx(dt,{className:"h-4 w-4 text-sunset-orange fill-current"}),e.jsx("span",{className:"text-sm font-bold text-white",children:o.rating})]})]}),e.jsxs(X,{className:"pb-4 px-8 pt-8",children:[e.jsx(Z,{className:"text-2xl text-white group-hover:text-sunset-orange transition-colors duration-500 font-premium-heading",children:o.name}),e.jsx(ke,{className:"text-white/90 leading-relaxed font-premium-body",children:o.shortDescription})]}),e.jsxs(K,{className:"pt-0 px-8 pb-8",children:[e.jsxs("div",{className:"flex items-center gap-8 mb-8 text-sm text-white/80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"font-medium tracking-wide",children:o.capacity})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Wa,{className:"h-4 w-4 text-sunset-orange"}),e.jsxs("span",{className:"font-medium tracking-wide",children:[o.bedrooms," bedroom",o.bedrooms>1?"s":""]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 mb-8",children:[o.amenities.slice(0,4).map(c=>e.jsx(Te,{variant:"secondary",className:"text-xs bg-white/15 backdrop-blur-md text-white/90 border border-white/20 hover:bg-white/25 transition-colors duration-300 rounded-2xl px-3 py-1",children:c},c)),o.amenities.length>4&&e.jsxs(Te,{variant:"secondary",className:"text-xs bg-white/15 backdrop-blur-md text-white/90 border border-white/25 rounded-2xl px-3 py-1",children:["+",o.amenities.length-4," more"]})]}),e.jsx(ct,{to:`/rooms/${o.id}`,children:e.jsxs(P,{className:"w-full bg-gradient-to-r from-sunset-orange to-orange-500 text-white font-bold hover:from-orange-500 hover:to-sunset-orange transition-all duration-500 h-12 text-lg hover:scale-105 shadow-xl rounded-2xl font-premium-accent",children:[e.jsx(Re,{className:"h-4 w-4 mr-2"}),"View Details & Book"]})})]})]},o.id))}),e.jsx("div",{className:"my-16 p-8 bg-gradient-to-r from-blue-600/20 to-blue-700/20 backdrop-blur-md border border-blue-500/20 rounded-3xl shadow-2xl",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center justify-between gap-8",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsx("div",{className:"bg-white/20 p-4 rounded-2xl",children:e.jsx("svg",{className:"h-12 w-12 text-white",viewBox:"0 0 24 24",fill:"
458currentColor",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h3",{className:"text-2xl font-bold text-white mb-2",children:"Book with Confidence on Booking.com"}),e.jsx("p",{className:"text-blue-100 text-lg",children:"Secure your stay through our trusted partner with instant confirmation and flexible cancellation"})]})]}),e.jsx("a",{href:"https://www.booking.com/hotel/th/samui-pier-beach-front.en-gb.html?aid=356980&label=gog235jc-10CAso3QFCFnNhbXVpLXBpZXItYmVhY2gtZnJvbnRIEVgDaN0BiAEBmAEzuAEHyAEN2AED6AEB-AEBiAIBqAIBuAKM_dXFBsACAdICJDY1MGQwZDRiLTYyNGUtNDhmNi1iYjdhLWI3NzQ3NjAwYjI3YtgCAeACAQ&sid=59fe93507f53ebb3a534c3424113cee7&dist=0&keep_landing=1&sb_price_type=total&type=total&",target:"_blank",rel:"noopener noreferrer",className:"bg-white text-blue-600 hover:bg-blue-50 font-bold px-8 py-4 rounded-2xl transition-all duration-300 hover:scale-105 shadow-lg hover:shadow-xl text-lg whitespace-nowrap",children:"Book on Booking.com"})]})}),e.jsx("div",{className:"text-center",children:e.jsx(z,{className:"bg-white/6 backdrop-blur-sm border border-white/12 p-12 shadow-2xl max-w-4xl mx-auto rounded-3xl",children:e.jsxs(K,{children:[e.jsx("h3",{className:"text-4xl md:text-5xl font-black text-white mb-6 text-shadow-2xl font-premium-heading",children:"Can't Find the Perfect Room?"}),e.jsx("p",{className:"text-xl text-white/80 mb-8 text-shadow-lg font-premium-body leading-relaxed max-w-3xl mx-auto",children:"Our team is here to help you find the ideal accommodation for your stay. Let us create a personalized experience just for you."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-6 justify-center",children:[e.jsx(P,{size:"lg",className:"bg-gradient-to-r from-sunset-orange to-orange-500 text-white font-bold hover:from-orange-500 hover:to-sunset-orange transition-all duration-500 h-14 text-lg hover:scale-105 shadow-2xl rounded-2xl px-8 font-premium-accent",children:"Contact Our Team"}),e.jsx(ct,{to:"/rooms",children:e.jsx(P,{size:"lg",variant:"outline",className:"border-2 border-white/20 text-white hover:bg-white/10 hover:text-white backdrop-blur-md transition-all duration-500 h-14 text-lg rounded-2xl px-8 font-premium-accent",children:"View All Rooms"})})]})]})})})]})]})]}),e.jsx(Ke,{})]})};var mu="Separator",tl="horizontal",hu=["horizontal","vertical"],Li=l.forwardRef((t,s)=>{const{decorative:a,orientation:r=tl,...n}=t,i=uu(r)?r:tl,c=a?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return e.jsx(Qe.div,{"data-orientation":i,...c,...n,ref:s})});Li.displayName=mu;function uu(t){return hu.includes(t)}var qi=Li;const xn=l.forwardRef(({className:t,orientation:s="horizontal",decorative:a=!0,...r},n)=>e.jsx(qi,{ref:n,decorative:a,orientation:s,className:de("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));xn.displayName=qi.displayName;var xu="Label",$i=l.forwardRef((t,s)=>e.jsx(Qe.label,{...t,ref:s,onMouseDown:a=>{var n;a.target.closest("button, input, select, textarea")||((n=t.onMouseDown)==null||n.call(t,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));$i.displayName=xu;var Ui=$i;const gu=cr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),A=l.forwardRef(({className:t,...s},a)=>e.jsx(Ui,{ref:a,className:de(gu(),t),...s}));A.displayName=Ui.displayName;const pu=cr("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Se=l.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("div",{ref:r,role:"alert",className:de(pu({variant:s}),t),...a}));Se.displayName="Alert";const fu=l.forwardRef(({className:t,...s},a)=>e.jsx("h5",{ref:a,className:de("mb-1 font-medium leading-none tracking-tight",t),...s}));fu.displayName="AlertTitle";const Ce=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:de("text-sm [&_p]:leading-relaxed",t),...s}));Ce.displayName="AlertDescription";var hr="Popover",[zi,qg]=na(hr,[la]),Ca=la(),[ju,fs]=zi(hr),Hi=t=>{const{__scopePopover:s,children:a,open:r,defaultOpen:n,onOpenChange:i,modal:o=!1}=t,c=Ca(s),d=l.useRef(null),[h,u]=l.useState(!1),[p,f]=pa({prop:r,defaultProp:n??!1,onChange:i,caller:hr});return e.jsx(Rl,{...c,children:e.jsx(ju,{scope:s,contentId:sr(),triggerRef:d,open:p,onOpenChange:f,onOpenToggle:l.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:h,onCustomAnchorAdd:l.useCallback(()=>u(!0),[]),onCustomAnchorRemove:l.useCallback(()=>u(!1),[]),modal:o,children:a})})};Hi.displayName=hr;var Vi="PopoverAnchor",bu=l.forwardRef((t,s)=>{const{__scopePopover:a,...r}=t,n=fs(Vi,a),i=Ca(a),{onCustomAnchorAdd:o,onCustomAnchorRemove:c}=n;return l.useEffect(()=>(o(),()=>c()),[o,c]),e.jsx(er,{...i,...r,ref:s})});bu.displayName=Vi;var Gi="PopoverTrigger",Wi=l.forwardRef((t,s)=>{const{__scopePopover:a,...r}=t,n=fs(Gi,a),i=Ca(a),o=st(s,n.triggerRef),c=e.jsx(Qe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Xi(n.open),...r,ref:o,onClick:Pe(t.onClick,n.onOpenToggle)});return n.hasCustomAnchor?c:e.jsx(er,{asChild:!0,...i,children:c})});Wi.displayName=Gi;var gn="PopoverPortal",[yu,vu]=zi(gn,{forceMount:void 0}),Ki=t=>{const{__scopePopover:s,forceMount:a,children:r,container:n}=t,i=fs(gn,s);return e.jsx(yu,{scope:s,forceMount:a,children:e.jsx(tr,{present:a||i.open,children:e.jsx(El,{asChild:!0,container:n,children:r})})})};Ki.displayName=gn;var aa="PopoverContent",Qi=l.forwardRef((t,s)=>{const a=vu(aa,t.__scopePopover),{forceMount:r=a.forceMount,...n}=t,i=fs(aa,t.__scopePopover);return e.jsx(tr,{present:r||i.open,children:i.modal?e.jsx(wu,{...n,ref:s}):e.jsx(ku,{...n,ref:s})})});Qi.displayName=aa;var Nu=Al("PopoverContent.RemoveScroll"),wu=l.forwardRef((t,s)=>{const a=fs(aa,t.__scopePopover),r=l.useRef(null),n=st(s,r),i=l.useRef(!1);return l.useEffect(()=>{const o=r.current;if(o)return Sl(o)},[]),e.jsx(Cl,{as:Nu,allowPinchZoom:!0,children:e.jsx(Yi,{...t,ref:n,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pe(t.onCloseAutoFocus,o=>{var c;o.preventDefault(),i.current||(c=a.triggerRef.current)==null||c.focus()}),onPointerDownOutside:Pe(t.onPointerDownOutside,o=>{const c=o.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,h=c.button===2||d;
458i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Pe(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),ku=l.forwardRef((t,s)=>{const a=fs(aa,t.__scopePopover),r=l.useRef(!1),n=l.useRef(!1);return e.jsx(Yi,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,c;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(c=a.triggerRef.current)==null||c.focus(),i.preventDefault()),r.current=!1,n.current=!1},onInteractOutside:i=>{var d,h;(d=t.onInteractOutside)==null||d.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const o=i.target;((h=a.triggerRef.current)==null?void 0:h.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&n.current&&i.preventDefault()}})}),Yi=l.forwardRef((t,s)=>{const{__scopePopover:a,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:u,...p}=t,f=fs(aa,a),m=Ca(a);return _l(),e.jsx(Pl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:i,children:e.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onDismiss:()=>f.onOpenChange(!1),children:e.jsx(Vr,{"data-state":Xi(f.open),role:"dialog",id:f.contentId,...m,...p,ref:s,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Ji="PopoverClose",Su=l.forwardRef((t,s)=>{const{__scopePopover:a,...r}=t,n=fs(Ji,a);return e.jsx(Qe.button,{type:"button",...r,ref:s,onClick:Pe(t.onClick,()=>n.onOpenChange(!1))})});Su.displayName=Ji;var Cu="PopoverArrow",_u=l.forwardRef((t,s)=>{const{__scopePopover:a,...r}=t,n=Ca(a);return e.jsx(Gr,{...n,...r,ref:s})});_u.displayName=Cu;function Xi(t){return t?"open":"closed"}var Pu=Hi,Eu=Wi,Au=Ki,Zi=Qi;const Ru=Pu,Tu=Eu,eo=l.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(Au,{children:e.jsx(Zi,{ref:n,align:s,sideOffset:a,className:de("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));eo.displayName=Zi.displayName;const Ja=({value:t,onChange:s,min:a,placeholder:r,className:n,disabledDates:i=[]})=>{const o=S=>{const[$,J,V]=S.split("-").map(Number);return new Date($,J-1,V)},c=S=>{const $=S.getFullYear(),J=String(S.getMonth()+1).padStart(2,"0"),V=String(S.getDate()).padStart(2,"0");return`${$}-${J}-${V}`},[d,h]=l.useState(!1),[u,p]=l.useState(t?o(t):new Date),[f,m]=l.useState(t?o(t):null);l.useState("top");const v=new Date,x=a?o(a):v,g=new Set(i);l.useEffect(()=>{if(t){const S=o(t);m(S),p(S)}},[t]),l.useEffect(()=>{d&&setTimeout(()=>{const S=document.querySelector("[data-radix-popover-trigger]");S&&S.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},150)},[d]);const b=(S=>{const $=S.getFullYear(),J=S.getMonth(),V=new Date($,J,1),R=new Date($,J+1,0),se=new Date(V);se.setDate(se.getDate()-V.getDay());const C=[],Y=new Date(se);for(;Y<=R||C.length<42;)C.push(new Date(Y)),Y.setDate(Y.getDate()+1);return C})(u),N=["January","February","March","April","May","June","July","August","September","October","November","December"],I=S=>{S<x||g.has(c(S))||(m(S),s(c(S)),h(!1))},y=S=>{if(h(S),S){const $=document.querySelector("[data-radix-popover-trigger]");$&&($.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),setTimeout(()=>{window.scrollBy({top:-50,behavior:"smooth"})},200))}},w=()=>{p(new Date(u.getFullYear(),u.getMonth()-1,1))},k=()=>
458{p(new Date(u.getFullYear(),u.getMonth()+1,1))},_=()=>{const S=new Date;p(S);const $=c(S);S>=x&&!g.has($)&&(m(S),s($))},M=S=>S.toDateString()===v.toDateString(),q=S=>f&&S.toDateString()===f.toDateString(),D=S=>S.getMonth()===u.getMonth(),F=S=>S<x?!0:g.has(c(S));return e.jsxs(Ru,{open:d,onOpenChange:y,children:[e.jsx(Tu,{asChild:!0,children:e.jsxs(P,{variant:"outline",className:de("w-full justify-start text-left font-normal h-12 text-base px-4 border-2 border-gray-200 hover:border-sunset-orange focus:border-sunset-orange focus:ring-2 focus:ring-sunset-orange/20 transition-all duration-200 cursor-pointer",!t&&"text-muted-foreground",n),children:[e.jsx(Re,{className:"mr-2 h-4 w-4 text-sunset-orange"}),t?e.jsx("span",{className:"font-medium",children:o(t).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"})}):e.jsx("span",{children:r||"Pick a date"})]})}),e.jsx(eo,{className:"w-auto p-0 bg-white border border-gray-200 shadow-xl rounded-lg mx-auto z-50",align:"center",side:"top",sideOffset:8,alignOffset:0,avoidCollisions:!1,onOpenAutoFocus:S=>S.preventDefault(),children:e.jsxs("div",{className:"p-3 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 p-2 bg-gray-50 rounded-lg",children:[e.jsx(P,{variant:"ghost",size:"sm",onClick:w,className:"h-6 w-6 p-0 hover:bg-white rounded-md",children:e.jsx(on,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("h3",{className:"text-base font-semibold text-gray-900",children:[N[u.getMonth()]," ",u.getFullYear()]}),e.jsx(P,{variant:"ghost",size:"sm",onClick:_,className:"h-5 px-2 text-xs text-sunset-orange hover:bg-sunset-orange/20 bg-white rounded-md border border-gray-200",children:"Today"})]}),e.jsx(P,{variant:"ghost",size:"sm",onClick:k,className:"h-6 w-6 p-0 hover:bg-white rounded-md",children:e.jsx(ka,{className:"h-3 w-3"})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(S=>e.jsx("div",{className:"h-8 w-8 flex items-center justify-center text-xs font-medium text-gray-600 bg-gray-50 rounded-md",children:S},S))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:b.map((S,$)=>e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>I(S),disabled:F(S),className:de("h-8 w-8 p-0 text-sm font-medium transition-colors rounded-md",!D(S)&&"text-gray-300 bg-gray-50/50",M(S)&&"bg-sunset-orange/20 text-sunset-orange font-semibold border-2 border-sunset-orange/30",q(S)&&"bg-sunset-orange text-white hover:bg-sunset-orange shadow-md",!q(S)&&!M(S)&&"hover:bg-gray-100 bg-white",F(S)&&"text-gray-300 cursor-not-allowed hover:bg-transparent bg-gray-50"),children:S.getDate()},$))})]})})]})};function to(){return`${"https://ckjiwgyeseqtkpgftubq.supabase.co".replace(/\/$/,"")}/functions/v1`}function Iu(t,s){return`${to()}/export-ical?room=${t}&token=${s}`}async function Du(t){try{let s=U.from("room_ical_sources").select("*").order("room_id",{ascending:!0});t!=null;const{data:a,error:r}=await s;if(r)throw r;return{data:a,error:null}}catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to load calendar sources"}}}async function sl(){try{const{data:t,error:s}=await U.from("rooms").select("id, name, ical_export_token").order("name",{ascending:!0});if(s)throw s;return{data:(t??[]).map(r=>({room_id:r.id,name:r.name,ical_export_token:r.ical_export_token,export_url:r.ical_export_token?Iu(r.id,r.ical_export_token):""})),error:null}}catch(t){return{data:null,error:t instanceof Error?t.message:"Failed to load rooms"}}}async function Mu(t){try{const{data:s,error:a}=await U.from("rooms").select("ical_export_token").eq("id",t).maybeSingle();if(a)throw a;if(s!=null&&s.ical_export_token)return{token:s.ical_export_token,error:null};const r=crypto.randomUUID(),{data:n,error:i}=await U.from("rooms").update({ical_export_token:r}).eq("id",t).select("ical_export_token").single();if(i)throw i;return{token:n.ical_export_token,error:null}}catch(s){return{token:null,error:s instanceof Error?s.message:"Failed to create export token"}}}const Fu=["Airbnb","Booking.com","Agoda","VRBO","Expedia","HotelRunner","Cloudbeds","Custom / PMS"];async function Bu(t){try{const s=t.name.trim(),a=t.icalUrl.trim();if(!s)return{data:null,error:"Channel name is required"};if(!a)return{data:null,error:"Calendar URL (.ics / iCal export) is required"};const{data:r,error:n}=await U.from("room_ical_sources").upsert({room_id:t.roomId,name:s,ical_url:a,enabled:t.enabled??!0,last_error:null},{onConflict:"room_id,name"}).select("*").single();if(n)throw n;return{data:r,error:null}}
458catch(s){return{data:null,error:s instanceof Error?s.message:"Failed to save calendar source"}}}async function al(t,s){try{const a={};s.name!=null&&(a.name=s.name.trim()),s.ical_url!=null&&(a.ical_url=s.ical_url.trim()),s.enabled!=null&&(a.enabled=s.enabled),s.ical_url!=null&&(a.last_error=null);const{data:r,error:n}=await U.from("room_ical_sources").update(a).eq("id",t).select("*").single();if(n)throw n;return{data:r,error:null}}catch(a){return{data:null,error:a instanceof Error?a.message:"Failed to update calendar source"}}}async function Ou(t){try{const{error:s}=await U.from("room_ical_sources").delete().eq("id",t);if(s)throw s;return{error:null}}catch(s){return{error:s instanceof Error?s.message:"Failed to delete calendar source"}}}async function Nr(t){var s;try{const{data:a}=await U.auth.getSession(),r=(s=a.session)==null?void 0:s.access_token;if(!r)return{success:!1,error:"You must be signed in to sync calendars"};const n=await fetch(`${to()}/sync-ical`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`},body:JSON.stringify({sourceId:t==null?void 0:t.sourceId,roomId:t==null?void 0:t.roomId})}),i=await n.json().catch(()=>({}));return!n.ok||!i.success?{success:!1,error:i.error||`Sync failed (${n.status})`}:{success:!0,error:null,results:i.results}}catch(a){return{success:!1,error:a instanceof Error?a.message:"Sync request failed"}}}async function Lu(t,s,a){try{let r=U.from("room_availability").select("date").eq("room_id",t).eq("is_available",!1).order("date",{ascending:!0});s&&(r=r.gte("date",s)),a&&(r=r.lte("date",a));const{data:n,error:i}=await r;if(i)throw i;return{data:(n??[]).map(o=>o.date),error:null}}catch(r){return{data:null,error:r instanceof Error?r.message:"Failed to load blocked dates"}}}const Hs=t=>{const s=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${s}-${a}-${r}`},Xa=(t,s)=>{const[a,r,n]=t.split("-").map(Number),i=new Date(a,r-1,n+s);return Hs(i)},qu=(t,s,a=540)=>{const r=[];for(let n=1;n<=a;n++){const i=Xa(t,n);let o=t,c=!1;for(;o<i;){if(s.has(o)){c=!0;break}o=Xa(o,1)}c&&r.push(i)}return r},wr=(t,s,a)=>{let r=t;for(;r<s;){if(a.has(r))return!0;r=Xa(r,1)}return!1},$u=()=>{var V;const{id:t}=zc(),s=vt();Nt();const a=t?Number(t):null,{room:r,loading:n,error:i}=su(a),o=l.useRef(null),[c,d]=l.useState(0),h=new Date,u=new Date(h);u.setDate(u.getDate()+1);const[p,f]=l.useState(Hs(h)),[m,v]=l.useState(Hs(u)),[x,g]=l.useState(1),[j,b]=l.useState(""),[N,I]=l.useState(null),[y,w]=l.useState([]);l.useEffect(()=>{if(!a||Number.isNaN(a))return;let R=!1;const se=Hs(new Date),C=Xa(se,540);return Lu(a,se,C).then(Y=>{R||Y.error||!Y.data||w(Y.data)}),()=>{R=!0}},[a]);const k=new Set(y),_=p?qu(p,k):[];if(l.useEffect(()=>{if(y.length===0)return;const R=new Set(y);if(p&&R.has(p)){f(""),v("");return}p&&m&&wr(p,m,R)&&v("")},[y,p,m]),n)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading room details..."})]})});if(i||!r)return e.jsx(Bi,{});const M=()=>{d(R=>R===r.gallery.length-1?0:R+1)},q=()=>{d(R=>R===0?r.gallery.length-1:R-1)},D=R=>{d(R)},F=R=>{f(R),I(null),(m&&R>=m||R&&m&&wr(R,m,k))&&v("")},S=()=>{if(!p||!m){I("Please select check-in and check-out dates");return}if(new Date(p)>=new Date(m)){I("Check-out date must be after check-in date");return}if(wr(p,m,k)){I("Selected dates include nights that are already booked");return}if(x>r.maxGuests){I(`Maximum ${r.maxGuests} guests allowed`);return}const R=new Date(p),se=new Date(m),C=Math.ceil((se.getTime()-R.getTime())/(1e3*60*60*24)),Y=C*(r.pricePerNight||0),ne={roomId:r.id,roomName:r.name,roomImage:r.image,checkInDate:p,checkOutDate:m,guests:x,specialRequests:j||"",totalPrice:Y,nights:C,pricePerNight:r.pricePerNight};sessionStorage.setItem("pendingCheckout",JSON.stringify(ne)),s("/checkout")},$=()=>{if(!p||!m)return 0;const R=new Date(p),se=new Date(m);return Math.ceil((se.getTime()-R.getTime())/(1e3*60*60*24))*(r.pricePerNight||0)},J=()=>{o.current&&o.current.scrollIntoView({behavior:"smooth",block:"start"})};return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"pt-20",children:[e.jsxs("div",{className:"relative h-96 md:h-[500px] overflow-hidden",children:[e.jsx(Vt,{src:r.gallery[c],alt:r.name,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/20"}),e.jsxs(P,{variant:"ghost",size:"lg",onClick:()=>s(-1),className:"absolute top-6 left-6 bg-white/20 backdrop-blur-md text-white hover:bg-white/30 border border-white/30",children:[e.jsx(nn,{className:"h-5 w-5 mr-2"}),"Back to Rooms"]}),e.jsxs(P,{size:"lg",onClick:J,className:"absolute top-6 right-6 bg-sunset-orange hover:bg-orange-600 text-white border-0 shadow-lg",children:[e.jsx(Re,{className:"h-5 w-5 mr-2"}),"Book Now"]}),e.jsx(P,{variant:"ghost",size:"lg",onClick:q,className:"absolute left-6 top-1/2 transform -translate-y-1/2 bg-white/20 backdrop-blur-md text-white hover:bg-white/30 border border-white/30 h-16 w-16 rounded-full",children:e.jsx(on,{className:"h-8 w-8"})}),e.jsx(P,{variant:"ghost",size:"lg",onClick:M,className:"absolute right-6 top-1/2 transform -translate-y-1/2 bg-white/20 backdrop-blur-md text-white hover:bg-white/30 border border-white/30 h-16 w-16 rounded-full",children:e.jsx(ka,{className:"h-8 w-8"})}),e.jsx("div",{className:"absolute bottom-6 left-1/2 transform -translate-x-1/2 flex gap-2",children:r.gallery.map((R,se)=>e.jsx("button",{onClick:()=>D(se),className:`w-3 h-3 rounded-full transition-all ${se===c?"bg-white scale-125":"bg-white/50 hover:bg-white/75"}`},se))}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-6",children:e.jsxs("div",{className:"container mx-auto",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-2",children:[e.jsx(Te,{className:"bg-sunset-orange text-white px-3 py-1",children:r.location}),e.jsxs("div",{className:"flex items-center gap-1 text-white",children:[e.jsx(dt,{className:"h-4 w-4 fill-current text-yellow-400"}),e.jsx("span",{className:"font-semibold",children:r.rating})]})]}),e.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-white mb-2",children:r.name}),e.jsx("p",{className:"text-white/90 text-lg max-w-2xl",children:r.shortDe
458scription})]})})]}),e.jsxs("div",{className:"container mx-auto px-6 py-12",children:[e.jsx(Oi,{items:[{label:"Rooms",href:"/rooms"},{label:r.name}]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-12",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-8 pb-32",children:[e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"About This Room"})}),e.jsx(K,{children:e.jsx("p",{className:"text-gray-700 leading-relaxed text-lg",children:r.longDescription})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"Room Specifications"})}),e.jsx(K,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(Xe,{className:"h-8 w-8 text-sunset-orange mx-auto mb-2"}),e.jsx("div",{className:"font-semibold text-gray-900",children:r.capacity}),e.jsx("div",{className:"text-sm text-gray-600",children:"Max Guests"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx(Wa,{className:"h-8 w-8 text-sunset-orange mx-auto mb-2"}),e.jsx("div",{className:"font-semibold text-gray-900",children:r.bedrooms}),e.jsx("div",{className:"text-sm text-gray-600",children:"Bedrooms"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx(Nh,{className:"h-8 w-8 text-sunset-orange mx-auto mb-2"}),e.jsx("div",{className:"font-semibold text-gray-900",children:r.bathrooms}),e.jsx("div",{className:"text-sm text-gray-600",children:"Bathrooms"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx(Bh,{className:"h-8 w-8 text-sunset-orange mx-auto mb-2"}),e.jsx("div",{className:"font-semibold text-gray-900",children:r.size}),e.jsx("div",{className:"text-sm text-gray-600",children:"Size"})]})]})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"Sleeping Arrangements"})}),e.jsx(K,{children:e.jsx("div",{className:"space-y-3",children:r.bedConfiguration.map((R,se)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[e.jsx(Wa,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-gray-700",children:R})]},se))})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"Amenities & Features"})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.amenities.map(R=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(jt,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{className:"text-gray-700",children:R})]},R))})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"Room Features"})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.features.map(R=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Jt,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-gray-700",children:R})]},R))})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"House Rules & Policies"})}),e.jsx(K,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"font-semibold text-gray-900 mb-3 flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-sunset-orange"}),"Check-in/Check-out"]}),e.jsxs("div",{className:"space-y-2 text-sm text-gray-600",children:[e.jsxs("div",{children:["Check-in: ",r.checkIn]}),e.jsxs("div",{children:["Check-out: ",r.checkOut]})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-semibold text-gray-900 mb-3 flex items-center gap-2",children:[e.jsx(Rs,{className:"h-4 w-4 text-sunset-orange"}),"Cancellation Policy"]}),e.jsx("p",{className:"text-sm text-gray-600",children:r.cancellationPolicy})]})]}),e.jsx(xn,{}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900 mb-3",children:"House Rules"}),e.jsx("div",{className:"space-y-2",children:r.policies.map(R=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx("div",{className:"w-2 h-2 bg-gray-400 rounded-full"}),R]},R))})]})]})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"What's Included"})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.includedServices.map(R=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(jt,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{className:"text-gray-700",children:R})]},R))})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"Additional Services"})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.additionalServices.map(R=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ut,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-gray-700",children:R})]},R))})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-2xl",children:"Nearby Attractions"})}),e.jsx(K,{children:e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:r.nearbyAttractions.map(R=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Je,{className:"h-5 w-5 text-sunset-orange"}),e.jsx("span",{className:"text-gray-700",children:R})]},R))})})]})]}),e.jsx("div",{className:"relative",children:e.jsx("div",{ref:o,className:"sticky top-24",children:e.jsxs(z,{className:"bg-white shadow-lg transition-all duration-300 mb-6",children:[e.jsxs(X,{className:"pb-3",children:[e.jsx(Z,{className:"text-2xl text-center",children:r.price}),r.pricePerNight&&e.jsx("p",{className:"text-center text-gray-600",children:"per night"})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-1",children:"Select Your Dates"}),e.jsx("p",{className:"text-xs text-gray-600",children:"Choose your check-in and check-out dates"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(A,{className:"block text-sm font-medium text-gray-700",children:[e.jsx(Re,{className:"h-4 w-4 inline mr-2 text-sunset-orange"}),"Check-in Date"]}),e.jsx(Ja,{value:p,onChange:F,min:Hs(new Date),placeholder:"Select check-in date",disabledDates:y})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(A,{className:"block text-sm font-medium text-gray-700",children:[e.jsx(Re,{className:"h-4 w-4 inline mr-2 text-sunset-orange"}),"Check-out Date"]}),e.jsx(Ja,{value:m,onChange:R=>{v(R),I(null)},min:p||Hs(new Date),placeholder:"Select check-out date",disabledDates:_})]}),p&&m&&e.jsx("div",{className:"bg-gradient-to-r from-sunset-orange/10 to-orange-100 p-3 rounded-lg border border-sunset-orange/20",children:e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"text-gray-700",children:"Duration:"})]}),e.jsxs("span",{className:"font-semibold text-sunset-orange",children:[Math.ceil((new Date(m).getTime()-new Date(p).getTime())/(1e3*60*60*24))," nights"]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(A,{className:"block text-sm font-medium text-gray-700",children:[e.jsx(Xe,{className:"h-4 w-4 inline mr-2 text-sunset-orange"}),"Number of Guests"]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(P,{variant:"outline",size:"lg",onClick:()=>
458g(Math.max(1,x-1)),className:"h-12 w-12 rounded-full border-2 border-gray-300 hover:border-sunset-orange hover:bg-sunset-orange hover:text-white transition-all duration-200",disabled:x<=1,children:e.jsx(Dh,{className:"h-5 w-5"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-3xl font-bold text-sunset-orange",children:x}),e.jsx("div",{className:"text-sm text-gray-600",children:"guests"})]}),e.jsx(P,{variant:"outline",size:"lg",onClick:()=>g(Math.min(r.maxGuests,x+1)),className:"h-12 w-12 rounded-full border-2 border-gray-300 hover:border-sunset-orange hover:bg-sunset-orange hover:text-white transition-all duration-200",disabled:x>=r.maxGuests,children:e.jsx(ut,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"mt-3 text-center",children:e.jsxs("div",{className:"inline-flex items-center gap-2 bg-white px-3 py-1 rounded-full border border-gray-200",children:[e.jsx(Xe,{className:"h-3 w-3 text-gray-500"}),e.jsxs("span",{className:"text-xs text-gray-600",children:["Max ",r.maxGuests," guests"]})]})})]})]}),p&&m&&e.jsxs("div",{className:"bg-gradient-to-br from-sunset-orange/5 to-orange-100/50 p-3 rounded-lg border border-sunset-orange/20",children:[e.jsxs("div",{className:"text-center mb-2",children:[e.jsx("div",{className:"text-xs text-gray-600",children:"Total Price"}),e.jsxs("div",{className:"text-2xl font-bold text-sunset-orange",children:["฿",$().toLocaleString()]})]}),e.jsx("div",{className:"space-y-1 text-xs",children:e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("span",{className:"text-gray-600",children:["฿",(V=r.pricePerNight)==null?void 0:V.toLocaleString(),"/night à ",Math.ceil((new Date(m).getTime()-new Date(p).getTime())/(1e3*60*60*24))," nights"]}),e.jsxs("span",{className:"font-medium",children:[x," guests"]})]})})]}),e.jsx("div",{children:e.jsxs(P,{onClick:S,disabled:!p||!m,className:"w-full bg-gradient-to-r from-sunset-orange to-orange-500 hover:from-orange-500 hover:to-orange-600 text-white font-bold py-3 text-base rounded-xl shadow-lg hover:shadow-xl transform hover:scale-[1.02] transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:shadow-none",children:[e.jsx(Re,{className:"h-5 w-5 mr-2"}),!p||!m?"Select Dates to Book":"Book Now"]})}),N&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(ps,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:N})]}),e.jsx("div",{className:"pt-3 border-t border-gray-200",children:e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(lt,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"text-gray-600",children:"+66 (0)81 978 9085"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(ts,{className:"h-4 w-4 text-sunset-orange"})})]})})]})]})})})]})]})]}),e.jsx(Ke,{})]})},_a=Bc,oa=l.forwardRef(({className:t,...s},a)=>e.jsx(Tl,{ref:a,className:de("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));oa.displayName=Tl.displayName;const Oe=l.forwardRef(({className:t,...s},a)=>e.jsx(Il,{ref:a,className:de("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...s}));Oe.displayName=Il.displayName;const Le=l.forwardRef(({className:t,...s},a)=>e.jsx(Dl,{ref:a,className:de("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...s}));Le.displayName=Dl.displayName;const Uu=()=>{const[t,s]=l.useState(!1),[a,r]=l.useState(null),n=u=>{try{return sessionStorage.setItem("pendingGuestBooking",JSON.stringify(u)),!0}catch(p){return console.error("Error storing guest booking:",p),!1}},i=()=>{try{const u=sessionStorage.getItem("pendingGuestBooking");return u?JSON.parse(u):null}catch(u){return console.error("Error retrieving guest booking:",u),null}},o=()=>{try{sessionStorage.removeItem("pendingGuestBooking")}catch(u){console.error("Error clearing guest booking:",u)}},c=async u=>{const p=i();if(!p)return r("No pending guest booking found"),!1;s(!0),r(null);try{const{data:f,error:m}=await U.from("bookings").insert([{user_id:u,room_id:p.room_id,check_in:p.check_in,check_out:p.check_out,guests:p.guests,total_price:p.total_price,status:"pending",special_requests:p.special_requests}]).select().single();if(m)throw m;return await d(p.room_id,p.check_in,p.check_out,f.id),o(),!0}catch(f){return r(f instanceof Error?f.message:"Failed to convert guest booking"),!1}finally{s(!1)}},d=async(u,p,f,m)=>{try{const x=h(p,f).map(j=>({room_id:u,date:j,is_available:!1,booking_id:m})),{error:g}=await U.from("room_availability").insert(x);if(g)throw g}catch(v){console.error("Error updating room availability:",v)}},h=(u,p)=>{const f=[],m=new Date(u),v=new Date(p);for(;m<v;)f.push(m.toISOString().split("T")[0]),m.setDate(m.getDate()+1);return f};return{loading:t,error:a,storeGuestBooking:n,getGuestBooking:i,clearGuestBooking:o,convertGuestBooking:c}},zu=()=>{var S,$,J,V;const[t,s]=l.useState(!1),[a,r]=l.useState(""),[n,i]=l.useState(""),[o,c]=l.useState(""),[d,h]=l.useState(""),[u,p]=l.useState(!1),[f,m]=l.useState(!1),[v,x]=l.useState(null),[g,j]=l.useState(null),{signIn:b,signUp:N,user:I}=Nt(),{convertGuestBooking:y,loading:w}=Uu(),k=vt(),_=$s(),M=(($=(S=_.state)==null?void 0:S.from)==null?void 0:$.pathname)||"/",q=((J=_.state)==null?void 0:J.guestBooking)||!1,D=((V=_.state)==null?void 0:V.message)||"";l.useEffect(()=>{q&&window.scrollTo({top:0,left:0,behavior:"smooth"})},[q]);const F=async R=>{R.preventDefault(),m(!0),x(null),j(null);try{if(t){const{data:se,error:C}=await N(a,n,o);C?x(C.message):se!=null&&se.user&&(j("Account created successfully! Redirecting..."),setTimeout(()=>{k("/dashboard")},1e3))}else{const{error:se}=await b(a,n);if(se)x(se.message);else{if(I&&await y(I.id)){j("Welcome back! Your pending booking has been processed."),setTimeout(()=>{k("/bookings")},2e3);return}j("Welcome back! Redirecting..."),setTimeout(()=>{k(M)},1e3)}}}catch{x("An unexpected error occurred. Please try again.")}finally{m(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsx("div",{className:"pt-20",children:e.jsx("div",{className:"container mx-auto px-6 py-12",children:e.jsx("div",{className:"max-w-md mx-auto",children:e.jsxs(z,{className:"shadow-xl",children:[e.jsxs(X,{className:"text-center",children:[e.jsx(Z,{className:"text-3xl font-bold text-gray-900",children:t?"Create Account":"Welcome Back"}),e.jsx(ke,{className:"text-gray-600",children:t?"Join us for an unforgettable stay at Samui Pier Resort":"Sign in to your account to continue"}),q&&e.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[e.jsxs("p",{className:"text-blue-800 text-sm font-medium",children:["ð ",D]}),e.jsx("p",{className:"text-blue-700 text-xs mt-1",children:"Complete your account setup to confirm your reservation."})]})]}),e.jsxs(K,{children:[e.jsxs(_a,{value:t?"signup":"signin",onValueChange:R=>
458s(R==="signup"),children:[e.jsxs(oa,{className:"grid w-full grid-cols-2 mb-6",children:[e.jsx(Oe,{value:"signin",children:"Sign In"}),e.jsx(Oe,{value:"signup",children:"Sign Up"})]}),e.jsx(Le,{value:"signin",children:e.jsxs("form",{onSubmit:F,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"email",children:"Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(ts,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"email",type:"email",placeholder:"Enter your email",value:a,onChange:R=>r(R.target.value),className:"pl-10",required:!0})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx($n,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"password",type:u?"text":"password",placeholder:"Enter your password",value:n,onChange:R=>i(R.target.value),className:"pl-10 pr-10",required:!0}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>p(!u),children:u?e.jsx(Rr,{className:"h-4 w-4"}):e.jsx(Ds,{className:"h-4 w-4"})})]})]}),e.jsx(P,{type:"submit",className:"w-full",disabled:f,children:f?"Signing In...":"Sign In"}),e.jsx("div",{className:"text-center",children:e.jsx(ct,{to:"/forgot-password",className:"text-sm text-sunset-orange hover:underline",children:"Forgot your password?"})})]})}),e.jsx(Le,{value:"signup",children:e.jsxs("form",{onSubmit:F,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"fullName",children:"Full Name"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ya,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"fullName",type:"text",placeholder:"Enter your full name",value:o,onChange:R=>c(R.target.value),className:"pl-10",required:!0})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"signupEmail",children:"Email"}),e.jsxs("div",{className:"relative",children:[e.jsx(ts,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"signupEmail",type:"email",placeholder:"Enter your email",value:a,onChange:R=>r(R.target.value),className:"pl-10",required:!0})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"phone",children:"Phone (Optional)"}),e.jsxs("div",{className:"relative",children:[e.jsx(lt,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"phone",type:"tel",placeholder:"Enter your phone number",value:d,onChange:R=>h(R.target.value),className:"pl-10"})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"signupPassword",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx($n,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"signupPassword",type:u?"text":"password",placeholder:"Create a password",value:n,onChange:R=>i(R.target.value),className:"pl-10 pr-10",required:!0,minLength:6}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>p(!u),children:u?e.jsx(Rr,{className:"h-4 w-4"}):e.jsx(Ds,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Password must be at least 6 characters"})]}),e.jsx(P,{type:"submit",className:"w-full",disabled:f,children:f?"Creating Account...":"Create Account"})]})})]}),v&&e.jsx(Se,{className:"mt-4 border-red-200 bg-red-50",children:e.jsx(Ce,{className:"text-red-800",children:v})}),g&&e.jsx(Se,{className:"mt-4 border-green-200 bg-green-50",children:e.jsx(Ce,{className:"text-green-800",children:g})}),e.jsxs("div",{className:"mt-6 text-center text-sm text-gray-600",children:["By continuing, you agree to our"," ",e.jsx(ct,{to:"/terms",className:"text-sunset-orange hover:underline",children:"Terms of Service"})," ","and"," ",e.jsx(ct,{to:"/privacy",className:"text-sunset-orange hover:underline",children:"Privacy Policy"})]})]})]})})})}),e.jsx(Ke,{})]})},Hu=()=>{const[t,s]=l.useState([]),[a,r]=l.useState(!1),[n,i]=l.useState(null),[o,c]=l.useState({total:0,pending:0,confirmed:0,cancelled:0,completed:0}),d=l.useCallback(async()=>{r(!0),i(null);try{const{data:x,error:g}=await U.from("bookings").select(` 459 *, 460 rooms:room_id ( 461 name, 462 image, 463 price_per_night 464 ), 465 users:user_id ( 466 email, 467 full_name 468 ), 469 guest_info:guest_info_id ( 470 full_name, 471 email, 472 phone, 473 address, 474 city, 475 country 476 ) 477 `).order("created_at",{ascending:!1});if(g){console.error("Join query failed, trying fallback approach:",g);const{data:j,error:b}=await U.from("bookings").select("*").order("created_at",{ascending:!1});if(b)throw b;const N=await Promise.all((j||[]).map(async I=>{const y={...I,rooms:{name:"Unknown",image:"",price_per_night:0},users:null,guest_info:null};if(I.room_id){const{data:w}=await U.from("rooms").select("name, image, price_per_night").eq("id",I.room_id).single();w&&(y.rooms=w)}
477if(I.user_id){const{data:w}=await U.from("users").select("email, full_name").eq("id",I.user_id).single();w&&(y.users={email:w.email||"",full_name:w.full_name})}if(I.guest_info_id){const{data:w}=await U.from("guest_info").select("full_name, email, phone, address, city, country").eq("id",I.guest_info_id).single();w&&(y.guest_info=w)}return y}));s(N),f(N)}else{const j=(x||[]).map(b=>{var N;return{...b,users:b.users&&(b.users.email||b.users.full_name)?{email:b.users.email||"",full_name:b.users.full_name||((N=b.users.user_metadata)==null?void 0:N.full_name)}:null,guest_info:b.guest_info||null}});s(j),f(j)}}catch(x){console.error("Error fetching bookings:",x),i(x instanceof Error?x.message:"Failed to fetch bookings")}finally{r(!1)}},[]),h=async(x,g)=>{try{const{error:j}=await U.from("bookings").update({status:g}).eq("id",x);if(j)throw j;return s(b=>b.map(N=>N.id===x?{...N,status:g}:N)),d(),!0}catch(j){return i(j instanceof Error?j.message:"Failed to update booking status"),!1}},u=x=>x==="all"?t:t.filter(g=>g.status===x),p=x=>{if(!x)return t;const g=x.toLowerCase();return t.filter(j=>{var _,M,q,D,F,S,$,J,V,R,se;const b=((M=(_=j.rooms)==null?void 0:_.name)==null?void 0:M.toLowerCase().includes(g))||!1,N=((D=(q=j.users)==null?void 0:q.email)==null?void 0:D.toLowerCase().includes(g))||!1,I=(((F=j.users)==null?void 0:F.full_name)||(($=(S=j.users)==null?void 0:S.user_metadata)==null?void 0:$.full_name)||"").toLowerCase().includes(g),y=((V=(J=j.guest_info)==null?void 0:J.full_name)==null?void 0:V.toLowerCase().includes(g))||!1,w=((se=(R=j.guest_info)==null?void 0:R.email)==null?void 0:se.toLowerCase().includes(g))||!1,k=j.id.toLowerCase().includes(g);return b||N||I||y||w||k})},f=x=>{const g={total:x.length,pending:x.filter(j=>j.status==="pending").length,confirmed:x.filter(j=>j.status==="confirmed").length,cancelled:x.filter(j=>j.status==="cancelled").length,completed:x.filter(j=>j.status==="completed").length};c(g)},m=()=>{const x=new Date;return x.setDate(x.getDate()-7),t.filter(g=>new Date(g.created_at)>=x)},v=()=>{const x=new Date;return x.setDate(x.getDate()+30),t.filter(g=>new Date(g.check_in)<=x&&g.status==="confirmed")};return l.useEffect(()=>{d()},[d]),{bookings:t,loading:a,error:n,stats:o,fetchAllBookings:d,updateBookingStatus:h,filterBookingsByStatus:u,searchBookings:p,getRecentBookings:m,getUpcomingBookings:v}},Vu=t=>{const[s,a]=l.useState(!1),r=l.useRef(null),n=l.useRef(null),i=l.useRef(""),o=l.useCallback(d=>{if(t&&d.new){const h={id:d.new.id,room_id:d.new.room_id,check_in:d.new.check_in,check_out:d.new.check_out,guests:d.new.guests,total_price:d.new.total_price,status:d.new.status,special_requests:d.new.special_requests,user_id:d.new.user_id,guest_info_id:d.new.guest_info_id,created_at:d.new.created_at,updated_at:d.new.updated_at,rooms:{name:"",image:"",price_per_night:0},users:null,guest_info:null};t(h)}},[t]),c=l.useCallback(()=>{r.current&&(U.removeChannel(r.current),r.current=null),n.current&&(clearTimeout(n.current),n.current=null),i.current=`bookings_changes_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,console.log("Setting up real-time subscription...");const d=U.channel(i.current).on("postgres_changes",{event:"INSERT",schema:"public",table:"bookings"},o).on("postgres_changes",{event:"UPDATE",schema:"public",table:"bookings"},h=>{var u;console.log("Booking updated:",(u=h.new)==null?void 0:u.id)}).on("postgres_changes",{event:"DELETE",schema:"public",table:"bookings"},h=>{var u;console.log("Booking deleted:",(u=h.old)==null?void 0:u.id)}).subscribe((h,u)=>{console.log("Subscription status:",h,u),a(h==="SUBSCRIBED"),h==="SUBSCRIBED"?console.log("Real-time subscription connected"):h==="CLOSED"||h==="CHANNEL_ERROR"?(console.error("Real-time subscription closed or error:",u),a(!1),n.current||(n.current=setTimeout(()=>{console.log("Attempting to reconnect real-time subscription..."),c()},3e3))):h==="TIMED_OUT"&&(console.error("Real-time subscription timed out"),a(!1),n.current||(n.current=setTimeout(()=>{console.log("Attempting to reconnect real-time subscription after timeout..."),c()},3e3)))});r.current=d},[o]);return l.useEffect(()=>(c(),()=>{r.current&&(console.log("Cleaning up real-time subscription"),U.removeChannel(r.current),r.current=null),n.current&&(clearTimeout(n.current),n.current=null),a(!1)}),[c]),{isConnected:s}};class Gu{constructor(){da(this,"supabaseUrl");da(this,"supabaseAnonKey");this.supabaseUrl="https://ckjiwgyeseqtkpgftubq.supabase.co",this.supabaseAnonKey="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNraml3Z3llc2VxdGtwZ2Z0dWJxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTYyOTAwMzgsImV4cCI6MjA3MTg2NjAzOH0.K4zfl-vnamPUMHXPjd7UUr-tZ0YV3JQXYXEwVo8aJ30",!this.supabaseUrl||!this.supabaseAnonKey?(console.error("â Supabase configuration not found. Email functionality will be disabled."),console.error("Please add VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY to your .env file")):console.log("â
Email service initialized (using secure Edge Function)")}stripHTML(s){return s.replace(/<style[^>]*>.*?<\/style>/gi,"").replace(/<script[^>]*>.*?<\/script>/gi,"").replace(/<[^>]+>/g,"").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/\s+/g," ").trim()}async sendEmail(s){if(!this.supabaseUrl||!this.supabaseAnonKey)return console.warn("Cannot send email: Supabase configuration not available"),console.warn("Email that would have been sent:",{to:s.to,subject:s.subject}),!1;try{const a=Array.isArray(s.to)?s.to:[{email:s.to}],r={to:s.to,subject:s.subject,htmlContent:s.htmlContent,textContent:s.textContent||this.stripHTML(s.htmlContent),replyTo:s.replyTo||{email:"[email protected]",name:"Samui Pier Resort"},tags:s.tags||["booking","confirmation"]};console.log("ð¤ Sending email via secure Edge Function:",{to:a.map(c=>typeof c=="string"?c:c.email),subject:s.subject});const n=`${this.supabaseUrl}/functions/v1/send-email`,i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.supabaseAnonKey}`},body:JSON.stringify(r)});if(console.log("ð¥ Edge Function response status:",i.status,i.statusText),!i.ok){const c=await i.text();let d;try{d=JSON.parse(c)}catch{d={message:c||"Unknown error"}}return console.error("â Email sending failed:",{status:i.status,statusText:i.statusText,error:d}),!1}const o=await i.json().catch(()=>({}));return console.log("â
Email sent successfully:",{to:a.map(c=>typeof c=="string"?c:c.email),subject:s.subject,messageId:o.messageId||"N/A"}),o.success!==!1}catch(a){return console.error("Error sending email:",{error:a instanceof Error?a.message:String(a),to:Array.isArray(s.to)?s.to:[s.to],subject:s.subject}),!1}}async sendCustomerBookingConfirmation(s){try{if(console.log("ð§ sendCustomerBookingConfirmation called with:",{customerEmail:s.customerEmail,customerName:s.customerName,room
477Name:s.roomName,bookingId:s.bookingId}),!s.customerEmail||!s.customerEmail.includes("@"))return console.error("â Invalid customer email:",s.customerEmail),!1;const a=this.generateCustomerEmailHTML(s),r=this.generateCustomerEmailText(s);console.log("ð Email content generated, sending...");const n=await this.sendEmail({to:s.customerEmail,subject:`Booking Confirmation - ${s.roomName} at Samui Pier Resort`,htmlContent:a,textContent:r,replyTo:{email:"[email protected]",name:"Samui Pier Resort"},tags:["booking","confirmation","customer"]});return console.log("ð§ Customer email result:",n?"â Success":"â Failed"),n}catch(a){return console.error("â Error in sendCustomerBookingConfirmation:",a),!1}}async sendHotelStaffNotification(s){try{console.log("ð§ sendHotelStaffNotification called with:",{customerEmail:s.customerEmail,customerName:s.customerName,roomName:s.roomName,bookingId:s.bookingId});const a=this.generateHotelStaffEmailHTML(s),r=this.generateHotelStaffEmailText(s),n="[email protected]";console.log("ð Hotel email content generated, sending to:",n);const i=await this.sendEmail({to:n,subject:`New Booking - ${s.roomName} - ${s.customerName}`,htmlContent:a,textContent:r,replyTo:{email:s.customerEmail,name:s.customerName},tags:["booking","notification","hotel-staff"]});return console.log("ð§ Hotel email result:",i?"â Success":"â Failed"),i}catch(a){return console.error("â Error in sendHotelStaffNotification:",a),!1}}generateCustomerEmailHTML(s){return` 478 <!DOCTYPE html> 479 <html> 480 <head> 481 <meta charset="utf-8"> 482 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 483 <title>Booking Confirmation</title> 484 <style> 485 body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; } 486 .container { max-width: 600px; margin: 0 auto; padding: 20px; } 487 .header { background: linear-gradient(135deg, #f97316, #ea580c); color: white; padding: 30px; text-align: center; border-radius: 10px 10px 0 0; } 488 .content { background: #f9fafb; padding: 30px; border-radius: 0 0 10px 10px; } 489 .booking-details { background: white; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #f97316; } 490 .detail-row { display: flex; justify-content: space-between; margin: 10px 0; padding: 8px 0; border-bottom: 1px solid #e5e7eb; } 491 .detail-label { font-weight: bold; color: #6b7280; } 492 .detail-value { color: #111827; } 493 .total-price { font-size: 24px; font-weight: bold; color: #f97316; text-align: center; margin: 20px 0; } 494 .footer { text-align: center; margin-top: 30px; color: #6b7280; font-size: 14px; } 495 .status-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; } 496 .status-pending { background: #fef3c7; color: #92400e; } 497 .status-confirmed { background: #d1fae5; color: #065f46; } 498 </style> 499 </head> 500 <body> 501 <div class="container"> 502 <div class="header"> 503 <h1>ð Booking Confirmation</h1> 504 <p>Thank you for choosing Samui Pier Resort!</p> 505 </div> 506 507 <div class="content"> 508 <p>Dear <strong>${s.customerName}</strong>,</p> 509 510 <p>Your booking has been successfully created and is currently pending confirmation from our hotel staff. Here are your booking details:</p> 511 512 <div class="booking-details"> 513 <div class="detail-row"> 514 <span class="detail-label">Booking ID:</span> 515 <span class="detail-value">#${s.bookingId}</span> 516 </div> 517 <div class="detail-row"> 518 <span class="detail-label">Room:</span> 519 <span class="detail-value">${s.roomName}</span> 520 </div> 521 <div class="detail-row"> 522 <span class="detail-label">Check-in:</span> 523 <span class="detail-value">${new Date(s.checkInDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}</span> 524 </div> 525 <div class="detail-row">
526 <span class="detail-label">Check-out:</span> 527 <span class="detail-value">${new Date(s.checkOutDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}</span> 528 </div> 529 <div class="detail-row"> 530 <span class="detail-label">Number of nights:</span> 531 <span class="detail-value">${s.nights}</span> 532 </div> 533 <div class="detail-row"> 534 <span class="detail-label">Guests:</span> 535 <span class="detail-value">${s.guests}</span> 536 </div> 537 ${s.specialRequests?` 538 <div class="detail-row"> 539 <span class="detail-label">Special requests:</span> 540 <span class="detail-value">${s.specialRequests}</span> 541 </div> 542 `:""} 543 <div class="detail-row"> 544 <span class="detail-label">Status:</span> 545 <span class="detail-value"> 546 <span class="status-badge status-${s.bookingStatus==="confirmed"?"confirmed":"pending"}"> 547 ${s.bookingStatus==="confirmed"?"Confirmed":"Pending Confirmation"} 548 </span> 549 </span> 550 </div> 551 </div> 552 553 <div class="total-price"> 554 Total: ฿${s.totalPrice.toLocaleString()} 555 </div> 556 557 <p><strong>What happens next?</strong></p> 558 <ul> 559 <li>Our hotel staff will review your booking within 24 hours</li> 560 <li>You'll receive a confirmation email once approved</li> 561 <li>We will send you information about the payment procedure</li> 562 </ul> 563 564 <p><strong>Need to make changes?</strong></p> 565 <p>If you need to modify or cancel your booking, please contact us at:</p> 566 <ul> 567 <li>ð§ [email protected]</li> 568 <li>ð +66 (0)81 978 9085</li> 569 </ul> 570 571 <p>We look forward to welcoming you to Samui Pier Resort!</p> 572 573 <p>Best regards,<br> 574 <strong>The Samui Pier Resort Team</strong></p> 575 </div> 576 577 <div class="footer"> 578 <p>Samui Pier Resort<br> 579 Koh Samui, Thailand<br> 580 This is an automated email. Please do not reply directly to this message.</p> 581 </div> 582 </div> 583 </body> 584 </html> 585 `}generateCustomerEmailText(s){return` 586BOOKING CONFIRMATION - Samui Pier Resort 587 588Dear ${s.customerName}, 589 590Your booking has been successfully created and is currently pending confirmation from our hotel staff. 591 592BOOKING DETAILS: 593- Booking ID: #${s.bookingId} 594- Room: ${s.roomName} 595- Check-in: ${new Date(s.checkInDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})} 596- Check-out: ${new Date(s.checkOutDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})} 597- Number of nights: ${s.nights} 598- Guests: ${s.guests} 599${s.specialRequests?`- Special requests: ${s.specialRequests}`:""} 600- Status: ${s.bookingStatus==="confirmed"?"Confirmed":"Pending Confirmation"} 601- Total: ฿${s.totalPrice.toLocaleString()} 602 603WHAT HAPPENS NEXT? 604- Our hotel staff will review your booking within 24 hours 605- You'll receive a confirmation email once approved 606- We will send you information about the payment procedure 607 608NEED TO MAKE CHANGES? 609If you need to modify or cancel your booking, please contact us at: 610- Email: [email protected] 611- Phone:+66 (0)81 978 9085 612 613We look forward to welcoming you to Samui Pier Resort! 614 615Best regards, 616The Samui Pier Resort Team 617 618--- 619Samui Pier Resort 620Koh Samui, Thailand 621This is an automated email. Please do not reply directly to this message. 622 `.trim()}generateHotelStaffEmailHTML(s){return` 623 <!DOCTYPE html> 624 <html> 625 <head> 626 <meta charset="utf-8"> 627 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 628 <title>New Booking Notification</title> 629 <style> 630 body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; } 631 .container { max-width: 600px; margin: 0 auto; padding: 20px; } 632 .header { background: #dc2626;
632 color: white; padding: 30px; text-align: center; border-radius: 10px 10px 0 0; } 633 .content { background: #f9fafb; padding: 30px; border-radius: 0 0 10px 10px; } 634 .booking-details { background: white; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #dc2626; } 635 .detail-row { display: flex; justify-content: space-between; margin: 10px 0; padding: 8px 0; border-bottom: 1px solid #e5e7eb; } 636 .detail-label { font-weight: bold; color: #6b7280; } 637 .detail-value { color: #111827; } 638 .action-buttons { text-align: center; margin: 20px 0; } 639 .btn { display: inline-block; padding: 12px 24px; margin: 0 10px; border-radius: 6px; text-decoration: none; font-weight: bold; } 640 .btn-confirm { background: #059669; color: white; } 641 .btn-reject { background: #dc2626; color: white; } 642 .urgent { background: #fef3c7; border: 2px solid #f59e0b; padding: 15px; border-radius: 8px; margin: 20px 0; } 643 </style> 644 </head> 645 <body> 646 <div class="container"> 647 <div class="header"> 648 <h1>ð New Booking Notification</h1> 649 <p>Action Required - Customer Booking Pending Confirmation</p> 650 </div> 651 652 <div class="content"> 653 <div class="urgent"> 654 <strong>â ï¸ URGENT:</strong> A new booking requires your attention and confirmation. 655 </div> 656 657 <h2>Booking Details</h2> 658 <div class="booking-details"> 659 <div class="detail-row"> 660 <span class="detail-label">Booking ID:</span> 661 <span class="detail-value">#${s.bookingId}</span> 662 </div> 663 <div class="detail-row"> 664 <span class="detail-label">Customer Name:</span> 665 <span class="detail-value">${s.customerName}</span> 666 </div> 667 <div class="detail-row"> 668 <span class="detail-label">Customer Email:</span> 669 <span class="detail-value">${s.customerEmail}</span> 670 </div> 671 <div class="detail-row"> 672 <span class="detail-label">Room:</span> 673 <span class="detail-value">${s.roomName}</span> 674 </div> 675 <div class="detail-row"> 676 <span class="detail-label">Check-in:</span> 677 <span class="detail-value">${new Date(s.checkInDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}</span> 678 </div> 679 <div class="detail-row"> 680 <span class="detail-label">Check-out:</span> 681 <span class="detail-value">${new Date(s.checkOutDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}</span> 682 </div> 683 <div class="detail-row"> 684 <span class="detail-label">Number of nights:</span> 685 <span class="detail-value">${s.nights}</span> 686 </div> 687 <div class="detail-row"> 688 <span class="detail-label">Guests:</span> 689 <span class="detail-value">${s.guests}</span> 690 </div> 691 <div class="detail-row"> 692 <span class="detail-label">Total Amount:</span> 693 <span class="detail-value">฿${s.totalPrice.toLocaleString()}</span> 694 </div> 695 ${s.specialRequests?` 696 <div class="detail-row"> 697 <span class="detail-label">Special requests:</span> 698 <span class="detail-value">${s.specialRequests}</span> 699 </div> 700 `:""} 701 </div> 702 703 <h2>Required Actions</h2> 704 <p>Please review this booking and take one of the following actions:</p> 705 706 <div class="action-buttons"> 707 <a href="http://localhost:3000/admin/bookings/${s.bookingId}" class="btn btn-confirm"> 708 Review in Admin Panel 709 </a> 710 </div> 711 712 <p><strong>Next steps:</strong></p> 713 <ol> 714 <li>Review the booking details above</li> 715 <li>Check room availability for the requested dates</li> 716 <li>Confirm or reject the booking in the admin panel</li> 717 <li>If confirmed, the customer will receive a confirmation email</li> 718 </ol> 719 720 <p><strong>Contact customer if needed:</strong></p> 721 <p>ð§ ${s.customerEmail}<br> 722 ð Customer phone number (if provided)</p> 723 724 <p>This notification was sent automatically by the Samui Pier Resort booking system.</p> 725 </div> 726 </div> 727 </body> 728 </html> 729 `}generateHotelStaffEmailText(s){return` 730NEW BOOKING NOTIFICATION - ACTION REQUIRED 731 732â ï¸ URGENT: A new booking requires your attention and confirmation. 733 734BOOKING DETAILS: 735- Booking ID: #${s.bookingId} 736- Customer Name: ${s.customerName} 737- Customer Email: ${s.customerEmail} 738- Room: ${s.roomName} 739- Check-in: ${new Date(s.checkInDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})} 740- Check-out: ${new Date(s.checkOutDate).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})} 741- Number of nights: ${s.nights} 742- Guests: ${s.guests}
743- Total Amount: ฿${s.totalPrice.toLocaleString()} 744${s.specialRequests?`- Special requests: ${s.specialRequests}`:""} 745 746REQUIRED ACTIONS: 747Please review this booking and take one of the following actions in the admin panel. 748 749NEXT STEPS: 7501. Review the booking details above 7512. Check room availability for the requested dates 7523. Confirm or reject the booking in the admin panel 7534. If confirmed, the customer will receive a confirmation email 754 755CONTACT CUSTOMER IF NEEDED: 756Email: ${s.customerEmail} 757Phone: Customer phone number (if provided) 758 759This notification was sent automatically by the Samui Pier Resort booking system. 760 `.trim()}async sendAgentApplicationReceived(s,a){return this.sendEmail({to:s,subject:"Agent application received â Samui Pier Resort",htmlContent:` 761 <p>Hi ${a},</p> 762 <p>We received your partner agent application. Please complete KYC document upload if you have not already, then wait for admin review.</p> 763 <p>You can check status anytime in the <a href="/agent">agent portal</a>.</p> 764 <p>â Samui Pier Resort</p> 765 `,tags:["agent","application"]})}async sendAgentApproved(s,a,r){const n=`${typeof window<"u"?window.location.origin:""}/?ref=${r}`;return this.sendEmail({to:s,subject:"Your agent account is approved â Samui Pier Resort",htmlContent:` 766 <p>Hi ${a},</p> 767 <p>Your agent application has been <strong>approved</strong>.</p> 768 <p>Your referral code: <strong>${r}</strong></p> 769 <p>Share this link: <a href="${n}">${n}</a></p> 770 <p>Open your <a href="/agent">agent portal</a> to track bookings and commissions.</p> 771 <p>â Samui Pier Resort</p> 772 `,tags:["agent","approved"]})}async sendAgentRejected(s,a,r){return this.sendEmail({to:s,subject:"Agent application update â Samui Pier Resort",htmlContent:` 773 <p>Hi ${a},</p> 774 <p>Unfortunately we could not approve your agent application at this time.</p> 775 <p><strong>Reason:</strong> ${r||"Please contact us for details."}</p> 776 <p>You may update your KYC documents and resubmit from the <a href="/agents/apply">application page</a>.</p> 777 <p>â Samui Pier Resort</p> 778 `,tags:["agent","rejected"]})}}const Yt=new Gu,Pa=()=>{const{user:t}=Nt(),[s,a]=l.useState([]),[r,n]=l.useState(!1),[i,o]=l.useState(null),c=l.useCallback(async()=>{if(t){n(!0),o(null);try{const{data:y,error:w}=await U.from("bookings").select(` 779 *, 780 rooms:room_id ( 781 name, 782 image, 783 price_per_night 784 ) 785 `).eq("user_id",t.id).order("created_at",{ascending:!1});if(w)throw w;a(y||[])}catch(y){o(y instanceof Error?y.message:"Failed to fetch bookings")}finally{n(!1)}}},[t]),d=async y=>{var w,k;if(!t){const _="User not authenticated";throw console.error(_),new Error(_)}n(!0),o(null);try{console.log("Creating booking with data:",{room_id:y.room_id,check_in:y.check_in,check_out:y.check_out,user_id:t.id});const _=v(y.check_in),M=v(y.check_out);if(_>=M)throw new Error("Check-out date must be after check-in date");if(!await p(y.room_id,y.check_in,y.check_out))throw new Error("Room is not available for the selected dates. Please try different dates.");console.log("Room is available, creating booking...");const{data:D,error:F}=await U.from("bookings").insert([{room_id:y.room_id,check_in:y.check_in,check_out:y.check_out,guests:y.guests,total_price:y.total_price,special_requests:y.special_requests,user_id:t.id,status:"pending",payment_status:y.payment_status||"pending",deposit_amount:y.deposit_amount,paid_amount:y.paid_amount,omise_charge_id:y.omise_charge_id,payment_method:y.payment_method||"manual",agent_id:y.agent_id||null,attribution_source:y.attribution_source||null,referral_code_used:y.referral_code_used||null}]).select().single();if(F)throw console.error("Supabase booking creation error:",F),F;console.log("Booking created successfully:",D.id);try{await f(y.room_id,y.check_in,y.check_out,D.id),console.log("Room availability updated successfully")}catch(S){console.error("Warning: Failed to update room availability:",S)}a(S=>[D,...S]);try{console.log("Starting email notification process for booking:",D.id);const{data:S,error:$}=await U.from("rooms").select("name").eq("id",y.room_id).single();$&&console.error("Error fetching room data for email:",$);const{data:J,error:V}=await U.auth.getUser();if(V&&console.error("Error fetching user data for email:",V),S&&(J!=null&&J.user)){const R=Math.ceil((new Date(y.check_out).getTime()-new Date(y.check_in).getTime())/864e5);console.log("Sending customer confirmation email to:",J.user.email);const se=await Yt.sendCustomerBookingConfirmation({bookingId:D.id,customerName:((w=J.user.user_metadata)==null?void 0:w.full_name)||"Guest",customerEmail:J.user.email||"",roomName:S.name,checkInDate:y.check_in,checkOutDate:y.check_out,guests:y.guests,totalPrice:y.total_price,nights:R,specialRequests:y.special_requests,bookingStatus:"pending"});console.log("Customer email result:",se?"Success":"Failed"),console.log("Sending hotel staff notification email");const C=await Yt.sendHotelStaffNotification({bookingId:D.id,customerName:((k=J.user.user_metadata)==null?void 0:k.full_name)||"Guest",customerEmail:J.user.email||"",roomName:S.name,checkInDate:y.check_in,checkOutDate:y.check_out,guests:y.guests,totalPrice:y.total_price,nights:R,specialRequests:y.special_requests,bookingStatus:"pending"});console.log("Hotel email result:",C?"Success":"Failed")}else console.warn("Cannot send emails: missing roomData or userData",{hasRoomData:!!S,hasUserData:!!(J!=null&&J.user)})}catch(S){console.error("Failed to send email notifications:",S)}return D}catch(_){throw o(_ instanceof Error?_.message:"Failed to create booking"),_}finally{n(!1)}},h=async y=>{n(!0),o(null);try{console.log("Creating guest booking with data:",{room_id:y.room_id,check_in:y.check_in,check_out:y.check_out,guest_email:y.guest_info.email});const w=v(y.check_in),k=v(y.check_out);if(w>=k)throw new Error("Check-out date must be after check-in date");if(!await p(y.room_id,y.check_in,y.check_out))throw new Error("Room is not available for the selected dates. Please try different dates.");console.log("Room is available, creating guest info...");const{data:M,error:q}=await U.from("guest_info").insert([y.guest_info]).select().single();if(q)throw console.error("Error creating guest info:",q),q;
785console.log("Guest info created:",M.id);const{data:D,error:F}=await U.from("bookings").insert([{room_id:y.room_id,check_in:y.check_in,check_out:y.check_out,guests:y.guests,total_price:y.total_price,special_requests:y.special_requests,status:"pending",guest_info_id:M.id,user_id:null,payment_status:y.payment_status||"pending",deposit_amount:y.deposit_amount,paid_amount:y.paid_amount,omise_charge_id:y.omise_charge_id,payment_method:y.payment_method||"manual",agent_id:y.agent_id||null,attribution_source:y.attribution_source||null,referral_code_used:y.referral_code_used||null}]).select().single();if(F)throw console.error("Error creating booking:",F),F;console.log("Guest booking created successfully:",D.id);try{await f(y.room_id,y.check_in,y.check_out,D.id),console.log("Room availability updated successfully")}catch(S){console.error("Warning: Failed to update room availability:",S)}try{console.log("Starting email notification process for guest booking:",D.id);const{data:S,error:$}=await U.from("rooms").select("name").eq("id",y.room_id).single();if($&&console.error("Error fetching room data for email:",$),S){const J=Math.ceil((new Date(y.check_out).getTime()-new Date(y.check_in).getTime())/864e5);console.log("Sending customer confirmation email to:",y.guest_info.email);const V=await Yt.sendCustomerBookingConfirmation({bookingId:D.id,customerName:y.guest_info.full_name,customerEmail:y.guest_info.email,roomName:S.name,checkInDate:y.check_in,checkOutDate:y.check_out,guests:y.guests,totalPrice:y.total_price,nights:J,specialRequests:y.special_requests,bookingStatus:"pending"});console.log("Customer email result:",V?"Success":"Failed"),console.log("Sending hotel staff notification email");const R=await Yt.sendHotelStaffNotification({bookingId:D.id,customerName:y.guest_info.full_name,customerEmail:y.guest_info.email,roomName:S.name,checkInDate:y.check_in,checkOutDate:y.check_out,guests:y.guests,totalPrice:y.total_price,nights:J,specialRequests:y.special_requests,bookingStatus:"pending"});console.log("Hotel email result:",R?"Success":"Failed")}else console.warn("Cannot send emails: missing roomData")}catch(S){console.error("Failed to send email notifications:",S)}return D}catch(w){throw o(w instanceof Error?w.message:"Failed to create guest booking"),w}finally{n(!1)}},u=async y=>{n(!0),o(null);try{const{error:w}=await U.from("bookings").update({status:"cancelled"}).eq("id",y).eq("user_id",t==null?void 0:t.id);if(w)throw w;a(k=>k.map(_=>_.id===y?{..._,status:"cancelled"}:_))}catch(w){throw o(w instanceof Error?w.message:"Failed to cancel booking"),w}finally{n(!1)}},p=async(y,w,k)=>{try{console.log(`Checking availability for room ${y} from ${w} to ${k}`);const{data:_,error:M}=await U.rpc("check_room_availability",{p_room_id:y,p_check_in:w,p_check_out:k});if(M){console.warn("Database function not available, using fallback method:",M);const{data:D,error:F}=await U.from("bookings").select("id").eq("room_id",y).neq("status","cancelled").or(`and(check_in.lt.${k},check_out.gt.${w})`);if(F)throw console.error("Error checking bookings:",F),F;const{data:S,error:$}=await U.from("room_availability").select("id").eq("room_id",y).eq("is_available",!1).gte("date",w).lt("date",k);if($)throw console.error("Error checking availability:",$),$;const J=D&&D.length>0||S&&S.length>0;return console.log("Fallback availability check result:",{available:!J,bookingConflicts:(D==null?void 0:D.length)||0,availabilityConflicts:(S==null?void 0:S.length)||0}),!J}const q=_;return console.log("Availability check result:",q),q.available}catch(_){return console.error("Error checking room availability:",_),!1}},f=async(y,w,k,_)=>{try{await g(y,w,k);const q=x(w,k).map(F=>({room_id:y,date:F,is_available:!1,booking_id:_,source:"booking"})),{error:D}=await U.from("room_availability").insert(q);if(D)throw D}catch(M){console.error("Error updating room availability:",M)}},m=y=>{const w=y.getFullYear(),k=String(y.getMonth()+1).padStart(2,"0"),_=String(y.getDate()).padStart(2,"0");return`${w}-${k}-${_}`},v=y=>{const[w,k,_]=y.split("-").map(Number);return new Date(w,k-1,_)},x=(y,w)=>{const k=[],_=v(y),M=v(w);for(;_<M;)k.push(m(_)),_.setDate(_.getDate()+1);return k},g=async(y,w,k)=>{try{const{error:_}=await U.from("room_availability").delete().eq("room_id",y).gte("date",w
785).lte("date",k);_&&console.warn("Warning: Could not clear conflicting availability records:",_)}catch(_){console.warn("Warning: Error clearing conflicting availability:",_)}},j=async y=>{try{const{error:w}=await U.from("room_availability").delete().eq("room_id",y);if(w)throw w;console.log(`Reset availability for room ${y}`)}catch(w){console.error("Error resetting room availability:",w)}},b=async()=>{try{const{error:y}=await U.from("room_availability").delete().neq("id","00000000-0000-0000-0000-000000000000");if(y)throw y;console.log("Reset all room availability")}catch(y){console.error("Error resetting all room availability:",y)}},N=async y=>{try{const{data:w,error:k}=await U.from("bookings").select(` 786 *, 787 rooms:room_id ( 788 name, 789 image, 790 price_per_night 791 ) 792 `).eq("id",y).single();if(k)throw k;return w}catch(w){return o(w instanceof Error?w.message:"Failed to fetch booking"),null}},I=async(y,w)=>{var k,_,M,q;n(!0),o(null);try{const{data:D,error:F}=await U.from("bookings").update({status:w}).eq("id",y).select(` 793 *, 794 rooms:room_id ( 795 name 796 ), 797 users:user_id ( 798 email, 799 user_metadata 800 ) 801 `).single();if(F)throw F;if(w==="confirmed"&&D)try{const S=Math.ceil((new Date(D.check_out).getTime()-new Date(D.check_in).getTime())/864e5);await Yt.sendCustomerBookingConfirmation({bookingId:D.id,customerName:((_=(k=D.users)==null?void 0:k.user_metadata)==null?void 0:_.full_name)||"Guest",customerEmail:((M=D.users)==null?void 0:M.email)||"",roomName:((q=D.rooms)==null?void 0:q.name)||"Room",checkInDate:D.check_in,checkOutDate:D.check_out,guests:D.guests,totalPrice:D.total_price,nights:S,specialRequests:D.special_requests,bookingStatus:"confirmed"})}catch(S){console.error("Failed to send confirmation email:",S)}return D}catch(D){throw o(D instanceof Error?D.message:"Failed to update booking status"),D}finally{n(!1)}};return l.useEffect(()=>{t&&c()},[t]),{bookings:s,loading:r,error:i,createBooking:d,createGuestBooking:h,cancelBooking:u,updateBookingStatus:I,checkRoomAvailability:p,clearConflictingAvailability:g,resetRoomAvailability:j,resetAllRoomAvailability:b,getBooking:N,fetchBookings:c}},ra=Fl,so=Bl,Wu=Ml,ao=l.forwardRef(({className:t,...s},a)=>e.jsx(Wr,{ref:a,className:de("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));ao.displayName=Wr.displayName;const Fs=l.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Wu,{children:[e.jsx(ao,{}),e.jsxs(Kr,{ref:r,className:de("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[s,e.jsxs(Qr,{className:"absolute right-4 top-4 roun
801ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(et,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fs.displayName=Kr.displayName;const Bs=({className:t,...s})=>e.jsx("div",{className:de("flex flex-col space-y-1.5 text-center sm:text-left",t),...s});Bs.displayName="DialogHeader";const ro=({className:t,...s})=>e.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});ro.displayName="DialogFooter";const Os=l.forwardRef(({className:t,...s},a)=>e.jsx(Yr,{ref:a,className:de("text-lg font-semibold leading-none tracking-tight",t),...s}));Os.displayName=Yr.displayName;const pn=l.forwardRef(({className:t,...s},a)=>e.jsx(Jr,{ref:a,className:de("text-sm text-muted-foreground",t),...s}));pn.displayName=Jr.displayName;const Ku=({newBooking:t,onClose:s,onViewDetails:a})=>{var d,h,u;const[r,n]=l.useState(!1);l.useState(!1),l.useEffect(()=>{if(t){n(!0);const p=setTimeout(()=>{n(!1),s()},1e4);return()=>clearTimeout(p)}},[t,s]);const i=()=>{n(!1),s()},o=()=>{t&&(a(t),i())};if(!t)return null;const c=p=>{switch(p){case"confirmed":return"bg-green-100 text-green-800 border-green-200";
801case"pending":return"bg-yellow-100 text-yellow-800 border-yellow-200";case"cancelled":return"bg-red-100 text-red-800 border-red-200";case"completed":return"bg-blue-100 text-blue-800 border-blue-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}};return e.jsx(ra,{open:r,onOpenChange:n,children:e.jsxs(Fs,{className:"max-w-md bg-white border-2 border-sunset-orange/20 shadow-xl",children:[e.jsx(Bs,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:"w-10 h-10 bg-sunset-orange/10 rounded-full flex items-center justify-center",children:e.jsx(wh,{className:"h-5 w-5 text-sunset-orange"})}),e.jsx(Os,{className:"text-lg",children:"New Booking!"})]}),e.jsx(P,{variant:"ghost",size:"sm",onClick:i,className:"h-8 w-8 p-0",children:e.jsx(et,{className:"h-4 w-4"})})]})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{className:"border-sunset-orange/20 bg-sunset-orange/5 shadow-md",children:e.jsxs(K,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-lg",children:((d=t.rooms)==null?void 0:d.name)||`Room ${t.room_id}`}),e.jsx(Te,{className:c(t.status),children:t.status})]}),e.jsxs("div",{className:"space-y-2 text-sm",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-gray-500"}),e.jsxs("span",{children:[t.guests," guests"]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Re,{className:"h-4 w-4 text-gray-500"}),e.jsxs("span",{children:[new Date(t.check_in).toLocaleDateString()," - ",new Date(t.check_out).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(dn,{className:"h-4 w-4 text-gray-500"}),e.jsxs("span",{className:"font-semibold",children:["$",t.total_price]})]})]})]})}),t.users&&e.jsxs("div",{className:"text-sm bg-gray-50 p-3 rounded-lg border border-gray-200",children:[e.jsx("h4",{className:"font-medium mb-2 text-gray-900",children:"Guest Information"}),e.jsxs("div",{className:"space-y-1 text-gray-700",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Name:"})," ",t.users.full_name||((h=t.users.user_metadata)==null?void 0:h.full_name)||"Guest"]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Email:"})," ",t.users.email||"No email"]}),((u=t.users.user_metadata)==null?void 0:u.phone)&&e.jsxs("p",{children:[e.jsx("strong",{children:"Phone:"})," ",t.users.user_metadata.phone]})]})]}),t.guest_info&&e.jsxs("div",{className:"text-sm bg-gray-50 p-3 rounded-lg border border-gray-200",children:[e.jsx("h4",{className:"font-medium mb-2 text-gray-900",children:"Guest Information"}),e.jsxs("div",{className:"space-y-1 text-gray-700",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Name:"})," ",t.guest_info.full_name]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Email:"})," ",t.guest_info.email]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Phone:"})," ",t.guest_info.phone]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Location:"})," ",t.guest_info.city,", ",t.guest_info.country]})]})]}),e.jsxs("div",{className:"flex space-x-2 pt-2",children:[e.jsxs(P,{onClick:o,className:"flex-1 bg-sunset-orange hover:bg-orange-500",children:[e.jsx(Ds,{className:"h-4 w-4 mr-2"}),"View Details"]}),e.jsx(P,{onClick:i,variant:"outline",className:"flex-1",children:"Dismiss"})]}),e.jsx("div",{className:"text-center",children:e.jsxs("div",{className:"inline-flex items-center space-x-2 text-xs text-gray-500",children:[e.jsx(Ie,{className:"h-3 w-3"}),e.jsx("span",{children:"Auto-closes in 10 seconds"})]})})]})]})})};function rl(t,[s,a]){return Math.min(a,Math.max(s,t))}function fn(t){const s=l.useRef({value:t,previous:t});return l.useMemo(()=>(s.current.value!==t&&(s.current.previous=s.current.value,s.current.value=t),s.current.previous),[t])}var Qu=[" ","Enter","ArrowUp","ArrowDown"],Yu=[" ","Enter"],Ls="Select",[ur,xr,Ju]=Oc(Ls),[ca,$g]=na(Ls,[Ju,la]),gr=la(),[Xu,js]=ca(Ls),[Zu,ex]=ca(Ls),no=t=>{const{__scopeSelect:s,children:a,open:r,defaultOpen:n,onOpenChange:i,value:o,defaultValue:c,onValueChange:d,dir:h,name:u,autoComplete:p,disabled:f,required:m,form:v}=t,x=gr(s),[g,j]=l.useState(null),[b,N]=l.useState(null),[I,y]=l.useState(!1),w=qc(h),[k,_]=pa({prop:r,defaultProp:n??!1,onChange:i,caller:Ls}),[M,q]=pa({prop:o,defaultProp:c,onChange:d,caller:Ls}),D=l.useRef(null),F=g?v||!!g.closest("form"):!0,[S,$]=l.useState(new Set),J=Array.from(S).map(V=>V.props.value).join(";");return e.jsx(Rl,{...x,children:e.jsxs(Xu,{required:m,scope:s,trigger:g,onTriggerChange:j,valueNode:b,onValueNodeChange:N,valueNodeHasChildren:I,onValueNodeHasChildrenChange:y,contentId:sr(),value:M,onValueChange:q,open:k,onOpenChange:_,dir:w,triggerPointerDownPosRef:D,disabled:f,children:[e.jsx(ur.Provider,{scope:s,children:e.jsx(Zu,{scope:t.__scopeSelect,onNativeOptionAdd:l.useCallback(V=>{$(R=>new Set(R).add(V))},[]),onNativeOptionRemove:l.useCallback(V=>{$(R=>{const se=new Set(R);return se.delete(V),se})},[]),children:a})}),F?e.jsxs(Ao,{"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:p,value:M,onChange:V=>q(V.target.value),disabled:f,form:v,children:[M===void 0?e.jsx("option",{value:""}):null,Array.from(S)]},J):null]})})};no.displayName=Ls;var lo="SelectTrigger",io=l.forwardRef((t,s)=>{const{__scopeSelect:a,disabled:r=!1,...n}=t,i=gr(a),o=js(lo,a),c=o.disabled||r,d=st(s,o.onTriggerChange),h=xr(a),u=l.useRef("touch"),[p,f,m]=To(x=>{const g=h().filter(N=>!N.disabled),j=g.find(N=>N.value===o.value),b=Io(g,x,j);b!==void 0&&o.onValueChange(b.value)}),v=x=>{c||(o.onOpenChange(!0),m()),x&&(o.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return e.jsx(er,{asChild:!0,...i,children:e.jsx(Qe.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":Ro(o.value)?"":void 0,...n,ref:d,onClick:Pe(n.onClick,x=>
vendor: 15,738 bytes, line 801
801{x.currentTarget.focus(),u.current!=="mouse"&&v(x)}),onPointerDown:Pe(n.onPointerDown,x=>{u.current=x.pointerType;const g=x.target;g.hasPointerCapture(x.pointerId)&&g.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(v(x),x.preventDefault())}),onKeyDown:Pe(n.onKeyDown,x=>{const g=p.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&f(x.key),!(g&&x.key===" ")&&Qu.includes(x.key)&&(v(),x.preventDefault())})})})});io.displayName=lo;var oo="SelectValue",co=l.forwardRef((t,s)=>{const{__scopeSelect:a,className:r,style:n,children:i,placeholder:o="",...c}=t,d=js(oo,a),{onValueNodeHasChildrenChange:h}=d,u=i!==void 0,p=st(s,d.onValueNodeChange);return gs(()=>{h(u)},[h,u]),e.jsx(Qe.span,{...c,ref:p,style:{pointerEvents:"none"},children:Ro(d.value)?e.jsx(e.Fragment,{children:o}):i})});co.displayName=oo;var tx="SelectIcon",mo=l.forwardRef((t,s)=>{const{__scopeSelect:a,children:r,...n}=t;return e.jsx(Qe.span,{"aria-hidden":!0,...n,ref:s,children:r||"â¼"})});mo.displayName=tx;var sx="SelectPortal",ho=t=>e.jsx(El,{asChild:!0,...t});ho.displayName=sx;var qs="SelectContent",uo=l.forwardRef((t,s)=>{const a=js(qs,t.__scopeSelect),[r,n]=l.useState();if(gs(()=>{n(new DocumentFragment)},[]),!a.open){const i=r;return i?Xr.createPortal(e.jsx(xo,{scope:t.__scopeSelect,children:e.jsx(ur.Slot,{scope:t.__scopeSelect,children:e.jsx("div",{children:t.children})})}),i):null}return e.jsx(go,{...t,ref:s})});uo.displayName=qs;var It=10,[xo,bs]=ca(qs),ax="SelectContentImpl",rx=Al("SelectContent.RemoveScroll"),go=l.forwardRef((t,s)=>{const{__scopeSelect:a,position:r="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:i,onPointerDownOutside:o,side:c,sideOffset:d,align:h,alignOffset:u,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:v,hideWhenDetached:x,avoidCollisions:g,...j}=t,b=js(qs,a),[N,I]=l.useState(null),[y,w]=l.useState(null),k=st(s,B=>I(B)),[_,M]=l.useState(null),[q,D]=l.useState(null),F=xr(a),[S,$]=l.useState(!1),J=l.useRef(!1);l.useEffect(()=>{if(N)return Sl(N)},[N]),_l();const V=l.useCallback(B=>{const[le,...Q]=F().map(oe=>oe.ref.current),[ie]=Q.slice(-1),G=document.activeElement;for(const oe of B)if(oe===G||(oe==null||oe.scrollIntoView({block:"nearest"}),oe===le&&y&&(y.scrollTop=0),oe===ie&&y&&(y.scrollTop=y.scrollHeight),oe==null||oe.focus(),document.activeElement!==G))return},[F,y]),R=l.useCallback(()=>V([_,N]),[V,_,N]);l.useEffect(()=>{S&&R()},[S,R]);const{onOpenChange:se,triggerPointerDownPosRef:C}=b;l.useEffect(()=>{if(N){let B={x:0,y:0};const le=ie=>{var G,oe;B={x:Math.abs(Math.round(ie.pageX)-(((G=C.current)==null?void 0:G.x)??0)),y:Math.abs(Math.round(ie.pageY)-(((oe=C.current)==null?void 0:oe.y)??0))}},Q=ie=>{B.x<=10&&B.y<=10?ie.preventDefault():N.contains(ie.target)||se(!1),document.removeEventListener("pointermove",le),C.current=null};return C.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",Q,{capture:!0})}}},[N,se,C]),l.useEffect(()=>{const B=()=>se(!1);return window.addEventListener("blur",B),window.addEventListener("resize",B),()=>{window.removeEventListener("blur",B),window.removeEventListener("resize",B)}},[se]);const[Y,ne]=To(B=>{const le=F().filter(G=>!G.disabled),Q=le.find(G=>G.ref.current===document.activeElement),ie=Io(le,B,Q);ie&&setTimeout(()=>ie.ref.current.focus())}),re=l.useCallback((B,le,Q)=>{const ie=!J.current&&!Q;(b.value!==void 0&&b.value===le||ie)&&(M(B),ie&&(J.current=!0))},[b.value]),me=l.useCallback(()=>N==null?void 0:N.focus(),[N]),he=l.useCallback((B,le,Q)=>{const ie=!J.current&&!Q;(b.value!==void 0&&b.value===le||ie)&&D(B)},[b.value]),E=r==="popper"?Lr:po,ce=E===Lr?{side:c,sideOffset:d,align:h,alignOffset:u,arrowPadding:p,collisionBoundary:f,collisionPadding:m,sticky:v,hideWhenDetached:x,avoidCollisions:g}:{};return e.jsx(xo,{scope:a,content:N,viewport:y,onViewportChange:w,itemRefCallback:re,selectedItem:_,onItemLeave:me,itemTextRefCallback:he,focusSelectedItem:R,selectedItemText:q,position:r,isPositioned:S,searchRef:Y,children:e.jsx(Cl,{as:rx,allowPinchZoom:!0,children:e.jsx(Pl,{asChild:!0,trapped:b.open,onMountAutoFocus:B=>{B.preventDefault()},onUnmountAutoFocus:Pe(n,B=>{var le;(le=b.trigger)==null||le.focus({preventScroll:!0}),B.preventDefault()}),children:e.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:B=>B.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:e.jsx(E,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:B=>B.preventDefault(),...j,...ce,onPlaced:()=>$(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...j.style},onKeyDown:Pe(j.onKeyDown,B=>{const le=B.ctrlKey||B.altKey||B.metaKey;if(B.key==="Tab"&&B.preventDefault(),!le&&B.key.length===1&&ne(B.key),["ArrowUp","ArrowDown","Home","End"].includes(B.key)){let ie=F().filter(G=>!G.disabled).map(G=>G.ref.current);if(["ArrowUp","End"].includes(B.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(B.key)){const G=B.target,oe=ie.indexOf(G);ie=ie.slice(oe+1)}setTimeout(()=>V(ie)),B.preventDefault()}})})})})})})});go.displayName=ax;var nx="SelectItemAlignedPosition",po=l.forwardRef((t,s)=>{const{__scopeSelect:a,onPlaced:r,...n}=t,i=js(qs,a),o=bs(qs,a),[c,d]=l.useState(null),[h,u]=l.useState(null),p=st(s,k=>u(k)),f=xr(a),m=l.useRef(!1),v=l.useRef(!0),{viewport:x,selectedItem:g,selectedItemText:j,focusSelectedItem:b}=o,N=l.useCallback(()=>{if(i.trigger&&i.valueNode&&c&&h&&x&&g&&j){const k=i.trigger.getBoundingClientRect(),_=h.getBoundingClientRect(),M=i.valueNode.getBoundingClientRect(),q=j.getBoundingClientRect();if(i.dir!=="rtl"){const G=q.left-_.left,oe=M.left-G,xe=k.left-oe,ue=k.width+xe,Ee=Math.max(ue,_.width),ve=window.innerWidth-It,qe=rl(oe,[It,Math.max(It,ve-Ee)]);c.style.minWidth=ue+"px",c.style.left=qe+"px"}else{const G=_.right-q.right,oe=window.innerWidth-M.right-G,xe=window.innerWidth-k.right-oe,ue=k.width+xe,Ee=Math.max(ue,_.width),ve=window.innerWidth-It,qe=rl(oe,[It,Math.max(It,ve-Ee)]);c.style.minWidth=ue+"px",c.style.right=qe+"px"}const D=f(),F=window.innerHeight-It*2,S=x.scrollHeight,$=window.getComputedStyle(h),J=parseInt($.borderTopWidth,10),V=parseInt($.paddingTop,10),R=parseInt($.borderBottomWidth,10),se=parseInt($.paddingBottom,10),C=J+V+S+se+R,Y=Math.min(g.offsetHeight*5,C),ne=window.getComputedStyle(x),re=parseInt(ne.paddingTop,10),me=parseInt(ne.paddingBottom,10),he=k.top+k.height/2-It,E=F-he,ce=g.offsetHeight/2,B=g.offsetTop+ce,le=J+V+B,Q=C-le;if(le<=he){const G=D.length>0&&g===D[D.length-1].ref.current;c.style.bottom="0px";const oe=h.clientHeight-x.offsetTop-x.offsetHeight,xe=Math.max(E,ce+(G?me:0)+oe+R),ue=le+xe;c.style.height=ue+"px"}else{const G=D.length>0&&g===D[0].ref.current;c.style.top="0px";const xe=Math.max(he,J+x.offsetTop+(G?re:0)+ce)+Q;c.style.height=xe+"px",x.scrollTop=le-he+x.offsetTop}c.style.margin=`${It}px 0`,c.style.minHeight=Y+"px",c.style.maxHeight=F+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[f,i.trigger,i.valueNode,c,h,x,g,j,i.dir,r]);gs(()=>N(),[N]);const[I,y]=l.useState();gs(()=>{h&&y(window.getComputedStyle(h).zIndex)},[h]);const w=l.useCallback(k=>{k&&v.current===!0&&(N(),b==null||b(),v.current=!1)},[N,b]);return e.jsx(ix,{scope:a,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:w,children:e.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:I},children:e.jsx(Qe.div,{...n,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});po.displayName=nx;var lx="SelectPopperPosition",Lr=l.forwardRef((t,s)=>{const{__scopeSelect:a,align:r="start",collisionPadding:n=It,...i}=t,o=gr(a);return e.jsx(Vr,{...o,...i,ref:s,align:r,collisionPadding:n,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Lr.displayName=lx;var[ix,jn]=ca(qs,{}),qr="SelectViewport",fo=l.forwardRef((t,s)=>{const{__scopeSelect:a,nonce:r,...n}=t,i=bs(qr,a),o=jn(qr,a),c=st(s,i.onViewportChange),d=l.useRef(0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),e.jsx(ur.Slot,{scope:a,children:e.jsx(Qe.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:Pe(n.onScroll,h=>{const u=h.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:f}=o;if(f!=null&&f.current&&p){const m=Math.abs(d.current-u.scrollTop);if(m>0){const v=window.innerHeight-It*2,x=parseFloat(p.style.minHeight),g=parseFloat(p.style.height),j=Math.max(x,g);if(j<v){const b=j+m,N=Math.min(v,b),I=b-N;p.style.height=N+"px",p.style.bottom==="0px"&&(u.scrollTop=I>0?I:0,p.style.justifyContent="flex-end")}}}d.current=u.scrollTop})})})]})});fo.displayName=qr;var jo="SelectGroup",[ox,cx]=ca(jo),dx=l.forwardRef((t,s)=>{const{__scopeSelect:a,...r}=t,n=sr();return e.jsx(ox,{scope:a,id:n,children:e.jsx(Qe.div,{role:"group","aria-labelledby":n,...r,ref:s})})});dx.displayName=jo;var bo="SelectLabel",yo=l.forwardRef((t,s)=>{const{__scopeSelect:a,...r}=t,n=cx(bo,a);return e.jsx(Qe.div,{id:n.id,...r,ref:s})});yo.displayName=bo;var Za="SelectItem",[mx,vo]=ca(Za),No=l.forwardRef((t,s)=>{const{__scopeSelect:a,value:r,disabled:n=!1,textValue:i,...o}=t,c=js(Za,a),d=bs(Za,a),h=c.value===r,[u,p]=l.useState(i??""),[f,m]=l.useState(!1),v=st(s,b=>{var N;return(N=d.itemRefCallback)==null?void 0:N.call(d,b,r,n)}),x=sr(),g=l.useRef("touch"),j=()=>{n||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return e.jsx(mx,{scope:a,value:r,disabled:n,textId:x,isSelected:h,onItemTextChange:l.useCallback(b=>{p(N=>N||((b==null?void 0:b.textContent)??"").trim())},[]),children:e.jsx(ur.ItemSlot,{scope:a,value:r,disabled:n,textValue:u,children:e.jsx(Qe.div,{role:"option","aria-labelledby":x,"data-highlighted":f?"":void 0,"aria-selected":h&&f,"data-state":h?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...o,ref:v,onFocus:Pe(o.onFocus,()=>m(!0)),onBlur:Pe(o.onBlur,()=>m(!1)),onClick:Pe(o.onClick,()=>{g.current!=="mouse"&&j()}),onPointerUp:Pe(o.onPointerUp,()=>{g.current==="mouse"&&j()}),onPointerDown:Pe(o.onPointerDown,b=>{g.current=b.pointerType}),onPointerMove:Pe(o.onPointerMove,b=>{var N;g.current=b.pointerType,n?(N=d.onItemLeave)==null||N.call(d):g.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Pe(o.onPointerLeave,b=>{var N;b.currentTarget===document.activeElement&&((N=d.onItemLeave)==null||N.call(d))}),onKeyDown:Pe(o.onKeyDown,b=>{var I;((I=d.searchRef)==null?void 0:I.current)!==""&&b.key===" "||(Yu.includes(b.key)&&j(),b.key===" "&&b.preventDefault())})})})})});No.displayName=Za;var ga="SelectItemText",wo=l.forwardRef((t,s)=>{const{__scopeSelect:a,className:r,style:n,...i}=t,o=js(ga,a),c=bs(ga,a),d=vo(ga,a),h=ex(ga,a),[u,p]=l.useState(null),f=st(s,j=>p(j),d.onItemTextChange,j=>{var b;return(b=c.itemTextRefCallback)==null?void 0:b.call(c,j,d.value,d.disabled)}),m=u==null?void 0:u.textContent,v=l.useMemo(()=>e.jsx("option",{value:d.value,disabled:d.disabled,children:m},d.value),[d.disabled,d.value,m]),{onNativeOptionAdd:x,onNativeOptionRemove:g}=h;return gs(()=>(x(v),()=>g(v)),[x,g,v]),e.jsxs(e.Fragment,{children:[e.jsx(Qe.span,{id:d.textId,...i,ref:f}),d.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Xr.createPortal(i.children,o.valueNode):null]})});wo.displayName=ga;var ko="SelectItemIndicator",So=l.forwardRef((t,s)=>{const{__scopeSelect:a,...r}=t;return vo(ko,a).isSelected?e.jsx(Qe.span,{"aria-hidden":!0,...r,ref:s}):null});So.displayName=ko;var $r="SelectScrollUpButton",Co=l.forwardRef((t,s)=>{const a=bs($r,t.__scopeSelect),r=jn($r,t.__scopeSelect),[n,i]=l.useState(!1),o=st(s,r.onScrollButtonChange);return gs(()=>{if(a.viewport&&a.isPositioned){let c=function(){const h=d.scrollTop>0;i(h)};const d=a.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[a.viewport,a.isPositioned]),n?e.jsx(Po,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=a;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});Co.displayName=$r;var Ur="SelectScrollDownButton",_o=l.forwardRef((t,s)=>{const a=bs(Ur,t.__scopeSelect),r=jn(Ur,t.__scopeSelect),[n,i]=l.useState(!1),o=st(s,r.onScrollButtonChange);return gs(()=>{if(a.viewport&&a.isPositioned){let c=function(){const h=d.scrollHeight-d.clientHeight,u=Math.ceil(d.scrollTop)<h;i(u)};const d=a.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[a.viewport,a.isPositioned]),n?e.jsx(Po,{...t,ref:o,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=a;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});_o.displayName=Ur;var Po=l.forwardRef((t,s)=>{const{__scopeSelect:a,onAutoScroll:r,...n}=t,i=bs("SelectScrollButton",a),o=l.useRef(null),c=xr(a),d=l.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return l.useEffect(()=>()=>d(),[d]),gs(()=>{var u;const h=c().find(p=>p.ref.current===document.activeElement);(u=h==null?void 0:h.ref.current)==null||u.scrollIntoView({block:"nearest"})},[c]),e.jsx(Qe.div,{"aria-hidden":!0,...n,ref:s,style:{flexShrink:0,...n.style},onPointerDown:Pe(n.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Pe(n.onPointerMove,()=>{var h;(h=i.onItemLeave)==null||h.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Pe(n.onPointerLeave,()=>{d()})})}),hx="SelectSeparator",Eo=l.forwardRef((t,s)=>{const{__scopeSelect:a,...r}=t;return e.jsx(Qe.div,{"aria-hidden":!0,...r,ref:s})});Eo.displayName=hx;var zr="SelectArrow",ux=l.forwardRef((t,s)=>{const{__scopeSelect:a,...r}=t,n=gr(a),i=js(zr,a),o=bs(zr,a);return i.open&&o.position==="popper"?e.jsx(Gr,{...n,...r,ref:s}):null});ux.displayName=zr;var xx="SelectBubbleInput",Ao=l.forwardRef(({__scopeSelect:t,value:s,...a},r)=>{const n=l.useRef(null),i=st(r,n),o=fn(s);return l.useEffect(()=>{const c=n.current;if(!c)return;const d=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(d,"value").set;if(o!==s&&u){const p=new Event("change",{bubbles:!0});u.call(c,s),c.dispatchEvent(p)}},[o,s]),e.jsx(Qe.select,{...a,style:{...$l,...a.style},ref:i,defaultValue:s})});Ao.displayName=xx;function Ro(t){return t===""||t===void 0}function To(t){const s=Lc(t),a=l.useRef(""),r=l.useRef(0),n=l.useCallback(o=>{const c=a.current+o;s(c),function d(h){a.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>d(""),1e3))}(c)},[s]),i=l.useCallback(()=>{a.current="",window.clearTimeout(r.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),[a,n,i]}function Io(t,s,a){const n=s.length>1&&Array.from(s).every(h=>h===s[0])?s[0]:s,i=a?t.indexOf(a):-1;let o=gx(t,Math.max(i,0));n.length===1&&(o=o.filter(h=>h!==a));const d=o.find(h=>h.textValue.toLowerCase().startsWith(n.toLowerCase()));return d!==a?d:void 0}function gx(t,s){return t.map((a,r)=>
801t[(s+r)%t.length])}var px=no,Do=io,fx=co,jx=mo,bx=ho,Mo=uo,yx=fo,Fo=yo,Bo=No,vx=wo,Nx=So,Oo=Co,Lo=_o,qo=Eo;const Xt=px,Zt=fx,Ut=l.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Do,{ref:r,className:de("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(jx,{asChild:!0,children:e.jsx(Qa,{className:"h-4 w-4 opacity-50"})})]}));Ut.displayName=Do.displayName;const $o=l.forwardRef(({className:t,...s},a)=>e.jsx(Oo,{ref:a,className:de("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(kh,{className:"h-4 w-4"})}));$o.displayName=Oo.displayName;const Uo=l.forwardRef(({className:t,...s},a)=>e.jsx(Lo,{ref:a,className:de("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Qa,{className:"h-4 w-4"})}));Uo.displayName=Lo.displayName;const zt=l.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(bx,{children:e.jsxs(Mo,{ref:n,className:de("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-white text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx($o,{}),e.jsx(yx,{className:de("p-1 bg-white",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(Uo,{})]})}));zt.displayName=Mo.displayName;const wx=l.forwardRef(({className:t,...s},a)=>e.jsx(Fo,{ref:a,className:de("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));wx.displayName=Fo.displayName;const ze=l.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Bo,{ref:r,className:de("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Nx,{children:e.jsx(ln,{className:"h-4 w-4"})})}),e.jsx(vx,{children:s})]}));ze.displayName=Bo.displayName;const kx=l.forwardRef(({className:t,...s},a)=>e.jsx(qo,{ref:a,className:de("-mx-1 my-1 h-px bg-muted",t),...s}));kx.displayName=qo.displayName;const zo=l.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:de("w-full caption-bottom text-sm",t),...s})}));zo.displayName="Table";const Ho=l.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:de("[&_tr]:border-b",t),...s}));Ho.displayName="TableHeader";const Vo=l.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:de("[&_tr:last-child]:border-0",t),...s}));Vo.displayName="TableBody";const Sx=l.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:de("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Sx.displayName="TableFooter";const Ha=l.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:de("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));Ha.displayName="TableRow";const ks=l.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:de("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ks.displayName="TableHead";const os=l.forwardRef(({className:t,...s},a)=>e.jsx("td",{ref:a,className:de("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...s}));os.displayName="TableCell";const Cx=l.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:de("mt-4 text-sm text-muted-foreground",t),...s}));Cx.displayName="TableCaption";var Go="AlertDialog",[_x,Ug]=na(Go,[Ol]),as=Ol(),Wo=t=>{const{__scopeAlertDialog:s,...a}=t,r=as(s);return e.jsx(Fl,{...r,...a,modal:!0})};Wo.displayName=Go;var Px="AlertDialogTrigger",Ko=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,n=as(a);return e.jsx(Bl,{...n,...r,ref:s})});Ko.displayName=Px;var Ex="AlertDialogPortal",Qo=t=>{const{__scopeAlertDialog:s,...a}=t,r=as(s);return e.jsx(Ml,{...r,...a})};Qo.displayName=Ex;var Ax="AlertDialogOverlay",Yo=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,n=as(a);return e.jsx(Wr,{...n,...r,ref:s})});Yo.displayName=Ax;var Gs="AlertDialogContent",[Rx,Tx]=_x(Gs),Ix=gl("AlertDialogContent"),Jo=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,children:r,...n}=t,i=as(a),o=l.useRef(null),c=st(s,o),d=l.useRef(null);
801return e.jsx($c,{contentName:Gs,titleName:Xo,docsSlug:"alert-dialog",children:e.jsx(Rx,{scope:a,cancelRef:d,children:e.jsxs(Kr,{role:"alertdialog",...i,...n,ref:c,onOpenAutoFocus:Pe(n.onOpenAutoFocus,h=>{var u;h.preventDefault(),(u=d.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[e.jsx(Ix,{children:r}),e.jsx(Mx,{contentRef:o})]})})})});Jo.displayName=Gs;var Xo="AlertDialogTitle",Zo=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,n=as(a);return e.jsx(Yr,{...n,...r,ref:s})});Zo.displayName=Xo;var ec="AlertDialogDescription",tc=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,n=as(a);return e.jsx(Jr,{...n,...r,ref:s})});tc.displayName=ec;var Dx="AlertDialogAction",sc=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,n=as(a);return e.jsx(Qr,{...n,...r,ref:s})});sc.displayName=Dx;var ac="AlertDialogCancel",rc=l.forwardRef((t,s)=>{const{__scopeAlertDialog:a,...r}=t,{cancelRef:n}=Tx(ac,a),i=as(a),o=st(s,n);return e.jsx(Qr,{...i,...r,ref:o})});rc.displayName=ac;var Mx=({contentRef:t})=>{const s=`\`${Gs}\` requires a description for the component to be accessible for screen reader users. 802 803You can add a description to the \`${Gs}\` by passing a \`${ec}\` component as a child, which also benefits sighted users by adding visible context to the dialog. 804 805Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Gs}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. 806 807For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return l.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(s)},[s,t]),null},Fx=Wo,Bx=Ko,Ox=Qo,nc=Yo,lc=Jo,ic=sc,oc=rc,cc=Zo,dc=tc;const pr=Fx,Lx=Bx,qx=Ox,mc=l.forwardRef(({className:t,...s},a)=>e.jsx(nc,{className:de("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));mc.displayName=nc.displayName;const Ea=l.forwardRef(({className:t,...s},a)=>e.jsxs(qx,{children:[e.jsx(mc,{}),e.jsx(lc,{ref:a,className:de("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));Ea.displayName=lc.displayName;const Aa=({className:t,...s})=>e.jsx("div",{className:de("flex flex-col space-y-2 text-center sm:text-left",t),...s});Aa.displayName="AlertDialogHeader";const Ra=({className:t,...s})=>e.jsx("div",{className:de("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Ra.displayName="AlertDialogFooter";const Ta=l.forwardRef(({className:t,...s},a)=>e.jsx(cc,{ref:a,className:de("text-lg font-semibold",t),...s}));Ta.displayName=cc.displayName;const Ia=l.forwardRef(({className:t,...s},a)=>e.jsx(dc,{ref:a,className:de("text-sm text-muted-foreground",t),...s}));Ia.displayName=dc.displayName;const Da=l.forwardRef(({className:t,...s},a)=>e.jsx(ic,{ref:a,className:de(hn(),t),...s}));Da.displayName=ic.displayName;const Ma=l.forwardRef(({className:t,...s},a)=>e.jsx(oc,{ref:a,className:de(hn({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));Ma.displayName=oc.displayName;function $x({roomId:t,currentImageUrl:s,onUploadComplete:a,onRemove:r,folder:n="gallery",label:i="Upload Image",accept:o="image/jpeg,image/jpg,image/png,image/webp",maxSizeMB:c=50}){const[d,h]=l.useState(!1),[u,p]=l.useState(null),[f,m]=l.useState(s||null),v=l.useRef(null);l.useEffect(()=>{m(s||null)},[s]);const x=async b=>{var w;const N=(w=b.target.files)==null?void 0:w[0];if(!N)return;if(!N.type.match(/^image\/(jpeg|jpg|png|webp)$/)){p("Please select a valid image file (JPEG, PNG, or WebP)");return}const I=c*1024*1024;if(N.size>I){p(`File size must be less than ${c}
807MB`);return}const y=new FileReader;y.onloadend=()=>{m(y.result)},y.readAsDataURL(N),h(!0),p(null);try{const k=await Ei(N,t,void 0,n);k.error?(p(k.error),m(null)):(m(k.url),a(k.url,k.path))}catch(k){p(k.message||"Failed to upload image"),m(null)}finally{h(!1),v.current&&(v.current.value="")}},g=()=>{m(null),p(null),v.current&&(v.current.value=""),r&&r()},j=()=>{var b;(b=v.current)==null||b.click()};return e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:i}),e.jsx("input",{ref:v,type:"file",accept:o,onChange:x,className:"hidden",disabled:d}),f?e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"relative w-full h-48 border-2 border-gray-300 rounded-lg overflow-hidden bg-gray-100",children:[e.jsx("img",{src:f,alt:"Preview",className:"w-full h-full object-cover"}),d&&e.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:e.jsx(Ht,{className:"h-8 w-8 text-white animate-spin"})})]}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:j,disabled:d,children:[e.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Replace"]}),r&&e.jsxs(P,{type:"button",variant:"destructive",size:"sm",onClick:g,disabled:d,children:[e.jsx(et,{className:"h-4 w-4 mr-2"}),"Remove"]})]})]}):e.jsx("div",{onClick:j,className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center cursor-pointer hover:border-sunset-orange hover:bg-orange-50/50 transition-colors",children:d?e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(Ht,{className:"h-8 w-8 text-sunset-orange animate-spin mb-2"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Uploading..."})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(es,{className:"h-12 w-12 text-gray-400 mb-2"}),e.jsx("p",{className:"text-sm font-medium text-gray-700 mb-1",children:"Click to upload or drag and drop"}),e.jsxs("p",{className:"text-xs text-gray-500",children:[o," (max ",c,"MB)"]})]})}),u&&e.jsx(Se,{variant:"destructive",children:e.jsx(Ce,{children:u})})]})}function Ux({roomId:t,currentImages:s,onUploadComplete:a,onRemoveImage:r,maxImages:n=20}){const[i,o]=l.useState(!1),[c,d]=l.useState(null),h=l.useRef(null),u=async p=>{const f=Array.from(p.target.files||[]);if(f.length===0)return;if(s.length+f.length>n){d(`Maximum ${n} images allowed. Please remove some images first.`);return}const m=f.filter(v=>!(!v.type.match(/^image\/(jpeg|jpg|png|webp)$/)||v.size>50*1024*1024));if(m.length===0){d("No valid image files selected");return}o(!0),d(null);try{const v=m.map(b=>Ei(b,t,void 0,"gallery")),x=await Promise.all(v),g=x.filter(b=>!b.error),j=x.filter(b=>b.error);if(j.length>0&&d(`${j.length} image(s) failed to upload: ${j.map(b=>b.error).join(", ")}`),g.length>0){const b=g.map(I=>I.url),N=g.map(I=>I.path);a(b,N)}}catch(v){d(v.message||"Failed to upload images")}finally{o(!1),h.current&&(h.current.value="")}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(A,{children:["Gallery Images (",s.length,"/",n,")"]}),e.jsxs(P,{type:"button",variant:"outline",size:"sm",onClick:()=>{var p;return(p=h.current)==null?void 0:p.click()},disabled:i||s.length>=n,children:[e.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Add Images"]})]}),e.jsx("input",{ref:h,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp",multiple:!0,onChange:u,className:"hidden",disabled:i}),s.length>0&&e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:s.map((p,f)=>e.jsxs("div",{className:"relative group",children:[e.jsx("img",{src:p,alt:`Gallery ${f+1}`,className:"w-full h-32 object-cover rounded-lg border-2 border-gray-200"}),e.jsx(P,{type:"button",variant:"destructive",size:"sm",className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>r(f),children:e.jsx(et,{className:"h-4 w-4"})})]},f))}),i&&e.jsxs("div",{className:"text-center py-4",children:[e.jsx(Ht,{className:"h-6 w-6 text-sunset-orange animate-spin mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Uploading images..."})]}),c&&e.jsx(Se,{variant:"destructive",children:e.jsx(Ce,{children:c})}),s.length===0&&!i&&e.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center",children:[e.jsx(es,{className:"h-12 w-12 text-gray-400 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-600 mb-1",children:"No gallery images yet"}),e.jsx("p",{className:"text-xs text-gray-500",children:'Click "Add Images" to upload'})]})]})}function zx({room:t,onSave:s,onCancel:a}){const r=!!t,n=(t==null?void 0:t.id)||"new",i=L=>Array.isArray(L)?L:L==null?[]:typeof L=="string"?[L]:[],[o,c]=l.useState((t==null?void 0:t.name)||""),[d,h]=l.useState((t==null?void 0:t.shortDe
807scription)||""),[u,p]=l.useState((t==null?void 0:t.longDescription)||""),[f,m]=l.useState((t==null?void 0:t.price)||""),[v,x]=l.useState((t==null?void 0:t.pricePerNight)||0),[g,j]=l.useState((t==null?void 0:t.image)||""),[b,N]=l.useState((t==null?void 0:t.imageStoragePath)||""),[I,y]=l.useState(i(t==null?void 0:t.gallery)),[w,k]=l.useState(i(t==null?void 0:t.galleryStoragePaths)),[_,M]=l.useState((t==null?void 0:t.maxGuests)||2),[q,D]=l.useState((t==null?void 0:t.bedrooms)||1),[F,S]=l.useState((t==null?void 0:t.bathrooms)||1),[$,J]=l.useState((t==null?void 0:t.size)||""),[V,R]=l.useState((t==null?void 0:t.rating)||0),[se,C]=l.useState((t==null?void 0:t.location)||""),[Y,ne]=l.useState((t==null?void 0:t.view)||""),[re,me]=l.useState(i(t==null?void 0:t.amenities)),[he,E]=l.useState(""),[ce,B]=l.useState(i(t==null?void 0:t.features)),[le,Q]=l.useState(""),[ie,G]=l.useState(i(t==null?void 0:t.bedConfiguration)),[oe,xe]=l.useState(""),[ue,Ee]=l.useState(i(t==null?void 0:t.policies)),[ve,qe]=l.useState(""),[tt,He]=l.useState(i(t==null?void 0:t.includedServices)),[at,rt]=l.useState(""),[te,fe]=l.useState(i(t==null?void 0:t.additionalServices)),[Fe,Ve]=l.useState(""),[De,T]=l.useState(i(t==null?void 0:t.nearbyAttractions)),[pe,Ne]=l.useState(""),[$e,Ct]=l.useState(i(t==null?void 0:t.specialOffers)),[_t,Bt]=l.useState(""),[H,ye]=l.useState((t==null?void 0:t.checkIn)||"3:00 PM"),[Me,wt]=l.useState((t==null?void 0:t.checkOut)||"11:00 AM"),[Pt,ys]=l.useState((t==null?void 0:t.cancellationPolicy)||""),[rs,Us]=l.useState((t==null?void 0:t.isActive)!==void 0?t.isActive:!0),[yt,Ot]=l.useState((t==null?void 0:t.depositType)||"none"),[Ba,ge]=l.useState((t==null?void 0:t.depositPercentage)||null),[Ae,Ue]=l.useState((t==null?void 0:t.depositFixedAmount)||null),[mt,pt]=l.useState(!1),[Et,At]=l.useState(null),Be=(L,we,Rt,Gt)=>{Rt.trim()&&(we([...L,Rt.trim()]),Gt(""))},nt=(L,we,Rt)=>{we(L.filter((Gt,Ac)=>Ac!==Rt))},Cc=(L,we)=>{j(L),N(we)},_c=(L,we)=>{y([...I,...L]),k([...w,...we])},Pc=L=>{y(I.filter((we,Rt)=>Rt!==L)),k(w.filter((we,Rt)=>Rt!==L))},Ec=async L=>{L.preventDefault(),At(null),pt(!0);try{const we={name:o,shortDescription:d,longDescription:u,price:f,pricePerNight:v,image:g,image_storage_path:g||void 0,gallery:I,gallery_storage_paths:I.length>0?I:void 0,amenities:re,capacity:`${_} guests`,maxGuests:_,bedrooms:q,bathrooms:F,size:$,rating:V,location:se,view:Y,bedConfiguration:ie,features:ce,policies:ue,checkIn:H,checkOut:Me,cancellationPolicy:Pt,includedServices:tt,additionalServices:te,nearbyAttractions:De,specialOffers:$e.length>0?$e:void 0,isActive:rs,depositType:yt,depositPercentage:yt==="percentage"?Ba:null,depositFixedAmount:yt==="fixed"?Ae:null},Rt=Xh(we);let Gt;r&&t?Gt=await Pi(t.id,Rt):Gt=await Zh(Rt),Gt.error?At(Gt.error):Gt.data&&s(Gt.data)}catch(we){At(we.message||"An unexpected error occurred")}finally{pt(!1)}};return e.jsxs("form",{onSubmit:Ec,className:"space-y-6",children:[Et&&e.jsxs(Se,{variant:"destructive",children:[e.jsx(ps,{className:"h-4 w-4"}),e.jsx(Ce,{children:Et})]}),e.jsxs(_a,{defaultValue:"basic",className:"w-full",children:[e.jsxs(oa,{className:"grid w-full grid-cols-5",children:[e.jsx(Oe,{value:"basic",children:"Basic"}),e.jsx(Oe,{value:"images",children:"Images"}),e.jsx(Oe,{value:"specs",children:"Specs"}),e.jsx(Oe,{value:"details",children:"Details"}),e.jsx(Oe,{value:"policies",children:"Policies"})]}),e.jsxs(Le,{value:"basic",className:"space-y-4",children:[e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Basic Information"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"name",children:"Room Name *"}),e.jsx(W,{id:"name",value:o,onChange:L=>c(L.target.value),required:!0,placeholder:"e.g., Deluxe Sea View Room"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"shortDescription",children:"Short Description *"}),e.jsx(Is,{id:"shortDescription",value:d,onChange:L=>h(L.target.value),required:!0,rows:2,placeholder:"Brief description for listings"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"longDescription",children:"Long Description"}),e.jsx(Is,{id:"longDescription",value:u,onChange:L=>p(L.target.value),rows:6,placeholder:"Detailed description of the room"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"price",children:"Display Price"}),e.jsx(W,{id:"price",value:f,onChange:L=>m(L.target.value),placeholder:"฿12,500/night"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"pricePerNight",children:"Price Per Night (THB) *"}
807),e.jsx(W,{id:"pricePerNight",type:"number",value:v,onChange:L=>x(Number(L.target.value)),required:!0,min:"0",step:"0.01"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"isActive",checked:rs,onChange:L=>Us(L.target.checked),className:"rounded"}),e.jsx(A,{htmlFor:"isActive",children:"Room is active (visible to guests)"})]})]})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Deposit Configuration"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"depositType",children:"Deposit Type *"}),e.jsxs(Xt,{value:yt,onValueChange:L=>{Ot(L),L!=="percentage"&&ge(null),L!=="fixed"&&Ue(null)},children:[e.jsx(Ut,{id:"depositType",children:e.jsx(Zt,{placeholder:"Select deposit type"})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"none",children:"No Deposit"}),e.jsx(ze,{value:"full",children:"Full Amount"}),e.jsx(ze,{value:"half",children:"Half Amount (50%)"}),e.jsx(ze,{value:"percentage",children:"Custom Percentage"}),e.jsx(ze,{value:"fixed",children:"Fixed Amount"})]})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Configure how much deposit is required when booking this room"})]}),yt==="percentage"&&e.jsxs("div",{children:[e.jsx(A,{htmlFor:"depositPercentage",children:"Deposit Percentage *"}),e.jsx(W,{id:"depositPercentage",type:"number",value:Ba||"",onChange:L=>ge(Number(L.target.value)),min:"0",max:"100",step:"0.01",placeholder:"e.g., 30"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Percentage of total booking amount (0-100)"})]}),yt==="fixed"&&e.jsxs("div",{children:[e.jsx(A,{htmlFor:"depositFixedAmount",children:"Fixed Deposit Amount (THB) *"}),e.jsx(W,{id:"depositFixedAmount",type:"number",value:Ae||"",onChange:L=>Ue(Number(L.target.value)),min:"0",step:"0.01",placeholder:"e.g., 5000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Fixed amount in Thai Baht (will not exceed total booking amount)"})]})]})]})]}),e.jsx(Le,{value:"images",className:"space-y-4",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Room Images"})}),e.jsxs(K,{className:"space-y-6",children:[e.jsx("div",{children:e.jsx($x,{roomId:n,currentImageUrl:g,onUploadComplete:Cc,folder:"main",label:"Main Room Image"})}),e.jsx("div",{children:e.jsx(Ux,{roomId:n,currentImages:I,onUploadComplete:_c,onRemoveImage:Pc,maxImages:20})})]})]})}),e.jsx(Le,{value:"specs",className:"space-y-4",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Room Specifications"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"maxGuests",children:"Max Guests *"}),e.jsx(W,{id:"maxGuests",type:"number",value:_,onChange:L=>M(Number(L.target.value)),required:!0,min:"1"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"bedrooms",children:"Bedrooms *"}),e.jsx(W,{id:"bedrooms",type:"number",value:q,onChange:L=>D(Number(L.target.value)),required:!0,min:"1"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"bathrooms",children:"Bathrooms *"}),e.jsx(W,{id:"bathrooms",type:"number",value:F,onChange:L=>S(Number(L.target.value)),required:!0,min:"1"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"size",children:"Size"}),e.jsx(W,{id:"size",value:$,onChange:L=>J(L.target.value),placeholder:"e.g., 45 sqm"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"rating",children:"Rating"}),e.jsx(W,{id:"rating",type:"number",value:V,onChange:L=>R(Number(L.target.value)),min:"0",max:"5",step:"0.1"})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"location",children:"Location"}),e.jsx(W,{id:"location",value:se,onChange:L=>C(L.target.value),placeholder:"e.g., Beachfront, Ocean View"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"view",children:"View"}),e.jsx(W,{id:"view",value:Y,onChange:L=>ne(L.target.value),placeholder:"e.g., Panoramic Ocean View"})]}),e.jsxs("div",{children:[e.jsx(A,{children:"Bed Configuration"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:oe,onChange:L=>xe(L.target.value),placeholder:"e.g., 1 King Bed",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(ie,G,oe,xe))}}),e.jsx(P,{type:"button",onClick:()=>Be(ie,G,oe,xe),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ie.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(ie,G,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]})]})]})}),e.jsx(Le,{value:"details",className:"space-y-4",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Amenities & Features"})}),e.jsxs(K,{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(A,{children:"Amenities"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:he,onCh
807ange:L=>E(L.target.value),placeholder:"e.g., Free WiFi, Air Conditioning",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(re,me,he,E))}}),e.jsx(P,{type:"button",onClick:()=>Be(re,me,he,E),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:re.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(re,me,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]}),e.jsxs("div",{children:[e.jsx(A,{children:"Features"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:le,onChange:L=>Q(L.target.value),placeholder:"e.g., Private Balcony, Ocean View",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(ce,B,le,Q))}}),e.jsx(P,{type:"button",onClick:()=>Be(ce,B,le,Q),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ce.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(ce,B,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]}),e.jsxs("div",{children:[e.jsx(A,{children:"Included Services"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:at,onChange:L=>rt(L.target.value),placeholder:"e.g., Daily housekeeping, Welcome drink",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(tt,He,at,rt))}}),e.jsx(P,{type:"button",onClick:()=>Be(tt,He,at,rt),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:tt.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(tt,He,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]}),e.jsxs("div",{children:[e.jsx(A,{children:"Additional Services"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:Fe,onChange:L=>Ve(L.target.value),placeholder:"e.g., Room service, Airport transfer",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(te,fe,Fe,Ve))}}),e.jsx(P,{type:"button",onClick:()=>Be(te,fe,Fe,Ve),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:te.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(te,fe,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]}),e.jsxs("div",{children:[e.jsx(A,{children:"Nearby Attractions"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:pe,onChange:L=>Ne(L.target.value),placeholder:"e.g., Beach (100m), Restaurant (50m)",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(De,T,pe,Ne))}}),e.jsx(P,{type:"button",onClick:()=>Be(De,T,pe,Ne),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:De.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(De,T,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]}),e.jsxs("div",{children:[e.jsx(A,{children:"Special Offers (Optional)"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:_t,onChange:L=>Bt(L.target.value),placeholder:"e.g., 10% off for stays over 7 nights",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be($e,Ct,_t,Bt))}}),e.jsx(P,{type:"button",onClick:()=>Be($e,Ct,_t,Bt),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:$e.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt($e,Ct,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]})]})]})}),e.jsx(Le,{value:"policies",className:"space-y-4",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Policies & Rules"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"checkIn",children:"Check-in Time"}),e.jsx(W,{id:"checkIn",value:H,onChange:L=>ye(L.target.value),placeholder:"e.g., 3:00 PM"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"checkOut",children:"Check-out Time"}),e.jsx(W,{id:"checkOut",value:Me,onChange:L=>wt(L.target.value),placeholder:"e.g., 11:00 AM"})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"cancellationPolicy",children:"Cancellation Policy"}
807),e.jsx(Is,{id:"cancellationPolicy",value:Pt,onChange:L=>ys(L.target.value),rows:3,placeholder:"e.g., Free cancellation up to 7 days before arrival"})]}),e.jsxs("div",{children:[e.jsx(A,{children:"House Rules & Policies"}),e.jsxs("div",{className:"flex gap-2 mb-2",children:[e.jsx(W,{value:ve,onChange:L=>qe(L.target.value),placeholder:"e.g., No smoking, No pets allowed",onKeyPress:L=>{L.key==="Enter"&&(L.preventDefault(),Be(ue,Ee,ve,qe))}}),e.jsx(P,{type:"button",onClick:()=>Be(ue,Ee,ve,qe),children:e.jsx(ut,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ue.map((L,we)=>e.jsxs("div",{className:"flex items-center gap-2 bg-gray-100 px-3 py-1 rounded",children:[e.jsx("span",{className:"text-sm",children:L}),e.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>nt(ue,Ee,we),children:e.jsx(et,{className:"h-3 w-3"})})]},we))})]})]})]})})]}),e.jsxs("div",{className:"flex justify-end gap-4 pt-4 border-t",children:[e.jsx(P,{type:"button",variant:"outline",onClick:a,disabled:mt,children:"Cancel"}),e.jsx(P,{type:"submit",disabled:mt,children:mt?e.jsxs(e.Fragment,{children:[e.jsx(Ht,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Oh,{className:"h-4 w-4 mr-2"}),r?"Update Room":"Create Room"]})})]})]})}function Hx({onRoomSelect:t}){const{rooms:s,loading:a,error:r,refetch:n}=mr(!0),[i,o]=l.useState(""),[c,d]=l.useState(null),[h,u]=l.useState(!1),[p,f]=l.useState(null),[m,v]=l.useState(null),[x,g]=l.useState(null),j=s.filter(k=>{var _,M;return k.name.toLowerCase().includes(i.toLowerCase())||((_=k.location)==null?void 0:_.toLowerCase().includes(i.toLowerCase()))||((M=k.shortDescription)==null?void 0:M.toLowerCase().includes(i.toLowerCase()))}),b=()=>{d(null),u(!0)},N=k=>{d(k),u(!0)},I=async k=>{v(`delete-${k.id}`),g(null);const _=await eu(k.id);_.error?(g(`Error: ${_.error}`),setTimeout(()=>g(null),5e3)):(g("Room deleted successfully"),setTimeout(()=>g(null),3e3),n()),v(null),f(null)},y=async k=>{v(`toggle-${k.id}`),g(null);const _=await tu(k.id,!k.isActive);_.error?(g(`Error: ${_.error}`),setTimeout(()=>g(null),5e3)):(g(`Room ${k.isActive?"deactivated":"activated"} successfully`),setTimeout(()=>g(null),3e3),n()),v(null)},w=k=>{u(!1);const _=c!==null;d(null),g(_?"Room updated successfully":"Room created successfully"),setTimeout(()=>g(null),3e3),n(),t&&t(k)};return a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(bt,{className:"h-8 w-8 animate-spin text-sunset-orange"})}):r?e.jsxs(Se,{variant:"destructive",children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(Ce,{children:r})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Room Management"}),e.jsx("p",{className:"text-gray-600",children:"Manage all rooms and their details"})]}),e.jsxs(ra,{open:h,onOpenChange:u,children:[e.jsx(so,{asChild:!0,children:e.jsxs(P,{onClick:b,children:[e.jsx(ut,{className:"h-4 w-4 mr-2"}),"Add New Room"]})}),e.jsxs(Fs,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[e.jsxs(Bs,{children:[e.jsx(Os,{children:c?"Edit Room":"Create New Room"}),e.jsx(pn,{children:c?"Update room information and images":"Add a new room to the system"})]}),e.jsx(zx,{room:c||void 0,onSave:w,onCancel:()=>{u(!1),d(null)}})]})]})]}),x&&e.jsx(Se,{className:"border-green-200 bg-green-50",children:e.jsx(Ce,{className:"text-green-800",children:x})}),e.jsxs("div",{className:"relative",children:[e.jsx(Ni,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{placeholder:"Search rooms by name, location, or description...",value:i,onChange:k=>o(k.target.value),className:"pl-10"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(z,{children:e.jsxs(K,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold",children:s.length}),e.jsx("div",{className:"text-sm text-gray-600",children:"Total Rooms"})]})}),e.jsx(z,{children:e.jsxs(K,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:s.filter(k=>k.isActive).length}),e.jsx("div",{className:"text-sm text-gray-600",children:"Active Rooms"})]})}),e.jsx(z,{children:e.jsxs(K,{className:"pt-6",children:[e.jsx("div",{className:"text-2xl font-bold text-gray-400",children:s.filter(k=>!k.isActive).length}),e.jsx("div",{className:"text-sm text-gray-600",children:"Inactive Rooms"})]})})]}),e.jsx(z,{children:e.jsx(K,{className:"p-0",children:e.jsxs(zo,{children:[e.jsx(Ho,{children:e.jsxs(Ha,{children:[e.jsx(ks,{children:"Room"}),e.jsx(ks,{children:"Location"}),e.jsx(ks,{children:"Price"}),e.jsx(ks,{children:"Guests"}),e.jsx(ks,{children:"Status"}),e.jsx(ks,{className:"text-right",children:"Actions"})]})}),e.jsx(Vo,{children:j.length===0?e.jsx(Ha,{children:e.jsx(os,{colSpan:6,className:"text-center py-8 text-gray-500",children:i?"No rooms found matching your search":"No rooms found. Create your first room!"})}):j.map(k=>e.jsxs(Ha,{children:[e.jsx(os,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:k.image||"/placeholder.svg",alt:k.name,className:"w-16 h-16 object-cover rounded-lg",onError:_=>{_.target.src="/placeholder.svg"}}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:k.name}),e.jsx("div",{className:"text-sm text-gray-500 line-clamp-1",children:k.shortDescription})]})]})}),e.jsx(os,{children:k.location||"-"}),e.jsxs(os,{children:[e.jsx("div",{className:"font-medium",children:k.price}),k.pricePerNight&&e.jsxs("div",{className:"text-sm text-gray-500",children:["฿",k.pricePerNight.toLocaleStr
807ing(),"/night"]})]}),e.jsxs(os,{children:[e.jsxs("div",{children:[k.maxGuests," guests"]}),e.jsxs("div",{className:"text-sm text-gray-500",children:[k.bedrooms," bed, ",k.bathrooms," bath"]})]}),e.jsx(os,{children:e.jsx(Te,{variant:k.isActive?"default":"secondary",className:k.isActive?"bg-green-100 text-green-800":"",children:k.isActive?"Active":"Inactive"})}),e.jsx(os,{className:"text-right",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>y(k),disabled:m===`toggle-${k.id}`,title:k.isActive?"Deactivate":"Activate",children:m===`toggle-${k.id}`?e.jsx(bt,{className:"h-4 w-4 animate-spin"}):k.isActive?e.jsx(Rr,{className:"h-4 w-4"}):e.jsx(Ds,{className:"h-4 w-4"})}),e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>N(k),children:e.jsx(wi,{className:"h-4 w-4"})}),e.jsxs(pr,{children:[e.jsx(Lx,{asChild:!0,children:e.jsx(P,{variant:"ghost",size:"sm",onClick:()=>f(k),children:e.jsx(Sa,{className:"h-4 w-4 text-red-600"})})}),e.jsxs(Ea,{children:[e.jsxs(Aa,{children:[e.jsx(Ta,{children:"Delete Room"}),e.jsxs(Ia,{children:['Are you sure you want to delete "',k.name,'"? This action cannot be undone. All bookings associated with this room will also be affected.']})]}),e.jsxs(Ra,{children:[e.jsx(Ma,{children:"Cancel"}),e.jsx(Da,{onClick:()=>I(k),className:"bg-red-600 hover:bg-red-700",disabled:m===`delete-${k.id}`,children:m===`delete-${k.id}`?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})]})]})})]},k.id))})]})})})]})}var fr="Switch",[Vx,zg]=na(fr),[Gx,Wx]=Vx(fr),hc=l.forwardRef((t,s)=>{const{__scopeSwitch:a,name:r,checked:n,defaultChecked:i,required:o,disabled:c,value:d="on",onCheckedChange:h,form:u,...p}=t,[f,m]=l.useState(null),v=st(s,N=>m(N)),x=l.useRef(!1),g=f?u||!!f.closest("form"):!0,[j,b]=pa({prop:n,defaultProp:i??!1,onChange:h,caller:fr});return e.jsxs(Gx,{scope:a,checked:j,disabled:c,children:[e.jsx(Qe.button,{type:"button",role:"switch","aria-checked":j,"aria-required":o,"data-state":pc(j),"data-disabled":c?"":void 0,disabled:c,value:d,...p,ref:v,onClick:Pe(t.onClick,N=>{b(I=>!I),g&&(x.current=N.isPropagationStopped(),x.current||N.stopPropagation())})}),g&&e.jsx(gc,{control:f,bubbles:!x.current,name:r,value:d,checked:j,required:o,disabled:c,form:u,style:{transform:"translateX(-100%)"}})]})});hc.displayName=fr;var uc="SwitchThumb",xc=l.forwardRef((t,s)=>{const{__scopeSwitch:a,...r}=t,n=Wx(uc,a);return e.jsx(Qe.span,{"data-state":pc(n.checked),"data-disabled":n.disabled?"":void 0,...r,ref:s})});xc.displayName=uc;var Kx="SwitchBubbleInput",gc=l.forwardRef(({__scopeSwitch:t,control:s,checked:a,bubbles:r=!0,...n},i)=>{const o=l.useRef(null),c=st(o,i),d=fn(a),h=Ll(s);return l.useEffect(()=>{const u=o.current;if(!u)return;const p=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(p,"checked").set;if(d!==a&&m){const v=new Event("click",{bubbles:r});m.call(u,a),u.dispatchEvent(v)}},[d,a,r]),e.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...n,tabIndex:-1,ref:c,style:{...n.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});gc.displayName=Kx;function pc(t){return t?"checked":"unchecked"}var fc=hc,Qx=xc;const Fa=l.forwardRef(({className:t,...s},a)=>e.jsx(fc,{className:de("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:a,children:e.jsx(Qx,{className:de("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Fa.displayName=fc.displayName;const za=t=>({roomId:t,channel:"Airbnb",customName:"",url:"",enabled:!0,saving:!1});function Yx(t){return t.channel==="Custom / PMS"?t.customName.trim()||"Custom / PMS":t.channel}function Jx(t){switch(t){case"Airbnb":return"Airbnb â Listing â Calendar â Availability â Connect calendars â copy export link";case"Booking.com":return"Booking.com Extranet â Rates & Availability â Sync calendars â Export calendar";case"Agoda":return"Agoda YCS â Calendar â Export / Sync calendar (iCal) â copy link";case"VRBO":return"VRBO â Calendar â Import/export calendars â copy export iCal URL";case"Expedia":return"Expedia Partner Central â Availability â Calendar sync â export iCal";case"HotelRunner":case"Cloudbeds":return`${t} â Calendar / Channel manager â Export iCal URL for this room`;default:return"Any PMS or desktop reservation system that exports an .ics / iCal URL (e.g. Opera, Mews, little Hotelier, local PC software)"}}function Xx(){const[t,s]=l.useState([]),[a,r]=l.useState([]),[n,i]=l.useState(!0),[o,c]=l.useState(null),[d,h]=l.useState(null),[u,p]=l.useState(null),[f,m]=l.useState(!1),[v,x]=l.useState(null),[g,j]=l.useState(null),[b,N]=l.useState({}),[I,y]=l.useState("all"),w=l.useCallback(async()=>{i(!0),h(null);const[C,Y]=await Promise.all([sl(),Du()]);if(C.error){h(C.error),i(!1);return}if(Y.error){h(Y.error),i(!1);return}const ne=C.data??[];for(const he of ne)he.ical_export_token||await Mu(he.room_id);const me=(ne.some(he=>!he.ical_export_token)?await sl():C).data??ne;s(me),r(Y.data??[]),N(he=>{const E={};for(const ce of me)E[ce.room_id]=he[ce.room_id]??za(ce.room_id);return E}),i(!1)},[]);l.useEffect(()=>{w()},[w]);const k=l.useMemo(()=>{const C=new Map;for(const Y of a){const ne=C.get(Y.room_id)??[];ne.push(Y),C.set(Y.room_id,ne)}return C},[a]),_=l.useMemo(()=>I==="all"?t:t.filter(C=>String(C.room_id)===I),[t,I]),M=a.filter(C=>C.enabled).length,q=async(C,Y)=>{try{await navigator.clipboard.writeText(Y),p(C),setTimeout(()=>p(null),2e3)}catch{h("Could not copy to clipboard")}},D=(C,Y)=>{N(ne=>({...ne,[C]:{...ne[C]??za(C),...Y}}))},F=async C=>{const Y=b[C]??za(C),ne=Yx(Y);if(Y.channel==="Custom / PMS"&&!Y.customName.trim()){h("Enter a name for the custom / PMS channel (e.g. Front desk PC, Opera)");return}if(!Y.url.trim()){h("Paste the channel export calendar URL (.ics)");return}if((k.get(C)??[]).some(he=>he.name.toLowerCase()===ne.toLowerCase())){h(`This room already has a "${ne}" calendar. Edit or remove it first.`);return}D(C,{saving:!0}),h(null),c(null);const{error:me}=await Bu({roomId:C,name:ne,icalUrl:Y.url,enabled:Y.enabled});if(me){h(me),D(C,{saving:!1});return}c(`${ne} calendar connected`),D(C,{saving:!1,url:"",customName:"",channel:"Airbnb",enabled:!0}),await w()},S=async(C,Y)=>{h(null),c(null);const{error:ne}=await al(C.id,{enabled:Y});if(ne){h(ne);return}c(`${C.name} ${Y?"enabled":"disabled"}`),await w()},$=async(C,Y)=>{if(!Y.trim()){h("Calendar URL cannot be empty");return}h(null),c(null);const{error:ne}=await al(C.id,{ical_url:Y});if(ne){h(ne);return}c(`${C.name} URL updated`),await w()},J=async C=>{h(null),c(null);const{error:Y}=await Ou(C.id);if(Y){h(Y);return}c(`${C.name} removed. Its blocked nights clear on the next sync.`),await w()},V=async C=>{j(C.id),h(null),c(null);const Y=await Nr({sourceId:C.id});Y.success?c(`Synced ${C.name}`):h(Y.error||"Sync failed"),j(null),await w()},R=async C=>{x(C),h(null),c(null);const Y=await Nr({roomId:C});Y.success?c("All channels for this room synced"):h(Y.error||"Sync failed"),x(null),await w()},se=async()=>{m(!0),h(null),c(null);const C=await Nr();C.success?c("All enabled channel calendars synced"):h(C.error||"Sync failed"),m(!1),await w()};return n?e.jsx(z,{children:e.jsx(K,{className:"py-10 text-center text-muted-foreground",children:"Loading c
807alendar channelsâ¦"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs(z,{children:[e.jsxs(X,{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{children:[e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(Rh,{className:"h-5 w-5"}),"Channel calendar sync"]}),e.jsx(ke,{className:"mt-2 max-w-3xl",children:"Connect any booking channel that exports an iCal (.ics) feed â Airbnb, Booking.com, Agoda, VRBO, Expedia, cloud PMS tools, or desktop reservation software. Inbound feeds block nights on this site. Copy each room's export URL into those channels so site bookings block them too. Sync is pull-based (usually minutes to a few hours)."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(Te,{variant:"secondary",children:[M," active feeds"]}),e.jsxs(Te,{variant:"outline",children:[t.length," rooms"]})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(Xt,{value:I,onValueChange:y,children:[e.jsx(Ut,{className:"w-[220px]",children:e.jsx(Zt,{placeholder:"Filter room"})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"all",children:"All rooms"}),t.map(C=>e.jsx(ze,{value:String(C.room_id),children:C.name},C.room_id))]})]}),e.jsxs(P,{onClick:se,disabled:f||a.length===0,children:[e.jsx(bt,{className:`mr-2 h-4 w-4 ${f?"animate-spin":""}`}),"Sync all channels"]})]})]}),e.jsxs(K,{className:"space-y-2 text-sm text-muted-foreground",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Setup (per channel)"}),e.jsxs("ol",{className:"list-decimal list-inside space-y-1",children:[e.jsxs("li",{children:["In the OTA/PMS, open calendar sync and copy the ",e.jsx("strong",{children:"export"})," iCal URL"]}),e.jsx("li",{children:"Add it below under the matching room and channel name, then save"}),e.jsxs("li",{children:["Copy this site's ",e.jsx("strong",{children:"export URL"})," and import it in that same OTA/PMS"]}),e.jsx("li",{children:"Click Sync now (or wait for the scheduled pull)"})]}),e.jsxs("p",{className:"pt-1",children:["Desktop reservation systems: if they can publish or export an .ics URL (or a public calendar file URL), add them as ",e.jsx("strong",{children:"Custom / PMS"}),". If they only import calendars, use this site's export URL so their PC calendar sees direct bookings."]})]})]}),o&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-700"}),e.jsx(Ce,{className:"text-green-800",children:o})]}),d&&e.jsxs(Se,{variant:"destructive",children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(Ce,{children:d})]}),_.length===0?e.jsx(z,{children:e.jsx(K,{className:"py-8 text-center text-muted-foreground",children:"No rooms found. Add rooms first."})}):_.map(C=>{const Y=k.get(C.room_id)??[],ne=b[C.room_id]??za(C.room_id);return e.jsxs(z,{children:[e.jsx(X,{children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(Z,{className:"text-lg",children:C.name}),e.jsx(ke,{children:Y.length===0?"No channels connected":`${Y.length} channel${Y.length===1?"":"s"}`})]}),e.jsxs(P,{variant:"secondary",size:"sm",onClick:()=>R(C.room_id),disabled:v===C.room_id||Y.length===0,children:[e.jsx(bt,{className:`mr-2 h-4 w-4 ${v===C.room_id?"animate-spin":""}`}),"Sync room"]})]})}),e.jsxs(K,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Site export URL (import this into every channel)"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(W,{readOnly:!0,value:C.export_url,className:"font-mono text-xs"}),e.jsx(P,{type:"button",variant:"outline",onClick:()=>q(`export-${C.room_id}`,C.export_url),disabled:!C.export_url,children:u===`export-${C.room_id}`?e.jsx(gt,{className:"h-4 w-4"}):e.jsx(cn,{className:"h-4 w-4"})})]})]}),Y.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsx(A,{children:"Connected inbound calendars"}),Y.map(re=>e.jsx(Zx,{source:re,syncing:g===re.id,copiedKey:u,onCopy:q,onToggle:me=>S(re,me),onSaveUrl:me=>$(re,me),onSync:()=>V(re),onRemove:()=>J(re)}
807,re.id))]}),e.jsxs("div",{className:"rounded-lg border border-dashed p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsx(ut,{className:"h-4 w-4"}),"Add channel calendar"]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Channel"}),e.jsxs(Xt,{value:ne.channel,onValueChange:re=>D(C.room_id,{channel:re}),children:[e.jsx(Ut,{children:e.jsx(Zt,{})}),e.jsx(zt,{children:Fu.map(re=>e.jsx(ze,{value:re,children:re},re))})]})]}),ne.channel==="Custom / PMS"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Custom name"}),e.jsx(W,{placeholder:"e.g. Front desk PC, Opera, Mews",value:ne.customName,onChange:re=>D(C.room_id,{customName:re.target.value})})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:Jx(ne.channel)}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Export calendar URL from that channel"}),e.jsx(W,{placeholder:"https://â¦/â¦.ics",value:ne.url,onChange:re=>D(C.room_id,{url:re.target.value})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fa,{checked:ne.enabled,onCheckedChange:re=>D(C.room_id,{enabled:re}),id:`new-enabled-${C.room_id}`}),e.jsx(A,{htmlFor:`new-enabled-${C.room_id}`,children:"Enabled after save"})]}),e.jsx(P,{onClick:()=>F(C.room_id),disabled:ne.saving,children:ne.saving?"Savingâ¦":"Add channel"})]})]})]},C.room_id)})]})}function Zx({source:t,syncing:s,copiedKey:a,onCopy:r,onToggle:n,onSaveUrl:i,onSync:o,onRemove:c}){const[d,h]=l.useState(t.ical_url),u=d.trim()!==t.ical_url;return l.useEffect(()=>{h(t.ical_url)},[t.ical_url]),e.jsxs("div",{className:"rounded-lg border p-3 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsx(Te,{variant:t.enabled?"default":"secondary",children:t.enabled?"Enabled":"Disabled"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fa,{checked:t.enabled,onCheckedChange:n,id:`src-enabled-${t.id}`}),e.jsx(A,{htmlFor:`src-enabled-${t.id}`,className:"text-sm",children:"Sync"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(W,{value:d,onChange:p=>h(p.target.value),className:"font-mono text-xs"}),e.jsx(P,{type:"button",variant:"outline",onClick:()=>r(`src-${t.id}`,d),children:a===`src-${t.id}`?e.jsx(gt,{className:"h-4 w-4"}):e.jsx(cn,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("div",{children:["Last sync:"," ",t.last_synced_at?new Date(t.last_synced_at).toLocaleString():"Never"]}),t.last_error&&e.jsxs("div",{className:"text-red-600",children:["Last error: ",t.last_error]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[u&&e.jsx(P,{size:"sm",onClick:()=>i(d),children:"Save URL"}),e.jsxs(P,{size:"sm",variant:"secondary",onClick:o,disabled:s||!t.enabled,children:[e.jsx(bt,{className:`mr-2 h-3 w-3 ${s?"animate-spin":""}`}),"Sync"]}),e.jsxs(P,{size:"sm",variant:"outline",onClick:c,children:[e.jsx(Sa,{className:"mr-2 h-3 w-3"}),"Remove"]})]})]})}function eg(){const{user:t}=Nt(),[s,a]=l.useState([]),[r,n]=l.useState([]),[i,o]=l.useState([]),[c,d]=l.useState(null),[h,u]=l.useState(null),[p,f]=l.useState([]),[m,v]=l.useState(""),[x,g]=l.useState([]),[j,b]=l.useState(""),[N,I]=l.useState("10"),[y,w]=l.useState("30"),[k,_]=l.useState(null),[M,q]=l.useState(null),[D,F]=l.useState(!0),[S,$]=l.useState(""),[J,V]=l.useState(""),[R,se]=l.useState(""),[C,Y]=l.useState(""),[ne,re]=l.useState(""),[me,he]=l.useState(""),[E,ce]=l.useState(""),[B,le]=l.useState(""),[Q,ie]=l.useState(!0),[G,oe]=l.useState(!1),xe=l.useCallback(async()=>{F(!0);const[T,pe,Ne,$e]=await Promise.all([oh(),xi(),gi(),an()]);T.error&&q(T.error),a(T.data||[]),n(pe.data||[]),o(Ne.data||[]),d($e.data),$e.data&&(I(String($e.data.default_commission_percent)),w(String($e.data.cookie_days))),F(!1)},[]);l.useEffect(()=>{xe()},[xe]);const ue=l.useMemo(()=>s.filter(T=>T.status==="pending_review"||T.status==="pending_kyc"),[s]),Ee=async T=>{u(T),v("");const{data:pe}=await ui(T.id);f(pe||[])},ve=async T=>{const{data:pe}=await U.from("users").select("email").eq("id",T).maybeSingle();return(pe==null?void 0:pe.email)||null},qe=async()=>
807{if(!h||!t)return;q(null);const{data:T,error:pe}=await ch(h.id,t.id);if(pe){q(pe);return}const Ne=await ve(h.user_id);Ne&&T&&await Yt.sendAgentApproved(Ne,T.display_name,T.referral_code),_("Agent approved"),u(null),await xe()},tt=async()=>{if(!h||!t||!m.trim()){q("Rejection reason is required");return}const{data:T,error:pe}=await dh(h.id,t.id,m.trim());if(pe){q(pe);return}const Ne=await ve(h.user_id);Ne&&T&&await Yt.sendAgentRejected(Ne,T.display_name,m),_("Agent rejected"),u(null),await xe()},He=async T=>{await Ga(T.id,{status:"suspended"}),_(`${T.display_name} suspended`),await xe()},at=async(T,pe)=>{const Ne=pe===""?null:Number(pe);await Ga(T.id,{commission_percent:Ne}),_("Commission updated"),await xe()},rt=async()=>{q(null),_(null),oe(!0);const{data:T,error:pe,invited:Ne}=await rh({email:S,display_name:J,company_name:C||void 0,phone:R||void 0,commission_percent:ne===""?null:Number(ne),bank_name:me||void 0,bank_account_name:E||void 0,bank_account_number:B||void 0,sendInviteEmail:Q});if(oe(!1),pe){q(pe);return}if(T)try{await Yt.sendAgentApproved(S.trim(),T.display_name,T.referral_code)}catch{}_(Ne?`Agent created & invite emailed. Referral: ${T==null?void 0:T.referral_code}`:`Agent added (approved, no KYC). Referral: ${T==null?void 0:T.referral_code}`),$(""),V(""),se(""),Y(""),re(""),he(""),ce(""),le(""),await xe()},te=async()=>{const{error:T}=await th({default_commission_percent:Number(N),cookie_days:Number(y)});T?q(T):_("Settings saved"),await xe()},fe=T=>{g(pe=>pe.includes(T)?pe.filter(Ne=>Ne!==T):[...pe,T])},Fe=async()=>{if(!t||x.length===0){q("Select payable commission lines");return}const T=r.find($e=>x.includes($e.id));if(!T)return;if(!x.every($e=>{const Ct=r.find(_t=>_t.id===$e);return Ct&&Ct.agent_id===T.agent_id})){q("All selected lines must belong to the same agent");return}const{error:Ne}=await hh({agentId:T.agent_id,ledgerIds:x,adminUserId:t.id});if(Ne){q(Ne);return}g([]),_("Payout created"),await xe()},Ve=async T=>{if(!j.trim()){q("Enter payment reference");return}const{error:pe}=await uh({payoutId:T,payment_reference:j.trim()});pe?q(pe):(_("Payout marked paid"),b("")),await xe()},De=async T=>{const{url:pe,error:Ne}=await ih(T);if(Ne||!pe){q(Ne||"Could not open document");return}window.open(pe,"_blank")};return D?e.jsx(z,{children:e.jsx(K,{className:"py-10 text-center",children:"Loading agentsâ¦"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-start gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Agents & commissions"}),e.jsx("p",{className:"text-muted-foreground",children:"KYC review, commission ledger, and bank payout tracking."})]}),e.jsxs(P,{variant:"outline",onClick:xe,children:[e.jsx(bt,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),k&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-700"}),e.jsx(Ce,{className:"text-green-800",children:k})]}),M&&e.jsxs(Se,{variant:"destructive",children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(Ce,{children:M})]}),e.jsxs(_a,{defaultValue:"queue",children:[e.jsxs(oa,{children:[e.jsxs(Oe,{value:"queue",children:["Review queue (",ue.length,")"]}),e.jsx(Oe,{value:"add",children:"Add agent"}),e.jsx(Oe,{value:"agents",children:"All agents"}),e.jsx(Oe,{value:"commissions",children:"Commissions"}),e.jsx(Oe,{value:"payouts",children:"Payouts"}),e.jsx(Oe,{value:"settings",children:"Settings"})]}),e.jsxs(Le,{value:"queue",className:"space-y-4",children:[ue.length===0&&e.jsx(z,{children:e.jsx(K,{className:"py-8 text-muted-foreground text-center",children:"No applications waiting for review."})}),ue.map(T=>e.jsx(z,{children:e.jsxs(X,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(Z,{children:T.display_name}),e.jsxs(ke,{children:[T.company_name||"Individual"," · ",T.status]})]}),e.jsx(P,{onClick:()=>Ee(T),children:"Review"})]})},T.id)),h&&e.jsxs(z,{className:"border-2 border-sunset-orange/40",children:[e.jsxs(X,{children:[e.jsxs(Z,{children:["Review: ",h.display_name]}),e.jsxs(ke,{children:["Code ",h.referral_code," · Bank"," ",h.bank_name," / ",h.bank_account_number]})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"KYC documents"}),p.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"No documents uploaded."}),p.map(T=>e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsxs("span",{children:[T.doc_type," â ",T.file_name]}),e.jsx(P,{size:"sm",variant:"outline",onClick:()=>De(T.storage_path),children:"View"})]},T.id))]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Rejection reason (if rejecting)"}),e.jsx(W,{value:m,onChange:T=>v(T.target.value),placeholder:"Incomplete documentsâ¦"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{onClick:qe,children:"Approve"}),e.jsx(P,{variant:"destructive",onClick:tt,children:"Reject"}),e.jsx(P,{variant:"ghost",onClick:()=>u(null),children:"Close"})]})]})]})]}),e.jsx(Le,{value:"add",className:"space-y-4",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(ut,{className:"h-5 w-5"}),"Add agent manually (skip KYC)"]}),e.jsxs(ke,{children:["Creates an ",e.jsx("strong",{children:"approved"})," agent immediately â no document upload. Use an existing account email, or invite a new user by email."]})]}),e.jsxs(K,{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Email *"}),e.jsx(W,{type:"email",value:S,onChange:T=>$(T.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Display name *"}),e.jsx(W,{value:J,onChange:T=>V(T.target.value),placeholder:"Agent name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Phone"}),e.jsx(W,{value:R,onChange:T=>se(T.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Company"}),e.jsx(W,{value:C,onChange:T=>Y(T.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Commission % (blank = default)"}),e.jsx(W,{type:"number",min:0,max:100,value:ne,onChange:T=>re(T.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Bank name"}),e.jsx(W,{value:me,onChange:T=>he(T.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Bank account name"}),e.jsx(W,{value:E,onChange:T=>ce(T.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Bank account number"}),e.jsx(W,{value:B,onChange:T=>le(T.target.value)})]}),e.jsxs("div",{className:"md:col-span-2 flex items-center gap-2",children:[e.jsx(Fa,{checked:Q,onCheckedChange:ie,id:"manual-invite"}),e.jsx(A,{htmlFor:"manual-invite",children:"If email is new, send invite email (requires admin-create-agent function)"})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(P,{onClick:rt,disabled:G||!S.trim()||!J.trim(),children:G?"Creatingâ¦":"Create approved agent"})})]})]})}),e.jsx(Le,{value:"agents",className:"space-y-3",children:s.map(T=>e.jsx(z,{children:e.jsxs(K,{className:"py-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium flex items-center gap-2",children:[T.display_name,e.jsx(Te,{variant:"outline",children:T.status})]}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[T.referral_code," · commission"," ",T.commission_percent??(c==null?void 0:c.default_commission_percent),"%"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(W,{className:"w-24",placeholder:"%",defaultValue:T.commission_percent??"",onBlur:pe=>at(T,pe.target.value)}),T.status==="approved"&&e.jsx(P,{size:"sm",variant:"outline",onClick:()=>He(T),children:"Suspend"}),e.jsx(P,{size:"sm",variant:"secondary",onClick:()=>Ee(T),children:"Docs"})]})]})},T.id))}),e.jsx(Le,{value:"commissions",className:"space-y-4",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Ledger"}),e.jsx(ke,{children:"Select payable lines for one agent, then create a payout."})]}),e.jsxs(K,{className:"space-y-2",children:[r.map(T=>{var Ne;const pe=((Ne=s.find($e=>$e.id===T.agent_id))==null?void 0:Ne.display_name)||T.agent_id.slice(0,8);return e.jsxs("label",{className:"flex items-center justify-between gap-3 border-b py-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[T.status==="payable"&&e.jsx("input",{type:"checkbox",checked:x.includes(T.id),onChange:()=>fe(T.id)}),e.jsx(Te,{variant:"outline",children:T.status}),e.jsx("span",{children:pe})]}),e.jsxs("span",{children:["฿",Number(T.commission_amount).toLocaleStr
807ing()," (",T.commission_percent,"%)"]})]},T.id)}),e.jsx(P,{onClick:Fe,disabled:!x.length,children:"Create payout from selected"})]})]})}),e.jsx(Le,{value:"payouts",className:"space-y-4",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Payout runs"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsx("div",{className:"flex gap-2 items-end",children:e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(A,{children:"Payment reference (for mark paid)"}),e.jsx(W,{value:j,onChange:T=>b(T.target.value),placeholder:"Bank transfer ref / slip no."})]})}),i.map(T=>{var Ne;const pe=((Ne=s.find($e=>$e.id===T.agent_id))==null?void 0:Ne.display_name)||T.agent_id.slice(0,8);return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b pb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:pe}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsx(Te,{variant:"outline",children:T.status})," ",T.payment_reference||"No reference yet"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:["฿",Number(T.amount).toLocaleString()]}),T.status==="pending"&&e.jsx(P,{size:"sm",onClick:()=>Ve(T.id),children:"Mark paid"})]})]},T.id)}),i.length===0&&e.jsx("p",{className:"text-muted-foreground",children:"No payouts yet."})]})]})}),e.jsx(Le,{value:"settings",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Agent program settings"})}),e.jsxs(K,{className:"grid gap-4 md:grid-cols-2 max-w-xl",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Default commission %"}),e.jsx(W,{value:N,onChange:T=>I(T.target.value),type:"number",min:0,max:100})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Referral cookie days"}),e.jsx(W,{value:y,onChange:T=>w(T.target.value),type:"number",min:1,max:365})]}),e.jsx(P,{onClick:te,children:"Save settings"})]})]})})]})]})}function ya({type:t,folder:s="gallery",onUploadComplete:a,onError:r,multiple:n=!1,maxSizeMB:i=50,maxFiles:o=10,customUploadHandler:c}){const[d,h]=l.useState(!1),[u,p]=l.useState(null),[f,m]=l.useState(!1),[v,x]=l.useState({}),[g,j]=l.useState(!1),b=l.useRef(null),N=_=>{if(!_.type.match(/^image\/(jpeg|jpg|png|webp)$/))return"Please select a valid image file (JPEG, PNG, or WebP)";const M=i*1024*1024;return _.size>M?`File size must be less than ${i}MB`:null},I=l.useCallback(async _=>{const M=Array.from(_);if(M.length!==0){if(M.length>o){const q=`Maximum ${o} files allowed`;p(q),r&&r(q);return}for(const q of M){const D=N(q);if(D){p(D),r&&r(D);return}}h(!0),p(null),m(!1),x({});try{const q=M.map(async(D,F)=>{const S=`${D.name}-${F}`;x(J=>({...J,[S]:0}));let $;if(c)$=await c(D);else if($=await Ai(D,t,s),$.error||!$.url||!$.path)throw new Error($.error||"Failed to upload image");if(x(J=>({...J,[S]:100})),"error"in $&&$.error)throw new Error($.error);return a($.url,$.path),$});await Promise.all(q),m(!0),setTimeout(()=>m(!1),3e3)}catch(q){const D=q.message||"Failed to upload images";p(D),r&&r(D)}finally{h(!1),x({}),b.current&&(b.current.value="")}}},[t,s,a,r,o]),y=_=>{const M=_.target.files;M&&M.length>0&&I(M)},w=_=>{_.preventDefault(),_.stopPropagation(),_.type==="dragenter"||_.type==="dragover"?j(!0):_.type==="dragleave"&&j(!1)},k=_=>{_.preventDefault(),_.stopPropagation(),j(!1),_.dataTransfer.files&&_.dataTransfer.files.length>0&&I(_.dataTransfer.files)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:`border-2 border-dashed rounded-lg p-8 text-center transition-colors ${g?"border-sunset-orange bg-orange-50":"border-gray-300 hover:border-gray-400"} ${d?"opacity-50 pointer-events-none":""}`,onDragEnter:w,onDragLeave:w,onDragOver:w,onDrop:k,children:[e.jsx("input",{ref:b,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp",multiple:n,onChange:y,className:"hidden",disabled:d}),e.jsx("div",{className:"flex flex-col items-center justify-center space-y-4",children:d?e.jsxs(e.Fragment,{children:[e.jsx(Ht,{className:"h-12 w-12 text-sunset-orange animate-spin"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Uploading images..."}),Object.keys(v).length>0&&e.jsx("div",{className:"w-full max-w-xs",children:e.jsx("div",{className:"bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-sunset-orange h-2 rounded-full transition-all duration-300",style:{width:`${Object.values(v).reduce((_,M)=>_+M,0)/Object.keys(v).length}%`}})})})]}):f?e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"h-12 w-12 text-green-500"}),e.jsx("p",{className:"text-sm text-green-600 font-medium",children:"Upload successful!"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-gray-100 rounded-full p-4",children:e.jsx(Ms,{className:"h-8 w-8 text-gray-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-gray-900",children:n?"Drop images here or click to browse":"Drop image here or click to browse"}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:[n?`Up to ${o} images`:"Single image"," ⢠Max ",i,"MB each"]})]}),e.jsxs(P,{type:"button",variant:"outline",onClick:()=>{var _;return(_=b.current)==null?void 0:_.click()},className:"mt-2",children:[e.jsx(es,{className:"h-4 w-4 mr-2"}),"Select ",n?"Images":"Image"]})]})})]}),u&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(et,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:u})]})]})}function nl({type:t,images:s,loading:a,error:r,onUpload:n,onUpdate:i,onDelete:o,onReorder:c}){const[d,h]=l.useState(null),[u,p]=l.useState(null),[f,m]=l.useState(!1),[v,x]=l.useState(!1),[g,j]=l.useState(""),[b,N]=l.useState(0),[I,y]=l.useState(null),w=async(S,$)=>{m(!1),x(!1),y("Image uploaded successfully!"),setTimeout(()=>y(null),3e3)},k=S=>
807{m(!1)},_=async(S,$="gallery")=>{m(!0);try{await n(S,$)}catch(J){throw J.message,k(),J}},M=S=>{h(S),j(S.alt_text||""),N(S.display_order)},q=async()=>{if(!d)return;await i(d.id,{alt_text:g,display_order:b})&&(h(null),y("Image updated successfully!"),setTimeout(()=>y(null),3e3))},D=async()=>{if(!u)return;await o(u)&&(p(null),y("Image deleted successfully!"),setTimeout(()=>y(null),3e3))},F=[...s].sort((S,$)=>S.display_order-$.display_order);return e.jsxs("div",{className:"space-y-4",children:[I&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-800"}),e.jsx(Ce,{className:"text-green-800",children:I})]}),r&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(et,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:r})]}),e.jsxs(z,{children:[e.jsx(X,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Z,{className:"flex items-center gap-2 text-lg",children:[e.jsx(es,{className:"h-5 w-5"}),t==="waterpark"?"Waterpark":"Restaurant"," Images"]}),e.jsxs(ke,{className:"mt-1",children:["Manage gallery images (",F.length," ",F.length===1?"image":"images",")"]})]}),e.jsx(P,{size:"sm",onClick:()=>x(!v),className:"gap-2",children:v?e.jsxs(e.Fragment,{children:[e.jsx(et,{className:"h-4 w-4"}),"Cancel"]}):e.jsxs(e.Fragment,{children:[e.jsx(ut,{className:"h-4 w-4"}),"Upload Images"]})})]})}),e.jsxs(K,{className:"space-y-4",children:[v&&e.jsxs("div",{className:"border rounded-lg p-4 bg-gray-50",children:[e.jsx(A,{className:"mb-3 block font-medium",children:"Upload New Images"}),e.jsx(ya,{type:t,folder:"gallery",customUploadHandler:async S=>(await _(S,"gallery"),{url:URL.createObjectURL(S),path:`${t}/gallery/${Date.now()}-${S.name}`}),onUploadComplete:w,onError:k,multiple:!0,maxFiles:10})]}),e.jsx(xn,{}),e.jsx("div",{children:a?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ht,{className:"h-8 w-8 animate-spin text-sunset-orange"})}):F.length===0?e.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50",children:[e.jsx(es,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600 font-medium",children:"No images uploaded yet"}),e.jsx("p",{className:"text-sm text-gray-500 mt-2",children:'Click "Upload Images" to get started'})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3",children:F.map((S,$)=>e.jsxs("div",{className:"group relative bg-white border border-gray-200 rounded-lg overflow-hidden hover:border-sunset-orange hover:shadow-md transition-all",children:[e.jsxs("div",{className:"relative aspect-square overflow-hidden bg-gray-100",children:[e.jsx(Vt,{src:S.image_url,alt:S.alt_text||`${t} image ${$+1}`,className:"w-full h-full object-cover"}),e.jsxs("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/50 transition-colors flex items-center justify-center gap-1 opacity-0 group-hover:opacity-100",children:[e.jsx(P,{size:"sm",variant:"secondary",onClick:()=>M(S),className:"h-8 w-8 p-0 bg-white/90 hover:bg-white",title:"Edit",children:e.jsx(wi,{className:"h-3.5 w-3.5"})}),e.jsx(P,{size:"sm",variant:"destructive",onClick:()=>p(S.id),className:"h-8 w-8 p-0 bg-red-500/90 hover:bg-red-600",title:"Delete",children:e.jsx(Sa,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"absolute top-1 left-1 bg-black/60 text-white text-xs px-1.5 py-0.5 rounded flex items-center gap-1",children:[e.jsx(Ph,{className:"h-3 w-3"}),S.display_order]})]}),e.jsx("div",{className:"p-2",children:S.alt_text?e.jsx("p",{className:"text-xs text-gray-700 truncate",title:S.alt_text,children:S.alt_text}):e.jsx("p",{className:"text-xs text-gray-400 italic",children:"No description"})})]},S.id))})})]})]}),e.jsx(ra,{open:!!d,onOpenChange:S=>!S&&h(null),children:e.jsxs(Fs,{className:"sm:max-w-md",children:[e.jsxs(Bs,{children:[e.jsx(Os,{children:"Edit Image"}),e.jsx(pn,{children:"Update image metadata and display order"})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[d&&e.jsx("div",{className:"relative aspect-video overflow-hidden rounded-lg border bg-gray-100",children:e.jsx(Vt,{src:d.image_url,alt:d.alt_text||"Image preview",className:"w-full h-full object-cover"})}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"alt-text",children:"Alt Text"}),e.jsx(W,{id:"alt-text",value:g,onChange:S=>j(S.target.value),placeholder:"Describe the image for accessibility",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"display-order",children:"Display Order"}),e.jsx(W,{id:"display-order",type:"number",value:b,onChange:S=>N(parseInt(S.target.value)||0),min:0,className:"mt-1"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Lower numbers appear first"})]})]}),e.jsxs(ro,{children:[e.jsx(P,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),e.jsx(P,{onClick:q,children:"Save Changes"})]})]})}),e.jsx(pr,{open:!!u,onOpenChange:S=>!S&&p(null),children:e.jsxs(Ea,{children:[e.jsxs(Aa,{children:[e.jsx(Ta,{children:"Delete Image?"}),e.jsx(Ia,{children:"This will permanently delete the image from storage and the database. This action cannot be undone."})]}),e.jsxs(Ra,{children:[e.jsx(Ma,{children:"Cancel"}),e.jsx(Da,{onClick:D,className:"bg-red-500 hover:bg-red-600",children:"Delete"})]})]})})]})}function tg({heroImage:t,loading:s,error:a,onUpload:r,onDelete:n,onRefresh:i}){const[o,c]=l.useState(null),[d,h]=l.useState(!1),[u,p]=l.useState(!1),[f,m]=l.useState(null),v=async(b,N)=>{h(!1),p(!1),m("Hero image uploaded successfully!"),setTimeout(()=>{m(null),i()},2e3)},x=b=>{h(!1)},g=async b=>{h(!0);try{await r(b,"hero","Beachfront Dining Experience")}catch(N){throw N.message,x(),N}},j=async()=>
807{if(!o)return;await n(o)&&(c(null),m("Hero image deleted successfully!"),setTimeout(()=>{m(null),i()},2e3))};return e.jsxs("div",{className:"space-y-4",children:[f&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-800"}),e.jsx(Ce,{className:"text-green-800",children:f})]}),a&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(et,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:a})]}),e.jsxs(z,{children:[e.jsx(X,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Z,{className:"flex items-center gap-2 text-lg",children:[e.jsx(es,{className:"h-5 w-5"}),"Beachfront Dining Hero Image"]}),e.jsx(ke,{className:"mt-1",children:'Main image displayed in the "Beachfront Dining" section'})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(P,{size:"sm",variant:"outline",onClick:i,className:"gap-2",children:[e.jsx(bt,{className:"h-4 w-4"}),"Refresh"]}),!t&&e.jsx(P,{size:"sm",onClick:()=>p(!u),className:"gap-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(et,{className:"h-4 w-4"}),"Cancel"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ms,{className:"h-4 w-4"}),"Upload Image"]})})]})]})}),e.jsx(K,{className:"space-y-4",children:s?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ht,{className:"h-8 w-8 animate-spin text-sunset-orange"})}):t?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 items-start border rounded-lg p-3 bg-white hover:border-sunset-orange transition-colors",children:[e.jsx("div",{className:"relative w-32 h-32 flex-shrink-0 rounded-lg overflow-hidden bg-gray-100 border",children:e.jsx(Vt,{src:t.image_url,alt:t.alt_text||"Beachfront Dining Hero Image",className:"w-full h-full object-cover"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 mb-1",children:"Current Hero Image"}),e.jsxs("p",{className:"text-xs text-gray-600 truncate",children:[e.jsx("span",{className:"font-medium",children:"Alt Text:"})," ",t.alt_text||"No description"]})]}),e.jsxs(P,{size:"sm",variant:"destructive",onClick:()=>c(t.id),className:"bg-red-500/90 hover:bg-red-600 flex-shrink-0",children:[e.jsx(Sa,{className:"h-4 w-4 mr-1"}),"Delete"]})]})})]}),u&&e.jsxs("div",{className:"border rounded-lg p-4 bg-gray-50",children:[e.jsx("p",{className:"text-sm font-medium mb-3 text-gray-700",children:"Replace Current Image"}),e.jsx(ya,{type:"restaurant",folder:"hero",customUploadHandler:async b=>(t&&await n(t.id),await g(b),{url:URL.createObjectURL(b),path:`restaurant/hero/${Date.now()}-${b.name}`}),onUploadComplete:v,onError:x,multiple:!1,maxFiles:1})]}),!u&&e.jsxs(P,{variant:"outline",onClick:()=>p(!0),className:"w-full",children:[e.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Replace Image"]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50",children:[e.jsx(es,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600 font-medium",children:"No hero image uploaded"}),e.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Upload an image to display in the Beachfront Dining section"})]}),u&&e.jsx("div",{className:"border rounded-lg p-4 bg-gray-50",children:e.jsx(ya,{type:"restaurant",folder:"hero",customUploadHandler:async b=>(await g(b),{url:URL.createObjectURL(b),path:`restaurant/hero/${Date.now()}-${b.name}`}),onUploadComplete:v,onError:x,multiple:!1,maxFiles:1})})]})})]}),e.jsx(pr,{open:!!o,onOpenChange:b=>!b&&c(null),children:e.jsxs(Ea,{children:[e.jsxs(Aa,{children:[e.jsx(Ta,{children:"Delete Hero Image?"}),e.jsx(Ia,{children:"This will permanently delete the hero image from storage and the database. The Beachfront Dining section will fall back to the default image. This action cannot be undone."})]}),e.jsxs(Ra,{children:[e.jsx(Ma,{children:"Cancel"}),e.jsx(Da,{onClick:j,className:"bg-red-500 hover:bg-red-600",children:"Delete"})]})]})})]})}function sg({heroImage:t,loading:s,error:a,onUpload:r,onDelete:n,onRefresh:i}){const[o,c]=l.useState(null),[d,h]=l.useState(!1),[u,p]=l.useState(!1),[f,m]=l.useState(null),v=async(b,N)=>{h(!1),p(!1),m("Hero image uploaded successfully!"),setTimeout(()=>{m(null),i()},2e3)},x=b=>{h(!1)},g=async b=>{h(!0);try{await r(b,"hero","Waterpark Important Rules")}catch(N){throw N.message,x(),N}},j=async()=>
807{if(!o)return;await n(o)&&(c(null),m("Hero image deleted successfully!"),setTimeout(()=>{m(null),i()},2e3))};return e.jsxs("div",{className:"space-y-4",children:[f&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-800"}),e.jsx(Ce,{className:"text-green-800",children:f})]}),a&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(et,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:a})]}),e.jsxs(z,{children:[e.jsx(X,{className:"pb-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(Z,{className:"flex items-center gap-2 text-lg",children:[e.jsx(es,{className:"h-5 w-5"}),"Important Rules Hero Image"]}),e.jsx(ke,{className:"mt-1",children:'Main image displayed in the "Important Rules" section'})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(P,{size:"sm",variant:"outline",onClick:i,className:"gap-2",children:[e.jsx(bt,{className:"h-4 w-4"}),"Refresh"]}),!t&&e.jsx(P,{size:"sm",onClick:()=>p(!u),className:"gap-2",children:u?e.jsxs(e.Fragment,{children:[e.jsx(et,{className:"h-4 w-4"}),"Cancel"]}):e.jsxs(e.Fragment,{children:[e.jsx(Ms,{className:"h-4 w-4"}),"Upload Image"]})})]})]})}),e.jsx(K,{className:"space-y-4",children:s?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(Ht,{className:"h-8 w-8 animate-spin text-sunset-orange"})}):t?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-4 items-start border rounded-lg p-3 bg-white hover:border-sunset-orange transition-colors",children:[e.jsx("div",{className:"relative w-32 h-32 flex-shrink-0 rounded-lg overflow-hidden bg-gray-100 border",children:e.jsx(Vt,{src:t.image_url,alt:t.alt_text||"Waterpark Important Rules Hero Image",className:"w-full h-full object-cover"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 mb-1",children:"Current Hero Image"}),e.jsxs("p",{className:"text-xs text-gray-600 truncate",children:[e.jsx("span",{className:"font-medium",children:"Alt Text:"})," ",t.alt_text||"No description"]})]}),e.jsxs(P,{size:"sm",variant:"destructive",onClick:()=>c(t.id),className:"bg-red-500/90 hover:bg-red-600 flex-shrink-0",children:[e.jsx(Sa,{className:"h-4 w-4 mr-1"}),"Delete"]})]})})]}),u&&e.jsxs("div",{className:"border rounded-lg p-4 bg-gray-50",children:[e.jsx("p",{className:"text-sm font-medium mb-3 text-gray-700",children:"Replace Current Image"}),e.jsx(ya,{type:"waterpark",folder:"hero",customUploadHandler:async b=>(t&&await n(t.id),await g(b),{url:URL.createObjectURL(b),path:`waterpark/hero/${Date.now()}-${b.name}`}),onUploadComplete:v,onError:x,multiple:!1,maxFiles:1})]}),!u&&e.jsxs(P,{variant:"outline",onClick:()=>p(!0),className:"w-full",children:[e.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Replace Image"]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50",children:[e.jsx(es,{className:"h-12 w-12 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600 font-medium",children:"No hero image uploaded"}),e.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Upload an image to display in the Important Rules section"})]}),u&&e.jsx("div",{className:"border rounded-lg p-4 bg-gray-50",children:e.jsx(ya,{type:"waterpark",folder:"hero",customUploadHandler:async b=>(await g(b),{url:URL.createObjectURL(b),path:`waterpark/hero/${Date.now()}-${b.name}`}),onUploadComplete:v,onError:x,multiple:!1,maxFiles:1})})]})})]}),e.jsx(pr,{open:!!o,onOpenChange:b=>!b&&c(null),children:e.jsxs(Ea,{children:[e.jsxs(Aa,{children:[e.jsx(Ta,{children:"Delete Hero Image?"}),e.jsx(Ia,{children:"This will permanently delete the hero image from storage and the database. The Important Rules section will fall back to the default image. This action cannot be undone."})]}),e.jsxs(Ra,{children:[e.jsx(Ma,{children:"Cancel"}),e.jsx(Da,{onClick:j,className:"bg-red-500 hover:bg-red-600",children:"Delete"})]})]})})]})}class ag{constructor(){da(this,"supabaseUrl");da(this,"supabaseAnonKey");this.supabaseUrl="https://ckjiwgyeseqtkpgftubq.supabase.co",this.supabaseAnonKey="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNraml3Z3llc2VxdGtwZ2Z0dWJxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTYyOTAwMzgsImV4cCI6MjA3MTg2NjAzOH0.K4zfl-vnamPUMHXPjd7UUr-tZ0YV3JQXYXEwVo8aJ30"}async getPaymentSettings(){try{const{data:s,error:a}=await U.from("payment_settings").select("*").single();return a?(console.error("Error fetching payment settings:",a),null):s}catch(s){return console.error("Error in getPaymentSettings:",s),null}}async updatePaymentSettings(s){try{const a=await this.getPaymentSettings();if(a){const{error:r}=await U.from("payment_settings").update({payment_mode:s.payment_mode,omise_public_key:s.omise_public_key,is_test_mode:s.is_test_mode,updated_at:new Date().toISOString()}).eq("id",a.id);if(r)throw r}else{const{error:r}=await U.from("payment_settings").insert([{payment_mode:s.payment_mode||"manual",omise_public_key:s.omise_public_key,is_test_mode:s.is_test_mode??!0}]);if(r)throw r}return{success:!0}}catch(a){return console.error("Error updating payment settings:",a),{success:!1,error:a instanceof Error?a.message:"Failed to update payment settings"}}}calculateDepositAmount(s,a){const{deposit_type:r,deposit_percentage:n,deposit_fixed_amount:i}=a;switch(r){case"full":return s;case"half":return s/2;case"percentage":return n&&n>0&&n<=100?s*n/100:0;case"fixed":return i&&i>0?Math.min(i,s):0;case"none":default:return 0}}async processPayment(s){try{const a=await fetch(`${this.supabaseUrl}/functions/v1/process-payment`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.supabaseAnonKey}`},body:JSON.stringify(s)}
807),r=await a.json();return a.ok?r:{success:!1,error:r.error||`HTTP error: ${a.status}`}}catch(a){return console.error("Error processing payment:",a),{success:!1,error:a instanceof Error?a.message:"Failed to process payment"}}}async createCharge(s,a,r,n){return this.processPayment({action:"charge",amount:s,currency:"thb",token:a,description:r,metadata:n})}async getCharge(s){return this.processPayment({action:"get",chargeId:s})}async refundCharge(s,a){return this.processPayment({action:"refund",chargeId:s,refundAmount:a})}async updateBookingPayment(s,a){try{const{error:r}=await U.from("bookings").update(a).eq("id",s);if(r)throw r;return{success:!0}}catch(r){return console.error("Error updating booking payment:",r),{success:!1,error:r instanceof Error?r.message:"Failed to update booking payment"}}}}const va=new ag,rg=()=>{const{user:t}=Nt(),s=vt(),{isAdmin:a,loading:r}=ir(),{bookings:n,loading:i,error:o,stats:c,fetchAllBookings:d,updateBookingStatus:h,filterBookingsByStatus:u,searchBookings:p,getRecentBookings:f,getUpcomingBookings:m}=Hu(),{resetAllRoomAvailability:v}=Pa(),{images:x,loading:g,error:j,uploadAndAddImage:b,updateImage:N,deleteImage:I,reorderImages:y,getHeroImage:w,fetchImages:k}=un(),[_,M]=l.useState(null),[q,D]=l.useState(!1);l.useEffect(()=>{(async()=>{if(w){D(!0);const ye=await w();M(ye),D(!1)}})()},[w,x]);const{images:F,loading:S,error:$,uploadAndAddImage:J,updateImage:V,deleteImage:R,reorderImages:se,getHeroImage:C,fetchImages:Y}=Ri(),[ne,re]=l.useState(null),[me,he]=l.useState(!1);l.useEffect(()=>{(async()=>{if(C){he(!0);const ye=await C();re(ye),he(!1)}})()},[C,F]);const[E,ce]=l.useState(""),[B,le]=l.useState("all"),[Q,ie]=l.useState(null),[G,oe]=l.useState(null),[xe,ue]=l.useState(null),[Ee,ve]=l.useState(null),[qe,tt]=l.useState(!1),[He,at]=l.useState(null),[rt,te]=l.useState(!1),[fe,Fe]=l.useState(!1);l.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[]),l.useEffect(()=>{if(i){console.log("Auth still loading...");return}if(!t){console.log("No user, redirecting to login"),s("/login");return}console.log("User found:",t.email,"User ID:",t.id),a&&!r&&!qe&&(console.log("Admin access confirmed, fetching bookings for the first time..."),d(),tt(!0))},[t,i,s,a,r,qe]);const Ve=l.useCallback(H=>{ve(H),d()},[d]),{isConnected:De}=Vu(Ve);l.useEffect(()=>{(async()=>{if(!a)return;te(!0);const ye=await va.getPaymentSettings();at(ye),te(!1)})()},[a]);const T=async()=>{if(!He)return;Fe(!0);const H=await va.updatePaymentSettings(He);H.success?(ue("Payment settings saved successfully"),setTimeout(()=>ue(null),3e3)):(ue(H.error||"Failed to save payment settings"),setTimeout(()=>ue(null),5e3)),Fe(!1)},pe=H=>{ie(H),console.log("Viewing booking:",H)},Ne=async(H,ye)=>{oe(H),ue(null);try{await h(H,ye)&&(ue(`Booking status updated to ${ye}`),setTimeout(()=>ue(null),3e3))}catch(Me){console.error("Failed to update status:",Me)}finally{oe(null)}},$e=H=>{const ye={pending:{color:"bg-yellow-100 text-yellow-800 border-yellow-200",icon:Ie},confirmed:{color:"bg-green-100 text-green-800 border-green-200",icon:jt},cancelled:{color:"bg-red-100 text-red-800 border-red-200",icon:ps},completed:{color:"bg-blue-100 text-blue-800 border-blue-200",icon:gt}},Me=ye[H]||ye.pending,wt=Me.icon;return e.jsxs(Te,{className:`${Me.color} border flex items-center gap-1`,children:[e.jsx(wt,{className:"h-3 w-3"}),H.charAt(0).toUpperCase()+H.slice(1)]})};p(E);const Ct=u(B),_t=f(),Bt=m();return i?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading admin panel..."})]})}):r?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-500 mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Checking admin access..."})]})}):t?e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"container mx-auto px-6 py-12 pt-32",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"Admin Dashboard"}),e.jsx("p",{className:"text-gray-700 font-medium",children:"Manage bookings, monitor performance, and oversee hotel operations"})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${De?"bg-green-500":"bg-red-500"}`}),e.jsx("span",{className:"text-sm text-gray-700 font-medium",children:De?"Real-time Connected":"Real-time Disconnected"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${a?"bg-blue-500":"bg-gray-400"}`}),e.jsx("span",{className:"text-sm text-gray-700 font-medium",children:r?"Checking Admin...":a?"Admin Access":"User Acce
807ss"})]})]})]})}),xe&&e.jsxs(Se,{className:"mb-6 border-green-200 bg-green-50",children:[e.jsx(jt,{className:"h-4 w-4 text-green-800"}),e.jsx(Ce,{className:"text-green-800",children:xe})]}),e.jsxs(_a,{defaultValue:"overview",className:"space-y-6",children:[e.jsxs(oa,{className:"grid w-full grid-cols-3 sm:grid-cols-5 lg:grid-cols-9 h-auto gap-1",children:[e.jsx(Oe,{value:"overview",children:"Overview"}),e.jsx(Oe,{value:"bookings",children:"Bookings"}),e.jsx(Oe,{value:"rooms",children:"Rooms"}),e.jsx(Oe,{value:"channels",children:"Channels"}),e.jsx(Oe,{value:"agents",children:"Agents"}),e.jsx(Oe,{value:"payments",children:"Payments"}),e.jsx(Oe,{value:"analytics",children:"Analytics"}),e.jsx(Oe,{value:"media",children:"Media"}),e.jsx(Oe,{value:"settings",children:"Settings"})]}),e.jsxs(Le,{value:"overview",className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsxs(z,{children:[e.jsxs(X,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Z,{className:"text-sm font-medium",children:"Total Bookings"}),e.jsx(Re,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(K,{children:[e.jsx("div",{className:"text-2xl font-bold",children:c.total}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),e.jsxs(z,{children:[e.jsxs(X,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Z,{className:"text-sm font-medium",children:"Pending"}),e.jsx(Ie,{className:"h-4 w-4 text-yellow-600"})]}),e.jsxs(K,{children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:c.pending}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Requires action"})]})]}),e.jsxs(z,{children:[e.jsxs(X,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Z,{className:"text-sm font-medium",children:"Confirmed"}),e.jsx(jt,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(K,{children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:c.confirmed}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Active bookings"})]})]}),e.jsxs(z,{children:[e.jsxs(X,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(Z,{className:"text-sm font-medium",children:"Revenue"}),e.jsx(dn,{className:"h-4 w-4 text-green-600"})]}),e.jsxs(K,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:["฿",n.filter(H=>H.status==="confirmed"||H.status==="completed").reduce((H,ye)=>H+ye.total_price,0).toLocaleString()]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Confirmed bookings"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsxs(z,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:()=>s("/calendar"),children:[e.jsxs(X,{children:[e.jsxs(Z,{className:"text-lg flex items-center",children:[e.jsx(Re,{className:"h-5 w-5 mr-2 text-sunset-orange"}),"Fullscreen Calendar"]}),e.jsx(ke,{children:"Visual room management and booking overview"})]}),e.jsx(K,{children:e.jsx("p",{className:"text-sm text-gray-600",children:"View and manage all bookings in an interactive calendar interface"})})]}),e.jsxs(z,{className:"hover:shadow-md transition-shadow cursor-pointer",onClick:async()=>{confirm("Are you sure you want to reset all room availability? This will clear all availability blocks.")&&(await v(),alert("Room availability has been reset. You can now try booking again."))},children:[e.jsxs(X,{children:[e.jsxs(Z,{className:"text-lg flex items-center",children:[e.jsx(bt,{className:"h-5 w-5 mr-2 text-red-500"}),"Reset Availability"]}),e.jsx(ke,{children:"Clear all room availability blocks"})]}),e.jsx(K,{children:e.jsx("p",{className:"text-sm text-gray-600",children:"Reset room availability to fix booking issues (use with caution)"})})]}),e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{className:"text-lg",children:"Recent Bookings"}),e.jsx(ke,{children:"Last 7 days"})]}),e.jsxs(K,{children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:_t.length}),e.jsx("p",{className:"text-sm text-gray-600",children:"New bookings this week"})]})]}),e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{className:"text-lg",children:"Upcoming Stays"}),e.jsx(ke,{children:"Next 30 days"})]}),e.jsxs(K,{children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:Bt.length}),e.jsx("p",{className:"text-sm text-gray-600",children:"Confirmed arrivals"})]})]})]}),e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{className:"text-lg",children:"Action Required"}),e.jsx(ke,{children:"Pending confirmations"})]}),e.jsxs(K,{children:[e.jsx("div",{className:"text-2xl font-bold text-orange-600",children:c.pending}),e.jsx("p",{className:"text-sm text-gray-600",children:"Need staff review"})]})]})]}),e.jsxs(Le,{value:"bookings",className:"space-y-6",children:[e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Manage Bookings"}),e.jsx(ke,{children:"Search, filter, and manage all hotel bookings"})]}),e.jsx(K,{className:"space-y-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(A,{htmlFor:"search",children:"Search Bookings"}),e.jsxs("div",{className:"relative",children:[e.jsx(Ni,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx(W,{id:"search",placeholder:"Search by customer name, email, room, or booking ID...",value:E,onChange:H=>ce(H.target.value),className:"pl-10"})]})]}),e.jsxs("div",{className:"sm:w-48",children:[e.jsx(A,{htmlFor:"status-filter",children:"Status Filter"}),e.jsxs(Xt,{value:B,onValueChange:le,children:[e.jsx(Ut,{children:e.jsx(Zt,{placeholder:"All statuses"})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"all",children:"All Statuses"}),e.jsx(ze,{value:"pending",children:"Pending"}),e.jsx(ze,{value:"confirmed",children:"Confirmed"}),e.jsx(ze,{value:"cancelled",children:"Cancelled"}),e.jsx(ze,{value:"completed",children:"Completed"})]})]})]}),e.jsxs("div",{className:"sm:w-auto",children:[e.jsx(A,{children:" "}),e.jsxs(P,{onClick:d,variant:"outline",className:"w-full sm:w-auto",children:[e.jsx(bt,{className:"h-4 w-4 mr-2"}),"Refresh"]})]})]})})]}),e.jsx(z,{children:e.jsx(K,{className:"p-0",children:i?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-sunset-orange mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Loading bookings..."})]}):o?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(ss,{className:"h-8 w-8 text-red-500 mx-auto mb-4"}),e.jsx("p",{className:"text-red-600",children:o})]}):Ct.length===0?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(Re,{className:"h-8 w-8 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"No bookings found"})]}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-gray-50 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Booking"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Customer"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Room"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Dates"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),e.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:Ct.map(H=>{var ye,Me,wt,Pt,ys,rs,Us,yt;return e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[e.jsxs("div",{className:"text-sm font-medium text-gray-900",children:["#",H.id.slice(-8)]}),e.jsx("div",{className:"text-sm text-gray-500",children:new Date(H.created_at).toLocaleDateString()})]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0 h-10 w-10",children:e.jsx("div",{className:"h-10 w-10 rounded-full bg-sunset-orange flex items-center justify-center",children:e.jsx(qh,{className:"h-5 w-5 text-white"})})}),e.jsxs("div",{className:"ml-4",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:((ye=H.users)==null?void 0:ye.full_name)||((Me=H.guest_info)==null?void 0:Me.full_name)||"Guest"}),e.jsx("div",{className:"text-sm text-gray-500",children:((wt=H.users)==null?void 0:wt.email)||((Pt=H.guest_info)==null?void 0:Pt.email)||"No email"})]})]})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("img",{className:"h-10 w-10 rounded-lg object-cover",src:H.rooms.image,alt:H.rooms.name}),e.jsxs("div",{className:"ml-3",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",children:H.rooms.name}),e.jsxs("div",{className:"text-sm text-gray-500",children:[H.guests," guests"]})]})]})}),e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap",children:[e.jsx("div",{className:"text-sm text-gray-900",children:new Date(H.check_in).toLocaleDateString()}),e.jsxs("div",{className:"text-sm text-gray-500",children:["to ",new Date(H.check_out).toLocaleDateString()]}),e.jsxs("div",{className:"text-xs text-gray-400",children:[Math.ceil((new Date(H.check_out).getTime()-new Date(H.check_in).getTime())/(1e3*60*60*24))," nights"]})]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:$e(H.status)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(ra,{children:[e.jsx(so,{asChild:!0,children:e.jsx(P,{variant:"outline",size:"sm",onClick:()=>ie(H),children:e.jsx(Ds,{className:"h-4 w-4"})})}),e.jsxs(Fs,{className:"max-w-2xl bg-white border-2 border-gray-200 shadow-2xl",children:[e.jsx(Bs,{children:e.jsx(Os,{children:"Booking Details"})}),Q&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Booking ID"}),e.jsxs("p",{className:"text-sm",children:["#",Q.id]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Status"}),e.jsx("div",{className:"mt-1",children:$e(Q.status)})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Customer Name"}),e.jsx("p",{className:"text-sm",children:((ys=Q.users)==null?void 0:ys.full_name)||((rs=Q.guest_info)==null?void 0:rs.full_name)||"Guest"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Email"}),e.jsx("p",{className:"text-sm",children:((Us=Q.users)==null?void 0:Us.email)||((yt=Q.guest_info)==null?void 0:yt.email)||"No email"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Room"}),e.jsx("p",{className:"text-sm",children:Q.rooms.name})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Guests"}),e.jsx("p",{className:"text-sm",children:Q.guests})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Check-in"}),e.jsx("p",{className:"text-sm",children:new Date(Q.check_in).toLocaleDateString()})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Check-out"}),e.jsx("p",{className:"text-sm",children:new Date(Q.check_out).toLocaleDateString()})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Total Price"}),e.jsxs("p",{className:"text-sm font-semibold",children:["฿",Q.total_price.toLocaleStr
807ing()]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Created"}),e.jsx("p",{className:"text-sm",children:new Date(Q.created_at).toLocaleDateString()})]})]}),Q.special_requests&&e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-500",children:"Special Requests"}),e.jsx("p",{className:"text-sm bg-gray-50 p-3 rounded-lg",children:Q.special_requests})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx(A,{className:"text-sm font-medium text-gray-500 mb-3 block",children:"Update Status"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(P,{size:"sm",variant:Q.status==="pending"?"default":"outline",onClick:()=>Ne(Q.id,"pending"),disabled:G===Q.id,children:[e.jsx(Ie,{className:"h-4 w-4 mr-1"}),"Pending"]}),e.jsxs(P,{size:"sm",variant:Q.status==="confirmed"?"default":"outline",onClick:()=>Ne(Q.id,"confirmed"),disabled:G===Q.id,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(jt,{className:"h-4 w-4 mr-1"}),"Confirm"]}),e.jsxs(P,{size:"sm",variant:Q.status==="cancelled"?"default":"outline",onClick:()=>Ne(Q.id,"cancelled"),disabled:G===Q.id,className:"bg-red-600 hover:bg-red-700",children:[e.jsx(ps,{className:"h-4 w-4 mr-1"}),"Cancel"]}),e.jsxs(P,{size:"sm",variant:Q.status==="completed"?"default":"outline",onClick:()=>Ne(Q.id,"completed"),disabled:G===Q.id,className:"bg-blue-600 hover:bg-blue-700",children:[e.jsx(gt,{className:"h-4 w-4 mr-1"}),"Complete"]})]})]})]})]})]}),H.status==="pending"&&e.jsx(P,{size:"sm",onClick:()=>Ne(H.id,"confirmed"),disabled:G===H.id,className:"bg-green-600 hover:bg-green-700",children:G===H.id?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}):e.jsxs(e.Fragment,{children:[e.jsx(jt,{className:"h-4 w-4 mr-1"}),"Confirm"]})})]})})]},H.id)})})]})})})})]}),e.jsx(Le,{value:"rooms",className:"space-y-6",children:e.jsx(Hx,{})}),e.jsx(Le,{value:"channels",className:"space-y-6",children:e.jsx(Xx,{})}),e.jsx(Le,{value:"agents",className:"space-y-6",children:e.jsx(eg,{})}),e.jsx(Le,{value:"analytics",className:"space-y-6",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Booking Analytics"}),e.jsx(ke,{children:"Performance metrics and trends"})]}),e.jsx(K,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Status Distribution"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-600",children:"Pending"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-yellow-500 h-2 rounded-full",style:{width:`${c.pending/c.total*100}%`}})}),e.jsx("span",{className:"text-sm font-medium",children:c.pending})]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-600",children:"Confirmed"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-green-500 h-2 rounded-full",style:{width:`${c.confirmed/c.total*100}%`}})}),e.jsx("span",{className:"text-sm font-medium",children:c.confirmed})]})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("span",{className:"text-sm text-gray-600",children:"Completed"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-blue-500 h-2 rounded-full",style:{width:`${c.completed/c.total*100}%`}})}),e.jsx("span",{className:"text-sm font-medium",children:c.completed})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Recent Activity"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:[_t.length," new bookings this week"]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Increased from last week"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:[Bt.length," upcoming stays"]}),e.jsx("p",{className:"text-xs text-gray-500",children:"Next 30 days"})]})]})]})]})]})})]})}),e.jsxs(Le,{value:"payments",className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Payment Management"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"View and manage all payment transactions"})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx($h,{className:"h-5 w-5"}),"Payment Statistics"]})}),e.jsx(K,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 bg-green-50 rounded-lg",children:[e.jsx("div",{className:"text-sm text-gray-600",children:"Total Collected"}),e.jsxs("div",{className:"text-2xl font-bold text-green-600",children:["฿",n.filter(H=>H.payment_status==="full_paid"||H.payment_status==="deposit_paid").reduce((H,ye)=>
807H+(ye.paid_amount||0),0).toLocaleString()]})]}),e.jsxs("div",{className:"p-4 bg-yellow-50 rounded-lg",children:[e.jsx("div",{className:"text-sm text-gray-600",children:"Pending Payments"}),e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:n.filter(H=>H.payment_status==="pending").length})]}),e.jsxs("div",{className:"p-4 bg-blue-50 rounded-lg",children:[e.jsx("div",{className:"text-sm text-gray-600",children:"Deposits Paid"}),e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:n.filter(H=>H.payment_status==="deposit_paid").length})]})]})})]}),e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Payment Transactions"}),e.jsx(ke,{children:"All payment records for bookings"})]}),e.jsx(K,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left p-2",children:"Booking ID"}),e.jsx("th",{className:"text-left p-2",children:"Customer"}),e.jsx("th",{className:"text-left p-2",children:"Amount"}),e.jsx("th",{className:"text-left p-2",children:"Deposit"}),e.jsx("th",{className:"text-left p-2",children:"Paid"}),e.jsx("th",{className:"text-left p-2",children:"Status"}),e.jsx("th",{className:"text-left p-2",children:"Method"}),e.jsx("th",{className:"text-left p-2",children:"Charge ID"})]})}),e.jsxs("tbody",{children:[n.map(H=>{var ye,Me;return e.jsxs("tr",{className:"border-b hover:bg-gray-50",children:[e.jsxs("td",{className:"p-2 text-sm",children:["#",H.id.slice(-8)]}),e.jsx("td",{className:"p-2 text-sm",children:((ye=H.users)==null?void 0:ye.full_name)||((Me=H.guest_info)==null?void 0:Me.full_name)||"Guest"}),e.jsxs("td",{className:"p-2 text-sm",children:["฿",H.total_price.toLocaleString()]}),e.jsx("td",{className:"p-2 text-sm",children:H.deposit_amount?`฿${H.deposit_amount.toLocaleString()}`:"-"}),e.jsx("td",{className:"p-2 text-sm",children:H.paid_amount?`฿${H.paid_amount.toLocaleString()}`:"-"}),e.jsx("td",{className:"p-2",children:e.jsx(Te,{className:H.payment_status==="full_paid"?"bg-green-100 text-green-800":H.payment_status==="deposit_paid"?"bg-blue-100 text-blue-800":H.payment_status==="refunded"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800",children:H.payment_status||"pending"})}),e.jsx("td",{className:"p-2 text-sm",children:H.payment_method||"manual"}),e.jsx("td",{className:"p-2 text-sm font-mono text-xs",children:H.omise_charge_id?H.omise_charge_id.slice(-12):"-"})]},H.id)}),n.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"p-4 text-center text-gray-500",children:"No payment records found"})})]})]})})})]})]}),e.jsxs(Le,{value:"settings",className:"space-y-6",children:[e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(Ar,{className:"h-5 w-5"}),"Payment Gateway Settings"]}),e.jsx(ke,{children:"Configure payment processing method"})]}),e.jsx(K,{className:"space-y-4",children:rt?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(bt,{className:"h-6 w-6 animate-spin text-sunset-orange"})}):He?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"paymentMode",children:"Payment Mode *"}),e.jsxs(Xt,{value:He.payment_mode,onValueChange:H=>{at({...He,payment_mode:H})},children:[e.jsx(Ut,{id:"paymentMode",children:e.jsx(Zt,{})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"manual",children:"Manual (Payment at Check-in)"}),e.jsx(ze,{value:"omise",children:"Omise Payment Gateway"})]})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:He.payment_mode==="manual"?"Guests will pay when they arrive at the hotel":"Guests can pay deposit online using credit card"})]}),He.payment_mode==="omise"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"omisePublicKey",children:"Omise Public Key"}),e.jsx(W,{id:"omisePublicKey",value:He.omise_public_key||"",onChange:H=>{at({...He,omise_public_key:H.target.value})},placeholder:"pkey_test_..."}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Public key for Omise (stored
807in database). Secret key must be set in Supabase Edge Function secrets as OMISE_SECRET_KEY."})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Fa,{id:"testMode",checked:He.is_test_mode,onCheckedChange:H=>{at({...He,is_test_mode:H})}}),e.jsx(A,{htmlFor:"testMode",children:"Test Mode"})]}),e.jsx("p",{className:"text-xs text-gray-500",children:He.is_test_mode?"Using test keys. No real charges will be made.":"Using live keys. Real charges will be processed."})]}),e.jsx("div",{className:"pt-4 border-t",children:e.jsx(P,{onClick:T,disabled:fe,className:"bg-sunset-orange hover:bg-orange-600",children:fe?e.jsxs(e.Fragment,{children:[e.jsx(bt,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(ba,{className:"h-4 w-4 mr-2"}),"Save Payment Settings"]})})})]}):e.jsxs(Se,{children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(Ce,{children:"Failed to load payment settings. Please refresh the page."})]})})]}),e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Email Settings"}),e.jsx(ke,{children:"Configure email notifications and templates"})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"hotel-email",children:"Hotel Staff Email"}),e.jsx(W,{id:"hotel-email",placeholder:"[email protected]",defaultValue:"[email protected]"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Email for staff notifications"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"brevo-key",children:"Brevo API Key"}),e.jsx(W,{id:"brevo-key",type:"password",placeholder:"Configured in Supabase Edge Function",defaultValue:"â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢â¢",disabled:!0}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Securely stored in Supabase Edge Function (not exposed to client)"})]})]}),e.jsxs("div",{className:"pt-4 border-t",children:[e.jsx("h4",{className:"font-medium mb-3",children:"Email Notifications"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Customer Booking Confirmation"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Sent when booking is created"})]}),e.jsx(Te,{className:"bg-green-100 text-green-800",children:"Enabled"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Hotel Staff Notifications"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Sent for new bookings"})]}),e.jsx(Te,{className:"bg-green-100 text-green-800",children:"Enabled"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Status Update Emails"}),e.jsx("p",{className:"text-xs text-gray-500",children:"Sent when booking status changes"})]}),e.jsx(Te,{className:"bg-green-100 text-green-800",children:"Enabled"})]})]})]})]})]})]}),e.jsxs(Le,{value:"media",className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Media Management"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Manage images for waterpark and restaurant sections"})]}),e.jsx(sg,{heroImage:_,loading:q,error:null,onUpload:async(H,ye,Me)=>{if(!await b(H,ye,Me))throw new Error("Failed to upload image");if(w){const Pt=await w();M(Pt)}},onDelete:async H=>{const ye=await I(H);return ye&&M(null),ye},onRefresh:async()=>{if(w){const H=await w();M(H)}k&&await k()}}),e.jsx(nl,{type:"waterpark",images:x,loading:g,error:j,onUpload:async(H,ye,Me)=>{if(!await b(H,ye,Me))throw new Error("Failed to upload image")},onUpdate:N,onDelete:I,onReorder:y}),e.jsx(tg,{heroImage:ne,loading:me,error:null,onUpload:async(H,ye,Me)=>{if(!await J(H,ye,Me))throw new Error("Failed to upload image");if(C){const Pt=await C();re(Pt)}},onDelete:async H=>{const ye=await R(H);return ye&&re(null),ye},onRefresh:async()=>
807{if(C){const H=await C();re(H)}Y&&await Y()}}),e.jsx(nl,{type:"restaurant",images:F,loading:S,error:$,onUpload:async(H,ye,Me)=>{if(!await J(H,ye,Me))throw new Error("Failed to upload image")},onUpdate:V,onDelete:R,onReorder:se})]})]})]}),e.jsx(Ku,{newBooking:Ee,onClose:()=>ve(null),onViewDetails:pe}),e.jsx(Ke,{})]}):null},ng=()=>{const{user:t}=Nt(),{bookings:s,loading:a,error:r,cancelBooking:n}=Pa(),i=vt();if(l.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[]),!t)return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsx("div",{className:"pt-20",children:e.jsx("div",{className:"container mx-auto px-6 py-12",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-4",children:"Access Denied"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Please log in to view your bookings."}),e.jsx(P,{onClick:()=>i("/login"),children:"Go to Login"})]})})}),e.jsx(Ke,{})]});const o=d=>{const h={pending:{color:"bg-yellow-100 text-yellow-800",icon:Ie},confirmed:{color:"bg-green-100 text-green-800",icon:jt},cancelled:{color:"bg-red-100 text-red-800",icon:ps},completed:{color:"bg-blue-100 text-blue-800",icon:jt}},u=h[d]||h.pending,p=u.icon;return e.jsxs(Te,{className:u.color,children:[e.jsx(p,{className:"h-3 w-3 mr-1"}),d.charAt(0).toUpperCase()+d.slice(1)]})},c=async d=>{if(window.confirm("Are you sure you want to cancel this booking?"))try{await n(d)}catch(h){console.error("Failed to cancel booking:",h)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsx("div",{className:"pt-20",children:e.jsxs("div",{className:"container mx-auto px-6 py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs(P,{variant:"ghost",onClick:()=>i(-1),className:"mb-4",children:[e.jsx(nn,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:"My Bookings"}),e.jsx("p",{className:"text-gray-600",children:"View and manage your reservations"})]}),a&&e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-sunset-orange mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Loading your bookings..."})]}),r&&e.jsx(z,{className:"border-red-200 bg-red-50",children:e.jsx(K,{className:"p-6",children:e.jsxs("p",{className:"text-red-800",children:["Error loading bookings: ",r]})})}),!a&&!r&&e.jsx(e.Fragment,{children:s.length===0?e.jsx(z,{className:"text-center py-12",children:e.jsxs(K,{children:[e.jsx(Re,{className:"h-16 w-16 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No Bookings Yet"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Start exploring our rooms and make your first reservation!"}),e.jsx(P,{onClick:()=>i("/"),children:"Browse Rooms"})]})}):e.jsx("div",{className:"space-y-6",children:s.map(d=>{var h;return e.jsxs(z,{className:"hover:shadow-lg transition-shadow",children:[e.jsx(X,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx(Z,{className:"text-xl",children:((h=d.rooms)==null?void 0:h.name)||"Room"}),e.jsxs(ke,{className:"text-gray-600",children:["Booking ID: ",d.id.slice(0,8),"..."]})]}),o(d.status)]})}),e.jsxs(K,{children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-sunset-orange"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Check-in"}),e.jsx("p",{className:"font-medium",children:new Date(d.check_in).toLocaleDateString()})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-sunset-orange"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Check-out"}),e.jsx("p",{className:"font-medium",children:new Date(d.check_out).toLocaleDateString()})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-sunset-orange"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Guests"}),e.jsx("p",{className:"font-medium",children:d.guests})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dn,{className:"h-4 w-4 text-sunset-orange"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total"}),e.jsxs("p",{className:"font-medium",children:["฿",d.total_price]})]})]})]}),d.special_requests&&e.jsxs("div",{className:"mb-4 p-3 bg-gray-50 rounded-lg",children:[e.jsx("p",{className:"text-sm text-gray-600 mb-1",children:"Special Requests:"}),e.jsx("p",{className:"text-gray-800",children:d.special_requests})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-200",children:[e.jsxs("div",{className:"text-sm text-gray-600",children:["Booked on ",new Date(d.created_at).toLocaleDateString()]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>i(`/rooms/${d.room_id}`),children:[e.jsx(Ds,{className:"h-4 w-4 mr-2"}),"View Room"]}),d.status==="pending"&&e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>c(d.id),className:"text-red-600 border-red-200 hover:bg-red-50",children:[e.jsx(ps,{className:"h-4 w-4 mr-2"}),"Cancel"]})]})]})]})]},d.id)})})})]})}),e.jsx(Ke,{})]})};var jr="Checkbox",[lg,Hg]=na(jr),[ig,bn]=lg(jr);function og(t){const{__scopeCheckbox:s,checked:a,children:r,defaultChecked:n,disabled:i,form:o,name:c,onCheckedChange:d,required:h,value:u="on",internal_do_not_use_render:p}=t,[f,m]=pa({prop:a,defaultProp:n??!1,onChange:d,caller:jr}),[v,x]=l.useState(null),[g,j]=l.useState(null),b=l.useRef(!1),N=v?!!o||!!v.closest("form"):!0,I={checked:f,disabled:i,setChecked:m,control:v,setControl:x,name:c,form:o,value:u,hasConsumerStoppedPropagationRef:b,required:h,defaultChecked:xs(n)?!1:n,isFormControl:N,bubbleInput:g,setBubbleInput:j};return e.jsx(ig,{scope:s,...I,children:cg(p)?p(I):r})}var jc="CheckboxTrigger",bc=l.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:a,...r},n)=>
807{const{control:i,value:o,disabled:c,checked:d,required:h,setControl:u,setChecked:p,hasConsumerStoppedPropagationRef:f,isFormControl:m,bubbleInput:v}=bn(jc,t),x=st(n,u),g=l.useRef(d);return l.useEffect(()=>{const j=i==null?void 0:i.form;if(j){const b=()=>p(g.current);return j.addEventListener("reset",b),()=>j.removeEventListener("reset",b)}},[i,p]),e.jsx(Qe.button,{type:"button",role:"checkbox","aria-checked":xs(d)?"mixed":d,"aria-required":h,"data-state":kc(d),"data-disabled":c?"":void 0,disabled:c,value:o,...r,ref:x,onKeyDown:Pe(s,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:Pe(a,j=>{p(b=>xs(b)?!0:!b),v&&m&&(f.current=j.isPropagationStopped(),f.current||j.stopPropagation())})})});bc.displayName=jc;var yn=l.forwardRef((t,s)=>{const{__scopeCheckbox:a,name:r,checked:n,defaultChecked:i,required:o,disabled:c,value:d,onCheckedChange:h,form:u,...p}=t;return e.jsx(og,{__scopeCheckbox:a,checked:n,defaultChecked:i,disabled:c,required:o,onCheckedChange:h,name:r,form:u,value:d,internal_do_not_use_render:({isFormControl:f})=>e.jsxs(e.Fragment,{children:[e.jsx(bc,{...p,ref:s,__scopeCheckbox:a}),f&&e.jsx(wc,{__scopeCheckbox:a})]})})});yn.displayName=jr;var yc="CheckboxIndicator",vc=l.forwardRef((t,s)=>{const{__scopeCheckbox:a,forceMount:r,...n}=t,i=bn(yc,a);return e.jsx(tr,{present:r||xs(i.checked)||i.checked===!0,children:e.jsx(Qe.span,{"data-state":kc(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:s,style:{pointerEvents:"none",...t.style}})})});vc.displayName=yc;var Nc="CheckboxBubbleInput",wc=l.forwardRef(({__scopeCheckbox:t,...s},a)=>{const{control:r,hasConsumerStoppedPropagationRef:n,checked:i,defaultChecked:o,required:c,disabled:d,name:h,value:u,form:p,bubbleInput:f,setBubbleInput:m}=bn(Nc,t),v=st(a,m),x=fn(i),g=Ll(r);l.useEffect(()=>{const b=f;if(!b)return;const N=window.HTMLInputElement.prototype,y=Object.getOwnPropertyDescriptor(N,"checked").set,w=!n.current;if(x!==i&&y){const k=new Event("click",{bubbles:w});b.indeterminate=xs(i),y.call(b,xs(i)?!1:i),b.dispatchEvent(k)}},[f,x,i,n]);const j=l.useRef(xs(i)?!1:i);return e.jsx(Qe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??j.current,required:c,disabled:d,name:h,value:u,form:p,...s,tabIndex:-1,ref:v,style:{...s.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});wc.displayName=Nc;function cg(t){return typeof t=="function"}function xs(t){return t==="indeterminate"}function kc(t){return xs(t)?"indeterminate":t?"checked":"unchecked"}const Sc=l.forwardRef(({className:t,...s},a)=>e.jsx(yn,{ref:a,className:de("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(vc,{className:de("flex items-center justify-center text-current"),children:e.jsx(ln,{className:"h-4 w-4"})})}));Sc.displayName=yn.displayName;function dg({amount:t,depositAmount:s,omisePublicKey:a,onSuccess:r,onError:n,description:i,metadata:o}){const[c,d]=l.useState(!1),[h,u]=l.useState(null),[p,f]=l.useState(!1),m=l.useRef(null);l.useEffect(()=>{if(!a){u("Omise public key is not configured. Please contact support.");return}if(window.Omise){window.Omise.setPublicKey(a),f(!0);return}const x=document.createElement("script");return x.src="https://cdn.omise.co/omise.js",x.async=!0,x.onload=()=>{window.Omise&&(window.Omise.setPublicKey(a),f(!0))},x.onerror=()=>{u("Failed to load Omise.js. Please check your internet connection.")},document.body.appendChild(x),()=>{x.parentNode&&x.parentNode.removeChild(x)}},[a]);const v=async x=>{var g,j,b,N,I,y,w,k,_,M;x&&x.preventDefault(),u(null),d(!0);try{if(!a)throw new Error("Omise public key is not configured. Please contact support.");if(!window.Omise||!window.OmiseCard)throw new Error("Omise.js is not loaded. Please refresh the page.");window.Omise.setPublicKey(a);const q={name:((j=(g=m.current)==null?void 0:g.querySelector('[name="cardName"]'))==null?void 0:j.value)||"",number:((N=(b=m.current)==null?void 0:b.querySelector('[name="cardNumber"]'))==null?void 0:N.value)||"",expiration_month:((y=(I=m.current)==null?void 0:I.querySelector('[name="expiryMonth"]'))==null?void 0:y.value)||"",expiration_year:((k=(w=m.current)==null?void 0:w.querySelector('[name="expiryYear"]'))==null?void 0:k.value)||"",security_code:((M=(_=m.current)==null?void 0:_.querySelector('[name="cvv"]'))==null?void 0:M.value)||""};if(!q.name||!q.number||!q.expiration_month||!q.expiration_year||!q.security_code)throw new Error("Please fill in all card details");
807window.Omise.createToken("card",q,async(D,F)=>{if(D===200){const S=F.id,$=await va.createCharge(s,S,i||`Deposit payment: ฿${s.toLocaleString()}`,o);if($.success&&$.data){const J=$.data;if(J.paid)r(J.id);else throw new Error(J.failure_message||"Payment failed")}else throw new Error($.error||"Payment processing failed")}else throw new Error(F.message||"Failed to create payment token")})}catch(q){const D=q instanceof Error?q.message:"An unexpected error occurred";u(D),n(D)}finally{d(!1)}};return p?e.jsxs(z,{children:[e.jsx(X,{children:e.jsxs(Z,{className:"flex items-center gap-2",children:[e.jsx(Ar,{className:"h-5 w-5"}),"Payment Information"]})}),e.jsx(K,{children:e.jsxs("div",{ref:m,className:"space-y-4",children:[h&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(sa,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:h})]}),e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Total Amount:"}),e.jsxs("span",{className:"text-lg font-bold text-gray-900",children:["฿",t.toLocaleString()]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Deposit Amount:"}),e.jsxs("span",{className:"text-lg font-bold text-sunset-orange",children:["฿",s.toLocaleString()]})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"You will be charged the deposit amount now. The remaining balance will be collected at check-in."})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"cardName",children:"Cardholder Name *"}),e.jsx(W,{id:"cardName",name:"cardName",placeholder:"John Doe",required:!0,disabled:c})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"cardNumber",children:"Card Number *"}),e.jsx(W,{id:"cardNumber",name:"cardNumber",placeholder:"4242 4242 4242 4242",maxLength:19,required:!0,disabled:c,onChange:x=>{var b;const g=x.target.value.replace(/\s/g,""),j=((b=g.match(/.{1,4}/g))==null?void 0:b.join(" "))||g;x.target.value=j}})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"col-span-1",children:[e.jsx(A,{htmlFor:"expiryMonth",children:"Month *"}),e.jsx(W,{id:"expiryMonth",name:"expiryMonth",placeholder:"MM",maxLength:2,required:!0,disabled:c})]}),e.jsxs("div",{className:"col-span-1",children:[e.jsx(A,{htmlFor:"expiryYear",children:"Year *"}),e.jsx(W,{id:"expiryYear",name:"expiryYear",placeholder:"YYYY",maxLength:4,required:!0,disabled:c})]}),e.jsxs("div",{className:"col-span-1",children:[e.jsx(A,{htmlFor:"cvv",children:"CVV *"}),e.jsx(W,{id:"cvv",name:"cvv",placeholder:"123",maxLength:4,required:!0,disabled:c,type:"password"})]})]}),e.jsx(P,{type:"button",onClick:v,className:"w-full bg-sunset-orange hover:bg-orange-600 text-white",disabled:c,children:c?e.jsxs(e.Fragment,{children:[e.jsx(Ht,{className:"h-4 w-4 mr-2 animate-spin"}),"Processing Payment..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ar,{className:"h-4 w-4 mr-2"}),"Pay Deposit ฿",s.toLocaleString()]})}),e.jsx("p",{className:"text-xs text-gray-500 text-center",children:"Your payment is secured by Omise. We do not store your card details."})]})})]}):e.jsx(z,{children:e.jsx(K,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(Ht,{className:"h-8 w-8 animate-spin text-sunset-orange"}),e.jsx("span",{className:"ml-2 text-gray-600",children:"Loading payment form..."})]})})})}const mg=()=>{var ie;const t=vt(),{user:s,signUp:a}=Nt(),{createBooking:r,createGuestBooking:n}=Pa(),[i,o]=l.useState(null),[c,d]=l.useState(!1),[h,u]=l.useState(null),[p,f]=l.useState(!1),[m,v]=l.useState(null),[x,g]=l.useState(null),[j,b]=l.useState(0),[N,I]=l.useState(!1),[y,w]=l.useState(null),[k,_]=l.useState(!1),[M,q]=l.useState(""),[D,F]=l.useState(""),[S,$]=l.useState(""),[J,V]=l.useState(""),[R,se]=l.useState(""),[C,Y]=l.useState(""),[ne,re]=l.useState(""),[me,he]=l.useState(!1),[E,ce]=l.useState(""),[B,le]=l.useState("");l.useEffect(()=>{var oe,xe;const G=sessionStorage.getItem("pendingCheckout");if(!G){t("/rooms");return}try{const ue=JSON.parse(G);o(ue),s&&(q(((oe=s.user_metadata)==null?void 0:oe.full_name)||""),F(s.email||""),$(((xe=s.user_metadata)==null?void 0:xe.phone)||""))}catch{t("/rooms")}},[t,s]),l.useEffect(()=>{(async()=>
807{if(i)try{const oe=await va.getPaymentSettings();v(oe);const xe=typeof i.roomId=="string"?parseInt(i.roomId,10):i.roomId;if(!isNaN(xe)){const{data:ue}=await _i(xe);if(ue){const Ee={deposit_type:ue.depositType||"none",deposit_percentage:ue.depositPercentage,deposit_fixed_amount:ue.depositFixedAmount};g(Ee);const ve=va.calculateDepositAmount(i.totalPrice,Ee);b(ve),(oe==null?void 0:oe.payment_mode)==="omise"&&ve>0&&_(!0)}}}catch(oe){console.error("Error loading payment info:",oe)}})()},[i]);const Q=async G=>{var Ee;if(G.preventDefault(),!i)return;if(!M||!D||!S||!J||!R||!C||!ne){u("Please fill in all required fields");return}if(me&&E!==B){u("Passwords do not match");return}if(me&&E.length<6){u("Password must be at least 6 characters");return}if(!i.checkInDate||!i.checkOutDate){u("Please select check-in and check-out dates");return}const oe=new Date(i.checkInDate),xe=new Date(i.checkOutDate),ue=new Date;if(ue.setHours(0,0,0,0),oe<ue){u("Check-in date cannot be in the past");return}if(oe>=xe){u("Check-out date must be after check-in date");return}if(k&&!N){u("Please complete the payment first");return}d(!0),u(null);try{let ve=s==null?void 0:s.id;if(me&&!s){const{data:fe,error:Fe}=await a(D,E,{full_name:M,phone:S,address:J,city:R,country:C,passport_number:ne});if(Fe)throw Fe;ve=(Ee=fe.user)==null?void 0:Ee.id}const qe=typeof i.roomId=="string"?parseInt(i.roomId,10):i.roomId;if(isNaN(qe))throw new Error("Invalid room ID");let tt=null,He=null,at=null;try{const{data:fe}=await an(),Fe=yi((fe==null?void 0:fe.cookie_days)??30);if(Fe){const{agentId:Ve}=await sh(Fe);Ve&&(tt=Ve,He="referral",at=Fe)}}catch(fe){console.warn("Referral attribution skipped:",fe)}const rt=N&&j>0?j>=i.totalPrice?"full_paid":"deposit_paid":"pending",te=(m==null?void 0:m.payment_mode)||"manual";if(ve){const{error:fe}=await U.from("users").update({full_name:M,phone:S,updated_at:new Date().toISOString()}).eq("id",ve);fe&&console.error("Error updating user profile:",fe);const{error:Fe}=await U.auth.updateUser({data:{full_name:M,phone:S,address:J,city:R,country:C,passport_number:ne}});Fe&&console.error("Error updating user metadata:",Fe),console.log("Creating authenticated user booking:",{room_id:qe,check_in:i.checkInDate,check_out:i.checkOutDate,guests:i.guests,total_price:i.totalPrice,payment_status:rt}),await r({room_id:qe,check_in:i.checkInDate,check_out:i.checkOutDate,guests:i.guests,total_price:i.totalPrice,special_requests:i.specialRequests||void 0,payment_status:N&&j>0?j>=i.totalPrice?"full_paid":"deposit_paid":"pending",deposit_amount:N?j:void 0,paid_amount:N?j:void 0,omise_charge_id:N&&y||void 0,payment_method:te,agent_id:tt,attribution_source:He,referral_code_used:at})}else console.log("Creating guest booking:",{room_id:qe,check_in:i.checkInDate,check_out:i.checkOutDate,guests:i.guests,total_price:i.totalPrice,payment_status:rt}),await n({room_id:qe,check_in:i.checkInDate,check_out:i.checkOutDate,guests:i.guests,total_price:i.totalPrice,special_requests:i.specialRequests||void 0,payment_status:N&&j>0?j>=i.totalPrice?"full_paid":"deposit_paid":"pending",deposit_amount:N?j:void 0,paid_amount:N?j:void 0,omise_charge_id:N&&y||void 0,payment_method:te,agent_id:tt,attribution_source:He,referral_code_used:at,guest_info:{full_name:M,email:D,phone:S,address:J,city:R,country:C,passport_number:ne}});sessionStorage.removeItem("pendingCheckout"),f(!0),setTimeout(()=>{ve?t("/bookings"):t("/rooms",{state:{message:"Booking completed successfully! You will receive a confirmation email shortly."}})},2e3)}catch(ve){console.error("Booking error:",ve);const qe=ve instanceof Error?ve.message:typeof ve=="string"?ve:"Failed to process booking. Please try again.";u(qe),ve&&typeof ve=="object"&&"code"in ve&&(console.error("Error code:",ve.code),console.error("Error details:",ve))}finally{d(!1)}};return i?e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"container mx-auto px-6 py-12",children:[e.jsxs(P,{variant:"ghost",onClick:()=>t(-1),className:"mb-6",children:[e.jsx(nn,{className:"h-4 w-4 mr-2"}),"Back"]}),e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-8",children:"Complete Your Booking"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsx("div",{className:"lg:col-span-1",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-xl",children:"Booking Summary"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:i.roomImage,alt:i.roomName,className:"w-16 h-16 object-cover rounded-lg"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:i.roomName}),e.jsx("p",{className:"text-sm text-gray-600",children:"Room Details"})]})]}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"text-gray-600",children:"Check-in:"}),e.jsx("span",{className:"font-medium",children:new Date(i.checkInDate).toLocaleDateString()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"text-gray-600",children:"Check-out:"}),e.jsx("span",{className:"font-medium",children:new Date(i.checkOutDate).toLocaleDateString()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"text-gray-600",children:"Guests:"}),e.jsx("span",{className:"font-medium",children:i.guests})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-sunset-orange"}),e.jsx("span",{className:"text-gray-600",children:"Nights:"}),e.jsx("span",{className:"font-medium",children:i.nights})]})]}),e.jsxs("div",{className:"pt-4 border-t border-gray-200",children:[e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsx("span",{className:"text-gray-600",children:"Price per night:"}),e.jsxs("span",{children:["฿",(ie=i.pricePerNight)==null?void 0:ie.toLocaleStr
807ing()]})]}),e.jsxs("div",{className:"flex justify-between items-center text-sm",children:[e.jsxs("span",{className:"text-gray-600",children:["Total (",i.nights," nights):"]}),e.jsxs("span",{className:"font-semibold text-lg",children:["฿",i.totalPrice.toLocaleString()]})]})]})]})]})}),e.jsx("div",{className:"lg:col-span-2",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{className:"text-xl",children:"Guest Information"}),e.jsx("p",{className:"text-gray-600",children:"Please provide your details to complete the booking"})]}),e.jsx(K,{children:e.jsxs("form",{onSubmit:Q,className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"fullName",children:"Full Name *"}),e.jsx(W,{id:"fullName",value:M,onChange:G=>q(G.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"email",children:"Email *"}),e.jsx(W,{id:"email",type:"email",value:D,onChange:G=>F(G.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"phone",children:"Phone Number *"}),e.jsx(W,{id:"phone",type:"tel",value:S,onChange:G=>$(G.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"passportNumber",children:"Passport Number *"}),e.jsx(W,{id:"passportNumber",value:ne,onChange:G=>re(G.target.value),required:!0})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"address",children:"Address *"}),e.jsx(W,{id:"address",value:J,onChange:G=>V(G.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"city",children:"City *"}),e.jsx(W,{id:"city",value:R,onChange:G=>se(G.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"country",children:"Country *"}),e.jsx(W,{id:"country",value:C,onChange:G=>Y(G.target.value),required:!0})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"specialRequests",children:"Special Requests"}),e.jsx(Is,{id:"specialRequests",value:i.specialRequests,disabled:!0,className:"bg-gray-50"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Special requests from your room selection"})]}),!s&&e.jsxs("div",{className:"pt-4 border-t border-gray-200",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Sc,{id:"createAccount",checked:me,onCheckedChange:G=>he(G)}),e.jsx(A,{htmlFor:"createAccount",className:"text-sm font-medium",children:"Create an account to manage your bookings"})]}),me&&e.jsx("div",{className:"mt-4 space-y-4",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"password",children:"Password *"}),e.jsx(W,{id:"password",type:"password",value:E,onChange:G=>ce(G.target.value),required:me,minLength:6}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Minimum 6 characters"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"confirmPassword",children:"Confirm Password *"}),e.jsx(W,{id:"confirmPassword",type:"password",value:B,onChange:G=>le(G.target.value),required:me,minLength:6})]})]})})]}),h&&e.jsxs(Se,{className:"border-red-200 bg-red-50",children:[e.jsx(ps,{className:"h-4 w-4 text-red-800"}),e.jsx(Ce,{className:"text-red-800",children:h})]}),p&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-800"}),e.jsx(Ce,{className:"text-green-800",children:"Booking completed successfully! Redirecting to your bookings..."})]}),k&&m&&!N&&e.jsx("div",{className:"pt-4 border-t border-gray-200",children:m.omise_public_key?e.jsx(dg,{amount:i.totalPrice,depositAmount:j,omisePublicKey:m.omise_public_key,onSuccess:G=>{w(G),I(!0),u(null)},onError:G=>{u(G)},description:`Deposit for ${i.roomName} booking`,metadata:{room_id:i.roomId.toString(),booking_type:"deposit"}}):e.jsxs(Se,{className:"border-yellow-200 bg-yellow-50",children:[e.jsx(ss,{className:"h-4 w-4 text-yellow-800"}),e.jsx(Ce,{className:"text-yellow-800",children:"Omise public key is not configured. Please configure it in Admin Settings, or contact support."})]})}),N&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-800"}),e.jsxs(Ce,{className:"text-green-800",children:["Payment processed successfully! Deposit of ฿",j.toLocaleStr
807ing()," has been charged."]})]}),(m==null?void 0:m.payment_mode)==="manual"&&e.jsx(Se,{className:"border-blue-200 bg-blue-50",children:e.jsx(Ce,{className:"text-blue-800",children:"We will send you information about the payment procedure."})}),e.jsx(P,{type:"submit",className:"w-full bg-sunset-orange hover:bg-orange-600 text-white",disabled:c||k&&!N,children:c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),"Processing..."]}):N?`Complete Booking - ฿${i.totalPrice.toLocaleString()}`:k?"Complete Payment First":`Complete Booking - ฿${i.totalPrice.toLocaleString()}`})]})})]})})]})]})]}),e.jsx(Ke,{})]}):e.jsx("div",{children:"Loading..."})},hg=()=>{var v,x,g;const t=vt(),{user:s,signOut:a,loading:r}=Nt(),{bookings:n,loading:i,fetchBookings:o}=Pa(),{isAdmin:c}=ir(),[d,h]=l.useState("overview"),[u,p]=l.useState(!1);l.useEffect(()=>{if(!r){if(!s){t("/login");return}u||(o(),p(!0))}},[s,r,t,u]);const f=async()=>{await a(),t("/")},m=j=>{switch(j){case"confirmed":return"bg-green-100 text-green-800";
807case"pending":return"bg-yellow-100 text-yellow-800";case"cancelled":return"bg-red-100 text-red-800";case"completed":return"bg-blue-100 text-blue-800";default:return"bg-gray-100 text-gray-800"}};return r?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading dashboard..."})]})}):s?e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"container mx-auto px-6 py-12 pt-32",children:[e.jsx("div",{className:"mb-8",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-3xl font-bold text-gray-900 mb-2",children:["Welcome back, ",typeof((v=s.user_metadata)==null?void 0:v.full_name)=="string"?s.user_metadata.full_name:"Guest","!"]}),e.jsx("p",{className:"text-gray-600",children:"Manage your bookings and profile"})]}),c&&e.jsx("div",{className:"flex items-center space-x-3",children:e.jsxs(P,{onClick:()=>t("/admin"),variant:"outline",className:"border-sunset-orange text-sunset-orange hover:bg-sunset-orange hover:text-white",children:[e.jsx(ba,{className:"h-4 w-4 mr-2"}),"Admin Panel"]})})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-6 mb-8",children:[e.jsx(z,{children:e.jsx(K,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Fn,{className:"h-8 w-8 text-sunset-orange mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total Bookings"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:n.length})]})]})})}),e.jsx(z,{children:e.jsx(K,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Re,{className:"h-8 w-8 text-green-600 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Active Bookings"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:n.filter(j=>j.status==="confirmed"||j.status==="pending").length})]})]})})}),e.jsx(z,{children:e.jsx(K,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(dt,{className:"h-8 w-8 text-yellow-500 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Completed"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:n.filter(j=>j.status==="completed").length})]})]})})}),e.jsx(z,{children:e.jsx(K,{className:"p-6",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Xe,{className:"h-8 w-8 text-blue-600 mr-3"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Total Guests"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:n.reduce((j,b)=>j+b.guests,0)})]})]})})})]}),e.jsxs("div",{className:"flex space-x-1 bg-gray-100 p-1 rounded-lg mb-8",children:[e.jsx(P,{variant:d==="overview"?"default":"ghost",size:"sm",onClick:()=>h("overview"),className:"flex-1",children:"Overview"}),e.jsx(P,{variant:d==="bookings"?"default":"ghost",size:"sm",onClick:()=>h("bookings"),className:"flex-1",children:"My Bookings"}),e.jsx(P,{variant:d==="profile"?"default":"ghost",size:"sm",onClick:()=>h("profile"),className:"flex-1",children:"Profile"})]}),d==="overview"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Recent Activity"})}),e.jsx(K,{children:n.length===0?e.jsx("p",{className:"text-gray-500 text-center py-8",children:"No bookings yet. Start exploring our rooms!"}):e.jsx("div",{className:"space-y-4",children:n.slice(0,3).map(j=>{var b;return e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gray-50 rounded-lg",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900",children:((b=j.rooms)==null?void 0:b.name)||"Room"}),e.jsxs("p",{className:"text-sm text-gray-600",children:[new Date(j.check_in).toLocaleDateString()," - ",new Date(j.check_out).toLocaleDateString()]})]}),e.jsx(Te,{className:m(j.status),children:j.status})]},j.id)})})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Qu
807ick Actions"})}),e.jsxs(K,{className:"space-y-3",children:[e.jsxs(P,{onClick:()=>t("/rooms"),className:"w-full justify-start",variant:"outline",children:[e.jsx(Fn,{className:"h-4 w-4 mr-2"}),"Book New Room"]}),e.jsxs(P,{onClick:()=>h("profile"),className:"w-full justify-start",variant:"outline",children:[e.jsx(ba,{className:"h-4 w-4 mr-2"}),"Update Profile"]})]})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Account Info"})}),e.jsxs(K,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsx("span",{className:"font-medium text-gray-600 w-20",children:"Email:"}),e.jsx("span",{className:"text-gray-900",children:s.email})]}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsx("span",{className:"font-medium text-gray-600 w-20",children:"Name:"}),e.jsx("span",{className:"text-gray-900",children:typeof((x=s.user_metadata)==null?void 0:x.full_name)=="string"?s.user_metadata.full_name:"Not set"})]}),e.jsxs("div",{className:"flex items-center text-sm",children:[e.jsx("span",{className:"font-medium text-gray-600 w-20",children:"Member since:"}),e.jsx("span",{className:"text-gray-900",children:new Date(s.created_at).toLocaleDateString()})]})]})]})]})]}),d==="bookings"&&e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"My Bookings"})}),e.jsx(K,{children:i?e.jsx("p",{className:"text-gray-500 text-center py-8",children:"Loading bookings..."}):n.length===0?e.jsx("p",{className:"text-gray-500 text-center py-8",children:"No bookings found. Start exploring our rooms!"}):e.jsx("div",{className:"space-y-4",children:n.map(j=>{var b;return e.jsxs("div",{className:"border rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-lg text-gray-900",children:((b=j.rooms)==null?void 0:b.name)||"Room"}),e.jsx(Te,{className:m(j.status),children:j.status})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-sm text-gray-600",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(Re,{className:"h-4 w-4 mr-2 text-sunset-orange"}),e.jsxs("span",{children:[new Date(j.check_in).toLocaleDateString()," - ",new Date(j.check_out).toLocaleDateString()]})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(Xe,{className:"h-4 w-4 mr-2 text-sunset-orange"}),e.jsxs("span",{children:[j.guests," guests"]})]}),e.jsx("div",{className:"flex items-center",children:e.jsxs("span",{className:"font-medium text-gray-900",children:["$",j.total_price]})})]}),j.special_requests&&e.jsx("div",{className:"mt-3 p-3 bg-gray-50 rounded-lg",children:e.jsxs("p",{className:"text-sm text-gray-600",children:[e.jsx("span",{className:"font-medium",children:"Special Requests:"})," ",j.special_requests]})})]},j.id)})})})]}),d==="profile"&&e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Profile Settings"})}),e.jsxs(K,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Full Name"}),e.jsx("input",{type:"text",value:typeof((g=s.user_metadata)==null?void 0:g.full_name)=="string"?s.user_metadata.full_name:"",disabled:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50 text-gray-500"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Contact support to update your name"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Email"}),e.jsx("input",{type:"email",value:s.email||"",disabled:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50 text-gray-500"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Email cannot be changed"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Member Since"}),e.jsx("input",{type:"text",value:new Date(s.created_at).toLocaleDateString(),disabled:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50 text-gray-500"})]})]}),e.jsx("div",{className:"pt-4 border-t",children:e.jsxs(P,{onClick:f,variant:"outline",className:"w-full",children:[e.jsx(Ir,{className:"h-4 w-4 mr-2"}),"Sign Out"]})})]})]})]}),e.jsx(Ke,{})]}):null},ug=()=>{var me,he;const t=vt(),[s,a]=l.useState(new Date),[r,n]=l.useState("month"),[i,o]=l.useState(null),[c,d]=l.useState([]),[h,u]=l.useState([]),[p,f]=l.useState(!0),[m,v]=l.useState(null),[x,g]=l.useState(!1),[j,b]=l.useState(!1),[N,I]=l.useState("all"),[y,w]=l.useState("all"),[k,_]=l.useState(null),[M,q]=l.useState(null),D=()=>{const E=new Date(s);r==="month"?E.setMonth(E.getMonth()-1):r==="week"?E.setDate(E.getDate()-7):E.setDate(E.getDate()-1),a(E)},F=()=>{const E=new Date(s);r==="month"?E.setMonth(E.getMonth()+1):r==="week"?E.setDate(E.getDate()+7):E.setDate(E.getDate()+1),a(E)},S=()=>{a(new Date),o(new Date)};l.useEffect(()=>{$()},[]);const $=async()=>{try{f(!0),console.log("Fetching calendar data...");const{data:E,error:ce}=await U.from("bookings").select(` 808 *, 809 rooms:room_id ( 810 name, 811 image 812 ), 813 users:user_id ( 814 email, 815 full_name 816 ), 817 guest_info:guest_info_id ( 818 full_name, 819 email, 820 phone, 821 address, 822 city, 823 country, 824 passport_number 825 ) 826 `).order("check_in",{ascending:!0});if(ce){console.log("Join query failed, trying simple query...");const{data:Q,error:ie}=await U.from("bookings").select("*").order("check_in",{ascending:!0});if(ie)throw console.error("Simple query also failed:",ie),ie;
826const G=await Promise.all(Q.map(async oe=>{try{const{data:xe}=await U.from("rooms").select("name, image").eq("id",oe.room_id).single(),{data:ue}=await U.from("users").select("email, full_name").eq("id",oe.user_id).single(),{data:Ee}=await U.from("guest_info").select("full_name, email, phone, address, city, country, passport_number").eq("id",oe.guest_info_id).single();return{...oe,rooms:xe||{name:"Unknown Room",image:""},users:ue||{email:"",full_name:""},guest_info:Ee||null}}catch(xe){return console.error("Error enriching booking:",xe),{...oe,rooms:{name:"Error Loading Room",image:""},users:{email:"",full_name:""},guest_info:null}}}));d(G)}else d(E||[]);console.log("Bookings fetched:",(E==null?void 0:E.length)||0,"bookings"),E&&E.length>0&&(console.log("Sample booking data:",E[0]),console.log("User data:",E[0].users),console.log("Guest info data:",E[0].guest_info));const{data:B,error:le}=await U.from("rooms").select("*").order("name");if(le)throw console.error("Rooms fetch error:",le),le;console.log("Rooms fetched:",(B==null?void 0:B.length)||0,"rooms"),d(E||[]),u(B||[])}catch(E){console.error("Error fetching data:",E)}finally{f(!1)}},J=l.useMemo(()=>{const E=s.getFullYear(),ce=s.getMonth();if(r==="month"){const B=new Date(E,ce,1),le=new Date(E,ce+1,0),Q=new Date(B);Q.setDate(Q.getDate()-B.getDay());const ie=[],G=new Date(Q);for(;G<=le||ie.length<42;)ie.push(new Date(G)),G.setDate(G.getDate()+1);return ie}else if(r==="week"){const B=new Date(s);B.setDate(B.getDate()-s.getDay());const le=[];for(let Q=0;Q<7;Q++)le.push(new Date(B)),B.setDate(B.getDate()+1);return le}else return[s]},[s,r]),V=E=>{const ce=E.toLocaleDateString("en-CA"),B=new Date(ce+"T00:00:00");return c.filter(le=>{const Q=le.check_in.split("T")[0],ie=le.check_out.split("T")[0],G=new Date(Q+"T00:00:00"),oe=new Date(ie+"T00:00:00");if(Q===ie){const ue=B.toDateString()===G.toDateString();return c.indexOf(le)<3&&console.log("Single night booking:",{date:ce,checkIn:Q,checkOut:ie,isOnCheckInDate:ue,result:ue}),ue}else{const ue=B>=G,Ee=B<oe;return c.indexOf(le)<3&&console.log("Multi-night booking:",{date:ce,checkIn:Q,checkOut:ie,isOnOrAfterCheckIn:ue,isBeforeCheckOut:Ee,result:ue&&Ee}),ue&&Ee}})},R=E=>{let ce=V(E);return N!=="all"&&(ce=ce.filter(B=>B.room_id.toString()===N)),y!=="all"&&(ce=ce.filter(B=>B.status===y)),ce},se=async(E,ce)=>{try{_(E),q(null),console.log("Updating booking status:",{bookingId:E,status:ce});const{error:B}=await U.from("bookings").update({status:ce}).eq("id",E);if(B)throw console.error("Supabase error:",B),B;console.log("Status updated successfully in database"),d(le=>le.map(Q=>Q.id===E?{...Q,status:ce}:Q)),m&&m.id===E&&v(le=>le?{...le,status:ce}:null),q(`Booking status updated to ${ce}`),setTimeout(()=>{$()},500)}catch(B){console.error("Error updating booking status:",B),q("Failed to update status")}finally{_(null),setTimeout(()=>q(null),3e3)}},C=E=>{switch(E){case"confirmed":return"bg-green-100 text-green-800 border-green-200";
826case"pending":return"bg-yellow-100 text-yellow-800 border-yellow-200";case"cancelled":return"bg-red-100 text-red-800 border-red-200";case"completed":return"bg-blue-100 text-blue-800 border-blue-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},Y=E=>r==="month"?E.getDate():r==="week"?E.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):E.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"}),ne=E=>{var ce,B,le,Q;return console.log("Getting guest name for booking:",{id:E.id,users:E.users,guest_info:E.guest_info}),(ce=E.users)!=null&&ce.full_name&&E.users.full_name.trim()!==""?(console.log("Using user full_name:",E.users.full_name),E.users.full_name):(B=E.guest_info)!=null&&B.full_name&&E.guest_info.full_name.trim()!==""?(console.log("Using guest_info full_name:",E.guest_info.full_name),E.guest_info.full_name):(le=E.users)!=null&&le.email&&E.users.email.trim()!==""?(console.log("Using user email as fallback:",E.users.email),E.users.email):(Q=E.guest_info)!=null&&Q.email&&E.guest_info.email.trim()!==""?(console.log("Using guest_info email as fallback:",E.guest_info.email),E.guest_info.email):(console.log("No guest name found, using default"),"Guest")},re=(E,ce)=>{const B=new Date(E),le=new Date(ce),Q=B.toLocaleDateString("en-US",{month:"short",day:"numeric"}),ie=le.toLocaleDateString("en-US",{month:"short",day:"numeric"});return`${Q} - ${ie}`};return p?e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-sunset-orange mx-auto"}),e.jsx("p",{className:"mt-4 text-gray-600",children:"Loading calendar..."})]})}):e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("div",{className:"bg-white border-b border-gray-200 sticky top-0 z-10",children:e.jsx("div",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(P,{variant:"ghost",onClick:()=>t("/admin"),className:"text-gray-600 hover:text-gray-900",children:"â Back to Admin"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Hotel Calendar"})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs(P,{variant:"outline",onClick:$,className:"mr-2",children:[e.jsx(bt,{className:"h-4 w-4 mr-2"}),"Refresh"]}),e.jsxs(P,{onClick:()=>b(!0),className:"bg-sunset-orange hover:bg-orange-500",children:[e.jsx(ut,{className:"h-4 w-4 mr-2"}),"New Booking"]})]})]})})}),e.jsx("div",{className:"bg-white border-b border-gray-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx(P,{variant:"outline",size:"sm",onClick:D,children:e.jsx(on,{className:"h-4 w-4"})}),e.jsx(P,{variant:"outline",size:"sm",onClick:S,children:"Today"}),e.jsx(P,{variant:"outline",size:"sm",onClick:F,children:e.jsx(ka,{className:"h-4 w-4"})}),e.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[r==="month"&&s.toLocaleDateString("en-US",{month:"long",year:"numeric"}),r==="week"&&`Week of ${s.toLocaleDateString("en-US",{month:"short",day:"numeric"})}`,r==="day"&&s.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})]})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(Xt,{value:r,onValueChange:E=>n(E),children:[e.jsx(Ut,{className:"w-32",children:e.jsx(Zt,{})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"month",children:"Month"}),e.jsx(ze,{value:"week",children:"Week"}),e.jsx(ze,{value:"day",children:"Day"})]})]}),e.jsxs(Xt,{value:N,onValueChange:I,children:[e.jsx(Ut,{className:"w-40",children:e.jsx(Zt,{placeholder:"Filter by room"})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"all",children:"All Rooms"}),h.map(E=>e.jsx(ze,{value:E.id.toString(),children:E.name},E.id))]})]}),e.jsxs(Xt,{value:y,onValueChange:w,children:[e.jsx(Ut,{className:"w-40",children:e.jsx(Zt,{placeholder:"Filter by status"})}),e.jsxs(zt,{children:[e.jsx(ze,{value:"all",children:"All Statuses"}),e.jsx(ze,{value:"pending",children:"Pending"}),e.jsx(ze,{value:"confirmed",children:"Confirmed"}),e.jsx(ze,{value:"cancelled",children:"Cancelled"}),e.jsx(ze,{value:"completed",children:"Completed"})]})]})]})]})}),e.jsxs("div",{className:"p-6",children:[r==="month"&&e.jsxs("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-gray-200",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(E=>e.jsx("div",{className:"p-4 text-center font-medium text-gray-500 bg-gray-50",children:E},E))}),e.jsx("div",{className:"grid grid-cols-7",children:J.map((E,ce)=>{const B=E.getMonth()===s.getMonth(),le=E.toDateString()===new Date().toDateString(),Q=i&&E.toDateString()===i.toDateString(),ie=R(E);return e.jsxs("div",{className:` 827 min-h-[120px] border-r border-b border-gray-200 p-2 cursor-pointer hover:bg-gray-50 transition-colors 828 ${B?"bg-white":"bg-gray-50 text-gray-400"} 829 ${le?"bg-blue-50":""} 830 ${Q?"bg-sunset-orange/10":""} 831 `,onClick:()=>o(E),children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:Y(E)}),e.jsxs("div",{className:"space-y-1",children:[ie.slice(0,3).map(G=>{var ue;const oe=new Date(G.check_in).toDateString()===E.toDateString(),xe=new Date(G.check_out).toDateString()===new Date(E.getTime()+24*60*60*1e3).toDateString();return e.jsxs("div",{className:` 832 text-xs p-2 rounded border-2 ${C(G.status)} 833 cursor-pointer hover:opacity-80 transition-opacity shadow-sm 834 ${oe?"border-l-4 border-l-green-500":""} 835 ${xe?"border-r-4 border-r-red-500":""} 836 `,onClick:Ee=>{Ee.stopPropagation(),v(G),g(!0)},children:[e.jsxs("div",{className:"font-bold text-xs mb-1",children:[((ue=G.rooms)==null?void 0:ue.name)||"Room",oe&&e.jsx("span",{className:"ml-1 text-green-600",children:"â"}),xe&&e.jsx("span",{className:"ml-1 text-red-600",children:"â"})]}),e.jsxs("div",{className:"text-xs mb-1",children:[e.jsx("span",{className:"font-medium",children:"ð¤"})," ",ne(G)]}),e.jsxs("div",{className:"text-xs mb-1",children:[e.jsx("span",{className:"font-medium",children:"ð¥"})," ",G.guests," guests"]}),e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"ð "})," ",re(G.check_in,G.check_out)]})]},G.id)}),ie.length>3&&e.jsxs("div",{className:"text-xs text-gray-500 text-center bg-gray-100 p-1 rounded",children:["+",ie.length-3," more"]})]})]},ce)})})]}),r==="week"&&e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:e.jsx("div",{className:"grid grid-cols-7",children:J.map((E,ce)=>{const B=E.toDateString()===new Date().toDateString(),le=R(E);return e.jsxs("div",{className:` 837 min-h-[200px] border-r border-gray-200 p-3 838 ${B?"bg-blue-50":"bg-white"} 839 `,children:[e.jsx("div",{className:"text-sm font-medium mb-3 text-center",children:Y(E)}),e.jsx("div",{className:"space-y-2",children:le.map(Q=>{var ie;return e.jsxs("div",{className:` 840 text-xs p-2 rounded border-2 ${C(Q.status)} 841 cursor-pointer hover:opacity-80 transition-opacity shadow-sm 842 `,onClick:()=>{v(Q),g(!0)},children:[e.jsx("div",{className:"font-bold text-xs mb-1",children:((ie=Q.rooms
842)==null?void 0:ie.name)||"Room"}),e.jsxs("div",{className:"text-xs mb-1",children:[e.jsx("span",{className:"font-medium",children:"ð¤"})," ",ne(Q)]}),e.jsxs("div",{className:"text-xs mb-1",children:[e.jsx("span",{className:"font-medium",children:"ð¥"})," ",Q.guests," guests"]}),e.jsxs("div",{className:"text-xs",children:[e.jsx("span",{className:"font-medium",children:"ð
"})," ",re(Q.check_in,Q.check_out)]})]},Q.id)})})]},ce)})})}),r==="day"&&e.jsx("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200",children:e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4",children:Y(s)}),e.jsxs("div",{className:"space-y-4",children:[R(s).map(E=>{var ce;return e.jsx(z,{className:"hover:shadow-md transition-shadow",children:e.jsx(K,{className:"p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"w-16 h-16 bg-gray-200 rounded-lg flex items-center justify-center",children:e.jsx(Re,{className:"h-8 w-8 text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-lg",children:((ce=E.rooms)==null?void 0:ce.name)||"Room"}),e.jsxs("div",{className:"flex items-center space-x-4 text-sm text-gray-600",children:[e.jsxs("span",{className:"flex items-center",children:[e.jsx(Ie,{className:"h-4 w-4 mr-1"}),new Date(E.check_in).toLocaleDateString()," - ",new Date(E.check_out).toLocaleDateString()]}),e.jsxs("span",{className:"flex items-center",children:[e.jsx(Xe,{className:"h-4 w-4 mr-1"}),E.guests," guests"]}),e.jsx("span",{className:"flex items-center",children:e.jsxs("span",{className:"font-medium",children:["$",E.total_price]})})]}),e.jsxs("div",{className:"text-sm text-gray-600 mt-1",children:[e.jsx("span",{className:"font-medium",children:"Guest:"})," ",ne(E)]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Te,{className:C(E.status),children:E.status}),e.jsx(P,{size:"sm",variant:"outline",onClick:()=>{v(E),g(!0)},children:e.jsx(Ds,{className:"h-4 w-4"})})]})]})})},E.id)}),R(s).length===0&&e.jsxs("div",{className:"text-center py-12 text-gray-500",children:[e.jsx(Re,{className:"h-12 w-12 mx-auto mb-4 text-gray-300"}),e.jsx("p",{children:"No bookings for this date"})]})]})]})})]}),e.jsx(ra,{open:x,onOpenChange:g,children:e.jsxs(Fs,{className:"max-w-2xl max-h-[90vh] overflow-y-auto bg-white border-2 border-gray-200 shadow-2xl",children:[e.jsx(Bs,{children:e.jsx(Os,{children:"Booking Details"})}),M&&e.jsx("div",{className:`p-3 rounded-md mb-4 ${M.includes("Failed")?"bg-red-100 text-red-800 border border-red-200":"bg-green-100 text-green-800 border border-green-200"}`,children:M}),m&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-lg",children:"Room Information"})}),e.jsx(K,{children:e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-200 rounded-lg flex items-center justify-center",children:e.jsx(Je,{className:"h-10 w-10 text-gray-400"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-xl",children:((me=m.rooms)==null?void 0:me.name)||"Room"}),e.jsxs("p",{className:"text-gray-600",children:[m.guests," guests ⢠$",m.total_price]})]})]})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-lg",children:"Guest Information"})}),e.jsx(K,{children:m.users?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-gray-500"}),e.jsx("span",{className:"font-medium",children:m.users.full_name||"Guest"})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ts,{className:"h-4 w-4 text-gray-500"}),e.jsx("span",{children:m.users.email})]}),((he=m.users.user_metadata)==null?void 0:he.phone)&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{className:"h-4 w-4 text-gray-500"}),e.jsx("span",{children:m.users.user_metadata.phone})]})]}):m.guest_info?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-gray-500"}),e.jsx("span",{className:"font-medium",children:m.guest_info.full_name})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(ts,{className:"h-4 w-4 text-gray-500"}),e.jsx("span",{children:m.guest_info.email})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(lt,{className:"h-4 w-4 text-gray-500"}),e.jsx("span",{children:m.guest_info.phone})]}),e.jsxs("div",{className:"text-sm text-gray-600",children:[m.guest_info.address,", ",m.guest_info.city,", ",m.guest_info.country]})]}):e.jsx("p",{className:"text-gray-500",children:"No guest information available"})})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-lg",children:"Booking Details"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-600",children:"Check-in"}),e.jsx("p",{className:"text-lg font-semibold",children:new Date(m.check_in).toLocaleDateString()})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-600",children:"Check-out"}),e.jsx("p",{className:"text-lg font-semibold",children:new Date(m.check_out).toLocaleDateString()})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-600",children:"Status"}),e.jsx(Te,{className:`mt-1 ${C(m.status)}`,children:m.status})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-600",children:"Total Price"}),e.jsxs("p",{className:"text-lg font-semibold",children:["$",m.total_price]})]})]}),m.special_requests&&e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-600",children:"Special Requests"}),e.jsx("p",{className:"mt-1 text-gray-900",children:m.special_requests})]})]})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{className:"text-lg",children:"Status Management"})}),e.jsx(K,{children:e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(P,{size:"sm",variant:"outline",className:"border-green-200 text-green-700 hover:bg-green-50",onClick:()=>se(m.id,"confirmed"),disabled:m.status==="confirmed"||k===m.id,children:[k===m.id?e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-green-700 mr-1"}):e.jsx(jt,{className:"h-4 w-4 mr-1"}),k===m.id?"Updating...":"Confirm"]}),e.jsxs(P,{size:"sm",variant:"outline",className:"border-blue-200 text-blue-700 hover:bg-blue-50",onClick:()=>se(m.id,"completed"),disabled:m.status==="completed",children:[e.jsx(jt,{className:"h-4 w-4 mr-1"}),"Complete"]}),e.jsxs(P,{size:"sm",variant:"outline",className:"border-red-200 text-red-700 hover:bg-red-50",onClick:()=>se(m.id,"cancelled"),disabled:m.status==="cancelled",children:[e.jsx(ps,{className:"h-4 w-4 mr-1"}),"Cancel"]})]})})]})]})]})}),e.jsx(ra,{open:j,onOpenChange:b,children:e.jsxs(Fs,{className:"max-w-2xl bg-white border-2 border-gray-200 shadow-2xl",children:[e.jsx(Bs,{children:e.jsx(Os,{children:"Create New Booking"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"room",children:"Room"}),e.jsxs(Xt,{children:[e.jsx(Ut,{children:e.jsx(Zt,{placeholder:"Select room"})}),e.jsx(zt,{children:h.map(E=>e.jsx(ze,{value:E.id.toString(),children:E.name},E.id))})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"guests",children:"Number of Guests"}),e.jsx(W,{id:"guests",type:"number",min:"1"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(A,{htmlFor:"checkin",children:"Check-in Date"}),e.jsx(W,{id:"checkin",type:"date"})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"checkout",children:"Check-out Date"}),e.jsx(W,{id:"checkout",type:"date"})]})]}),e.jsxs("div",{children:[e.jsx(A,{htmlFor:"special-requests",children:"Special Requests"}),e.jsx(Is,{id:"special-requests",placeholder:"Any special requests..."})]}),e.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[e.jsx(P,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),e.jsx(P,{className:"bg-sunset-orange hover:bg-orange-500",children:"Create Booking"})]})]})]})})]})},ll=[{type:"id_passport",label:"Government ID / Passport"},{type:"selfie",label:"Selfie holding ID"},{type:"bank_proof",label:"Bank account proof"}],xg=[{type:"business_license",label:"Business license (optional)"}],gg=()=>{const{user:t,loading:s}=Nt(),{agent:a,refetch:r}=or(),n=vt(),[i,o]=l.useState(""),[c,d]=l.useState(""),[h,u]=l.useState(""),[p,f]=l.useState(""),[m,v]=l.useState(""),[x,g]=l.useState(""),[j,b]=l.useState(""),[N,I]=l.useState(""),[y,w]=l.useState(new Set),[k,_]=l.useState(!1),[M,q]=l.useState(null),[D,F]=l.useState(null);l.useEffect(()=>{a&&(o(a.display_name||""),d(a.company_name||""),u(a.phone||""),f(a.country||""),v(a.bank_name||""),g(a.bank_account_name||""),b(a.bank_account_number||""),I(a.bank_swift||""),ui(a.id).then(({data:V})=>{w(new Set((V||[]).map(R=>R.doc_type)))}))},[a]);const S=async()=>
842{if(!i.trim()){F("Display name is required");return}_(!0),F(null);const{data:V,error:R}=await ah({display_name:i,company_name:c,phone:h,country:p,bank_name:m,bank_account_name:x,bank_account_number:j,bank_swift:N});if(_(!1),R){F(R);return}V&&(t!=null&&t.email)&&await Yt.sendAgentApplicationReceived(t.email,i),q("Application started. Upload KYC documents, then submit for review."),await r()},$=async(V,R)=>{if(!R||!a||!t)return;F(null);const{error:se}=await lh(a.id,t.id,V,R);if(se){F(se);return}w(C=>new Set(C).add(V)),q(`${V} uploaded`)},J=async()=>{if(!a)return;const V=ll.filter(C=>!y.has(C.type));if(V.length){F(`Upload required documents: ${V.map(C=>C.label).join(", ")}`);return}if(!m||!x||!j){F("Bank name, account name, and account number are required before review");return}_(!0),F(null);const{error:R}=await rn(a.id,{display_name:i,company_name:c||null,phone:h||null,country:p||null,bank_name:m,bank_account_name:x,bank_account_number:j,bank_swift:N||null});if(R){_(!1),F(R);return}const{error:se}=await nh(a.id);if(_(!1),se){F(se);return}q("Submitted for admin review. You will be emailed when reviewed."),await r()};return s?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:"Loadingâ¦"}):t?(a==null?void 0:a.status)==="approved"?e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsx("div",{className:"container mx-auto px-6 py-32 max-w-lg",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"You are already an approved agent"})}),e.jsx(K,{children:e.jsx(P,{onClick:()=>n("/agent"),children:"Open agent portal"})})]})}),e.jsx(Ke,{})]}):e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"container mx-auto px-6 py-28 max-w-2xl space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Partner agent application"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Earn commission on bookings via your referral link or agent portal. After KYC approval you will receive a unique referral code."})]}),a&&e.jsx(Se,{children:e.jsxs(Ce,{children:["Status: ",e.jsx("strong",{children:a.status.replace(/_/g," ")}),a.rejection_reason?` â ${a.rejection_reason}`:""]})}),M&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-700"}),e.jsx(Ce,{className:"text-green-800",children:M})]}),D&&e.jsxs(Se,{variant:"destructive",children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(Ce,{children:D})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Profile & bank details"})}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Display name *"}),e.jsx(W,{value:i,onChange:V=>o(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Company (optional)"}),e.jsx(W,{value:c,onChange:V=>d(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Phone"}),e.jsx(W,{value:h,onChange:V=>u(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Country"}),e.jsx(W,{value:p,onChange:V=>f(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Bank name *"}),e.jsx(W,{value:m,onChange:V=>v(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Account name *"}),e.jsx(W,{value:x,onChange:V=>g(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Account number *"}),e.jsx(W,{value:j,onChange:V=>b(V.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"SWIFT / BIC"}),e.jsx(W,{value:N,onChange:V=>I(V.target.value)})]})]}),a?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Application ID created. Upload KYC files below."}):e.jsx(P,{onClick:S,disabled:k,children:k?"Savingâ¦":"Start application"})]})]}),a&&e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"KYC documents"}),e.jsx(ke,{children:"PDF or images, max 10MB each."})]}),e.jsxs(K,{className:"space-y-4",children:[[...ll,...xg].map(V=>e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b pb-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:V.label}),y.has(V.type)&&e.jsx("span",{className:"text-xs text-green-700",children:"Uploaded"})]}),e.jsx(W,{type:"file",accept:"image/*,application/pdf",className:"max-w-xs",onChange:R=>{var se;return $(V.type,((se=R.target.files)==null?void 0:se[0])||null)}})]},V.type)),a.status!=="pending_review"&&e.jsx(P,{onClick:J,disabled:k,children:k?"Submittingâ¦":"Submit for review"})]})]})]}),e.jsx(Ke,{})]}):e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsx("div",{className:"container mx-auto px-6 py-32 max-w-lg",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Become a partner agent"}),e.jsx(ke,{children:"Sign in or create an account first, then complete KYC to earn commissions."})]}),e.jsx(K,{children:e.jsx(P,{asChild:!0,className:"w-full",children:e.jsx(ct,{to:"/login",state:{from:{pathname:"/agents/appl
842y"}},children:"Sign in to apply"})})})]})}),e.jsx(Ke,{})]})},pg=()=>{const{agent:t,isApprovedAgent:s,loading:a}=or(),{rooms:r}=mr(),{createGuestBooking:n,checkRoomAvailability:i}=Pa(),[o,c]=l.useState([]),[d,h]=l.useState([]),[u,p]=l.useState([]),[f,m]=l.useState(null),[v,x]=l.useState(null),[g,j]=l.useState(!1),[b,N]=l.useState(""),[I,y]=l.useState(""),[w,k]=l.useState(""),[_,M]=l.useState(""),[q,D]=l.useState(""),[F,S]=l.useState(""),[$,J]=l.useState(""),[V,R]=l.useState(""),[se,C]=l.useState(2),[Y,ne]=l.useState(""),[re,me]=l.useState(""),[he,E]=l.useState(""),[ce,B]=l.useState(""),[le,Q]=l.useState(""),[ie,G]=l.useState(""),[oe,xe]=l.useState(""),[ue,Ee]=l.useState(!1),ve=l.useCallback(async()=>{if(!t)return;const[te,fe,Fe]=await Promise.all([mh(t.id),xi({agentId:t.id}),gi(t.id)]);c(te.data||[]),h(fe.data||[]),p(Fe.data||[])},[t]);l.useEffect(()=>{t&&(N(t.bank_name||""),y(t.bank_account_name||""),k(t.bank_account_number||""),M(t.bank_swift||""),D(t.phone||""),ve())},[t,ve]);const qe=l.useMemo(()=>{const te=d.filter(Ve=>Ve.status==="payable").reduce((Ve,De)=>Ve+Number(De.commission_amount),0),fe=d.filter(Ve=>Ve.status==="paid").reduce((Ve,De)=>Ve+Number(De.commission_amount),0),Fe=d.filter(Ve=>Ve.status==="void").reduce((Ve,De)=>Ve+Number(De.commission_amount),0);return{payable:te,paid:fe,voided:Fe,bookings:o.length}},[d,o]),tt=t?fh(t.referral_code):"",He=async()=>{await navigator.clipboard.writeText(tt),j(!0),setTimeout(()=>j(!1),2e3)},at=async()=>{if(!t)return;x(null);const{error:te}=await rn(t.id,{phone:q||null,bank_name:b||null,bank_account_name:I||null,bank_account_number:w||null,bank_swift:_||null});te?x(te):m("Profile saved")},rt=async()=>{if(!t||!F||!$||!V){x("Select room and dates");return}const te=r.find(fe=>String(fe.id)===F);if(!te){x("Room not found");return}Ee(!0),x(null);try{if(!await i(Number(F),$,V))throw new Error("Room not available for those dates");const Ve=Math.max(1,Math.ceil((new Date(V).getTime()-new Date($).getTime())/(1e3*60*60*24)))*(te.pricePerNight||0);await n({room_id:Number(F),check_in:$,check_out:V,guests:se,total_price:Ve,agent_id:t.id,attribution_source:"agent_portal",referral_code_used:t.referral_code,guest_info:{full_name:Y,email:re,phone:he,address:ce||"N/A",city:le||"N/A",country:ie||"N/A",passport_number:oe||"N/A"}}),m("Booking created. Commission accrues when admin confirms it."),await ve()}catch(fe){x(fe instanceof Error?fe.message:"Failed to create booking")}finally{Ee(!1)}};return a?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:"Loading agent portalâ¦"}):t?s?e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsxs("div",{className:"container mx-auto px-6 py-28 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Agent portal"}),e.jsxs("p",{className:"text-muted-foreground",children:["Welcome, ",t.display_name,". Code: ",e.jsx(Te,{children:t.referral_code})]})]}),f&&e.jsxs(Se,{className:"border-green-200 bg-green-50",children:[e.jsx(gt,{className:"h-4 w-4 text-green-700"}),e.jsx(Ce,{className:"text-green-800",children:f})]}),v&&e.jsxs(Se,{variant:"destructive",children:[e.jsx(ss,{className:"h-4 w-4"}),e.jsx(Ce,{children:v})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[e.jsx(z,{children:e.jsxs(X,{className:"pb-2",children:[e.jsx(ke,{children:"Bookings"}),e.jsx(Z,{children:qe.bookings})]})}),e.jsx(z,{children:e.jsxs(X,{className:"pb-2",children:[e.jsx(ke,{children:"Payable"}),e.jsxs(Z,{children:["฿",qe.payable.toLocaleString()]})]})}),e.jsx(z,{children:e.jsxs(X,{className:"pb-2",children:[e.jsx(ke,{children:"Paid"}),e.jsxs(Z,{children:["฿",qe.paid.toLocaleString()]})]})}),e.jsx(z,{children:e.jsxs(X,{className:"pb-2",children:[e.jsx(ke,{children:"Voided"}),e.jsxs(Z,{children:["฿",qe.voided.toLocaleString()]})]})})]}),e.jsxs(_a,{defaultValue:"referral",children:[e.jsxs(oa,{children:[e.jsx(Oe,{value:"referral",children:"Referral"}),e.jsx(Oe,{value:"book",children:"Create booking"}),e.jsx(Oe,{value:"bookings",children:"Bookings"}),e.jsx(Oe,{value:"commissions",children:"Commissions"}),e.jsx(Oe,{value:"profile",children:"Bank / profile"})]}),e.jsx(Le,{value:"referral",className:"space-y-4",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Your referral link"}),e.jsx(ke,{children:"Guests who book through this link attribute the booking to you (within the cookie window)."})]}),e.jsxs(K,{className:"flex gap-2",children:[e.jsx(W,{readOnly:!0,value:tt,className:"font-mono text-sm"}),e.jsx(P,{variant:"outline",onClick:He,children:g?e.jsx(gt,{className:"h-4 w-4"}):e.jsx(cn,{className:"h-4 w-4"})})]})]})}),e.jsx(Le,{value:"book",className:"space-y-4",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsx(Z,{children:"Book for a guest"}),e.jsx(ke,{children:"Creates a pending booking attributed to your agent account."})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2 md:col-span-2",children:[e.jsx(A,{children:"Room"}),e.jsxs("select",{className:"w-full border rounded-md h-10 px-3",value:F,onChange:te=>S(te.target.value),children:[e.jsx("option",{value:"",children:"Select room"}),r.map(te=>{var fe;return e.jsxs("option",{value:te.id,children:[te.name," â ฿",(fe=te.pricePerNight)==null?void 0:fe.toLocaleStr
842ing(),"/night"]},te.id)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Check-in"}),e.jsx(Ja,{value:$,onChange:J,min:new Date().toISOString().slice(0,10)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Check-out"}),e.jsx(Ja,{value:V,onChange:R,min:$||new Date().toISOString().slice(0,10)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Guests"}),e.jsx(W,{type:"number",min:1,value:se,onChange:te=>C(Number(te.target.value))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Guest full name"}),e.jsx(W,{value:Y,onChange:te=>ne(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Guest email"}),e.jsx(W,{value:re,onChange:te=>me(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Guest phone"}),e.jsx(W,{value:he,onChange:te=>E(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Passport / ID"}),e.jsx(W,{value:oe,onChange:te=>xe(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Address"}),e.jsx(W,{value:ce,onChange:te=>B(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"City"}),e.jsx(W,{value:le,onChange:te=>Q(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Country"}),e.jsx(W,{value:ie,onChange:te=>G(te.target.value)})]})]}),e.jsx(P,{onClick:rt,disabled:ue,children:ue?"Creatingâ¦":"Create booking"})]})]})}),e.jsx(Le,{value:"bookings",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Attributed bookings"})}),e.jsxs(K,{className:"space-y-3",children:[o.length===0&&e.jsx("p",{className:"text-muted-foreground",children:"No bookings yet."}),o.map(te=>{var fe,Fe;return e.jsxs("div",{className:"flex flex-wrap justify-between gap-2 border-b pb-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:((fe=te.rooms)==null?void 0:fe.name)||"Room"}),e.jsxs("div",{className:"text-muted-foreground",children:[te.check_in," â ",te.check_out," · ",((Fe=te.guest_info)==null?void 0:Fe.full_name)||"Guest"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(Te,{variant:"outline",children:te.status}),e.jsxs("div",{children:["฿",Number(te.total_price).toLocaleString()]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:te.attribution_source})]})]},te.id)})]})]})}),e.jsxs(Le,{value:"commissions",className:"space-y-4",children:[e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Commission ledger"})}),e.jsxs(K,{className:"space-y-2",children:[d.map(te=>e.jsxs("div",{className:"flex justify-between border-b pb-2 text-sm",children:[e.jsxs("div",{children:[e.jsx(Te,{children:te.status}),e.jsxs("span",{className:"ml-2 text-muted-foreground",children:[te.commission_percent,"% of ฿",Number(te.booking_total).toLocaleString()]})]}),e.jsxs("div",{className:"font-medium",children:["฿",Number(te.commission_amount).toLocaleString()]})]},te.id)),d.length===0&&e.jsx("p",{className:"text-muted-foreground",children:"No commissions yet."})]})]}),e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Payouts"})}),e.jsxs(K,{className:"space-y-2",children:[u.map(te=>e.jsxs("div",{className:"flex justify-between border-b pb-2 text-sm",children:[e.jsxs("div",{children:[e.jsx(Te,{variant:"outline",children:te.status}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:te.payment_reference||"â"})]}),e.jsxs("div",{children:["฿",Number(te.amount).toLocaleString()]})]},te.id)),u.length===0&&e.jsx("p",{className:"text-muted-foreground",children:"No payouts yet."})]})]})]}),e.jsx(Le,{value:"profile",children:e.jsxs(z,{children:[e.jsx(X,{children:e.jsx(Z,{children:"Bank & contact"})}),e.jsxs(K,{className:"grid gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Phone"}),e.jsx(W,{value:q,onChange:te=>D(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Bank name"}),e.jsx(W,{value:b,onChange:te=>N(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Account name"}),e.jsx(W,{value:I,onChange:te=>y(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"Account number"}),e.jsx(W,{value:w,onChange:te=>k(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{children:"SWIFT"}
842),e.jsx(W,{value:_,onChange:te=>M(te.target.value)})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx(P,{onClick:at,children:"Save"})})]})]})})]})]}),e.jsx(Ke,{})]}):e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(We,{}),e.jsx("div",{className:"container mx-auto px-6 py-32 max-w-lg",children:e.jsxs(z,{children:[e.jsxs(X,{children:[e.jsxs(Z,{children:["Agent status: ",t.status.replace(/_/g," ")]}),e.jsxs(ke,{children:["Your portal unlocks after KYC approval.",t.rejection_reason?` Reason: ${t.rejection_reason}`:""]})]}),e.jsx(K,{children:e.jsx(P,{asChild:!0,children:e.jsx(ct,{to:"/agents/apply",children:"Update application / KYC"})})})]})}),e.jsx(Ke,{})]}):e.jsx(Ns,{to:"/agents/apply",replace:!0})},fg=()=>(l.useState(!1),l.useEffect(()=>{document.title="The Cashew Tree Restobar - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx(Ii,{}),e.jsx(Ke,{})]})),jg=()=>{const{getHeroImage:t}=un(),[s,a]=l.useState(null),[r,n]=l.useState(!0);return l.useEffect(()=>{document.title="Waterpark - Samui Pier Resort"},[]),l.useEffect(()=>{(async()=>{if(t){n(!0);const o=await t();a(o?o.image_url:"/waterpark.jpg"),n(!1)}else a("/waterpark.jpg"),n(!1)})()},[t]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx(Di,{}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-12",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Opening Hours"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Open Daily (Weather Permitting)"}),e.jsx("span",{className:"text-gray-600",children:"10:30 AM â 6:30 PM"})]})})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Admission Fees"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Full Day Park & Pool"}),e.jsx("span",{className:"text-gray-600",children:"500฿ / person"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Pool Only"}),e.jsx("span",{className:"text-gray-600",children:"200฿ / person"})]})]})]})]})})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Important Rules"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Your safety is our priority. Please follow our waterpark rules and guidelines."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsx("div",{children:e.jsx("p",{className:"text-gray-600",children:"All kids under 17 must wear a life jacket."})})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsx("div",{children:e.jsx("p",{className:"text-gray-600",children:"Children under 6 must be supervised by an adult at all times."})})]})]})]}),e.jsx("div",{className:"relative",children:r?e.jsx("div",{className:"w-full h-96 bg-gray-200 animate-pulse rounded-lg shadow-2xl"}):e.jsx(Vt,{src:s||"/waterpark.jpg",alt:"Waterpark Important Rules",className:"rounded-lg shadow-2xl w-full h-auto"})})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-6xl mx-auto",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Find us on the map"}),e.jsx("div",{className:"rounded-lg overflow-hidden shadow-2xl",children:e.jsx("iframe",{src:"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3842.206678710397!2d100.05607769999999!3d9.5590467!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x3054f16970fef6e3%3A0xc2db56b147908444!2sSamui%20Ninja%20inflatable%20water%20park!5e1!3m2!1sen!2shu!4v1766043841167!5m2!1sen!2shu",width:"100%",height:"450",style:{border:0},allowFullScreen:!0,loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",className:"w-full"})})]})})}),e.jsx("section",{className:"py-20 bg-gradient-to-br from-blue-50 to-cyan-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx("div",{className:"text-center max-w-4xl mx-auto",children:e.jsx("p",{className:"text-2xl md:text-3xl font-semibold text-gray-900",children:"Come splash, slide, and enjoy a fun day at Ninja Water Park!"})})})}),e.jsx(Ke,{})]})},bg=()=>{AbortSignal.timeout||(AbortSignal.timeout=m=>{const v=new AbortController;return setTimeout(()=>v.abort(),m),v.signal});const[t,s]=l.useState([]),[a,r]=l.useState(!0),[n,i]=l.useState(null),[o,c]=l.useState(!1);l.useEffect(()=>{document.title="Fullmoon Party - Samui Pier Resort"},[]);const d=async()=>{try{const m="https://ckjiwgyeseqtkpgftubq.supabase.co",v="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNraml3Z3llc2VxdGtwZ2Z0dWJxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTYyOTAwMzgsImV4cCI6MjA3MTg2NjAzOH0.K4zfl-vnamPUMHXPjd7UUr-tZ0YV3JQXYXEwVo8aJ30",x=await fetch("https://ckjiwgyeseqtkpgftubq.supabase.co/functions/v1/youtube-search",{method:"POST",headers:{Authorization:`Bearer ${v}`,"Content-Type":"application/json"},body:JSON.stringify({query:"Full Moon Party Koh Phangan 2024",maxResults:9})});if(x.ok){const g=await x.json();if(g.videos&&g.videos.length>0)return console.log("Found real videos via Supabase:",g.videos),g.videos}return console.log("Supabase search failed, using fallback videos"),h()}catch(m){return console.error("Supabase video search failed:",m),h()}},h=()=>[{id:"Q8Z9nQqXqQw",title:"Full Moon Party Koh Phangan - Real Experience",description:"Experience the legendary Full Moon Party at Haad Rin Beach",thumbnail:"https://img.youtube.com/vi/Q8Z9nQqXqQw/maxresdefault.jpg"},{id:"XqQqQqQqQqQ",title:"Koh Phangan Full Moon Party - Beach Atmosphere",description:"Beach atmosphere, dancing, and thousands of lamps",thumbnail:"https://img.youtube.com/vi/XqQqQqQqQqQ/maxresdefault.jpg"},{id:"YqQqQqQqQqQ",title:"Full Moon Party Thailand - Beach Party",description:"Thailand's most famous beach party with international crowd",thumbnail:"https://img.youtube.com/vi/YqQqQqQqQqQ/maxresdefault.jpg"},{id:"ZqQqQqQqQqQ",title:"Haad Rin Beach Full Moon Party - Original",description:"The original and most authentic Full Moon Party location",thumbnail:"https://img.youtube.com/vi/ZqQqQqQqQqQ/maxresdefault.jpg"},{id:"AqQqQqQqQqQ",title:"Full Moon Party 2024 - Highlights",description:"Latest Full Moon Party celebrations and moments",thumbnail:"https://img.youtube.com/vi/AqQqQqQqQqQ/maxresdefault.jpg"},{id:"BqQqQqQqQqQ",title:"Beach Party Koh Phangan - Vibes",description:"Beach vibes, party atmosphere, sunset to sunrise",thumbnail:"https://img.youtube.com/vi/BqQqQqQqQqQ/maxresdefault.jpg"},{id:"CqQqQqQqQqQ",title:"Full Moon Party Music & DJ Sets",description:"Trance, techno, reggae, and commercial dance beats",thumbnail:"https://img.youtube.com/vi/CqQqQqQqQqQ/maxresdefault.jpg"},{id:"DqQqQqQqQqQ",title:"Koh Phangan Nightlife & Entertainment",description:"Nightlife, fire shows, jugglers, and beach traders",thumbnail:"https://img.youtube.com/vi/DqQqQqQqQqQ/maxresdefault.jpg"},{id:"EqQqQqQqQqQ",title:"Complete Full Moon Party Experience",description:"From dusk till dawn - the ultimate beach party experience",thumbnail:"https://img.youtube.com/vi/EqQqQqQqQqQ/maxresdefault.jpg"}],u=async()=>{try{const m=await d();await new Promise(v=>setTimeout(v,1e3)),s(m),r(!1)}catch(m){console.error("Error loading videos:",m),r(!1)}};l.useEffect(()=>{u()},[]);const p=m=>{i(m),c(!0)},f=()=>{c(!1),i(null)};return l.useEffect(()=>{document.title="Fullmoon Party - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsxs("section",{className:"relative pt-32 pb-20 bg-cover bg-center bg-no-repeat",style:{backgroundImage:"url(/pexels-quintingellar-6510555.jpg)"},children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-purple-900/60 via-purple-800/50 to-pink-900/60"}),e.jsx("div",{className:"container mx-auto px-4 relative z-10",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-white mb-6 text-shadow-lg",children:"Fullmoon Party Experience"}),e.jsx("p",{className:"text-xl text-white/90 mb-8 text-shadow-md",children:"Join the legendary Koh Samui Fullmoon Party with exclusive access and safety"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-white/80",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Haad Rin Beach, Koh Phangan"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Monthly Events"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dt,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"World Famous"})]})]})]})})]}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Full Moon Party Gallery"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Capturing the magic and energy of the world's most famous beach party"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-500",children:[e.jsx("img",{src:"/fullmoon/phangan_1_onrxtu.jpg",alt:"Full Moon Party Koh Phangan",className:"w-full h-64 object-cover group-hover:scale-110 transition-transform duration-500"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
842parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsxs("div",{className:"absolute bottom-4 left-4 right-4",children:[e.jsx("h3",{className:"text-white font-semibold text-lg",children:"Koh Phangan Full Moon"}),e.jsx("p",{className:"text-white/80 text-sm",children:"The legendary beach party destination"})]})})]}),e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-500",children:[e.jsx("img",{src:"/fullmoon/full-moon-party-koh-phangan-samui_02_medium.webp",alt:"Full Moon Party beach atmosphere",className:"w-full h-64 object-cover group-hover:scale-110 transition-transform duration-500"}),e.jsxs("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[e.jsx("div",{className:"text-white font-semibold text-lg",children:"Beach Atmosphere"}),e.jsx("p",{className:"text-white/80 text-sm",children:"Thousands of lamps light up the beach"})]})]}),e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-500",children:[e.jsx("img",{src:"/fullmoon/Full-Moon-Party-Koh-Phangan-Thailand-2.webp",alt:"Full Moon Party Thailand",className:"w-full h-64 object-cover group-hover:scale-110 transition-transform duration-500"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
842parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsxs("div",{className:"absolute bottom-4 left-4 right-4",children:[e.jsx("h3",{className:"text-white font-semibold text-lg",children:"Thailand's Finest"}),e.jsx("p",{className:"text-white/80 text-sm",children:"World-famous beach party experience"})]})})]}),e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-500",children:[e.jsx("img",{src:"/fullmoon/KP-Full-moon-1.webp",alt:"Full Moon Party Koh Phangan",className:"w-full h-64 object-cover group-hover:scale-110 transition-transform duration-500"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsxs("div",{className:"absolute bottom-4 left-4 right-4",children:[e.jsx("h3",{className:"text-white font-semibold text-lg",children:"KP Full Moon"}),e.jsx("p",{className:"text-white/80 text-sm",children:"The original and most authentic party"})]})})]}),e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-500",children:[e.jsx("img",{src:"/fullmoon/Full-Moon-Party-Koh-Phangan-20230107-01_nsf9s2.jpg",alt:"Full Moon Party 2023",className:"w-full h-64 object-cover group-hover:scale-110 transition-transform duration-500"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-trans
842parent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsxs("div",{className:"absolute bottom-4 left-4 right-4",children:[e.jsx("h3",{className:"text-white font-semibold text-lg",children:"2023 Celebration"}),e.jsx("p",{className:"text-white/80 text-sm",children:"Latest Full Moon Party moments"})]})})]}),e.jsxs("div",{className:"group relative overflow-hidden rounded-2xl shadow-lg hover:shadow-2xl transition-all duration-500",children:[e.jsx("img",{src:"/fullmoon/full_moon_party_cg3eji.jpg",alt:"Full Moon Party crowd",className:"w-full h-64 object-cover group-hover:scale-110 transition-transform duration-500"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsxs("div",{className:"absolute bottom-4 left-4 right-4",children:[e.jsx("h3",{className:"text-white font-semibold text-lg",children:"Party Crowd"}),e.jsx("p",{className:"text-white/80 text-sm",children:"10,000-30,000 people join monthly"})]})})]})]})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"What is the Fullmoon Party?"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"The Fullmoon Party is a monthly beach party that takes place on Haad Rin Beach, Koh Phangan. It's one of the most famous beach parties in the world, attracting thousands of travelers from around the globe."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Monthly Event"}),e.jsx("p",{className:"text-gray-600",children:"Held every month on the night of the full moon"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Beach Party"}),e.jsx("p",{className:"text-gray-600",children:"12+ hours of music, dancing, and beach vibes"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-purple-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"International Crowd"}),e.jsx("p",{className:"text-gray-600",children:"Travelers from all over the world"})]})]})]})]}),e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/fullmoon/ef.jpg",alt:"Beach party atmosphere",className:"rounded-lg shadow-2xl"})})]})})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-30",children:e.jsx("div",{className:"grid lg:grid-cols-1 gap-16 items-center",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-8",children:"The Legend of the Full Moon Party"}),e.jsxs("div",{className:"space-y-6 text-lg leading-relaxed text-gray-700",children:[e.jsx("p",{children:"Some time ago, a group of tourists found that the most beautiful moon was in Koh Phangan. They arranged a party along the crescent-shaped beach of Haad Rin to celebrate the Full Moon night. From then on, people from all over the world come to join the celebrationâ¦"}),e.jsxs("p",{children:["And now there are ",e.jsx("span",{className:"font-semibold text-purple-600",children:"10,000-30,000 people"})," at the party each month. The party begins at dusk, when the round yellow moon makes its appearance over the white sand beach. In twilight, small tables are lined up on the beach and thousands of lamps are litâ¦"]}),e.jsx("p",{children:"As the evening progresses the beach explodes into a dancing frenzy as different m.c.'s take their turn on the decks. There is something for everyone here, trance, techno, drum and bass, commercial dance and reggae, no-one is disappointed. Juggler
842s and fire-eaters entertain the crowds as the night goes on and with the brilliant impromptu fireworks display, the party atmosphere is complete."}),e.jsxs("p",{children:["After a few hours it could be time to chill-out for a while, maybe grab a drink or a bite to eat from one of the many beach traders and wade out or sit down in the warm surf of the Gulf of Thailand,",e.jsx("span",{className:"italic text-purple-600",children:"pure, pure heaven."})]}),e.jsxs("p",{children:["Revived and relaxed it's time to return to the main beach and get blown into another dancing dimension, while all around people are doing the same, there are no barriers here, no inhibitions, just people enjoying themselves with one unified intention, to rejoice in the magic that is the paradise of",e.jsx("span",{className:"font-bold text-2xl text-purple-600",children:"FULL MOON PARTY!"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-6",children:[e.jsxs("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 p-4 rounded-xl border border-purple-100",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Mh,{className:"h-4 w-4 text-purple-600"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"Music"})]}),e.jsx("p",{className:"text-xs text-gray-600",children:"Trance, Techno, Reggae & more"})]}),e.jsxs("div",{className:"bg-gradient-to-br from-orange-50 to-yellow-50 p-4 rounded-xl border border-orange-100",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Xe,{className:"h-4 w-4 text-orange-600"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"Crowd"})]}),e.jsx("p",{className:"text-xs text-gray-600",children:"10,000-30,000 partygoers"})]})]})]})})})}),e.jsx("section",{className:"py-20 bg-gradient-to-br from-purple-50 to-pink-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Latest Full Moon Party Videos"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Experience the energy and excitement of Koh Phangan's legendary Full Moon Party"})]}),a?e.jsx("div",{className:"text-center py-12",children:e.jsxs("div",{className:"inline-flex items-center gap-3 text-gray-600",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-purple-600"}),e.jsx("span",{children:"Loading Full Moon Party videos with details..."})]})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:t.map((m,v)=>e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative aspect-video rounded-lg overflow-hidden shadow-lg cursor-pointer group",onClick:()=>p(m),children:[e.jsx("iframe",{src:`https://www.youtube.com/embed/${m.id||"dQw4w9WgXcQ"}`,title:m.title||`Full Moon Party Video ${v+1}`,className:"w-full h-full pointer-events-none",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}),e.jsx("div",{className:"absolute inset-0 bg-black/10 group-hover:bg-black/20 transition-colors duration-300"}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:e.jsx("div",{className:"bg-red-600 hover:bg-red-700 text-white p-3 rounded-full shadow-lg",children:e.jsx(Fh,{className:"h-6 w-6"})})})]}),e.jsx("div",{className:"space-y-3",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("a",{href:`https://www.youtube.com/watch?v=${m.id||"dQw4w9WgXcQ"}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-red-600 hover:text-red-700 transition-colors font-medium",children:[e.jsx(mn,{className:"h-4 w-4"}),"Watch on YouTube"]})})})]},m.id||v))}),e.jsx("div",{className:"mt-12 text-center",children:e.jsx("div",{className:"inline-flex items-center gap-2 bg-red-100 text-red-800 px-4 py-2 rounded-full"})})]})}),o&&n&&e.jsx("div",{className:"fixed inset-0 bg-black/90 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"relative w-full max-w-6xl max-h-[90vh]",children:[e.jsx("button",{onClick:f,className:"absolute -top-12 right-0 text-white hover:text-gray-300 transition-colors z-10",children:e.jsx("svg",{className:"w-8 h-8",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),e.jsx("div",{className:"relative aspect-video w-full",children:e.jsx("iframe",{src:`https://www.youtube.com/embed/${n.id}?autoplay=1&rel=0&modestbranding=1`,title:n.title,className:"w-full h-full rounded-lg",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})}),e.jsxs("div",{className:"mt-4 text-center",children:[e.jsx("h3",{className:"text-xl font-semibold text-white mb-2",children:n.title}),e.jsx("p",{className:"text-gray-300",children:n.description})]})]})}),e.jsx(Ke,{})]})},yg=()=>(l.useEffect(()=>{document.title="Fullmoon Safety Tips - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-red-50 to-orange-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Fullmoon Party Safety Tips"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Stay
842safe and have fun with our comprehensive safety guide"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rs,{className:"h-5 w-5 text-red-500"}),e.jsx("span",{children:"Safety First"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"h-5 w-5 text-red-500"}),e.jsx("span",{children:"Group Safety"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ss,{className:"h-5 w-5 text-red-500"}),e.jsx("span",{children:"Emergency Info"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Essential Safety Tips"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Follow these guidelines for a safe experience"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-red-50 rounded-lg p-6 border-l-4 border-red-500",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Before the Party"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Get adequate sleep the night before"}),e.jsx("li",{children:"⢠Eat a substantial meal"}),e.jsx("li",{children:"⢠Stay hydrated throughout the day"}),e.jsx("li",{children:"⢠Plan your transportation in advance"}),e.jsx("li",{children:"⢠Charge your phone fully"}),e.jsx("li",{children:"⢠Bring essential items only"})]})]}),e.jsxs("div",{className:"bg-orange-50 rounded-lg p-6 border-l-4 border-orange-500",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"During the Party"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Stay with your group at all times"}),e.jsx("li",{children:"⢠Keep your drink in sight"}),e.jsx("li",{children:"⢠Take regular breaks from dancing"}),e.jsx("li",{children:"⢠Stay hydrated with water"}),e.jsx("li",{children:"⢠Know your limits"}),e.jsx("li",{children:"⢠Be aware of your surroundings"})]})]}),e.jsxs("div",{className:"bg-yellow-50 rounded-lg p-6 border-l-4 border-yellow-500",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"After the Party"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Don't leave alone"}),e.jsx("li",{children:"⢠Use designated transportation"}),e.jsx("li",{children:"⢠Check in with your group"}),e.jsx("li",{children:"⢠Get proper rest"}),e.jsx("li",{children:"⢠Stay hydrated"}),e.jsx("li",{children:"⢠Report any incidents"})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"What to Bring"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Pack smart and travel light. Only bring essential items to keep yourself and your belongings safe."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Essential Items"}),e.jsx("p",{className:"text-gray-600",children:"Phone, money, ID, and small bag"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Comfort Items"}),e.jsx("p",{className:"text-gray-600",children:"Comfortable shoes and light clothing"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Safety Items"}),e.jsx("p",{className:"text-gray-600",children:"Small flashlight and emergency contacts"})]})]})]})]}),e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Beach party preparation",className:"rounded-lg shadow-2xl"})})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"What NOT to Bring"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Avoid these items for your safety"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"bg-red-50 rounded-lg p-6 border border-red-200",children:[e.jsx("h3",{className:"text-2xl font-bold text-red-700 mb-4",children:"Valuable Items"}),e.jsxs("ul",{className:"space-y-3 text-red-600",children:[e.jsx("li",{children:"⢠Expensive jewelry"}),e.jsx("li",{children:"⢠Large amounts of cash"}),e.jsx("li",{children:"⢠Credit cards (bring one if needed)"}),e.jsx("li",{children:"⢠Expensive electronics"}),e.jsx("li",{children:"⢠Designer bags"})]})]}),e.jsxs("div",{className:"bg-red-50 rounded-lg p-6 border border-red-200",children:[e.jsx("h3",{className:"text-2xl font-bold text-red-700 mb-4",children:"Unnecessary Items"}),e.jsxs("ul",{className:"space-y-3 text-red-600",children:[e.jsx("li",{children:"⢠Large backpacks"}),e.jsx("li",{children:"⢠Heavy clothing"}),e.jsx("li",{children:"⢠Multiple bags"}),e.jsx("li",{children:"⢠Glass containers"}),e.jsx("li",{children:"⢠Sharp objects"})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-red-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Emergency Information"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Important contacts and procedures"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-red-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(lt,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Emergency Numbers"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Police: 191"}),e.jsx("li",{children:"⢠Ambulance: 1669"}),e.jsx("li",{children:"⢠Fire: 199"}),e.jsx("li",{children:"⢠Tourist Police: 1155"}),e.jsx("li",{children:"⢠Our Resort: +66 81 978 9085"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Rs,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"First Aid"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Medical stations at the party"}),e.jsx("li",{children:"⢠Basic first aid available"}),e.jsx("li",{children:"⢠Emergency evacuation procedures"}),e.jsx("li",{children:"⢠Nearest hospital information"}),e.jsx("li",{children:"⢠Medical staff on standby"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Je,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Lost & Found"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Designated lost & found area"}),e.jsx("li",{children:"⢠Report lost items immediately"}),e.jsx("li",{children:"⢠Check with security staff"}),e.jsx("li",{children:"⢠Contact our resort for help"}),e.jsx("li",{children:"⢠Keep emergency contacts handy"})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Group safety at party",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Group Safety"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Traveling with a group? Here are essential tips to keep everyone safe."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Designate a Leader"}),e.jsx("p",{className:"text-gray-600",children:"Choose someone responsible to coordinate the group"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Check-in System"}),e.jsx("p",{className:"text-gray-600",children:"Establish regular check-in times and locations"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Buddy System"}),e.jsx("p",{className:"text-gray-600",children:"Always stay with at least one other person"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Emergency Plan"}),e.jsx("p",{className:"text-gray-600",children:"Have a clear plan for emergencie
842s"})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 bg-gradient-to-r from-red-500 to-orange-500",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsx("h2",{className:"text-4xl font-bold text-white mb-6",children:"Remember: Safety First!"}),e.jsx("p",{className:"text-xl text-white/90 mb-8",children:"The Fullmoon Party is an amazing experience, but your safety is our top priority. Follow these guidelines and have a fantastic time!"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center",children:[e.jsxs("div",{className:"flex items-center gap-2 text-white/90",children:[e.jsx(Ie,{className:"h-5 w-5"}),e.jsx("span",{children:"Party starts at sunset"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-white/90",children:[e.jsx(Xe,{className:"h-5 w-5"}),e.jsx("span",{children:"Stay with your group"})]})]})]})}),e.jsx(Ke,{})]})),vg=()=>(l.useEffect(()=>{document.title="Fullmoon Boat Charter - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-blue-50 to-cyan-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Fullmoon Boat Charter"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Experience the Fullmoon Party in style with our exclusive boat charter service"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ts,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"Luxury Boats"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"Sunset to Sunrise"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(dt,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"VIP Experience"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"What is Boat Charter?"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Our boat charter service offers a unique and luxurious way to experience the Fullmoon Party. Instead of taking the regular ferry, enjoy a private boat with premium amenities and exclusive access."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Private Transportation"}),e.jsx("p",{className:"text-gray-600",children:"Skip the crowds with your own boat"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Premium Experience"}),e.jsx("p",{className:"text-gray-600",children:"Luxury amenities and professional crew"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Flexible Schedule"}),e.jsx("p",{className:"text-gray-600",children:"Depart and return at your convenience"})]})]})]})]}),e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Luxury boat charter",className:"rounded-lg shadow-2xl"})})]})})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Our Boat Fleet"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Choose from our selection of luxury vessels"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Ts,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Speed Boat"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Capacity: 8-12 passengers"}),e.jsx("li",{children:"⢠Travel time: 45 minutes"}),e.jsx("li",{children:"⢠Air-conditioned cabin"}),e.jsx("li",{children:"⢠Professional crew"}),e.jsx("li",{children:"⢠Refreshments included"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg border-2 border-blue-500 relative",children:[e.jsx("div",{className:"absolute -top-4 left-1/2 transform -translate-x-1/2 bg-blue-500 text-white px-4 py-2 rounded-full text-sm font-semibold",children:"Most Popular"}),e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(xa,{
842className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Luxury Catamaran"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Capacity: 15-20 passengers"}),e.jsx("li",{children:"⢠Travel time: 1 hour"}),e.jsx("li",{children:"⢠Spacious deck areas"}),e.jsx("li",{children:"⢠Premium amenities"}),e.jsx("li",{children:"⢠Full catering service"}),e.jsx("li",{children:"⢠Music system"})]})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Ch,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Private Yacht"}),e.jsxs("ul",{className:"space-y-3 text-gray-600",children:[e.jsx("li",{children:"⢠Capacity: 25-30 passengers"}),e.jsx("li",{children:"⢠Travel time: 1.5 hours"}),e.jsx("li",{children:"⢠Multiple decks"}),e.jsx("li",{children:"⢠VIP amenities"}),e.jsx("li",{children:"⢠Professional DJ"}),e.jsx("li",{children:"⢠Premium bar service"})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Boat charter amenities",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"What's Included"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Every charter includes essential services and amenities for your comfort and safety."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Professional Crew"}),e.jsx("p",{className:"text-gray-600",children:"Experienced captain and crew members"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Safety Equipment"}),e.jsx("p",{className:"text-gray-600",children:"Life jackets, first aid, and emergency gear"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Insurance Coverage"}),e.jsx("p",{className:"text-gray-600",children:"Comprehensive insurance for all passengers"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Refreshments"}),e.jsx("p",{className:"text-gray-600",children:"Water, soft drinks, and light snacks"})]})]})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Schedule & Timing"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Typical charter schedule for Fullmoon Party"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-12",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Departure Schedule"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Check-in at Pier"}),e.jsx("span",{className:"text-gray-600",children:"5:00 PM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Departure"}),e.jsx("span",{className:"text-gray-600",children:"5:30 PM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Arrival at Haad Rin"}),e.jsx("span",{className:"text-gray-600",children:"6:30 PM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Party Time"}),e.jsx("span",{className:"text-gray-600",children:"7:00 PM - 6:00 AM"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Return Schedule"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Check-in at Haad Rin"}),e.jsx("span",{className:"text-gray-600",children:"6:00 AM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Departure"}),e.jsx("span",{className:"text-gray-600",children:"6:30 AM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Arrival at Samui"}),e.jsx("span",{className:"text-gray-600",children:"7:30 AM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Hotel Transfer"}),e.jsx("span",{className:"text-gray-600",children:"8:00 AM"})]})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-blue-50",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Book Your Charter"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Reserve your boat charter for the next Fullmoon Party"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(lt,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"+66 (0)81 978 9085"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(Ie,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"Book at least 1 week in advance"})]})]}),e.jsx("div",{className:"mt-8",children:e.jsx("button",{className:"bg-blue-500 text-white px-8 py-4 rounded-lg font-semibold text-lg hover:bg-blue-600 transition-colors",children:"Contact Us to Book"})})]})}),e.jsx(Ke,{})]})),Ng=()=>(l.useEffect(()=>{document.title="10 Things to do in Koh Samui - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-green-50 to-blue-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"10 Things to do in Koh Samui"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Discover the best activities and attractions on Thailand's paradise island"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Jt,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{children:"Beautiful Beaches"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mr,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{children:"Natural Wonders"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{children:"Cultural Sites"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Top 10 Must-Do Activities"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Experience the best of Koh Samui"})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"1"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Visit Big Buddha Temple"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"The iconic 12-meter golden Buddha statue at Wat Phra Yai is one of Koh Samui's most recognizable landmarks. Located on a small island connected by a causeway, this temple offers stunning views and spiritual significance."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Best time: Early morning"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"North-east coast"})]})]})]}),e.jsx("div",{className:"order-1 lg:order-2",children:e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Big Buddha Temple",className:"rounded-lg shadow-2xl"})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{children:e.jsx("img",{src:"/pexels-anna-zviahina-431214732-15249164.jpg",alt:"Chaweng Beach",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"2"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Relax on Chaweng Beach"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"Koh Samui's most famous beach stretches for 7 kilometers with powdery white sand and crystal-clear waters. Perfect for swimming, water sports, or simply soaking up the tropical sun."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"All day long"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"East coast"})]})]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"3"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Explore Ang Thong Marine Park"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"This stunning archipelago of 42 islands features limestone mountains, hidden lagoons, and pristine beaches. Take a day trip to snorkel, kayak, or hike to viewpoints for breathtaking panoramas."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Full day trip"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Offshore islands"})]})]})]}),e.jsx("div",{className:"order-1 lg:order-2",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Ang Thong Marine Park",className:"rounded-lg shadow-2xl"})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{children:e.jsx("img",{src:"/pexels-allphoto-bangkok-1628521-12001661.jpg",alt:"Fisherman's Village",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"4"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Shop at Fisherman's Village"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"This charming area in Bophut features traditional Chinese shop-houses, boutique shops, and the famous Friday Night Walking Street market. Perfect for souvenirs and local crafts."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Best: Friday evening"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Bophut area"})]})]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"5"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Visit Na Muang Waterfall"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"Koh Samui's most impressive waterfall cascades down 80 meters of rock face. The area is surrounded by lush jungle and offers swimming opportunities in natural pools."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Best: After rain"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Central island"})]})]})]}),e.jsx("div",{className:"order-1 lg:order-2",children:e.jsx("img",{src:"/pexels-anetta-kolesnikova-2154382947-33271606.jpg",alt:"Na Muang Waterfall",className:"rounded-lg shadow-2xl"})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Lamai Beach",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"6"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Discover Lamai Beach"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"A quieter alternative to Chaweng, Lamai Beach offers a more relaxed atmosphere with beautiful scenery, good snorkeling spots, and the famous Grandmother and Grandfather Rocks."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"All day"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"South-east coast"})]})]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"7"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Take a Thai Cooking Class"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"Learn to cook authentic Thai dishes from local chefs. Visit local markets to select fresh ingredients, then prepare and enjoy your own delicious Th
842ai meal."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Half day"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Various locations"})]})]})]}),e.jsx("div",{className:"order-1 lg:order-2",children:e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Thai Cooking Class",className:"rounded-lg shadow-2xl"})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{children:e.jsx("img",{src:"/pexels-anna-zviahina-431214732-15249164.jpg",alt:"Sunset Viewpoint",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"8"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Watch Sunset at Viewpoint"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"Head to the viewpoint near Lamai Beach for one of the most spectacular sunsets on the island. The panoramic views of the ocean and neighboring islands are simply breathtaking."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"5:30-6:30 PM"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Lamai area"})]})]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsxs("div",{className:"order-2 lg:order-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"9"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Visit Secret Buddha Garden"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"Hidden in the hills, this mystical garden features hundreds of Buddha statues and sculptures surrounded by lush jungle. A peaceful retreat with stunning island views."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Morning or afternoon"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Central hills"})]})]})]}),e.jsx("div",{className:"order-1 lg:order-2",children:e.jsx("img",{src:"/pexels-allphoto-bangkok-1628521-12001661.jpg",alt:"Secret Buddha Garden",className:"rounded-lg shadow-2xl"})})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-8 items-center",children:[e.jsx("div",{children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Island Hopping",className:"rounded-lg shadow-2xl"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"w-8 h-8 bg-green-500 rounded-full flex items-center justify-center text-white font-bold text-lg",children:"10"}),e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Go Island Hopping"})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-4",children:"Explore the smaller islands around Koh Samui including Koh Tan, Koh Madsum, and Koh Taen. Perfect for snorkeling, swimming, and experiencing untouched nature."}),e.jsxs("div",{className:"flex items-center gap-4 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Full day"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"Offshore islands"})]})]})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Travel Tips"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Make the most of your Koh Samui experience"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-green-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Ie,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Best Time to Visit"}),e.jsx("p",{className:"text-gray-600",children:"February to April offers the best weather with clear skies and calm seas. Avoid the monsoon season from October to December."})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Ka,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Photography"}),e.jsx("p",{className:"text-gray-600",children:"Early morning and late afternoon provide the best lighting for photos. Don't forget to capture the stunning sunsets!"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Xe,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Local Culture"}),e.jsx("p",{className:"text-gray-600",children:"Respect local customs, dress modestly when visiting temples, and always ask permission before taking photos of locals."})]})]})]})}),e.jsx(Ke,{})]})),wg=()=>(l.useEffect(()=>{document.title="Top 10 Tours - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-purple-50 to-pink-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Top 10 Tours in Koh Samui"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Discover the best guided tours and experiences on the island"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ts,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Island Tours"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Mr,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Adventure Tours"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Er,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Cultural Tours"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Our Top 10 Tours"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Expertly curated experiences for every traveler"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Ang Thong Marine Park",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"1"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Ang Thong Marine Park"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Explore 42 stunning islands
842with snorkeling, kayaking, and hiking."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Full Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Island Hopping",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"2"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Island Hopping Adventure"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Visit Koh Tan, Koh Madsum, and Koh Taen in one day."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Full Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-anna-zviahina-431214732-15249164.jpg",alt:"Elephant Sanctuary",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"3"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Elephant Sanctuary"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Ethical elephant experience with feeding and bathing."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Half Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-allphoto-bangkok-1628521-12001661.jpg",alt:"Thai Cooking Class",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"4"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Thai Cooking Class"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Learn to cook authentic Thai dishes from local chefs."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Half Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-anetta-kolesnikova-2154382947-33271606.jpg",alt:"Waterfall Adventure",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"5"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Waterfall Adventure"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Explore Na Muang and Hin Lad waterfalls with swimming."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Half Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Sunset Cruise",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"6"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Sunset Cruise"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Romantic sunset cruise with dinner and drinks."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Evening"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Temple Tour",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"7"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Temple & Culture Tour"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Visit Big Buddha, Wat Plai Laem, and Secret Garden."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Half Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-anna-zviahina-431214732-15249164.jpg",alt:"Snorkeling",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"8"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Snorkeling Safari"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Discover vibrant coral reefs and marine life."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Full Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-allphoto-bangkok-1628521-12001661.jpg",alt:"ATV Adventure",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"9"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"ATV Adventure"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Off-road adventure through jungle and mountains."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Half Day"})})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden border border-gray-200",children:[e.jsx("img",{src:"/pexels-anetta-kolesnikova-2154382947-33271606.jpg",alt:"Fishing Trip",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("div",{className:"w-6 h-6 bg-purple-500 rounded-full flex items-center justify-center text-white text-sm font-bold",children:"10"}),e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Deep Sea Fishing"})]}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Professional fishing trip with equipment provided."}),e.jsx("div",{className:"flex items-center justify-end",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Full Day"})})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Tour Categories"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Find the perfect tour for your interests"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(Ts,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Beach & Water"}),e.jsx("p",{className:"text-gray-600",children:"Snorkeling, diving, and beach activities"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-green-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(Mr,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Adventure"}),e.jsx("p",{className:"text-gray-600",children:"ATV, hiking, and outdoor activities"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-purple-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(Er,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Cultural"}),e.jsx("p",{className:"text-gray-600",children:"Temples, cooking, and local experiences"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-orange-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(Ka,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Photography"}),e.jsx("p",{className:"text-gray-600",children:"Scenic tours and photo opportunities"})]})]})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Book Your Tour"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"All tours include professional guides, transportation, and safety equipment"}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center",children:[e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(Ie,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Book 24 hours in advance"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(Xe,{className:"h-5 w-5 text-purple-500"}),e.jsx("span",{children:"Small group sizes"})]})]}),e.jsx("div",{className:"mt-8",children:e.jsx("button",{className:"bg-purple-500 text-white px-8 py-4 rounded-lg font-semibold text-lg hover:bg-purple-600 transition-colors",children:"Contact Us to Book"})})]})}),e.jsx(Ke,{})]})),kg=()=>(l.useEffect(()=>{document.title="Watersports - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-blue-50 to-cyan-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Watersports & Activities"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Experience thrilling water adventures and fun activities on Koh Samui"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Vn,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"Thrilling Activities"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rs,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"Safety First"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xa,{
842className:"h-5 w-5 text-blue-500"}),e.jsx("span",{children:"Professional Equipment"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Available Watersports"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Explore our exciting range of activities and adventures"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-blue-50 rounded-lg p-6 border-l-4 border-blue-500",children:[e.jsx("div",{className:"w-12 h-12 bg-blue-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Vn,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Jet Ski"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"High-speed water adventure for thrill-seekers"}),e.jsxs("ul",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsx("li",{children:"⢠Duration: 30 min - 1 hour"}),e.jsx("li",{children:"⢠Age: 16+ years"}),e.jsx("li",{children:"⢠Safety briefing included"}),e.jsx("li",{children:"⢠Professional instruction"})]})]}),e.jsxs("div",{className:"bg-green-50 rounded-lg p-6 border-l-4 border-green-500",children:[e.jsx("div",{className:"w-12 h-12 bg-green-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(xa,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Parasailing"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Soar above the ocean with stunning views"}),e.jsxs("ul",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsx("li",{children:"⢠Duration: 15-20 min flight"}),e.jsx("li",{children:"⢠Age: 8+ years"}),e.jsx("li",{children:"⢠Safety equipment provided"}),e.jsx("li",{children:"⢠Professional crew"})]})]}),e.jsxs("div",{className:"bg-yellow-50 rounded-lg p-6 border-l-4 border-yellow-500",children:[e.jsx("div",{className:"w-12 h-12 bg-yellow-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Xe,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Banana Boat"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Fun group activity for friends and family"}),e.jsxs("ul",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsx("li",{children:"⢠Duration: 15-20 min"}),e.jsx("li",{children:"⢠Age: 6+ years"}),e.jsx("li",{children:"⢠Up to 8 people"}),e.jsx("li",{children:"⢠Life jackets provided"})]})]}),e.jsxs("div",{className:"bg-purple-50 rounded-lg p-6 border-l-4 border-purple-500",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(xa,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Kayaking"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Peaceful exploration of coastal waters"}),e.jsxs("ul",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsx("li",{children:"⢠Duration: 1-2 hours"}),e.jsx("li",{children:"⢠Age: 8+ years"}),e.jsx("li",{children:"⢠Single & double kayaks"}),e.jsx("li",{children:"⢠Guided tours available"})]})]}),e.jsxs("div",{className:"bg-cyan-50 rounded-lg p-6 border-l-4 border-cyan-500",children:[e.jsx("div",{className:"w-12 h-12 bg-cyan-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Rs,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Snorkeling"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Discover underwater marine life"}),e.jsxs("ul",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsx("li",{children:"⢠Duration: 2-3 hours"}),e.jsx("li",{children:"⢠Age: 6+ years"}),e.jsx("li",{children:"⢠Equipment included"}),e.jsx("li",{children:"⢠Professional guide"})]})]}),e.jsxs("div",{className:"bg-pink-50 rounded-lg p-6 border-l-4 border-pink-500",children:[e.jsx("div",{className:"w-12 h-12 bg-pink-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(xa,{
842className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"SUP Boarding"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Balance and paddle on calm waters"}),e.jsxs("ul",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsx("li",{children:"⢠Duration: 1-2 hours"}),e.jsx("li",{children:"⢠Age: 12+ years"}),e.jsx("li",{children:"⢠Beginner friendly"}),e.jsx("li",{children:"⢠Instruction included"})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Safety & Equipment"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Your safety is our top priority. All activities include professional equipment and safety briefings."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Professional Equipment"}),e.jsx("p",{className:"text-gray-600",children:"All equipment is regularly inspected and maintained"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Safety Briefings"}),e.jsx("p",{className:"text-gray-600",children:"Comprehensive safety instructions before each activity"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Professional Staff"}),e.jsx("p",{className:"text-gray-600",children:"Experienced instructors and safety personnel"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-blue-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Insurance Coverage"}),e.jsx("p",{className:"text-gray-600",children:"All activities include comprehensive insurance"})]})]})]})]}),e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Watersports equipment",className:"rounded-lg shadow-2xl"})})]})})}),e.jsx("section",{className:"py-20 bg-blue-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-12",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Opening Hours"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Monday - Sunday"}),e.jsx("span",{className:"text-gray-600",children:"8:00 AM - 6:00 PM"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Weather Dependent"}),e.jsx("span",{className:"text-gray-600",children:"Activities may be cancelled in bad weather"})]}),e.jsxs("div",{className:"flex justify-between items-center py-3 border-b border-gray-200",children:[e.jsx("span",{className:"font-medium text-gray-900",children:"Advance Booking"}),e.jsx("span",{className:"text-gray-600",children:"Recommended 24 hours in advance"})]})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Booking Information"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Contact us to book your watersports activities and get ready for an unforgettable adventure!"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ie,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{className:"text-gray-600",children:"Activities run throughout the day"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Xe,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{className:"text-gray-600",children:"Suitable for all ages (with restrictions)"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Rs,{className:"h-5 w-5 text-blue-500"}),e.jsx("span",{className:"text-gray-600",children:"Safety equipment and instruction included"})]})]})]})]})})}),e.jsx(Ke,{})]})),Sg=()=>(l.useEffect(()=>{document.title="Nearby Attractions - Samui Pier Resort"},[]),e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-indigo-50 to-purple-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Nearby Attractions"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Discover amazing places and activities just minutes from our resort"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ua,{className:"h-5 w-5 text-indigo-500"}
vendor: 8,914 bytes, line 842
842),e.jsx("span",{children:"Easy Access"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx($a,{className:"h-5 w-5 text-indigo-500"}),e.jsx("span",{children:"Walking Distance"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ts,{className:"h-5 w-5 text-indigo-500"}),e.jsx("span",{children:"Boat Trips"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Walking Distance (0-15 min)"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Explore these attractions on foot"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-indigo-50 rounded-lg p-6 border-l-4 border-indigo-500",children:[e.jsx("div",{className:"w-12 h-12 bg-indigo-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx($a,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Local Beach"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Our private beach access with crystal clear waters"}),e.jsxs("div",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Distance:"}),e.jsx("span",{className:"font-semibold",children:"2 min walk"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Best time:"}),e.jsx("span",{children:"Sunrise to sunset"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Activities:"}),e.jsx("span",{children:"Swimming, sunbathing"})]})]}),e.jsx("div",{className:"text-indigo-600 font-semibold",children:"Free for guests"})]}),e.jsxs("div",{className:"bg-purple-50 rounded-lg p-6 border-l-4 border-purple-500",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(Xe,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Local Market"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Authentic Thai market with fresh produce and street food"}),e.jsxs("div",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Distance:"}),e.jsx("span",{className:"font-semibold",children:"5 min walk"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Best time:"}),e.jsx("span",{children:"6:00 AM - 10:00 AM"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Highlights:"}),e.jsx("span",{children:"Fresh fruits, local snacks"})]})]}),e.jsx("div",{className:"text-purple-600 font-semibold",children:"Budget friendly"})]}),e.jsxs("div",{className:"bg-yellow-50 rounded-lg p-6 border-l-4 border-yellow-500",children:[e.jsx("div",{className:"w-12 h-12 bg-yellow-500 rounded-lg flex items-center justify-center mb-4",children:e.jsx(dt,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Local Temple"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Beautiful Buddhist temple with traditional architecture"}),e.jsxs("div",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Distance:"}),e.jsx("span",{className:"font-semibold",children:"10 min walk"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Best time:"}),e.jsx("span",{children:"Early morning"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Dress code:"}),e.jsx("span",{children:"Modest clothing"})]})]}),e.jsx("div",{className:"text-yellow-600 font-semibold",children:"Free entry"})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Short Drive (15-30 min)"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Perfect for half-day excursions"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Big Buddha",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Big Buddha Temple"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Iconic 12-meter golden Buddha statue with stunning views"}),e.jsxs("div",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Distance:"}),e.jsx("span",{className:"font-semibold",children:"20 min drive"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Best time:"}),e.jsx("span",{children:"Early morning"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Entry fee:"}),e.jsx("span",{children:"Free"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-indigo-600",children:[e.jsx(ua,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:"Taxi: ฿300 round trip"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-allphoto-bangkok-1628521-12001661.jpg",alt:"Fisherman's Village",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Fisherman's Village"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Charming area with boutique shops and Friday night market"}),e.jsxs("div",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Distance:"}),e.jsx("span",{className:"font-semibold",children:"25 min drive"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Best time:"}),e.jsx("span",{children:"Friday evening"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Highlights:"}),e.jsx("span",{children:"Shopping, dining"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-indigo-600",children:[e.jsx(ua,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:"Taxi: ฿400 round trip"})]})]})]}),e.jsxs("div",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-anna-zviahina-431214732-15249164.jpg",alt:"Chaweng Beach",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-4",children:"Chaweng Beach"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Koh Samui's most famous beach with water sports and nightlife"}),e.jsxs("div",{className:"space-y-2 text-gray-600 mb-4",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Distance:"}),e.jsx("span",{className:"font-semibold",children:"30 min drive"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Best time:"}),e.jsx("span",{children:"All day"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Activities:"}),e.jsx("span",{children:"Swimming, water sports"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-indigo-600",children:[e.jsx(ua,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:"Taxi: ฿500 round trip"})]})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Full Day Trips (1+ hours)"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Worth the journey for unforgettable experiences"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-50 to-cyan-50 rounded-lg p-8 border-2 border-blue-200",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-500 rounded-lg flex items-center justify-center",children:e.jsx(Ts,{className:"h-8 w-8 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Ang Thong Marine Park"}),e.jsx("p",{className:"text-blue-600 font-semibold",children:"42 stunning islands"})]})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Explore this stunning archipelago with snorkeling, k
842ayaking, and hiking. Visit hidden lagoons and pristine beaches."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Travel time:"}),e.jsx("p",{className:"font-semibold",children:"1 hour by boat"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Duration:"}),e.jsx("p",{className:"font-semibold",children:"Full day (8-10 hours)"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Price:"}),e.jsx("p",{className:"font-semibold",children:"฿2,500 per person"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Includes:"}),e.jsx("p",{className:"font-semibold",children:"Transport, lunch, guide"})]})]}),e.jsx("button",{className:"w-full bg-blue-500 text-white py-3 rounded-lg font-semibold hover:bg-blue-600 transition-colors",children:"Book This Trip"})]}),e.jsxs("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 rounded-lg p-8 border-2 border-green-200",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[e.jsx("div",{className:"w-16 h-16 bg-green-500 rounded-lg flex items-center justify-center",children:e.jsx($a,{className:"h-8 w-8 text-white"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-3xl font-bold text-gray-900",children:"Na Muang Waterfall"}),e.jsx("p",{className:"text-green-600 font-semibold",children:"Natural wonder"})]})]}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Hike to one of Koh Samui's most impressive waterfalls. Swim in natural pools and enjoy the lush jungle surroundings."}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-6",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Travel time:"}),e.jsx("p",{className:"font-semibold",children:"1.5 hours by car"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Duration:"}),e.jsx("p",{className:"font-semibold",children:"Half day (4-5 hours)"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Price:"}),e.jsx("p",{className:"font-semibold",children:"฿1,200 per person"})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-500",children:"Includes:"}),e.jsx("p",{className:"font-semibold",children:"Transport, guide"})]})]}),e.jsx("button",{className:"w-full bg-green-500 text-white py-3 rounded-lg font-semibold hover:bg-green-600 transition-colors",children:"Book This Trip"})]})]})]})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Getting Around"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Transportation options for exploring the island"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-8",children:[e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-indigo-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(ua,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Taxi"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Convenient but more expensive"}),e.jsx("div",{className:"text-indigo-600 font-semibold",children:"฿300-800 per trip"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-green-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx($a,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Walking"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Free and healthy option"}),e.jsx("div",{className:"text-green-600 font-semibold",children:"0-15 min walks"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-blue-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(Ts,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Boat Tours"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Organized island trips"}),e.jsx("div",{className:"text-blue-600 font-semibold",children:"฿1,500-3,000"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 text-center shadow-lg",children:[e.jsx("div",{className:"w-16 h-16 bg-purple-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(Xe,{className:"h-8 w-8 text-white"})}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Group Tours"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Shared transportation"}),e.jsx("div",{className:"text-purple-600 font-semibold",children:"฿800-1,500"})]})]})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Tips for Exploring"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Make the most of your time exploring Koh Samui with these helpful tips."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-indigo-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Plan Your Route"}),e.jsx("p",{className:"text-gray-600",children:"Group nearby attractions to minimize travel time"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-indigo-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Book in Advance"}),e.jsx("p",{className:"text-gray-600",children:"Popular tours and activities fill up quickly"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-indigo-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Check Weather"}),e.jsx("p",{className:"text-gray-600",children:"Some activities are weather-dependent"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-indigo-500 rounded-full mt-3"}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-gray-900",children:"Local Time"}),e.jsx("p",{className:"text-gray-600",children:"Plan around local opening hours and peak times"})]})]})]})]}),e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Exploring Koh Samui",className:"rounded-lg shadow-2xl"})})]})})}),e.jsx(Ke,{})]})),Cg=()=>
842{const[t,s]=l.useState({firstName:"",lastName:"",email:"",phone:"",subject:"General Inquiry",message:""}),[a,r]=l.useState(!1),[n,i]=l.useState("idle"),[o,c]=l.useState("");l.useEffect(()=>{document.title="Contact Us - Samui Pier Resort"},[]);const d=u=>{const{name:p,value:f}=u.target;s(m=>({...m,[p]:f}))},h=async u=>{u.preventDefault(),r(!0),i("idle");try{(await ou(t)).success?(i("success"),c("Thank you! Your message has been sent successfully. We will get back to you within 2 hours."),s({firstName:"",lastName:"",email:"",phone:"",subject:"General Inquiry",message:""})):(i("error"),c("Sorry, there was an error sending your message. Please try again or call us directly."))}catch{i("error"),c("Sorry, there was an error sending your message. Please try again or call us directly.")}finally{r(!1)}};return e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-orange-50 to-amber-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Contact Us"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Get in touch with us for bookings, inquiries, or any assistance you need"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(lt,{className:"h-5 w-5 text-orange-500"}),e.jsx("span",{children:"+66 (0)81 978 9085"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ts,{className:"h-5 w-5 text-orange-500"}),e.jsx("span",{children:"[email protected]"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-5 w-5 text-orange-500"}),e.jsx("span",{children:"Koh Samui, Thailand"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Get in Touch"}),e.jsx("p",{className:"text-lg text-gray-600 mb-8",children:"We're here to help you plan your perfect stay at Samui Pier Resort. Contact us for any questions or special requests."}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center",children:e.jsx(lt,{className:"h-6 w-6 text-orange-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Phone"}),e.jsx("p",{className:"text-gray-600",children:"+66 (0)81 978 9085"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Available 24/7 for urgent matters"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center",children:e.jsx(ts,{className:"h-6 w-6 text-orange-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Email"}),e.jsx("p",{className:"text-gray-600",children:"[email protected]"}),e.jsx("p",{className:"text-sm text-gray-500",children:"We respond within 2 hours"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center",children:e.jsx(Je,{className:"h-6 w-6 text-orange-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Address"}),e.jsx("p",{className:"text-gray-600",children:"30/5 Moo 4 Bophut, Samui"}),e.jsx("p",{className:"text-gray-600",children:"Surat Thani 84320, Thailand"})]})]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-12 h-12 bg-orange-100 rounded-lg flex items-center justify-center",children:e.jsx(Ie,{className:"h-6 w-6 text-orange-600"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Office Hours"}),e.jsx("p",{className:"text-gray-600",children:"Monday - Sunday: 7:00 AM - 10:00 PM"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Local time (GMT+7)"})]})]})]})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-8",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Send us a Message"}),n==="success"&&e.jsxs("div",{className:"mb-6 p-4 bg-green-50 border border-green-200 rounded-lg flex items-center gap-3",children:[e.jsx(jt,{className:"h-5 w-5 text-green-600"}),e.jsx("p",{className:"text-green-800",children:o})]}),n==="error"&&e.jsxs("div",{className:"mb-6 p-4 bg-red-50 border border-red-200 rounded-lg flex items-center gap-3",children:[e.jsx(sa,{className:"h-5 w-5 text-red-600"}),e.jsx("p",{className:"text-red-800",children:o})]}),e.jsxs("form",{onSubmit:h,className:"space-y-6",children:[e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"First Name *"}),e.jsx("input",{type:"text",name:"firstName",value:t.firstName,onChange:d,required:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent",placeholder:"Your first name"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Last Name *"}),e.jsx("input",{type:"text",name:"lastName",value:t.lastName,onChange:d,required:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent",placeholder:"Your last name"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Email *"}),e.jsx("input",{type:"email",name:"email",value:t.email,onChange:d,required:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent",placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Phone"}),e.jsx("input",{type:"tel",name:"phone",value:t.phone,onChange:d,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent",placeholder:"+66 (0)81 978 9085"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Subject *"}),e.jsxs("select",{name:"subject",value:t.subject,onChange:d,required:!0,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent",children:[e.jsx("option",{value:"General Inquiry",children:"General Inquiry"}),e.jsx("option",{value:"Room Booking",children:"Room Booking"}),e.jsx("option",{value:"Tour Booking",children:"Tour Booking"}),e.jsx("option",{value:"Special Request",children:"Special Request"}),e.jsx("option",{value:"Feedback",children:"Feedback"}),e.jsx("option",{value:"Other",children:"Other"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Message *"}),e.jsx("textarea",{name:"message",value:t.message,onChange:d,required:!0,rows:4,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-orange-500 focus:border-transparent",placeholder:"Tell us how we
842can help you..."})]}),e.jsx("button",{type:"submit",disabled:a,className:"w-full bg-orange-500 text-white py-3 px-6 rounded-lg font-semibold hover:bg-orange-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:a?"Sending...":"Send Message"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Find Us"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Visit us on beautiful Koh Samui"})]}),e.jsx("div",{className:"bg-white rounded-lg p-8 shadow-lg",children:e.jsx("div",{className:"aspect-video bg-gray-200 rounded-lg flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Je,{className:"h-16 w-16 text-gray-400 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Interactive map will be embedded here"}),e.jsx("p",{className:"text-sm text-gray-400",children:"30/5 Moo 4 Bophut, Samui, Thailand"})]})})})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Frequently Asked Questions"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Quick answers to common questions"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-b border-gray-200 pb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"How do I make a reservation?"}),e.jsx("p",{className:"text-gray-600",children:"You can book directly through our website, call us at +66 (0)81 978 9085, or send us an email."})]}),e.jsxs("div",{className:"border-b border-gray-200 pb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"What is your cancellation policy?"}),e.jsx("p",{className:"text-gray-600",children:"Free cancellation up to 24 hours before check-in. Late cancellations may incur a fee."})]}),e.jsxs("div",{className:"border-b border-gray-200 pb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Do you offer airport transfers?"}),e.jsx("p",{className:"text-gray-600",children:"Yes, we provide airport pickup and drop-off services. Please book in advance."})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"border-b border-gray-200 pb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"What time is check-in and check-out?"}),e.jsx("p",{className:"text-gray-600",children:"Check-in: 2:00 PM, Check-out: 11:00 AM. Early check-in and late check-out available upon request."})]}),e.jsxs("div",{className:"border-b border-gray-200 pb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Is breakfast included?"}),e.jsx("p",{className:"text-gray-600",children:"Yes, our room rates include a delicious breakfast buffet with local and international options."})]}),e.jsxs("div",{className:"border-b border-gray-200 pb-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Do you have parking available?"}),e.jsx("p",{className:"text-gray-600",children:"Yes, we offer free parking for guests. Secure parking is available for motorcycles and cars."})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-red-50",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Emergency Contact"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"For urgent matters outside office hours, please use these emergency numbers"}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-8 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-red-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(lt,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Emergency"}),e.jsx("p",{className:"text-red-600 font-semibold",children:"191"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Police"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-red-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(lt,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Ambulance"}),e.jsx("p",{className:"text-red-600 font-semibold",children:"1669"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Medical Emergency"})]}),e.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-lg",children:[e.jsx("div",{className:"w-12 h-12 bg-red-500 rounded-lg flex items-center justify-center mx-auto mb-4",children:e.jsx(lt,{className:"h-6 w-6 text-white"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Resort Manager"}),e.jsx("p",{className:"text-red-600 font-semibold",children:"+66 81 978 9085"}),e.jsx("p",{className:"text-sm text-gray-600",children:"24/7 Available"})]})]})]})}),e.jsx(Ke,{})]})},_g=()=>{const[t,s]=l.useState(""),[a,r]=l.useState(!1),[n,i]=l.useState("idle"),[o,c]=l.useState("");l.useEffect(()=>{document.title="Blog - Samui Pier Resort"},[]);const d=async h=>{if(h.preventDefault(),!!t){r(!0),i("idle");try{const{subscribed:u}=await Fi(t);if(u){i("already_subscribed"),c("This email is already subscribed to our newsletter!");return}
842(await Mi(t)).success?(i("success"),c("Thank you for subscribing! Please check your email for confirmation."),s("")):(i("error"),c("Sorry, there was an error subscribing. Please try again."))}catch{i("error"),c("Sorry, there was an error subscribing. Please try again.")}finally{r(!1)}}};return e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx(We,{}),e.jsx("section",{className:"relative pt-32 pb-20 bg-gradient-to-br from-green-50 to-blue-50",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsxs("div",{className:"text-center max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl md:text-6xl font-bold text-gray-900 mb-6",children:"Resort Blog"}),e.jsx("p",{className:"text-xl text-gray-600 mb-8",children:"Discover travel tips, local insights, and stories from Koh Samui"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 text-gray-600",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{children:"Travel Tips"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ya,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{children:"Local Stories"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-5 w-5 text-green-500"}),e.jsx("span",{children:"Latest Updates"})]})]})]})})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsx("div",{className:"container mx-auto px-4",children:e.jsx("div",{className:"bg-gradient-to-r from-green-50 to-blue-50 rounded-2xl p-8 lg:p-12",children:e.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"inline-block bg-green-500 text-white px-4 py-2 rounded-full text-sm font-semibold mb-4",children:"Featured Post"}),e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-6",children:"Ultimate Guide to Koh Samui: Best Time to Visit and What to Expect"}),e.jsx("p",{className:"text-lg text-gray-600 mb-6",children:"Discover the perfect time to visit Koh Samui, what to pack, and the must-see attractions that will make your trip unforgettable. From weather patterns to local festivals, we've got you covered."}),e.jsxs("div",{className:"flex items-center gap-6 text-gray-600 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"December 15, 2024"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ya,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"By Resort Team"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 text-green-500"}),e.jsx("span",{children:"8 min read"})]})]}),e.jsxs("button",{className:"bg-green-500 text-white px-6 py-3 rounded-lg font-semibold hover:bg-green-600 transition-colors flex items-center gap-2",children:["Read Full Article",e.jsx(vs,{className:"h-4 w-4"})]})]}),e.jsx("div",{className:"relative",children:e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Koh Samui guide",className:"rounded-lg shadow-2xl"})})]})})})}),e.jsx("section",{className:"py-20 bg-gray-50",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Latest Articles"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Stay updated with our latest posts and insights"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-8",children:[e.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Thai cuisine",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 mb-3",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:"December 10, 2024"})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3",children:"Top 10 Thai Dishes You Must Try in Koh Samui"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"From spicy curries to fresh seafood, discover the authentic flavors of Thai cuisine that make Koh Samui a food lover's paradise."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"5 min read"}),e.jsxs("button",{className:"text-green-600 hover:text-green-700 font-semibold flex items-center gap-1",children:["Read More",e.jsx(vs,{className:"h-3 w-3"})]})]})]})]}),e.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-anna-zviahina-431214732-15249164.jpg",alt:"Beach activities",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 mb-3",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:"December 8, 2024"})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3",children:"Best Beach Activities for Families in Koh Samui"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Planning a family vacation? Here are the best beach activities that will keep everyone entertained, from toddlers to teenager
842s."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"6 min read"}),e.jsxs("button",{className:"text-green-600 hover:text-green-700 font-semibold flex items-center gap-1",children:["Read More",e.jsx(vs,{className:"h-3 w-3"})]})]})]})]}),e.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-allphoto-bangkok-1628521-12001661.jpg",alt:"Sunset spots",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 mb-3",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:"December 5, 2024"})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3",children:"Hidden Sunset Spots: Where to Watch the Best Sunsets"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Skip the crowded viewpoints and discover our secret spots for the most breathtaking sunset views on the island."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"4 min read"}),e.jsxs("button",{className:"text-green-600 hover:text-green-700 font-semibold flex items-center gap-1",children:["Read More",e.jsx(vs,{className:"h-3 w-3"})]})]})]})]}),e.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-anetta-kolesnikova-2154382947-33271606.jpg",alt:"Waterfall adventure",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 mb-3",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:"December 3, 2024"})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3",children:"Adventure Guide: Hiking to Na Muang Waterfall"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Everything you need to know about hiking to one of Koh Samui's most beautiful waterfalls, including tips and what to bring."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"7 min read"}),e.jsxs("button",{className:"text-green-600 hover:text-green-700 font-semibold flex items-center gap-1",children:["Read More",e.jsx(vs,{className:"h-3 w-3"})]})]})]})]}),e.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-quintingellar-6510555.jpg",alt:"Local culture",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 mb-3",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:"November 30, 2024"})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3",children:"Understanding Thai Culture: Dos and Don'ts for Visitors"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Respect local customs and make the most of your stay with our guide to Thai culture and etiquette."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"9 min read"}),e.jsxs("button",{className:"text-green-600 hover:text-green-700 font-semibold flex items-center gap-1",children:["Read More",e.jsx(vs,{className:"h-3 w-3"})]})]})]})]}),e.jsxs("article",{className:"bg-white rounded-lg shadow-lg overflow-hidden",children:[e.jsx("img",{src:"/pexels-mike-to-323754-5567082.jpg",alt:"Photography tips",className:"w-full h-48 object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-500 mb-3",children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{children:"November 28, 2024"})]}),e.jsx("h3",{className:"text-xl font-bold text-gray-900 mb-3",children:"Photography Tips: Capturing Koh Samui's Beauty"}),e.jsx("p",{className:"text-gray-600 mb-4",children:"Professional photography tips to help you capture the stunning landscapes, beautiful beaches, and vibrant culture of Koh Samui."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-gray-500",children:"6 min read"}),e.jsxs("button",{className:"text-green-600 hover:text-green-700 font-semibold flex items-center gap-1",children:["Read More",e.jsx(vs,{className:"h-3 w-3"})]})]})]})]})]})]})}),e.jsx("section",{className:"py-20 bg-green-600",children:e.jsxs("div",{className:"container mx-auto px-4 text-center",children:[e.jsx("h2",{className:"text-4xl font-bold text-white mb-6",children:"Stay Updated"}),e.jsx("p",{className:"text-xl text-green-100 mb-8",children:"Subscribe to our newsletter for the latest travel tips and resort updates"}),n==="success"&&e.jsxs("div",{className:"max-w-md mx-auto mb-6 p-4 bg-green-50 border border-green-200 rounded-lg flex items-center gap-3",children:[e.jsx(jt,{className:"h-5 w-5 text-green-600"}),e.jsx("p",{className:"text-green-800",children:o})]}),n==="error"&&e.jsxs("div",{className:"max-w-md mx-auto mb-6 p-4 bg-red-50 border border-red-200 rounded-lg flex items-center gap-3",children:[e.jsx(sa,{className:"h-5 w-5 text-red-600"}),e.jsx("p",{className:"text-red-800",children:o})]}),n==="already_subscribed"&&e.jsxs("div",{className:"max-w-md mx-auto mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg flex items-center gap-3",children:[e.jsx(sa,{className:"h-5 w-5 text-blue-600"}),e.jsx("p",{className:"text-blue-800",children:o})]}),e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("form",{onSubmit:d,className:"flex gap-4",children:[e.jsx("input",{type:"email",value:t,onChange:h=>s(h.target.value),placeholder:"Enter your email",required:!0,className:"flex-1 px-4 py-3 rounded-lg focus:ring-2 focus:ring-white focus:outline-none"}),e.jsx("button",{type:"submit",disabled:a,className:"bg-white text-green-600 px-6 py-3 rounded-lg font-semibold hover:bg-gray-100 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:a?"Subscribing...":"Subscribe"})]}),e.jsx("p",{className:"text-sm text-green-200 mt-3",children:"We respect your privacy. Unsubscribe at any time."})]})]})}),e.jsx("section",{className:"py-20 bg-white",children:e.jsxs("div",{className:"container mx-auto px-4",children:[e.jsxs("div",{className:"text-center mb-16",children:[e.jsx("h2",{className:"text-4xl font-bold text-gray-900 mb-4",children:"Browse by Category"}),e.jsx("p",{className:"text-xl text-gray-600",children:"Find articles that interest you most"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 lg:grid-cols-4 gap-6",children:[e.jsxs("button",{className:"bg-gray-100 hover:bg-green-100 p-6 rounded-lg text-center transition-colors",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Travel Tips"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Planning and preparation advice"})]}),e.jsxs("button",{className:"bg-gray-100 hover:bg-green-100 p-6 rounded-lg text-center transition-colors",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Local Culture"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Thai traditions and customs"})]}),e.jsxs("button",{className:"bg-gray-100 hover:bg-green-100 p-6 rounded-lg text-center transition-colors",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Food & Dining"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Restaurant reviews and food guides"})]}),e.jsxs("button",{className:"bg-gray-100 hover:bg-green-100 p-6 rounded-lg text-center transition-colors",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"Adventure"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Outdoor activities and exploration"})]})]})]})}),e.jsx(Ke,{})]})},Pg=()=>(l.useEffect(()=>{const t=new PerformanceObserver(r=>{for(const n of r.getEntries())n.entryType==="largest-contentful-paint"&&(console.log("LCP:",n.startTime),window.gtag&&window.gtag("event","web_vitals",{event_category:"Performance",event_label:"LCP",value:Math.round(n.startTime)})),n.entryType==="first-input"&&(console.log("FID:",n.processingStart-n.startTime),window.gtag&&window.gtag("event","web_vitals",{event_category:"Performance",event_label:"FID",value:Math.round(n.processingStart-n.startTime)}))});t.observe({entryTypes:["largest-contentful-paint","first-input"]});let s=0;const a=new PerformanceObserver(r=>{for(const n of r.getEntries())n.hadRecentInput||(s+=n.value);console.log("CLS:",s),window.gtag&&window.gtag("event","web_vitals",{event_category:"Performance",event_label:"CLS",value:Math.round(s*1e3)})});return a.observe({entryTypes:["layout-shift"]}),()=>{t.disconnect(),a.disconnect()}},[]),null),Eg=new Km;function Ag(){return Sd(),e.jsx(Zm,{children:e.jsx(Ym,{client:Eg,children:e.jsxs(km,{children:[e.jsxs(Hc,{children:[e.jsx(Pg,{}),e.jsx(Rg,{}),e.jsx(jh,{}),e.jsxs(Vc,{children:[e.jsx(Ye,{path:"/",element:e.jsx(cu,{})}),e.jsx(Ye,{path:"/rooms",element:e.jsx(du,{})}),e.jsx(Ye,{path:"/rooms/:id",element:e.jsx($u,{})}
842),e.jsx(Ye,{path:"/agents/apply",element:e.jsx(gg,{})}),e.jsx(Ye,{path:"/agent",element:e.jsx(zs,{requireAuth:!0,children:e.jsx(pg,{})})}),e.jsx(Ye,{path:"/login",element:e.jsx(zs,{children:e.jsx(zu,{})})}),e.jsx(Ye,{path:"/dashboard",element:e.jsx(zs,{requireAuth:!0,children:e.jsx(hg,{})})}),e.jsx(Ye,{path:"/bookings",element:e.jsx(zs,{requireAuth:!0,children:e.jsx(ng,{})})}),e.jsx(Ye,{path:"/checkout",element:e.jsx(mg,{})}),e.jsx(Ye,{path:"/admin",element:e.jsx(zs,{requireAuth:!0,requireAdmin:!0,children:e.jsx(rg,{})})}),e.jsx(Ye,{path:"/calendar",element:e.jsx(zs,{requireAuth:!0,requireAdmin:!0,children:e.jsx(ug,{})})}),e.jsx(Ye,{path:"/restaurant",element:e.jsx(fg,{})}),e.jsx(Ye,{path:"/waterpark",element:e.jsx(jg,{})}),e.jsx(Ye,{path:"/fullmoon-party",element:e.jsx(bg,{})}),e.jsx(Ye,{path:"/fullmoon-safety",element:e.jsx(yg,{})}),e.jsx(Ye,{path:"/fullmoon-boat-charter",element:e.jsx(vg,{})}),e.jsx(Ye,{path:"/koh-samui-things-to-do",element:e.jsx(Ng,{})}),e.jsx(Ye,{path:"/top-10-tours",element:e.jsx(wg,{})}),e.jsx(Ye,{path:"/watersports",element:e.jsx(kg,{})}),e.jsx(Ye,{path:"/nearby-attractions",element:e.jsx(Sg,{})}),e.jsx(Ye,{path:"/contact",element:e.jsx(Cg,{})}),e.jsx(Ye,{path:"/blog",element:e.jsx(_g,{})}),e.jsx(Ye,{path:"*",element:e.jsx(Bi,{})})]})]}),e.jsx(kd,{})]})})})}function Rg(){const{pathname:t}=$s();return l.useEffect(()=>{window.scrollTo({top:0,left:0,behavior:"smooth"})},[t]),null}ql(document.getElementById("root")).render(e.jsx(Ag,{}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.