1import{z as y,e as x}from"./BA2cZanY.js";import{s as b,c as U}from"./BI5BN1rn.js";function E(){const{$store:h,$translate:s}=y(),{locale:p}=b(h),{currency:v}=U(),i=x(()=>p.value.replace("_","-")),c=e=>e?new Date(Number(e)*1e3).toLocaleDateString(i.value,{year:"numeric",month:"numeric",day:"numeric"}):"",S=e=>{if(!e)return"";const t=new Date(Number(e)*1e3),r=t.toLocaleDateString(i.value,{weekday:"short",year:"numeric",month:"short",day:"numeric"}),a=t.toLocaleTimeString(i.value,{hour:"2-digit",minute:"2-digit",hour12:!1});return`${r} ${s("at")} ${a}`},$=(e,t)=>{if(!e||!t)return"";const r=new Date(e*1e3),a=new Date(t*1e3),o=r.toLocaleDateString(i.value,{year:"numeric",month:"short",day:"numeric"}),d=a.toLocaleDateString(i.value,{year:"numeric",month:"short",day:"numeric"}),l=r.toLocaleTimeString(i.value,{hour:"2-digit",minute:"2-digit",hour12:!1}),n=a.toLocaleTimeString(i.value,{hour:"2-digit",minute:"2-digit",hour12:!1});return o===d?`${o} ${s("at")} ${l} - ${n}`:`${o} ${s("at")} ${l} - ${d} ${s("at")} ${n}`},w=e=>parseInt(e.refunded)?"danger":parseInt(e.processed)?"default":parseInt(e.paid)?"success":(parseInt(e.confirmed),"info"),I=e=>parseInt(e.refunded)?s("Refunded"):parseInt(e.processed)?s("Processed"):parseInt(e.paid)?s("Paid"):parseInt(e.confirmed)?s("Confirmed"):s("Open order"),_=e=>{const t=Math.floor(Date.now()/1e3);return e.cancelled?"danger":e.end_ts<t?"default":e.start_ts<=t&&e.end_ts>=t?"success":"info"},D=e=>{const t=Math.floor(Date.now()/1e3);return e.end_ts<t?s("Completed"):e.start_ts<=t&&e.end_ts>=t?s("Active"):s("Upcoming")},R=e=>{if(!e.ownItem||Object.keys(e.ownItem).length===0)return e.name||s("No items");const t=Object.values(e.ownItem).map(n=>({id:n.id,item_id:n.item_id,name:n.product_name,value:parseFloat(n.price)*parseFloat(n.count)})),r=t.filter(n=>!n.item_id),a=t.filter(n=>!!n.item_id);r.sort((n,f)=>{const V=n.value+a.filter(u=>u.item_id===n.id).reduce((u,m)=>u+m.value,0);return f.value+a.filter(u=>u.item_id===f.id).reduce((u,m)=>u+m.value,0)-V});const o=[];for(const n of r)o.push(n),o.push(...a.filter(f=>f.item_id===n.id));const d=new Set(r.map(n=>n.id));for(const n of a)d.has(n.item_id)||o.push(n);const l=o.slice(0,3).map(n=>n.name).filter(Boolean);return l.length===0?e.name||s("No items"):l.join(", ")},C=e=>{if(!e.reservation?.sharedResource||e.reservation.sharedResource.length===0)return"";const t=e.ownSeat_ticket?.[0]?.seat?.resource_id;return t&&e.reservation.sharedResource.find(a=>a.id===t)?.name||e.reservation.sharedResource[0]?.name},T=(e,t,r)=>{const a="https://qrcode.johku.com",o=`${r}${t}/qr/R${e.identifier}`;return`${a}?size=5&margin=1&code=${encodeURIComponent(o)}`},g=e=>{const t=parseFloat(e.remainingvalue||0),r=parseInt(e.remainingcount||0);if(t<=0&&r<=0)return"exhausted";const a=parseFloat(e.value||0),o=parseInt(e.count||0);return t<a||r<o?"partial":"full"};return{currency:v,formatDate:c,formatDateTime:S,formatDateRange:$,getOrderStatusClass:w,getOrderStatusText:I,getReservationStatusClass:_,getReservationStatusText:D,getOrderItemsPreview:R,getTicketResource:C,getTicketQRUrl:T,getValueCardStatus:g,getValueCardStatusClass:e=>{const t=g(e);return t==="exhausted"?"valuecard-exhausted":t==="partial"?"valuecard-partial":"valuecard-full"},isValueCardValid:e=>{const t=Math.floor(Date.now()/1e3),r=parseInt(e.validfrom||0),a=parseInt(e.validto||0);return!(r>0&&t<r||a>0&&t>a)},shouldShowUsageBadges:e=>{const t=parseInt(e.singleuse)&&parseInt(e.count)<=1,r=parseInt(e.singleorder);return t||r},getValidityText:e=>{const t=parseInt(e.validfrom||0),r=parseInt(e.validto||0);return t>0&&r>0?`${c(t)} - ${c(r)}`:t>0?`${s("Valid from")} ${c(t)}`:r>0?`${s("Valid until")} ${c(r)}`:""},downloadReceipt:(e,t,r)=>{e.identifier&&window.open(`${r}${t}/receipts/${e.identifier}.pdf`,"_blank")},getStorefrontOrderUrl:(e,t,r)=>!e?.identifier||parseInt(r?.legacystorefront)?"":`https://${r?.shopdomain||`${t}.johku.com`}/${p.value}/orderinfo/${e.identifier}`,getSubscriptionStatusText:e=>{switch(e?.status){case"active":return e.cancelled?s("Cancelled"):s("Active");case"suspended":return s("Suspended");case"ended":return s("Ended");default:return e?.status??""}},getSubscriptionStatusClass:e=>{switch(e?.status){case"active":return e.cancelled?"warning":"success";case"suspended":return"danger";default:return"default"}},isValidAccountTab:e=>["overview","information","orders","reservations","codes","tickets","subscriptions"].includes(e)}}
1export{E as u};
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.