1import{a as ne}from"./chunk-GYEAK6A2.js";import"./chunk-VZDUNVSE.js";import{a as ae}from"./chunk-DGH55HEQ.js";import{a as oe}from"./chunk-HI3BBQYM.js";import"./chunk-BYXBJQAS.js";import{b as ie}from"./chunk-E6GZEUAF.js";import"./chunk-VYULK3Y3.js";import{a as J,b as K}from"./chunk-LAPCUU4J.js";import"./chunk-DQRROS2B.js";import"./chunk-5LMG4TVJ.js";import"./chunk-Z2TVBXTG.js";import"./chunk-ZV7NG4F4.js";import"./chunk-DJ5AJG3T.js";import"./chunk-6EF6RNOO.js";import"./chunk-T3DWPM4S.js";import"./chunk-K6QYQNRN.js";import"./chunk-ZNR7QNVV.js";import"./chunk-U3Z5BGA7.js";import{b as te}from"./chunk-N3YFX76I.js";import"./chunk-WF4KZOYP.js";import{a as X,b as Z}from"./chunk-M6YDMVQ7.js";import{a as ee}from"./chunk-OTMVSU27.js";import{a as j}from"./chunk-EB6TJ75L.js";import{D as Q}from"./chunk-FOJCKIWO.js";import{a as z}from"./chunk-NBMUSEX4.js";import"./chunk-3AIY57KH.js";import"./chunk-AB6CKZTE.js";import"./chunk-Z64D265S.js";import"./chunk-K5O3OQFW.js";import"./chunk-2DRXLVRR.js";import{d as G,e as q}from"./chunk-RQJZECR4.js";import"./chunk-G3G5OK6Q.js";import"./chunk-AERMLNF3.js";import"./chunk-QHMYZ6SM.js";import"./chunk-PJPLTBJX.js";import"./chunk-DLIVM562.js";import"./chunk-CV2ZWZQE.js";import"./chunk-H4HD3LNW.js";import{ja as Y}from"./chunk-AQEWHUN5.js";import{c as W,d as H,e as $}from"./chunk-YQZAETCE.js";import{o as A,r as B,s as N,x as F}from"./chunk-EO42E46J.js";import"./chunk-3QVSKJ3X.js";import{D as L,I as V}from"./chunk-ERUCNOOT.js";import{$b as D,Hc as R,Jb as g,Lb as I,Ob as w,Qb as d,Qc as r,Rc as p,Sc as C,Tb as M,Ub as b,Vb as o,Wb as a,Xb as c,da as S,db as n,fc as T,gc as m,la as h,ma as x,mc as P,nc as O,oc as U,sb as y,tc as s,uc as u,vc as v,wc as k,yb as _}from"./chunk-DBE7WQEG.js";import{g as E}from"./chunk-W7GRJBO5.js";var le=["chatWidget"],pe=t=>["/studio/purchases",t],de=(t,i)=>i.date;function me(t,i){if(t&1&&(o(0,"span",6),s(1),a()),t&2){let e=m();n(),v("#",e.dispute.ticketNumber,"")}}function ce(t,i){if(t&1&&(c(0,"p-button",7),r(1,"translate")),t&2){let e=m();g("label",p(1,3,"DISPUTES.VIEW_ORDER"))("outlined",!0)("routerLink",R(5,pe,e.dispute.orderId))}}function ue(t,i){t&1&&c(0,"app-widget-loading")}function _e(t,i){if(t&1){let e=D();o(0,"app-widget-api-error",9),T("retry",function(){h(e);let f=m();return x(f.loadDispute())}),a()}}function ge(t,i){if(t&1&&c(0,"p-tag",24),t&2){let e=m(3);g("severity",e.getStatusSeverity(e.dispute.disputeStatus))("value",e.getStatusLabel(e.dispute.disputeStatus))}}function fe(t,i){if(t&1&&(o(0,"div",22)(1,"span"),c(2,"i",23),s(3),r(4,"translate"),a(),_(5,ge,1,2,"p-tag",24),a()),t&2){let e=m(2);n(3),u(p(4,2,"DISPUTES.DISPUTE_INFO")),n(2),d(e.dispute.disputeStatus?5:-1)}}function ve(t,i){if(t&1&&(o(0,"div",14)(1,"small",15),s(2),r(3,"translate"),a(),o(4,"span",16),s(5),a()()),t&2){let e=m(2);n(2),u(p(3,2,"DISPUTES.COL_AMOUNT")),n(3),u(e.formatPrice(e.dispute.disputeAmountCents))}}function Se(t,i){if(t&1&&(o(0,"div",14)(1,"small",15),s(2),r(3,"translate"),a(),o(4,"span",25),s(5),r(6,"date"),a()()),t&2){let e=m(2);n(2),u(p(3,2,"DISPUTES.AUTO_RESOLVE_AT")),n(3),u(C(6,4,e.dispute.autoResolveAt,"dd/MM/yyyy HH:mm"))}}function Ce(t,i){if(t&1&&(o(0,"div",22)(1,"span"),c(2,"i",28),s(3),r(4,"translate"),a(),c(5,"p-tag",24),a()),t&2){let e=m(3);n(3),u(p(4,3,"DISPUTES.OUTCOME_TITLE")),n(2),g("severity",e.outcomeSeverity)("value",e.outcomeLabel)}}function Ee(t,i){if(t&1&&(o(0,"div",26),s(1),r(2,"translate"),a()),t&2){let e=m(3);n(),k(" ",p(2,2,"DISPUTES.REFUND_AMOUNT")," : ",e.formatPrice(e.dispute.refundAmountCents)," ")}}function he(t,i){t&1&&(o(0,"div",27),c(1,"i",29),s(2),r(3,"translate"),a()),t&2&&(n(2),v("",p(3,1,"DISPUTES.REFUND_PROCESSED")," "))}function xe(t,i){if(t&1&&(o(0,"p-panel",11),_(1,Ce,6,5,"ng-template",12)(2,Ee,3,4,"div",26)(3,he,4,3,"div",27),a()),t&2){let e=m(2);g("toggleable",!1),n(2),d(e.dispute.refundAmountCents?2:-1),n(),d(e.dispute.stripeRefundId?3:-1)}}function De(t,i){t&1&&(o(0,"span"),c(1,"i",30),s(2),r(3,"translate"),a()),t&2&&(n(2),u(p(3,1,"DISPUTES.MESSAGES")))}function Te(t,i){if(t&1&&(o(0,"div",31)(1,"div",32),c(2,"i"),a(),o(3,"div",33)(4,"div",34),s(5),a(),o(6,"div",27),s(7),r(8,"date"),a()()()),t&2){let e=i.$implicit;I("timeline__item--success",e.severity==="success")("timeline__item--danger",e.severity==="danger")("timeline__item--info",e.severity==="info")("timeline__item--warn",e.severity==="warn"),n(2),w("pi ",e.icon,""),n(3),v(" ",e.label," "),n(2),v(" ",C(8,13,e.date,"dd/MM/yyyy HH:mm")," ")}}function ye(t,i){t&1&&(o(0,"p-panel",19),r(1,"translate"),o(2,"p",35),s(3),r(4,"translate"),a()()),t&2&&(g("toggleable",!1)("header",p(1,3,"DISPUTES.HELP_TITLE")),n(3),v(" ",p(4,5,"DISPUTES.HELP_BUYER")," "))}function Ie(t,i){if(t&1){let e=D();o(0,"div",8)(1,"div",10)(2,"p-panel",11),_(3,fe,6,4,"ng-template",12),o(4,"div",13)(5,"div",14)(6,"small",15),s(7),r(8,"translate"),a(),o(9,"span",16),s(10),a()(),o(11,"div",14)(12,"small",15),s(13),r(14,"translate"),a(),o(15,"span"),s(16),r(17,"date"),a()(),_(18,ve,6,4,"div",14)(19,Se,7,7,"div",14),a()(),_(20,xe,4,3,"p-panel",11),o(21,"p-panel",11),_(22,De,4,3,"ng-template",12),o(23,"app-widget-chat",17,0),T("messageSent",function(f){h(e);let re=m();return x(re.onChatMessageSent(f))}),a()()(),o(25,"div",18)(26,"p-panel",19),r(27,"translate"),o(28,"div",20),M(29,Te,9,16,"div",21,de),a()(),_(31,ye,5,7,"p-panel",19),a()()}if(t&2){let e=m();n(2),g("toggleable",!1),n(5),u(p(8,15,"DISPUTES.COL_REASON")),n(3),u(e.getReasonLabel(e.dis
1pute.disputeReason||"")),n(3),u(p(14,17,"DISPUTES.COL_DATE")),n(3),u(C(17,19,e.dispute.createdAt,"dd/MM/yyyy HH:mm")),n(2),d(e.dispute.disputeAmountCents?18:-1),n(),d(e.dispute.autoResolveAt?19:-1),n(),d(e.dispute.disputeOutcome?20:-1),n(),g("toggleable",!1),n(2),g("ticket",e.dispute)("loading",!1)("compact",!0),n(3),g("toggleable",!1)("header",p(27,22,"DISPUTES.TIMELINE_TITLE")),n(3),b(e.timelineEvents),n(2),d(e.isClosed?-1:31)}}var se=class t{route=S(A);router=S(B);disputeService=S(oe);ticketService=S(ae);toastService=S(j);t=S(W);loading=!0;error=null;dispute=null;disputeId="";chatWidget;socketSubscription=null;timelineEvents=[];get isClosed(){return this.dispute?.disputeStatus==="closed"||this.dispute?.disputeStatus==="admin_resolved"}get outcomeLabel(){return this.dispute?.disputeOutcome?this.t.instant(`DISPUTES.OUTCOME_${this.dispute.disputeOutcome.toUpperCase()}`):""}get outcomeSeverity(){return{buyer_full_refund:"success",buyer_partial_refund:"info",seller_wins:"danger",mutual_agreement:"warn"}[this.dispute?.disputeOutcome||""]||"info"}ngOnInit(){if(this.disputeId=this.route.snapshot.paramMap.get("id")||"",!this.disputeId){this.router.navigate(["/studio/disputes"]);return}this.loadDispute(),this.connectSocket()}ngOnDestroy(){this.socketSubscription?.close()}loadDispute(){return E(this,null,function*(){this.loading=!0,this.error=null;try{let i=yield this.disputeService.getBuyerDispute(this.disputeId);this.dispute=i.dispute,this.buildTimeline()}catch{this.error="load"}finally{this.loading=!1}})}connectSocket(){this.socketSubscription=this.ticketService.connectStream(i=>{if(i.ticketId===this.disputeId&&(i.type==="new_message"&&i.message&&this.dispute?.messages&&(this.dispute.messages=[...this.dispute.messages,i.message]),i.type==="status_changed"&&this.loadDispute(),i.type==="link_preview_update"&&i.messageId&&i.linkPreviews&&this.dispute?.messages)){let e=this.dispute.messages.find(l=>l.id===i.messageId);e&&(e.linkPreviews=i.linkPreviews)}})}onChatMessageSent(i){return E(this,null,function*(){if(this.dispute)try{let e=this.chatWidget?.selectedFiles||[],l;e.length>0&&(l=yield this.ticketService.uploadImages(this.dispute.id,e));let f=yield this.disputeService.addBuyerMessage(this.dispute.id,i.message);this.dispute.messages&&(this.dispute.messages=[...this.dispute.messages,f.message]),this.chatWidget?.resetForm()}catch{this.chatWidget?.markSendingDone(),this.toastService.error(this.t.instant("COMMON.ERROR"))}})}buildTimeline(){if(!this.dispute)return;let i=[];if(i.push({label:this.t.instant("DISPUTES.TIMELINE_OPENED"),date:this.dispute.createdAt,icon:"pi-exclamation-triangle",severity:"warn"}),this.dispute.sellerRespondedAt&&i.push({label:this.t.instant("DISPUTES.TIMELINE_SELLER_RESPONDED"),date:this.dispute.sellerRespondedAt,icon:"pi-reply",severity:"info"}),this.dispute.disputeOutcome){let e=this.dispute.resolvedAt||this.dispute.updatedAt;i.push({label:this.t.instant("DISPUTES.TIMELINE_RESOLVED"),date:e,icon:"pi-check-circle",severity:this.dispute.disputeOutcome==="seller_wins"?"danger":"success"})}this.dispute.refundAmountCents&&this.dispute.stripeRefundId&&i.push({label:this.t.instant("DISPUTES.TIMELINE_REFUNDED"),date:this.dispute.updatedAt,icon:"pi-wallet",severity:"success"}),this.timelineEvents=i}getStatusSeverity(i){return{open:"warn",seller_response_pending:"warn",seller_responded:"info",ai_reviewing:"info",ai_resolved:"success",escalated:"danger",admin_resolved:"success",refund_processing:"info",closed:"secondary"}[i]||"info"}getStatusLabel(i){return this.t.instant(`DISPUTES.STATUS_${i.toUpperCase()}`)}getReasonLabel(i){return this.t.instant(`DISPUTES.REASON_${i.toUpperCase()}`)}formatPrice(i,e="EUR"){return(i/100).toFixed(2)+" "+e.toUpperCase()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=y({type:t,selectors:[["app-view-manager-dispute-detail"]],viewQuery:function(e,l){if(e&1&&P(le,5),e&2){let f;O(f=U())&&(l.chatWidget=f.first)}},decls:14,vars:11,consts:[["chatWidget",""],[1,"d-flex","justify-content-between","align-items-center","mb-2","flex-wrap","gap-2"],[1,"text-light","fs-6","d-flex","align-items-center","gap-2"],["routerLink","/studio/disputes",1,"text-muted","text-decoration-none"],[1,"pi","pi-arrow-left","me-2"],[1,"pi","pi-angle-right","mx-1","text-muted"],[1,"text-muted","ms-1"],["icon","pi pi-shopping-cart","severity","secondary","size","small",3,"label","outlined","routerLink"],[1,"row","g-4"],[3,"retry"],[1,"col-12","col-lg-8"],[3,"toggleable"],["pTemplate","header"],[1,"row","g-3"],[1,"col-6"],[1,"text-muted","d-block"],[1,"fw-semibold"],[3,"messageSent","ticket","loading","compact"],[1,"col-12","col-lg-4"],[3,"toggleable","header"],[1,"timeline"],[1,"timeline__item",3,"timeline__item--success","timeline__item--danger","timeline__item--info","timeline__item--warn"],[1,"d-flex","align-items-center","justify-content-between","w-100"],[1,"pi","pi-shield","me-2"],[3,"severity","value"],[1,"text-danger","small"],[1,"fw-semibold","fs-5","mb-2"],[1,"text-muted","small"],[1,"pi","pi-check-circle","me-2"],[1,"pi","pi-check","me-1","text-success"],[1,"pi","pi-comments","me-2"],[1,"timeline__item"],[1,"timeline__dot"],[1,"timeline__content"],[1,"fw-semibold","small"],[1,"text-muted","small","mb-0"]],template:function(e,l){e&1&&(o(0,"div",1)(1,"span",2)(2,"a",3),c(3,"i",4),s(4),r(5,"translate"),a(),c(6,"i",5),s(7),r(8,"translate"),_(9,me,2,1,"span",6),a(),_(10,ce,2,7,"p-button",7),a(),_(11,ue,1,0,"app-widget-loading")(12,_e,1,0,"app-widget-api-error")(13,Ie,32,24,"div",8)),e&2&&(n(4),v("",p(5,7,"DISPUTES.TITLE")," "),n(3),v(" ",p(8,9,"DISPUTES.DETAIL_TITLE")," "),n(2),d(l.dispute?9:-1),n(),d(l.dispute!=null&&l.dispute.orderId?10:-1),n(),d(l.loading?11:-1),n(),d(!l.loading&&l.error?12:-1),n(),d(!l.loading&&!l.error&&l.dispute?13:-1))},dependencies:[V,L,F,N,Q,$,H,q,G,Y,Z,X,K,J,ie,te,z,ee,ne],styles:['[_nghost-%COMP%] p-panel+p-panel{display:block;margin-top:1rem}.timeline[_ngcontent-%COMP%]{position:relative;padding-left:1.5rem}.timeline__item[_ngcontent-%COMP%]{position:relative;padding-bottom:1rem;padding-left:.75rem}.timeline__item[_ngcontent-%COMP%]:last-child{padding-bottom:0}.timeline__item[_ngcontent-%COMP%]:before{content:"";position:absolute;
1left:-1.0625rem;top:.875rem;bottom:0;width:2px;background:var(--p-surface-border)}.timeline__item[_ngcontent-%COMP%]:last-child:before{display:none}.timeline__item--success[_ngcontent-%COMP%] .timeline__dot[_ngcontent-%COMP%]{background:var(--p-green-500);color:#fff}.timeline__item--danger[_ngcontent-%COMP%] .timeline__dot[_ngcontent-%COMP%]{background:var(--p-red-500);color:#fff}.timeline__item--info[_ngcontent-%COMP%] .timeline__dot[_ngcontent-%COMP%]{background:var(--p-blue-500);color:#fff}.timeline__item--warn[_ngcontent-%COMP%] .timeline__dot[_ngcontent-%COMP%]{background:var(--p-yellow-500);color:#fff}.timeline__dot[_ngcontent-%COMP%]{position:absolute;left:-1.5rem;top:0;width:.875rem;height:.875rem;border-radius:50%;background:var(--p-surface-300);display:flex;align-items:center;justify-content:center}.timeline__dot[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.5rem}.timeline__content[_ngcontent-%COMP%]{min-width:0}']})};export{se as ViewManagerDisputeDetailComponent};
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.