PageSourceSearch

https://kozystay.com/assets/StayDebugWidget-Cofc4GIf.js

js kozystay.com collected 2026-09-26 07:47:50 UTC 13,079 bytes, 1 lines download raw bytes

1import{_ as j,u as Q,w as G,o as W,c as J,a as c,b as e,d as h,e as E,f as $,v as V,g as b,h as q,n as H,i as v,j as k,r as U,t as T,k as X,T as Z,l as ee,m as I,F as N,p as O,q as i,s as S,x as A,y as B,z as C,P as R,A as te,B as oe}from"./index-BspZFfai.js";import{P as le,u as F,a as se,q as K}from"./keys-Bh1F8xSS.js";const ne={key:0,class:"base-drawer__header"},ae={class:"base-drawer__header-content"},re={key:0,class:"base-drawer__title"},ie={key:1,class:"base-drawer__footer"},de={__name:"BaseDrawer",props:{visible:{type:Boolean,default:!1},placement:{type:String,default:"right",validator:p=>["left","right","bottom","top"].includes(p)},title:{type:String,default:""},width:{type:[String,Number],default:"360px"},height:{type:[String,Number],default:"65vh"},zIndex:{type:[Number,String],default:60},closeOnOverlay:{type:Boolean,default:!0},showOverlay:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},allowBackgroundInteraction:{type:Boolean,default:!1},bodyPadding:{type:Boolean,default:!0}},emits:["update:visible"],setup(p,{emit:o}){const a=p,_=o,u=Q(),d=typeof window<"u"&&typeof document<"u";let f=null;const y=()=>{_("update:visible",!1)},w=()=>{a.closeOnOverlay&&y()},x=v(()=>["base-drawer__panel",`base-drawer__panel--${a.placement}`]),s=v(()=>{const m={};return(a.placement==="left"||a.placement==="right")&&(m.width=typeof a.width=="number"?`${a.width}px`:a.width,m.maxWidth="100%",m.height="100%"),(a.placement==="bottom"||a.placement==="top")&&(m.height=typeof a.height=="number"?`${a.height}px`:a.height,m.maxHeight="100%",m.width="100%"),m}),n=v(()=>{switch(a.placement){case"left":return"drawer-slide-left";case"bottom":return"drawer-slide-bottom";case"top":return"drawer-slide-top";default:return"drawer-slide-right"}}),r=v(()=>!!u.footer),g=v(()=>!!u.header),t=v(()=>g.value||!!a.title),l=m=>{m.key==="Escape"&&y()};return d&&(G(()=>a.visible,m=>{m?(a.lockScroll&&(f=document.body.style.overflow,document.body.style.overflow="hidden"),window.addEventListener("keydown",l)):(window.removeEventListener("keydown",l),a.lockScroll&&(document.body.style.overflow=f??"",f=null))},{immediate:!0}),W(()=>{window.removeEventListener("keydown",l),a.lockScroll&&f!==null&&(document.body.style.overflow=f,f=null)})),(m,P)=>(c(),J(ee,{to:"body"},[e("div",{class:k(["base-drawer",{"base-drawer--open":p.visible,"base-drawer--passthrough":p.allowBackgroundInteraction}]),style:H({zIndex:Number(p.zIndex)})},[p.showOverlay?h((c(),b("div",{key:0,class:"base-drawer__overlay",onClick:w},null,512)),[[V,p.visible]]):E("",!0),$(Z,{name:n.value},{default:q(()=>[h(e("aside",{key:"drawer-panel",class:k(x.value),style:H(s.value),role:"dialog","aria-modal":"true"},[t.value?(c(),b("header",ne,[U(m.$slots,"header",{close:y},()=>[e("div",ae,[p.title?(c(),b("h2",re,T(p.title),1)):E("",!0),P[0]||(P[0]=e("span",{class:"base-drawer__spacer"},null,-1)),e("button",{type:"button",class:"base-drawer__close",onClick:y,"aria-label":"Close drawer"},[$(X,{is:"close",class:"w-20 h-20"})])])],!0)])):E("",!0),e("section",{class:k(["base-drawer__body",{"base-drawer__body--padded":p.bodyPadding}])},[U(m.$slots,"default",{close:y},void 0,!0)],2),r.value?(c(),b("footer",ie,[U(m.$slots,"footer",{close:y},void 0,!0)])):E("",!0)],6),[[V,p.visible]])]),_:3},8,["name"])],6)]))}},ue=j(de,[["__scopeId","data-v-ddabfcc2"]]),ce={class:"flex flex-col gap-12"},pe={class:"flex items-center justify-between"},me={class:"grid grid-cols-2 gap-8"},be=["title","onClick"],fe=I({__name:"DebugPresets",props:{activePreset:{}},emits:["apply","reset"],setup(p,{emit:o}){const a=o;return(_,u)=>(c(),b("section",ce,[e("header",pe,[u[1]||(u[1]=e("h3",{class:"text-sm font-semibold text-neutral-900"},"Scenario presets",-1)),e("button",{type:"button",class:"rounded-full border border-feedback-error/40 px-12 py-4 text-xs font-medium text-feedback-error hover:bg-feedback-error/10",onClick:u[0]||(u[0]=d=>a("reset"))}," Reset all ")]),e("div",me,[(c(!0),b(N,null,O(i(le),d=>(c(),b("button",{key:d.id,type:"button",title:d.description,class:k(["rounded-lg border px-12 py-8 text-left text-xs font-medium transition-colors",p.activePreset===d.id?"border-primary-500 bg-primary-50 text-neutral-900":"border-neutral-900/10 bg-neutral-0 text-neutral-900/80 hover:border-neutral-900/30"]),onClick:f=>a("apply",d.id)},T(d.label),11,be))),128))])]))}}),ye={class:"flex flex-col gap-12"},xe={class:"rounded-lg bg-neutral-100 px-12 py-8 text-xs leading-5 text-neutral-900/80"},ve={key:0,class:"ml-4 rounded bg-primary-500 px-4 py-0.5 text-2xs font-semibold text-neutral-900"},ge={class:"text-neutral-900/50"},ke={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},we={class:"flex flex-wrap gap-8"},he=["onClick"],z=3600*1e3,Se=I({__name:"DebugTimeControls",setup(p){const o=F(),a=24*z,_=[{label:"-1d",deltaMs:-a},{label:"-1h",deltaMs:-z},{label:"+1h",deltaMs:z},{label:"+1d",deltaMs:a},{label:"+7d",deltaMs:7*a}],u=x=>String(x).padStart(2,"0");function d(x){const s=new Date(x);return`${s.getFullYear()}-${u(s.getMonth()+1)}-${u(s.getDate())}T${u(s.getHours())}:${u(s.getMinutes())}`}const f=v({get:()=>d(o.fakeNowMs),set:x=>{const s=new Date(x).getTime();Number.isNaN(s)||o.setFakeNow(s)}}),y=v(()=>
1new Date(o.fakeNowMs).toLocaleString()),w=v(()=>new Date(o.realNowMs).toLocaleString());return(x,s)=>(c(),b("section",ye,[s[7]||(s[7]=e("h3",{class:"text-sm font-semibold text-neutral-900"},"Current time",-1)),e("div",xe,[e("p",null,[s[4]||(s[4]=e("span",{class:"font-medium"},"Fake now:",-1)),S(" "+T(y.value)+" ",1),i(o).isTimeFaked?(c(),b("span",ve,T(i(o).clock.mode==="frozen"?"FROZEN":"OFFSET"),1)):E("",!0)]),e("p",ge,[s[5]||(s[5]=e("span",{class:"font-medium"},"Real now:",-1)),S(" "+T(w.value),1)])]),e("label",ke,[s[6]||(s[6]=S(" Set fake time ",-1)),h(e("input",{"onUpdate:modelValue":s[0]||(s[0]=n=>f.value=n),type:"datetime-local",class:"rounded-lg border border-neutral-900/15 px-12 py-8 text-sm text-neutral-900"},null,512),[[A,f.value]])]),e("div",we,[(c(),b(N,null,O(_,n=>e("button",{key:n.label,type:"button",class:"rounded-full border border-neutral-900/15 px-12 py-4 text-xs font-medium text-neutral-900/80 hover:border-neutral-900/40",onClick:r=>i(o).nudge(n.deltaMs)},T(n.label),9,he)),64)),e("button",{type:"button",class:"rounded-full border border-secondary-500/40 px-12 py-4 text-xs font-medium text-secondary-500 hover:bg-secondary-500/10",onClick:s[1]||(s[1]=n=>i(o).setFakeNow(i(o).realNowMs))}," Now "),e("button",{type:"button",class:"rounded-full border border-neutral-900/15 px-12 py-4 text-xs font-medium text-neutral-900/80 hover:border-neutral-900/40",onClick:s[2]||(s[2]=n=>i(o).setTimeReal())}," Real time "),e("button",{type:"button",class:k(["rounded-full px-12 py-4 text-xs font-medium",i(o).clock.mode==="frozen"?"bg-primary-500 text-neutral-900":"border border-neutral-900/15 text-neutral-900/80 hover:border-neutral-900/40"]),onClick:s[3]||(s[3]=n=>i(o).clock.mode==="frozen"?i(o).unfreeze():i(o).freezeNow())},T(i(o).clock.mode==="frozen"?"Unfreeze":"Freeze"),3)])]))}}),Te={class:"flex flex-col gap-12"},_e={class:"flex items-center justify-between"},Ee={key:0,class:"rounded bg-feedback-success/15 px-6 py-0.5 text-2xs font-semibold text-feedback-success"},Ce={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},De=["value"],$e={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},Ne=["value"],Ae={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},Oe=["value"],Pe={class:"grid grid-cols-2 gap-8"},Re={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},Me={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},Ie={class:"grid grid-cols-2 gap-8"},Ue={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},Be={class:"flex flex-col gap-4 text-xs font-medium text-neutral-900/80"},D="rounded-lg border border-neutral-900/15 px-12 py-8 text-sm text-neutral-900 bg-neutral-0",ze=I({__name:"DebugStayControls",setup(p){const o=F(),a=["STAY_CREATED","STAY_ACTIVATED","STAY_CONFIRMED","STAY_IN_PROGRESS","STAY_LATE_CHECK_OUT_CONFIRMED","STAY_CHECK_OUT","STAY_COMPLETED"],_=["RESERVED","WAITING_FOR_PAYMENT","PROCESSING_PAYMENT","PAID","START_CHECK_IN","CURRENTLY_STAYING","CHECK_OUT_OVERDUE","CHECKED_OUT","COMPLETED","CANCELLED","EXPIRED","REFUNDED"],u=[{label:"House",value:R.HOUSE},{label:"Apartment",value:R.APARTMENT},{label:"Villa",value:R.VILLA},{label:"Aparthotel",value:R.APARTHOTEL}];function d(g){return v({get:()=>o.stayOverride[g],set:t=>{const l=t===""?null:t;o.setStayOverride({[g]:l})}})}const f=d("status"),y=d("bookingStatus"),w=d("propertyTypeId"),x=d("checkinDate"),s=d("checkoutDate"),n=d("checkoutTime"),r=d("timezone");return(g,t)=>(c(),b("section",Te,[e("header",_e,[t[8]||(t[8]=e("h3",{class:"text-sm font-semibold text-neutral-900"},"Stay overrides",-1)),i(o).hasStayOverride?(c(),b("span",Ee,"ACTIVE")):E("",!0)]),e("label",Ce,[t[10]||(t[10]=S(" Stay status ",-1)),h(e("select",{"onUpdate:modelValue":t[0]||(t[0]=l=>C(f)?f.value=l:null),class:k(D)},[t[9]||(t[9]=e("option",{value:null},"— no override —",-1)),(c(),b(N,null,O(a,l=>e("option",{key:l,value:l},T(l),9,De)),64))],512),[[B,i(f)]])]),e("label",$e,[t[12]||(t[12]=S(" Booking status ",-1)),h(e("select",{"onUpdate:modelValue":t[1]||(t[1]=l=>C(y)?y.value=l:null),class:k(D)},[t[11]||(t[11]=e("option",{value:null},"— no override —",-1)),(c(),b(N,null,O(_,l=>e("option",{key:l,value:l},T(l),9,Ne)),64))],512),[[B,i(y)]])]),e("label",Ae,[t[14]||(t[14]=S(" Property type (add-on) ",-1)),h(e("select",{"onUpdate:modelValue":t[2]||(t[2]=l=>C(w)?w.value=l:null),class:k(D)},[t[13]||(t[13]=e("option",{value:null},"— no override —",-1)),(c(),b(N,null,O(u,l=>e("option",{key:l.value,value:l.value},T(l.label),9,Oe)),64))],512),[[B,i(w)]])]),e("div",Pe,[e("label",Re,[t[15]||(t[15]=S(" Check-in date ",-1)),h(e("input",{"onUpdate:modelValue":t[3]||(t[3]=l=>C(x)?x.value=l:null),type:"date",class:k(D)},null,512),[[A,i(x)]])]),e("label",Me,[t[16]||(t[16]=S(" Check-out date ",-1)),h(e("input",{"onUpdate:modelValue":t[4]||(t[4]=l=>C(s)?s.value=l:null),type:"date",class:k(D)},null,512),[[A,i(s)]])])]),e("div",Ie,[e("label",Ue,[t[17]||(t[17]=S(" Check-out time ",-1)),h(e("input",{"onUpdate:modelValue":t[5]||(t[5]=l=>C(n)?n.value=l:null),type:"time",class:k(D)},null,512),[[A,i(n)]])]),e("label",Be,[t[18]||(t[18]=S(" Timezone ",-1)),h(e("input",{"onUpdate:modelValue":t[6]||(t[6]=l=>C(r)?r.value=l:null),type:"text",placeholder:"Asia/Jakarta",class:k(D)},null,512),[[A,i(r)]])])]),e("button",{type:"button",class:"self
1-start rounded-full border border-neutral-900/15 px-12 py-4 text-xs font-medium text-neutral-900/80 hover:border-neutral-900/40",onClick:t[7]||(t[7]=l=>i(o).clearStayOverride())}," Clear stay override ")]))}}),Fe={key:0,"aria-hidden":"true",class:"animate-shimmer pointer-events-none absolute inset-0 bg-gradient-to-r from-transparent via-neutral-0/30 to-transparent"},Le={class:"flex flex-col gap-24 pb-24"},M=1440*60*1e3,He=I({__name:"StayDebugWidget",setup(p){const o=F(),a=oe(),_=se();te(()=>o.init());const u=v(()=>{const n=a.params.bookingId;return Array.isArray(n)?n[0]??"":String(n??"")});G(u,n=>n&&o.loadStay(n),{immediate:!0});const d=v(()=>/^\/stays\/[^/]+/.test(a.path)),f=v(()=>o.isActive&&d.value),y=v(()=>o.hasStayOverride||o.isTimeFaked),w=n=>String(n??"").slice(0,10);function x(){const n=o.realNowMs,r=_.getQueryData(K.stays.detail(u.value)),g=_.getQueryData(K.reservations.detail(u.value)),t=w(r?.checkinDate??g?.checkinDate),l=w(r?.checkoutDate??g?.checkoutDate),m=r?.listing?.checkinStartTime??g?.listing?.checkinStartTime??"14:00",P=r?.listing?.checkoutTime??g?.listing?.checkoutTime??"12:00",L=t?new Date(`${t}T${m}`).getTime():n+2*M,Y=l?new Date(`${l}T${P}`).getTime():n+5*M;return{checkinMs:Number.isNaN(L)?n+2*M:L,checkoutMs:Number.isNaN(Y)?n+5*M:Y,realNowMs:n}}function s(n){o.applyPreset(n,x())}return(n,r)=>f.value?(c(),b(N,{key:0},[e("button",{type:"button","data-testid":"stay-debug-fab",class:k(["fixed top-16 left-1/2 z-80 -translate-x-1/2 overflow-hidden rounded-full px-16 py-8 text-xs font-semibold text-neutral-0 shadow-xl",y.value?"bg-feedback-success hover:bg-feedback-success/90":"bg-neutral-900 hover:bg-neutral-900/90"]),onClick:r[0]||(r[0]=g=>i(o).togglePanel())},[y.value?(c(),b("span",Fe)):E("",!0),r[3]||(r[3]=e("span",{class:"relative"},"🛠 Debug",-1))],2),$(ue,{visible:i(o).isPanelOpen,placement:"bottom",height:"85vh","z-index":90,title:"Stay Debug","onUpdate:visible":r[2]||(r[2]=g=>i(o).closePanel())},{default:q(()=>[e("div",Le,[r[4]||(r[4]=e("p",{class:"rounded-lg bg-secondary-500/10 px-12 py-8 text-xs leading-5 text-secondary-500"}," Dev-only. Overrides live in this browser tab and simulate frontend rendering only — they don't change real backend state. ",-1)),$(fe,{"active-preset":i(o).activePreset,onApply:s,onReset:r[1]||(r[1]=g=>i(o).resetAll())},null,8,["active-preset"]),r[5]||(r[5]=e("hr",{class:"border-neutral-900/10"},null,-1)),$(Se),r[6]||(r[6]=e("hr",{class:"border-neutral-900/10"},null,-1)),$(ze)])]),_:1},8,["visible"])],64)):E("",!0)}});export{He as default};

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.