1import{_ as Te}from"./CVMoMFLq.js";import{_ as Ce}from"./CQ2YDQlQ.js";import{a4 as Ne,cP as Ae,m as Me,Y as Oe,u as Ve,j as Fe,z as Re,p as $e,o as c,c as u,b as e,f as J,d as F,e as R,g as l,t as m,F as I,r as x,B as Pe,k as T,K as Be,_ as Le,L as Q,$ as W,q as Ue,a1 as C,x as ee,v as $,s as r}from"./3vrl0Mfu.js";import{E as Ee}from"./2cDGQtUm.js";/* empty css */import{b as te}from"./B2-EIB7p.js";import{u as qe}from"./DUc_LXK8.js";import{u as Ge}from"./DnfPPfH6.js";import"./DoKz5QII.js";import"./TltYmMti.js";import"./fJq7v90W.js";import"./Cq9Fpw4b.js";import"./DaETq0I7.js";import"./BBtDnPCj.js";import"./DlDMoBQ9.js";import"./DraYwP1e.js";import"./ClM0sUxB.js";/* empty css */import"./BiM_31tW.js";import"./D3qPioTH.js";import"./8oIyIJDU.js";const Ye={class:"main"},je={class:"complete-container"},ze={class:"main-details"},Ke={class:"details-block"},He={class:"order-attribute"},Xe={class:"details-block"},Ze={class:"order-list-area"},Je={class:"sold-block-list ui-skeleton-block"},Qe={class:"ucenter-details"},We={key:0,class:"main-details"},et={class:"details-block"},tt={class:"title-top"},st={class:"left"},ot={class:"img"},at=["src","alt"],lt={class:"order-info"},rt={class:"imgbox"},it=["src","alt"],nt={class:"text-box"},ct={class:"title"},ut={class:"order-attribute"},dt={key:1,class:"order-description"},mt={class:"text-box"},vt={class:"details-block"},ft={class:"title-top"},pt={class:"left"},bt={class:"profile"},gt={class:"user-image"},_t=["src","alt"],kt={class:"info"},yt={class:"username"}
1,ht={key:0,class:"icomoon-icon icon icon-badge"},St={key:0,class:"user-feed"},wt={class:"score"},Dt={class:"rate"},It={class:"details-block"},xt={class:"order-list-area"},Tt={class:"label"},Ct={class:"value"},Nt={class:"sold-block-list"},At={class:"value"},Mt={key:1,class:"details-block order-detail-access-denied"},Ot={key:0},Vt={key:1},Ft={__name:"details",setup(Rt){const{isLight:se}=Ae(),g=Me(),P=Oe(),h=Ve(),{get:oe}=Fe(),{isOrderDetailApiSuccess:ae,isDeniedApiResponse:le,isDeniedFetchError:re,redirectAfterDenied:B}=qe(),a=$(null),S=$(!0),ie={leading:0,trailing:200},ne=r(()=>S.value),b=$(!1),f=r(()=>String(g.query.role||"").trim().toLowerCase()==="seller"?"seller":"buyer"),L=r(()=>{const t=String(g.params.id||"").trim();return t===""?"":decodeURIComponent(t)}),U=r(()=>a.value?.orderOfferDetails?.gameName||"--"),E=r(()=>a.value?.orderOfferDetails?.deliveryMethod||"--");function ce(t){const s=Math.max(0,Number(t)||0);if(s<=0)return"Instant";const o=Math.floor(s/3600),i=Math.floor(s%3600/60),d=s%60;return o>0&&i>0?`Up to ${o}h ${i}m`:o>0?`Up to ${o} hour${o===1?"":"s"}`:i>0?`Up to ${i} minute${i===1?"":"s"}`:`Up to ${d} second${d===1?"":"s"}`}const q=r(()=>{const t=a.value?.orderOfferDetails?.guaranteedDeliveryTime;if(t!=null&&String(t).trim()!=="")return String(t).trim();const s=Number(a.value?.deliveryTimeOptions?.guaranteedDeliveryTimeSeconds??0);return s>0?ce(s):""}),ue=r(()=>{const t=a.value?.orderOfferDetails,s=t?.mainImage||"";if(s)return String(s);const o=t?.attributeIdValues?.find(i=>String(i?.imageLocation||"").trim())?.imageLocation;return String(o?o||"":t?.gameServiceIcon||t?.mainImage||"")}),de=r(()=>{const t=a.value?.orderOfferDetails;return String(t?.serviceName||"").trim()==="Currency"?t?.categories?.find(i=>i.dimension==="OTHER"&&String(i?.imageLocation||"").trim())?.imageLocation||String(t?.gameServiceIcon||t?.mainImage||te(t?.gameLogo)):te(t?.gameLogo)}),N=r(()=>{const t=a.value?.orderOfferDetails,s=String(t?.serviceName||"").trim(),o=String(t?.offerTitle||"").trim();if(o)return o;const i=t?.attributeIdValues?.find(d=>String(d?.value||"").trim())?.value;return String(i?i||"":s)}),G=r(()=>a.value.descriptionFull),me=r(()=>{const t=a.value?.orderOfferDetails,s=Array.isArray(t?.categories)?t.categories:[],o=Array.isArray(t?.attributes)?t.attributes:[],i=Array.isArray(t?.attributeIdValues)?t.attributeIdValues:[],d=[],_=new Map;for(const p of s){const v=String(p?.name||"").trim(),k=String(p?.value||"").trim();v&&k&&d.push({label:v,value:k})}for(const p of i){const v=String(p?.id||"").trim(),k=v.includes("-")?v.split("-")[0]:v,D=String(p?.name||"").trim(),O=k||D,V=String(p?.value||"").trim();if(!O||!V)continue;const Z=_.get(O)||[];Z.includes(V)||_.set(O,[...Z,V])}for(const p of o){const v=String(p?.name||"").trim();if(!v)continue;const k=String(p?.id||"").trim(),D=_.get(k)||_.get(v)||[];D.length&&d.push({label:v,value:D.join(", ")})}let n=[{label:"Delivery method",value:E.value||"--"},{label:"Guaranteed delivery time",value:q.value||"Instant"}];return d.length>0?d.concat(n):[{label:"Delivery method",value:E.value||"--"},{label:"Guaranteed delivery time",value:q.value||"Instant"}]}),ve=r(()=>f.value==="seller"?"Buyer":"Seller"),A=r(()=>f.value==="seller"?a.value?.buyerInfo?.user:a.value?.sellerInfo?.user),w=r(()=>A.value?.username||"--"),fe=r(()=>A.value?.avatarUrl||A.value?.picture),pe=r(()=>f.value==="buyer"),Y=r(()=>a.value?.sellerInfo?.userOrderInfo??null),be=r(()=>f.value==="buyer"),ge=r(()=>De(Y.value)),_e=r(()=>Math.max(0,Number(Y.value?.ratingCount||0))),ke=r(()=>h(`/users/${w.value}/reviews`)),ye=r(()=>j.value.length>0),{formatMoney:he,formatRawAmount:M}=Ge(),j=r(()=>{const t=[...Array.isArray(a.value?.orderOfferDetails?.offerImages)?a.value.orderOfferDetails.offerImages:[]].filter(o=>typeof o=="string"&&o);return Array.from(new Set([...t].filter(Boolean)))}),Se=r(()=>({label:"You receive",value:M(a.value?.paymentDetails?.netProceeds??"0",a.value?.paymentDetails?.currency,{fallbackText:""})})),we=r(()=>{if(f.value==="seller")return[{label:"Order Price",value:M(a.value?.paymentDetails?.orderPrice??"0",a.value?.paymentDetails?.currency,{fallbackText:""})},{label:"Commission",value:M(a.value?.paymentDetails?.Commission??"0",a.value?.paymentDetails?.currency,{fallbackText:""})}];const t=a.value?.paymentBreakdown?.lines?.find(o=>o.code==="SYSTEM_DISCOUNT")?.amount,s=Ie(a.value?.buyerPayments?.walletDeduction);return[{label:"Product Price",value:y(a.value?.paymentBreakdown?.lines?.find(o=>o.code==="SUBTOTAL")?.amount)},...z(t)?[{label:"Discount Amount",value:y(t)}]:[],{label:"Payment fees",value:y(a.value?.paymentBreakdown?.lines?.find(o=>o.code==="BUYER_SERVICE_FEE")?.amount)||"0"},...z(s)?[{label:"IGX balance",value:`-${y(s)}`}]:[],{label:"Total",value:y(a.value?.buyerPayments?.totalPaid)}]});function De(t){const s=Number(t?.positiveCount||0),o=Number(t?.ratingCount||0);return!Number.isFinite(s)||!Number.isFinite(o)||o<=0?0:Math.round(s/o*100)}function y(t){return he(t,{fallbackText:""})}function Ie(t,s){return t||s||null}function z(t){if(!t)return!1;const s=typeof t=="object"?t.amount:t,o=Number(s);return Number.isFinite(o)&&o!==0}const K=r(()=>h(f.value==="seller"?"/dashboard/orders/sold":"/dashboard/orders/purchased"));async function H(){if(!L.value){S.value=!1,b.value=!1;return}S.value=!0,b.value=!1;try{const t=await oe(`/orders/me/${encodeURIComponent(L.value)}`,{},{credentials:"include"});ae(t)?a.value=t.data:le(t)?(a.value=null,b.value=!0,C.warning("This order is not available."),await B(K.value)):(a.value=null,b.value=!1,C.error(typeof t?.message=="string"?t.message:"Failed to load order"))}catch(t){console.error("Failed to load order details",t),a.value=null,re(t)?(b.value=!0,C.warning("This order is not available."),await B(K.value)):(b.value=!1,C.error("Failed to load order"))}finally{S.value=!1}}async function X(){if(typeof g.query.from=="string"&&g.query.from){await ee(g.query.from);return}if(window.history.length>1){P.back();return}await ee(h(f.value==="seller"?"/dashboard/orders/sold":"/dashboard/orders/purchased"))}function xe(t){t&&P.push(h(`/users/${t}/shop`))}return Re(()=>{H()}),$e(()=>g.params.id,()=>{H()}),(t,s)=>{const o=Te,i=Ce,d=Le,_=Ee;return c(),u("main",Ye,[e("div",{class:"complete-container"},[e("a",{class:"order-go-back",onClick:X}
1,[...s[1]||(s[1]=[e("span",{class:"icomoon-icon icon icon-sign-left"},null,-1),J(" Back to order",-1)])])]),e("div",je,[F(_,{loading:l(ne),animated:"",throttle:ie},{template:R(()=>[e("div",{class:Ue(["ucenter-details ui-skeleton-surface",{"ui-skeleton-surface--light":l(se)}])},[e("div",ze,[e("div",Ke,[s[3]||(s[3]=e("div",{class:"title-top"},[e("div",{class:"left"},[e("div",{class:"img ui-skeleton-block"},"ââ"),e("span",{class:"ui-skeleton-block"},"ââââââ")])],-1)),s[4]||(s[4]=e("div",{class:"order-info"},[e("div",{class:"imgbox ui-skeleton-block"},"âââ"),e("div",{class:"text-box"},[e("div",{class:"title ui-skeleton-block"},"âââââââ")])],-1)),e("div",He,[(c(),u(I,null,x(3,n=>e("div",{key:n,class:"link"},[...s[2]||(s[2]=[e("span",{class:"ui-skeleton-block"},"âââ",-1),e("strong",{class:"ui-skeleton-block"},"ââââ",-1)])])),64))]),s[5]||(s[5]=e("div",{class:"order-description"},[e("div",{class:"title-top"},[e("div",{class:"left"},[e("span",{class:"ui-skeleton-block"},"ââââ")])]),e("div",{class:"text-box"},[e("p",{class:"ui-skeleton-block"},"â"),e("p",{class:"ui-skeleton-block"},"â"),e("p",{class:"ui-skeleton-block"},"â")])],-1))]),s[8]||(s[8]=e("div",{class:"details-block"},[e("div",{class:"title-top"},[e("div",{class:"left"},[e("span",{class:"ui-skeleton-block"},"âââ")])]),e("div",{class:"profile"},[e("div",{class:"user-image ui-skeleton-block"},"ââ"),e("div",{class:"info"},[e("div",{class:"username"},[e("span",{class:"name ui-skeleton-block"},"ââââ")])])])],-1)),e("div",Xe,[s[7]||(s[7]=e("div",{class:"title-top"},[e("div",{class:"left"},[e("span",{class:"ui-skeleton-block"},"âââ")])],-1)),e("ul",Ze,[(c(),u(I,null,x(4,n=>e("li",{key:n},[...s[6]||(s[6]=[e("span",{class:"label ui-skeleton-block"},"âââ",-1),e("span",{class:"value ui-skeleton-block"},"ââââ",-1)])])),64))])]),Q(e("div",Je,"â",512),[[W,l(f)==="seller"]])])],2)]),default:R(()=>[e("div",Qe,[l(a)?(c(),u("div",We,[e("div",et,[e("div",tt,[e("div",st,[e("div",ot,[e("img",{src:l(de),alt:l(U),width:"19",height:"19"},null,8,at)]),e("span",null,m(l(U)),1)])]),e("div",lt,[e("div",rt,[e("img",{src:l(ue),alt:l(N),width:"58",height:"58"},null,8,it)]),e("div",nt,[e("div",ct,m(l(N)),1)])]),e("div",ut,[(c(!0),u(I,null,x(l(me),n=>(c(),u("div",{key:`${n.label}-${n.value}`,class:"link"},[e("span",null,m(n.label),1),e("strong",null,m(n.value),1)]))),128))]),l(ye)?(c(),Pe(o,{key:0,images:l(j),title:l(N)},null,8,["images","title"])):T("",!0),l(G)?(c(),u("div",dt,[s[9]||(s[9]=e("div",{class:"title-top"},[e("div",{class:"left"},[e("span",null,"Description")])],-1)),e("div",mt,[F(i,{text:l(G),rows:3,"overflow-mode":"toggle"},null,8,["text"])])])):T("",!0)]),e("div",vt,[e("div",ft,[e("div",pt,[e("span",null,m(l(ve)),1)])]),e("div",bt,[e("div",gt,[e("img",{src:l(fe),alt:l(w)},null,8,_t)]),e("div",kt,[e("div",yt,[e("a",{class:"name",rel:"nofollow",onClick:s[0]||(s[0]=Be(n=>xe(l(w)),["prevent"]))},m(l(w)),1),l(pe)?(c(),u("span",ht,[...s[10]||(s[10]=[e("div",{class:"verified"},"Verified seller",-1)])])):T("",!0)]),l(be)?(c(),u("div",St,[e("div",wt,[s[11]||(s[11]=e("span",{class:"icomoon-icon
1icon icon-thumbs-up"},null,-1)),e("span",Dt,m(l(ge))+"%",1)]),F(d,{class:"review-count",to:l(ke)},{default:R(()=>[J(m(l(_e))+" reviews ",1)]),_:1},8,["to"])])):T("",!0)])])]),e("div",It,[s[12]||(s[12]=e("div",{class:"title-top"},[e("div",{class:"left"},[e("span",null,"Payment")])],-1)),e("ul",xt,[(c(!0),u(I,null,x(l(we),n=>(c(),u("li",{key:n.label},[e("span",Tt,m(n.label),1),e("span",Ct,m(n.value),1)]))),128))])]),Q(e("div",Nt,[s[13]||(s[13]=e("span",{class:"label"},"You receive: ",-1)),e("span",At,m(l(Se).value),1)],512),[[W,l(f)==="seller"]])])):(c(),u("div",Mt,[l(b)?(c(),u("p",Ot,"This order is not available or you do not have permission to view it.")):(c(),u("p",Vt,"Unable to load this order. Check your connection or try again later.")),e("a",{class:"text-link order-detail-access-denied__link",href:"javascript:void(0)",onClick:X},"Back to orders")]))])]),_:1},8,["loading"])])])}}},os=Ne(Ft,[["__scopeId","data-v-1abfb211"]]);export{os 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.