@vendure/admin-ui-plugin 2.0.0-next.12 → 2.0.0-next.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/lib/admin-ui/{239.68785500c3346bfc.js → 239.ca7af610928bd44b.js} +2 -2
  2. package/lib/admin-ui/{239.68785500c3346bfc.js.map → 239.ca7af610928bd44b.js.map} +1 -1
  3. package/lib/admin-ui/{26.f714c21768111b4f.js → 26.762a61e2d3e37e33.js} +2 -2
  4. package/lib/admin-ui/{26.f714c21768111b4f.js.map → 26.762a61e2d3e37e33.js.map} +1 -1
  5. package/lib/admin-ui/{316.f5c3548835a302f3.js → 316.fbaa08dea0a8bad5.js} +2 -2
  6. package/lib/admin-ui/{316.f5c3548835a302f3.js.map → 316.fbaa08dea0a8bad5.js.map} +1 -1
  7. package/lib/admin-ui/{356.d5ab46db919a9f0b.js → 356.0ff226e8c9164ae6.js} +2 -2
  8. package/lib/admin-ui/{356.d5ab46db919a9f0b.js.map → 356.0ff226e8c9164ae6.js.map} +1 -1
  9. package/lib/admin-ui/3rdpartylicenses.txt +23 -0
  10. package/lib/admin-ui/{504.1e0ba4990f5d7f56.js → 504.40693d5cedca9d79.js} +2 -2
  11. package/lib/admin-ui/{504.1e0ba4990f5d7f56.js.map → 504.40693d5cedca9d79.js.map} +1 -1
  12. package/lib/admin-ui/{600.33754aa49984ab73.js → 600.fa2fa923a1a62838.js} +2 -2
  13. package/lib/admin-ui/{600.33754aa49984ab73.js.map → 600.fa2fa923a1a62838.js.map} +1 -1
  14. package/lib/admin-ui/{625.00b1380b31501047.js → 625.ed9ce3bf64237de8.js} +2 -2
  15. package/lib/admin-ui/{625.00b1380b31501047.js.map → 625.ed9ce3bf64237de8.js.map} +1 -1
  16. package/lib/admin-ui/{849.a5b2f52c180a376b.js → 849.21d37348d17a9559.js} +2 -2
  17. package/lib/admin-ui/{849.a5b2f52c180a376b.js.map → 849.21d37348d17a9559.js.map} +1 -1
  18. package/lib/admin-ui/index.html +1 -1
  19. package/lib/admin-ui/main.5b576260330cb630.js +2777 -0
  20. package/lib/admin-ui/main.5b576260330cb630.js.map +1 -0
  21. package/lib/admin-ui/runtime.6ba91bceea486bae.js +2 -0
  22. package/lib/admin-ui/{runtime.c3853db7e86bc9e7.js.map → runtime.6ba91bceea486bae.js.map} +1 -1
  23. package/package.json +4 -4
  24. package/lib/admin-ui/main.ecd7bd3b4c1715b7.js +0 -2777
  25. package/lib/admin-ui/main.ecd7bd3b4c1715b7.js.map +0 -1
  26. package/lib/admin-ui/runtime.c3853db7e86bc9e7.js +0 -2
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[849],{3849:(ui,Ee,s)=>{s.r(Ee),s.d(Ee,{AddManualPaymentDialogComponent:()=>V,CancelOrderDialogComponent:()=>B,FulfillOrderDialogComponent:()=>W,FulfillmentCardComponent:()=>z,FulfillmentDetailComponent:()=>Q,FulfillmentStateLabelComponent:()=>X,LineFulfillmentComponent:()=>Y,LineRefundsComponent:()=>I,ModificationDetailComponent:()=>ee,NODE_HEIGHT:()=>qe,OrderCustomFieldsCardComponent:()=>te,OrderDetailComponent:()=>pe,OrderEditResultType:()=>b,OrderEditorComponent:()=>_e,OrderEditsPreviewDialogComponent:()=>me,OrderHistoryComponent:()=>ce,OrderListComponent:()=>ge,OrderModule:()=>fe,OrderPaymentCardComponent:()=>ue,OrderProcessEdgeComponent:()=>ne,OrderProcessGraphComponent:()=>re,OrderProcessGraphDialogComponent:()=>oe,OrderProcessNodeComponent:()=>R,OrderResolver:()=>M,OrderStateSelectDialogComponent:()=>ae,OrderTableComponent:()=>H,OrderTransitionService:()=>w,PaymentDetailComponent:()=>$,PaymentStateLabelComponent:()=>de,RefundOrderDialogComponent:()=>ie,RefundStateLabelComponent:()=>se,SettleRefundDialogComponent:()=>le,SimpleItemListComponent:()=>L,modifyingOrderBreadcrumb:()=>lt,orderBreadcrumb:()=>Me,orderRoutes:()=>it});var a=s(587),e=s(3184),u=s(3682),T=s(309),Ye=s(4652),A=s(8660),C=s(7890),J=s(8318),f=s(7514),p=s(6362),v=s(4187);function at(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.add-payment-to-order"))}function ct(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"localeCurrency"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.form.invalid||t.form.pristine),e.xp6(1),e.AsE(" ",e.lcZ(5,6,"order.add-payment")," (",e.xi3(6,8,t.outstandingAmount,t.currencyCode),") ")}}class V{constructor(n){this.dataService=n,this.form=new a.cw({method:new a.NI("",a.kI.required),transactionId:new a.NI("",a.kI.required)})}ngOnInit(){this.paymentMethods$=this.dataService.settings.getPaymentMethods(999).mapSingle(n=>n.paymentMethods.items)}submit(){const n=this.form.value;this.resolveWith({method:n.method,transactionId:n.transactionId})}cancel(){this.resolveWith()}}V.\u0275fac=function(n){return new(n||V)(e.Y36(u.DoR))},V.\u0275cmp=e.Xpm({type:V,selectors:[["vdr-add-manual-payment-dialog"]],decls:10,vars:11,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","method",3,"label"],["bindLabel","code","autofocus","","bindValue","code","formControlName","method",3,"items","addTag"],["for","transactionId",3,"label"],["id","transactionId","type","text","formControlName","transactionId"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,at,2,3,"ng-template",0),e.TgZ(1,"form",1)(2,"vdr-form-field",2),e.ALo(3,"translate"),e._UZ(4,"ng-select",3),e.ALo(5,"async"),e.qZA(),e.TgZ(6,"vdr-form-field",4),e.ALo(7,"translate"),e._UZ(8,"input",5),e.qZA()(),e.YNc(9,ct,7,11,"ng-template",6)),2&n&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,5,"order.payment-method")),e.xp6(2),e.Q6J("items",e.lcZ(5,7,t.paymentMethods$))("addTag",!0),e.xp6(2),e.Q6J("label",e.lcZ(7,9,"order.transaction-id")))},directives:[T.q,a._Y,a.JL,a.sg,Ye.h,A.w9,a.JJ,a.u,C.y,a.Fj,J.n],pipes:[f.X$,p.Ov,v.k],styles:[".ng-select[_ngcontent-%COMP%]{min-width:100%}"],changeDetection:0});var _=s(8270),m=s(2748),he=s(1353);function dt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.cancel-order"))}function st(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",19),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id]=i})("input",function(){return e.CHM(t),e.oxw(2).checkIfAllSelected()}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("ngModel",o.lineQuantities[t.id])("disabled",o.cancelAll)("max",t.quantity)}}function ut(r,n){if(1&r&&e._uU(0),2&r){const t=e.oxw().$implicit;e.Oqu(t.quantity)}}function pt(r,n){if(1&r&&(e.TgZ(0,"tr",10)(1,"td",11),e._UZ(2,"img",12),e.ALo(3,"assetPreview"),e.qZA(),e.TgZ(4,"td",13),e._uU(5),e.qZA(),e.TgZ(6,"td",14),e._uU(7),e.qZA(),e.TgZ(8,"td",15),e._uU(9),e.qZA(),e.TgZ(10,"td",15),e._uU(11),e.ALo(12,"localeCurrency"),e.qZA(),e.TgZ(13,"td",16),e.YNc(14,st,1,3,"input",17),e.YNc(15,ut,1,1,"ng-template",null,18,e.W1O),e.qZA()()),2&r){const t=n.$implicit,o=e.MAs(16),i=e.oxw();e.ekj("is-disabled",i.cancelAll)("is-cancelled",0===t.quantity),e.xp6(2),e.Q6J("src",e.xi3(3,11,t.featuredAsset,"tiny"),e.LSH),e.xp6(3),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.Oqu(t.quantity),e.xp6(2),e.hij(" ",e.xi3(12,14,t.unitPriceWithTax,i.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",t.quantity>0&&!i.order.active)("ngIfElse",o)}}function mt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"clr-radio-wrapper")(2,"input",20),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().cancelAll=i})("ngModelChange",function(){return e.CHM(t),e.oxw().radioChanged()}),e.qZA(),e.TgZ(3,"label"),e._uU(4),e.ALo(5,"translate"),e.qZA()(),e.TgZ(6,"clr-radio-wrapper")(7,"input",20),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().cancelAll=i})("ngModelChange",function(){return e.CHM(t),e.oxw().radioChanged()}),e.qZA(),e.TgZ(8,"label"),e._uU(9),e.ALo(10,"translate"),e.qZA()(),e.BQk()}if(2&r){const t=e.oxw();e.xp6(2),e.Q6J("value",!0)("ngModel",t.cancelAll),e.xp6(2),e.Oqu(e.lcZ(5,6,"order.cancel-entire-order")),e.xp6(3),e.Q6J("value",!1)("ngModel",t.cancelAll),e.xp6(2),e.Oqu(e.lcZ(10,8,"order.cancel-specified-items"))}}function _t(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-selected-items")," "))}function gt(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-order")," "))}function ft(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",21),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",22),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e.YNc(4,_t,3,3,"ng-container",6),e.YNc(5,gt,3,3,"ng-container",6),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.reason||!t.order.active&&0===t.selectionCount),e.xp6(1),e.Q6J("ngIf",!t.order.active),e.xp6(1),e.Q6J("ngIf",t.order.active)}}class B{constructor(n){var t;this.i18nService=n,this.cancelAll=!0,this.lineQuantities={},this.reasons=null!==(t=(0,u.hq7)().cancellationReasons)&&void 0!==t?t:[(0,_.J)("order.cancel-reason-customer-request"),(0,_.J)("order.cancel-reason-not-available")],this.reasons=this.reasons.map(o=>this.i18nService.translate(o))}get selectionCount(){return Object.values(this.lineQuantities).reduce((n,t)=>n+t,0)}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>Object.assign(Object.assign({},n),{[t.id]:t.quantity}),{})}radioChanged(){if(this.cancelAll)for(const n of this.order.lines)this.lineQuantities[n.id]=n.quantity;else for(const n of this.order.lines)this.lineQuantities[n.id]=0}checkIfAllSelected(){var n;for(const[t,o]of Object.entries(this.lineQuantities)){const i=null===(n=this.order.lines.find(l=>l.id===t))||void 0===n?void 0:n.quantity;if(i&&o<i)return}this.cancelAll=!0}select(){this.resolveWith({orderId:this.order.id,lines:this.getLineInputs(),reason:this.reason,cancelShipping:this.cancelAll})}cancel(){this.resolveWith()}getLineInputs(){if(!this.order.active)return Object.entries(this.lineQuantities).map(([n,t])=>({orderLineId:n,quantity:t})).filter(n=>0<n.quantity)}}B.\u0275fac=function(n){return new(n||B)(e.Y36(u.Dp7))},B.\u0275cmp=e.Xpm({type:B,selectors:[["vdr-cancel-order-dialog"]],decls:30,vars:23,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-lines"],[1,"table"],["class","order-line",3,"is-disabled","is-cancelled",4,"ngFor","ngForOf"],[1,"cancellation-details"],[4,"ngIf"],[1,"clr-control-label"],["bindLabel","name","autofocus","","bindValue","id",3,"items","addTag","ngModel","ngModelChange"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"ngModel","disabled","max","ngModelChange","input",4,"ngIf","ngIfElse"],["nonEditable",""],["type","number","min","0",3,"ngModel","disabled","max","ngModelChange","input"],["type","radio","clrRadio","","name","options",3,"value","ngModel","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,dt,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.YNc(22,pt,17,17,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e.YNc(24,mt,11,10,"ng-container",6),e.TgZ(25,"label",7),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"ng-select",8),e.NdJ("ngModelChange",function(i){return t.reason=i}),e.qZA()()(),e.YNc(29,ft,6,6,"ng-template",9)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,11,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,13,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,15,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,17,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(21,19,"order.cancel")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(2),e.Q6J("ngIf",!0!==t.order.active),e.xp6(2),e.Oqu(e.lcZ(27,21,"order.cancellation-reason")),e.xp6(2),e.Q6J("items",t.reasons)("addTag",!0)("ngModel",t.reason))},directives:[T.q,p.sg,p.O5,C.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,m.EeQ,a._,m.asN,m.MgK,A.w9,J.n],pipes:[f.X$,he.M,v.k],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .cancellation-details[_ngcontent-%COMP%]{margin-top:0;margin-left:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}"],changeDetection:0});var je=s(9667),ht=s(8931);function xt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.fulfill-order"))}function vt(r,n){if(1&r&&(e._UZ(0,"img",17),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}function Ct(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",18),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().fulfillmentQuantities[l.id].fulfillCount=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.getUnfulfilledCount(t))("ngModel",o.fulfillmentQuantities[t.id].fulfillCount)("max",o.fulfillmentQuantities[t.id].max)}}function yt(r,n){if(1&r&&(e.TgZ(0,"tr",9)(1,"td",10),e.YNc(2,vt,2,4,"img",11),e.qZA(),e.TgZ(3,"td",12),e._uU(4),e.qZA(),e.TgZ(5,"td",13),e._uU(6),e.qZA(),e.TgZ(7,"td",14),e._uU(8),e.qZA(),e.TgZ(9,"td",14),e._uU(10),e.qZA(),e.TgZ(11,"td",15),e.YNc(12,Ct,1,3,"input",16),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw();e.ekj("ignore",0===o.getUnfulfilledCount(t)),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.Oqu(o.getUnfulfilledCount(t)),e.xp6(2),e.Oqu(t.productVariant.stockOnHand),e.xp6(2),e.Q6J("ngIf",o.fulfillmentQuantities[t.id])}}function Zt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.canSubmit()),e.xp6(1),e.hij(" ",e.lcZ(5,5,"order.create-fulfillment")," ")}}class W{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new a.NI,this.fulfillmentQuantities={}}ngOnInit(){this.dataService.settings.getGlobalSettings().single$.subscribe(({globalSettings:n})=>{this.fulfillmentQuantities=this.order.lines.reduce((t,o)=>{const i=this.getFulfillableCount(o,n.trackInventory);return Object.assign(Object.assign({},t),{[o.id]:{fulfillCount:i,max:i}})},{}),this.changeDetector.markForCheck()}),this.dataService.shippingMethod.getShippingMethodOperations().mapSingle(n=>n.fulfillmentHandlers).subscribe(n=>{this.fulfillmentHandlerDef=n.find(t=>{var o,i;return t.code===(null===(i=null===(o=this.order.shippingLines[0])||void 0===o?void 0:o.shippingMethod)||void 0===i?void 0:i.fulfillmentHandlerCode)})||n[0],this.fulfillmentHandler=(0,u.miO)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:o,stockOnHand:i}=n.productVariant,l=o===u.TvZ.INHERIT?t:o===u.TvZ.TRUE,c=this.getUnfulfilledCount(n);return l?Math.min(c,i):c}getUnfulfilledCount(n){var t,o;const i=null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.map(l=>l.summary).flat().filter(l=>l.orderLine.id===n.id).reduce((l,c)=>l+c.quantity,0))&&void 0!==o?o:0;return n.quantity-i}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((o,{fulfillCount:i})=>o+i,0);return(0,u.dOS)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:o}])=>({orderLineId:t,quantity:o}));this.resolveWith({lines:n,handler:(0,u.RnJ)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}}W.\u0275fac=function(n){return new(n||W)(e.Y36(u.DoR),e.Y36(e.sBO))},W.\u0275cmp=e.Xpm({type:W,selectors:[["vdr-fulfill-order-dialog"]],decls:34,vars:29,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",3,"ignore",4,"ngFor","ngForOf"],[1,"shipping-details"],[3,"address"],[3,"operationDefinition","operation","formControl","removable"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange",4,"ngIf"],[3,"src"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,xt,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.YNc(22,yt,13,8,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e._UZ(24,"vdr-formatted-address",6),e.TgZ(25,"h6"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e._uU(28),e.TgZ(29,"strong"),e._uU(30),e.ALo(31,"localeCurrency"),e.qZA(),e._UZ(32,"vdr-configurable-input",7),e.qZA()(),e.YNc(33,Zt,6,7,"ng-template",8)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,14,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,16,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,18,"order.unfulfilled")),e.xp6(3),e.Oqu(e.lcZ(18,20,"catalog.stock-on-hand")),e.xp6(3),e.Oqu(e.lcZ(21,22,"order.fulfill")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(2),e.Q6J("address",t.order.shippingAddress),e.xp6(2),e.Oqu(e.lcZ(27,24,"order.shipping-method")),e.xp6(2),e.hij(" ",null==t.order.shippingLines[0]||null==t.order.shippingLines[0].shippingMethod?null:t.order.shippingLines[0].shippingMethod.name," "),e.xp6(2),e.Oqu(e.xi3(31,26,t.order.shipping,t.order.currencyCode)),e.xp6(2),e.Q6J("operationDefinition",t.fulfillmentHandlerDef)("operation",t.fulfillmentHandler)("formControl",t.fulfillmentHandlerControl)("removable",!1))},directives:[T.q,p.sg,p.O5,C.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,je.b,ht.q,a.oH,J.n],pipes:[f.X$,he.M,v.k],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:0;margin-left:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%] clr-input-container[_ngcontent-%COMP%]{margin-top:24px}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}"],changeDetection:0});var G=s(4447),Z=s(858);function Ot(r,n){1&r&&e._UZ(0,"clr-icon",2)}class X{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}}X.\u0275fac=function(n){return new(n||X)},X.\u0275cmp=e.Xpm({type:X,selectors:[["vdr-fulfillment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Ot,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Delivered"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[G.Y,p.O5,m.qvL],pipes:[f.X$,Z.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});var U=s(234),K=s(7368);function bt(r,n){if(1&r&&(e.TgZ(0,"li",2)(1,"div",3),e._uU(2),e.qZA(),e._UZ(3,"clr-icon",4),e._uU(4),e.qZA()),2&r){const t=n.$implicit;e.Q6J("title",t.name),e.xp6(2),e.Oqu(t.quantity),e.xp6(2),e.hij(" ",t.name," ")}}class L{}L.\u0275fac=function(n){return new(n||L)},L.\u0275cmp=e.Xpm({type:L,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],[1,"quantity"],["shape","times","size","12"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"ul"),e.YNc(2,bt,5,3,"li",1),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("ngForOf",t.items))},directives:[p.sg,m.qvL],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-left:2px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list[_ngcontent-%COMP%] .quantity[_ngcontent-%COMP%]{min-width:16px;display:inline-block}"],changeDetection:0});var Te=s(2231),xe=s(2651);function Tt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.tracking-code")),e.xp6(2),e.hij(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function At(r,n){if(1&r&&e._UZ(0,"vdr-custom-field-control",5),2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",o.customFieldFormGroup)}}function Lt(r,n){if(1&r&&(e.ynx(0),e.YNc(1,At,1,4,"vdr-custom-field-control",4),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.customFieldFormGroup.get(t.name))}}class Q{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new a.cw({})}ngOnInit(){this.customFieldConfig=this.serverConfigService.getCustomFieldsFor("Fulfillment")}ngOnChanges(n){this.buildCustomFieldsFormGroup()}get fulfillment(){return this.order.fulfillments&&this.order.fulfillments.find(n=>n.id===this.fulfillmentId)}get items(){var n,t;return null!==(t=null===(n=this.fulfillment)||void 0===n?void 0:n.summary.map(o=>{var i,l;return{name:null!==(l=null===(i=this.order.lines.find(c=>c.id===o.orderLine.id))||void 0===i?void 0:i.productVariant.name)&&void 0!==l?l:"",quantity:o.quantity}}))&&void 0!==t?t:[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new a.NI(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,U.isObject)(n)}}Q.\u0275fac=function(n){return new(n||Q)(e.Y36(u.iHG))},Q.\u0275cmp=e.Xpm({type:Q,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.TTD],decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"items"],[4,"ngFor","ngForOf"],[3,"readonly","compact","customField","customFieldsFormGroup",4,"ngIf"],[3,"readonly","compact","customField","customFieldsFormGroup"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeDate"),e.qZA(),e.TgZ(4,"vdr-labeled-data",0),e.ALo(5,"translate"),e._uU(6),e.qZA(),e.YNc(7,Tt,3,4,"vdr-labeled-data",1),e.TgZ(8,"vdr-labeled-data",0),e.ALo(9,"translate"),e._UZ(10,"vdr-simple-item-list",2),e.qZA(),e.YNc(11,Lt,2,1,"ng-container",3)),2&n&&(e.Q6J("label",e.lcZ(1,8,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(3,10,null==t.fulfillment?null:t.fulfillment.createdAt,"medium"),"\n"),e.xp6(2),e.Q6J("label",e.lcZ(5,13,"order.fulfillment-method")),e.xp6(2),e.hij(" ",null==t.fulfillment?null:t.fulfillment.method,"\n"),e.xp6(1),e.Q6J("ngIf",null==t.fulfillment?null:t.fulfillment.trackingCode),e.xp6(1),e.Q6J("label",e.lcZ(9,15,"order.contents")),e.xp6(2),e.Q6J("items",t.items),e.xp6(1),e.Q6J("ngForOf",t.customFieldConfig))},directives:[K.W,p.O5,L,p.sg,Te.M],pipes:[f.X$,xe.H],styles:[""],changeDetection:0});var D=s(735),k=s(1519),E=s(8854),ve=s(5111);function It(r,n){if(1&r&&e._UZ(0,"vdr-fulfillment-detail",7),2&r){const t=e.oxw();e.Q6J("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}const Re=function(r){return{state:r}};function qt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw(2).transitionState.emit(l)}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA(),e.BQk()}if(2&r){const t=n.ngIf;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.set-fulfillment-state",e.VKq(8,Re,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function Ft(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"clr-icon",18),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Re,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function wt(r,n){1&r&&(e._UZ(0,"clr-icon",19),e._uU(1),e.ALo(2,"translate")),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-fulfillment")," "))}function Mt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",15),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).transitionState.emit(l)}),e.YNc(2,Ft,6,10,"ng-container",16),e.YNc(3,wt,3,3,"ng-template",null,17,e.W1O),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.MAs(4);e.xp6(2),e.Q6J("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Pt(r,n){if(1&r&&(e.TgZ(0,"div",8),e.YNc(1,qt,6,10,"ng-container",9),e.TgZ(2,"vdr-dropdown")(3,"button",10),e._UZ(4,"clr-icon",11),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",12),e.YNc(6,Mt,5,2,"ng-container",13),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.nextSuggestedState()),e.xp6(5),e.Q6J("ngForOf",t.nextOtherStates())}}class z{constructor(){this.transitionState=new e.vpe}nextSuggestedState(){var n;if(!this.fulfillment)return;const{nextStates:t}=this.fulfillment,o=i=>t.includes(i)?i:t[0];switch(null===(n=this.fulfillment)||void 0===n?void 0:n.state){case"Pending":return o("Shipped");case"Shipped":return o("Delivered");default:return t.find(i=>"Cancelled"!==i)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}}function St(r,n){1&r&&e._UZ(0,"clr-icon",9)}function Nt(r,n){1&r&&e._UZ(0,"clr-icon",10)}function Jt(r,n){1&r&&e._UZ(0,"clr-icon",11)}function Ut(r,n){1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.line-fulfillment-all")," "))}z.\u0275fac=function(n){return new(n||z)},z.\u0275cmp=e.Xpm({type:z,selectors:[["vdr-fulfillment-card"]],inputs:{fulfillment:"fulfillment",order:"order"},outputs:{transitionState:"transitionState"},decls:10,vars:6,consts:[[1,"card"],[1,"card-header","fulfillment-header"],[1,"fulfillment-state"],[3,"state"],[1,"card-block"],[3,"fulfillmentId","order",4,"ngIf"],["class","card-footer",4,"ngIf"],[3,"fulfillmentId","order"],[1,"card-footer"],[4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],[4,"ngFor","ngForOf"],[1,"btn","btn-sm","btn-primary",3,"click"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"div",2),e._UZ(6,"vdr-fulfillment-state-label",3),e.qZA()(),e.TgZ(7,"div",4),e.YNc(8,It,1,2,"vdr-fulfillment-detail",5),e.qZA(),e.YNc(9,Pt,7,2,"div",6),e.qZA()),2&n&&(e.xp6(3),e.Oqu(e.lcZ(4,4,"order.fulfillment")),e.xp6(3),e.Q6J("state",null==t.fulfillment?null:t.fulfillment.state),e.xp6(2),e.Q6J("ngIf",!!t.fulfillment),e.xp6(1),e.Q6J("ngIf",null==t.fulfillment?null:t.fulfillment.nextStates.length))},directives:[X,p.O5,Q,D.J,k.U,m.qvL,E.N,p.sg,ve.H],pipes:[f.X$,Z.N],styles:[".fulfillment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0});const Qt=function(r,n){return{total:r,count:n}};function Dt(r,n){if(1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.line-fulfillment-partial",e.WLB(4,Qt,t.line.quantity,t.fulfilledCount))," ")}}function kt(r,n){1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.line-fulfillment-none")," "))}function Et(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",15),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.tracking-code")),e.xp6(2),e.hij(" ",t.fulfillment.trackingCode," ")}}const Yt=function(r){return{count:r}};function jt(r,n){if(1&r&&(e.TgZ(0,"div",13)(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"vdr-labeled-data",15),e.ALo(6,"translate"),e._uU(7),e.ALo(8,"localeDate"),e.qZA(),e.TgZ(9,"vdr-labeled-data",15),e.ALo(10,"translate"),e._uU(11),e.qZA(),e.YNc(12,Et,3,4,"vdr-labeled-data",16),e.qZA()),2&r){const t=n.$implicit;e.xp6(2),e.lnq(" ",e.lcZ(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.xi3(4,10,"order.item-count",e.VKq(20,Yt,t.count)),") "),e.xp6(3),e.Q6J("label",e.lcZ(6,13,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(8,15,t.fulfillment.createdAt,"medium")," "),e.xp6(2),e.Q6J("label",e.lcZ(10,18,"order.fulfillment-method")),e.xp6(2),e.hij(" ",t.fulfillment.method," "),e.xp6(1),e.Q6J("ngIf",t.fulfillment.trackingCode)}}function Rt(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown",1)(1,"button",2),e.YNc(2,St,1,0,"clr-icon",3),e.YNc(3,Nt,1,0,"clr-icon",4),e.YNc(4,Jt,1,0,"clr-icon",5),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",6),e.YNc(6,Ut,3,3,"label",7),e.YNc(7,Dt,3,7,"label",7),e.YNc(8,kt,3,3,"label",7),e.YNc(9,jt,13,22,"div",8),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.Q6J("ngIf","full"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","partial"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","none"===t.fulfillmentStatus),e.xp6(2),e.Q6J("ngIf","full"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","partial"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","none"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngForOf",t.fulfillments)}}class Y{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.items.length),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){var t,o;return null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.reduce((i,l)=>{var c,d;return i+(null!==(d=null===(c=l.summary.find(g=>g.orderLine.id===n.id))||void 0===c?void 0:c.quantity)&&void 0!==d?d:0)},0))&&void 0!==o?o:0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){var t,o;return null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.map(i=>{var l;const c=i.summary.find(d=>d.orderLine.id===n.id);return{count:null!==(l=null==c?void 0:c.quantity)&&void 0!==l?l:0,fulfillment:i}}))&&void 0!==o?o:[]}}Y.\u0275fac=function(n){return new(n||Y)},Y.\u0275cmp=e.Xpm({type:Y,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",orderState:"orderState"},features:[e.TTD],decls:1,vars:1,consts:[["class","search-settings-menu",4,"ngIf"],[1,"search-settings-menu"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["class","item-fulfilled","shape","check-circle",4,"ngIf"],["class","item-partially-fulfilled","shape","check-circle",4,"ngIf"],["class","item-not-fulfilled","shape","exclamation-circle",4,"ngIf"],["vdrPosition","bottom-right"],["class","dropdown-header",4,"ngIf"],["class","fulfillment-detail",4,"ngFor","ngForOf"],["shape","check-circle",1,"item-fulfilled"],["shape","check-circle",1,"item-partially-fulfilled"],["shape","exclamation-circle",1,"item-not-fulfilled"],[1,"dropdown-header"],[1,"fulfillment-detail"],[1,"fulfillment-title"],[3,"label"],[3,"label",4,"ngIf"]],template:function(n,t){1&n&&e.YNc(0,Rt,10,7,"vdr-dropdown",0),2&n&&e.Q6J("ngIf",t.fulfilledCount||"PartiallyDelivered"===t.orderState)},directives:[p.O5,D.J,k.U,m.qvL,E.N,m.MgK,p.sg,K.W],pipes:[f.X$,xe.H],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-500)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-500)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-500)}.fulfillment-detail[_ngcontent-%COMP%]{margin:6px 12px}.fulfillment-detail[_ngcontent-%COMP%]:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}"],changeDetection:0});var He=s(1588);const Ht=function(r){return{count:r}};function $t(r,n){if(1&r&&(e.TgZ(0,"span",1),e.ALo(1,"translate"),e._UZ(2,"clr-icon",2),e.qZA()),2&r){const t=e.oxw();e.Q6J("title",e.xi3(1,1,"order.refunded-count",e.VKq(4,Ht,t.getRefundedCount())))}}class I{getRefundedCount(){var n,t;const o=null!==(t=null===(n=this.payments)||void 0===n?void 0:n.reduce((i,l)=>[...i,...l.refunds],[]))&&void 0!==t?t:[];return this.line.items.filter(i=>{if(null===i.refundId&&!i.cancelled)return!1;if(i.refundId){const l=o.find(c=>c.id===i.refundId);return"Failed"!==(null==l?void 0:l.state)}return!1}).length}}function Vt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.note")),e.xp6(2),e.Oqu(t.modification.note)}}function Bt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw();let i;e.Q6J("label",e.lcZ(1,3,"order.surcharges")),e.xp6(2),e.AsE(" ",null==(i=o.getSurcharge(t.id))?null:i.description," ",e.xi3(3,5,null==(i=o.getSurcharge(t.id))?null:i.priceWithTax,o.order.currencyCode),"")}}function Wt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._UZ(2,"vdr-simple-item-list",3),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.added-items")),e.xp6(2),e.Q6J("items",t.getAddedItems())}}function Gt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._UZ(2,"vdr-simple-item-list",3),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.removed-items")),e.xp6(2),e.Q6J("items",t.getRemovedItems())}}I.\u0275fac=function(n){return new(n||I)},I.\u0275cmp=e.Xpm({type:I,selectors:[["vdr-line-refunds"]],inputs:{line:"line",payments:"payments"},decls:1,vars:1,consts:[[3,"title",4,"ngIf"],[3,"title"],["shape","redo","dir","down",1,"is-solid"]],template:function(n,t){1&n&&e.YNc(0,$t,3,6,"span",0),2&n&&e.Q6J("ngIf",t.getRefundedCount())},directives:[p.O5,m.qvL,He.Lv],pipes:[f.X$],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0});class ee{constructor(){this.addedItems=new Map,this.removedItems=new Map}ngOnChanges(){const{added:n,removed:t}=this.getModifiedLines();this.addedItems=n,this.removedItems=t}getSurcharge(n){return this.order.surcharges.find(t=>t.id===n)}getAddedItems(){return[...this.addedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getRemovedItems(){return[...this.removedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getModifiedLines(){var n,t;const o=new Map,i=new Map;for(const l of this.modification.orderItems||[]){const c=this.getOrderLineAndItem(l.id);if(c){const{line:d,item:g}=c;if(g.cancelled){const x=null!==(n=i.get(d))&&void 0!==n?n:0;i.set(d,x+1)}else{const x=null!==(t=o.get(d))&&void 0!==t?t:0;o.set(d,x+1)}}}return{added:o,removed:i}}getOrderLineAndItem(n){for(const t of this.order.lines){const o=t.items.find(i=>i.id===n);if(o)return{line:t,item:o}}}}ee.\u0275fac=function(n){return new(n||ee)},ee.\u0275cmp=e.Xpm({type:ee,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.TTD],decls:7,vars:8,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA(),e.YNc(3,Vt,3,4,"vdr-labeled-data",1),e.YNc(4,Bt,4,8,"vdr-labeled-data",2),e.YNc(5,Wt,3,4,"vdr-labeled-data",1),e.YNc(6,Gt,3,4,"vdr-labeled-data",1)),2&n&&(e.Q6J("label",e.lcZ(1,6,"common.ID")),e.xp6(2),e.Oqu(t.modification.id),e.xp6(1),e.Q6J("ngIf",t.modification.note),e.xp6(1),e.Q6J("ngForOf",t.modification.surcharges),e.xp6(1),e.Q6J("ngIf",t.getAddedItems().length),e.xp6(1),e.Q6J("ngIf",t.getRemovedItems().length))},directives:[K.W,p.O5,p.sg,L],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var Xt=s(837);function Kt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){e.CHM(t);return e.oxw(2).editable=!0}),e._UZ(1,"clr-icon",10),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"common.edit")," "))}function zt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).onUpdateClick()}),e._UZ(1,"clr-icon",12),e._uU(2),e.ALo(3,"translate"),e.qZA()}if(2&r){const t=e.oxw(2);e.Q6J("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.xp6(2),e.hij(" ",e.lcZ(3,2,"common.update")," ")}}function en(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).onCancelClick()}),e._UZ(1,"clr-icon",13),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"common.cancel")," "))}function tn(r,n){if(1&r&&(e.TgZ(0,"div",1)(1,"div",2),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",3)(5,"div",4),e._UZ(6,"vdr-tabbed-custom-fields",5),e.qZA()(),e.TgZ(7,"div",6),e.YNc(8,Kt,4,3,"button",7),e.YNc(9,zt,4,4,"button",8),e.YNc(10,en,4,3,"button",7),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.hij(" ",e.lcZ(3,10,"common.custom-fields")," "),e.xp6(3),e.ekj("editable",t.editable),e.xp6(1),e.Q6J("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.xp6(2),e.Q6J("ngIf",!t.editable),e.xp6(1),e.Q6J("ngIf",t.editable),e.xp6(1),e.Q6J("ngIf",t.editable)}}class te{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e.vpe,this.editable=!1}ngOnInit(){this.customFieldForm=this.formBuilder.group({});for(const n of this.customFieldsConfig)this.customFieldForm.addControl(n.name,this.formBuilder.control(this.customFieldValues[n.name]))}onUpdateClick(){this.updateClick.emit(this.customFieldForm.value),this.customFieldForm.markAsPristine(),this.editable=!1}onCancelClick(){this.customFieldForm.dirty?this.modalService.dialog({title:(0,_.J)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,_.J)("common.keep-editing")},{type:"danger",label:(0,_.J)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}}te.\u0275fac=function(n){return new(n||te)(e.Y36(a.qu),e.Y36(u.Z7U))},te.\u0275cmp=e.Xpm({type:te,selectors:[["vdr-order-custom-fields-card"]],inputs:{customFieldsConfig:"customFieldsConfig",customFieldValues:"customFieldValues"},outputs:{updateClick:"updateClick"},decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text","custom-field-form"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly","compact"],[1,"card-footer"],["class","btn btn-sm btn-secondary",3,"click",4,"ngIf"],["class","btn btn-sm btn-primary",3,"disabled","click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","pencil"],[1,"btn","btn-sm","btn-primary",3,"disabled","click"],["shape","check"],["shape","times"]],template:function(n,t){1&n&&e.YNc(0,tn,11,12,"div",0),2&n&&e.Q6J("ngIf",t.customFieldsConfig.length)},directives:[p.O5,Xt.y,m.qvL],pipes:[f.X$],styles:["vdr-custom-field-control[_ngcontent-%COMP%]{margin-bottom:6px;display:block}.custom-field-form[_ngcontent-%COMP%] .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable[_ngcontent-%COMP%] .clr-control-label{color:inherit}"],changeDetection:0});var Ae=s(253),j=s(591),q=s(745),Ce=s(9295),$e=s(4874),h=s(2673),F=s(635),Le=s(73),Ie=s(6317),Ve=s(1989);const qe=72;function nn(r,n){if(1&r&&(e.TgZ(0,"div",3),e._UZ(1,"div",4)(2,"clr-icon",5),e.TgZ(3,"div",6),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"stateI18nToken"),e.qZA()()),2&r){const t=e.oxw();e.xp6(4),e.hij(" ",e.lcZ(5,1,e.lcZ(6,3,t.cancelledState))," ")}}class R{constructor(n){this.elementRef=n,this.active$=new Ie.X(!1),this.activeTarget$=new Ie.X(!1),this.isCancellable=!1,this.cancelledState="Cancelled"}ngOnChanges(n){this.isCancellable=!!this.node.to.find(t=>"Cancelled"===t.name),n.active&&this.active$.next(this.active)}getPos(n="top"){var t,o;this.elementRef.nativeElement.getBoundingClientRect();const l=null!==(o=null===(t=this.elementRef.nativeElement.querySelector(".node"))||void 0===t?void 0:t.getBoundingClientRect().height)&&void 0!==o?o:0;return{x:10,y:this.index*qe+("bottom"===n?l:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}}R.\u0275fac=function(n){return new(n||R)(e.Y36(e.SBq))},R.\u0275cmp=e.Xpm({type:R,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.TTD],decls:8,vars:15,consts:[[1,"node-wrapper",3,"ngStyle"],[1,"node"],["class","cancelled-wrapper",4,"ngIf"],[1,"cancelled-wrapper"],[1,"cancelled-edge"],["shape","dot-circle"],[1,"cancelled-node"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0),e.ALo(1,"async"),e.TgZ(2,"div",1),e.ALo(3,"async"),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"stateI18nToken"),e.qZA(),e.YNc(7,nn,7,5,"div",2),e.qZA()),2&n&&(e.ekj("active",e.lcZ(1,7,t.active$)),e.Q6J("ngStyle",t.getStyle()),e.xp6(2),e.ekj("active-target",e.lcZ(3,9,t.activeTarget$)),e.xp6(2),e.hij(" ",e.lcZ(5,11,e.lcZ(6,13,t.node.name))," "),e.xp6(3),e.Q6J("ngIf",t.isCancellable))},directives:[p.PC,p.O5,m.qvL],pipes:[p.Ov,f.X$,Z.N],styles:["[_nghost-%COMP%]{display:block}.node-wrapper[_ngcontent-%COMP%]{position:absolute;z-index:1;display:flex;align-items:center}.node[_ngcontent-%COMP%]{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target[_ngcontent-%COMP%]{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge[_ngcontent-%COMP%]{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon[_ngcontent-%COMP%]{margin-left:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-left:6px}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{opacity:1}.active[_ngcontent-%COMP%] .node[_ngcontent-%COMP%]{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{color:var(--color-error-500)}.active[_ngcontent-%COMP%] .cancelled-edge[_ngcontent-%COMP%]{background-color:var(--color-error-500)}"],changeDetection:0});var rn=s(9337);class ne{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,rn.b)(n=>this.to.activeTarget$.next(n)))}getStyle(){const n=this.from.index<this.to.index?"down":"up",t=this.from.getPos("down"===n?"bottom":"top"),o=this.to.getPos("down"===n?"top":"bottom"),i=Math.abs(t.x-o.x),l=Math.abs(t.y-o.y),c=Math.sqrt(Math.pow(i,2)+Math.pow(l,2));return Object.assign({"top.px":t.y,"left.px":t.x+("down"===n?10:40)+12*this.index,"height.px":c,"width.px":1},"up"===n?{transform:"rotateZ(180deg)","transform-origin":"top"}:{})}}function on(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-order-process-node",1),e.NdJ("mouseenter",function(){const l=e.CHM(t).$implicit;return e.oxw().onMouseOver(l.name)})("mouseleave",function(){return e.CHM(t),e.oxw().onMouseOut()}),e.ALo(2,"async"),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=n.index,i=e.oxw();e.xp6(1),e.Q6J("node",t)("index",o)("active",e.lcZ(2,3,i.activeState$)===t.name)}}function ln(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-order-process-edge",2),e.BQk()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("from",t.from)("to",t.to)("index",t.index)}}ne.\u0275fac=function(n){return new(n||ne)},ne.\u0275cmp=e.Xpm({type:ne,selectors:[["vdr-order-process-edge"]],inputs:{from:"from",to:"to",index:"index"},decls:3,vars:7,consts:[[1,"edge",3,"ngStyle"],["shape","arrow","flip","vertical",1,"arrow"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0),e.ALo(1,"async"),e._UZ(2,"clr-icon",1),e.qZA()),2&n&&(e.ekj("active",e.lcZ(1,5,t.active$)),e.Q6J("ngStyle",t.getStyle()),e.uIk("data-from",t.from.node.name)("data-to",t.to.node.name))},directives:[p.PC,m.qvL],pipes:[p.Ov],styles:[".edge[_ngcontent-%COMP%]{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active[_ngcontent-%COMP%]{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{color:var(--color-primary-500)}.edge[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}"],changeDetection:0});class re{constructor(n){this.changeDetector=n,this.setActiveState$=new Ie.X(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*qe}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Ve.b)(150))}ngOnChanges(n){this.populateNodes()}ngAfterViewInit(){setTimeout(()=>this.populateEdges())}onMouseOver(n){this.setActiveState$.next(n)}onMouseOut(){this.setActiveState$.next(this.initialState)}getNodeFor(n){if(this.nodeComponents)return this.nodeComponents.find(t=>t.node.name===n)}populateNodes(){var n,t;const o=new Map;for(const i of this.states)o.set(i.name,{name:i.name,to:[]});for(const[i,l]of o.entries()){const c=null!==(t=null===(n=this.states.find(d=>d.name===i))||void 0===n?void 0:n.to)&&void 0!==t?t:[];for(const d of c){const g=o.get(d);g&&l.to.push(g)}}this.nodes=[...o.values()].filter(i=>"Cancelled"!==i.name)}populateEdges(){for(const n of this.nodes){const t=this.getNodeFor(n.name);let o=0;for(const i of n.to){const l=this.getNodeFor(i.name);t&&l&&t!==l&&(this.edges.push({to:l,from:t,index:o}),o++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}}function an(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.order-state-diagram"))}re.\u0275fac=function(n){return new(n||re)(e.Y36(e.sBO))},re.\u0275cmp=e.Xpm({type:re,selectors:[["vdr-order-process-graph"]],viewQuery:function(n,t){if(1&n&&e.Gf(R,5),2&n){let o;e.iGM(o=e.CRH())&&(t.nodeComponents=o)}},hostVars:2,hostBindings:function(n,t){2&n&&e.Udp("height",t.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.TTD],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"node","index","active","mouseenter","mouseleave"],[3,"from","to","index"]],template:function(n,t){1&n&&(e.YNc(0,on,3,5,"ng-container",0),e.YNc(1,ln,2,3,"ng-container",0)),2&n&&(e.Q6J("ngForOf",t.nodes),e.xp6(1),e.Q6J("ngForOf",t.edges))},directives:[p.sg,R,ne],pipes:[p.Ov],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});class oe{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}}oe.\u0275fac=function(n){return new(n||oe)(e.Y36(u.iHG))},oe.\u0275cmp=e.Xpm({type:oe,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(n,t){1&n&&(e.YNc(0,an,2,3,"ng-template",0),e._UZ(1,"vdr-order-process-graph",1)),2&n&&(e.xp6(1),e.Q6J("states",t.states)("initialState",t.activeState))},directives:[T.q,re],pipes:[f.X$],styles:[""],changeDetection:0});var Be=s(7283);function cn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.refund-and-cancel-order"))}function dn(r,n){if(1&r&&(e.TgZ(0,"div",36),e._uU(1),e.TgZ(2,"div",37),e._uU(3),e.ALo(4,"currency"),e.ALo(5,"number"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw(3).$implicit,i=e.oxw();e.xp6(1),e.hij(" ",t.description," "),e.xp6(2),e.hij(" ",e.xi3(4,2,e.xi3(5,5,t.amount/100/o.quantity,"1.0-2"),i.order.currencyCode)," ")}}function sn(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown")(1,"div",32)(2,"button",33),e._UZ(3,"clr-icon",34),e.qZA()(),e.TgZ(4,"vdr-dropdown-menu"),e.YNc(5,dn,6,8,"div",35),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(5),e.Q6J("ngForOf",t)}}function un(r,n){if(1&r&&(e.ynx(0),e.YNc(1,sn,6,1,"vdr-dropdown",26),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function pn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",38),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].quantity=i})("input",function(){e.CHM(t);const i=e.oxw().$implicit,l=e.oxw();return l.handleZeroQuantity(l.lineQuantities[i.id])}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("ngModel",o.lineQuantities[t.id].quantity)("max",t.quantity)}}function mn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].refund=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.lineQuantities[t.id].quantity)("ngModel",o.lineQuantities[t.id].refund)}}function _n(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].cancel=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.lineQuantities[t.id].quantity)("ngModel",o.lineQuantities[t.id].cancel)}}function gn(r,n){if(1&r&&(e.TgZ(0,"tr",18)(1,"td",19),e._UZ(2,"img",20),e.ALo(3,"assetPreview"),e.qZA(),e.TgZ(4,"td",21),e._uU(5),e.qZA(),e.TgZ(6,"td",22),e._uU(7),e.qZA(),e.TgZ(8,"td",23),e._uU(9),e._UZ(10,"vdr-line-refunds",24),e.qZA(),e.TgZ(11,"td",23),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA(),e.TgZ(14,"td",23)(15,"div",25),e._uU(16),e.ALo(17,"localeCurrency"),e.YNc(18,un,2,1,"ng-container",26),e.qZA()(),e.TgZ(19,"td",27),e.YNc(20,pn,1,2,"input",28),e.qZA(),e.TgZ(21,"td",29)(22,"div",30),e.YNc(23,mn,1,2,"input",31),e.qZA()(),e.TgZ(24,"td",29)(25,"div",30),e.YNc(26,_n,1,2,"input",31),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(2),e.Q6J("src",e.xi3(3,12,t.featuredAsset,"tiny"),e.LSH),e.xp6(3),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",t.quantity," "),e.xp6(1),e.Q6J("line",t)("payments",o.order.payments),e.xp6(2),e.hij(" ",e.xi3(13,15,t.unitPriceWithTax,o.order.currencyCode)," "),e.xp6(4),e.hij(" ",e.xi3(17,18,t.proratedUnitPriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.discounts),e.xp6(2),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.xp6(3),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.xp6(3),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t))}}function fn(r,n){if(1&r&&(e.TgZ(0,"option",40),e._uU(1),e.ALo(2,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw();e.Q6J("ngValue",t)("disabled","Settled"!==t.state),e.xp6(1),e.lnq(" #",t.id," ",t.method,": ",e.xi3(2,5,t.amount,o.order.currencyCode)," ")}}const hn=function(r,n){return{min:r,max:n}};function xn(r,n){if(1&r&&(e.TgZ(0,"div",41),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"currency"),e.ALo(4,"localeCurrency"),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,1,"order.refund-total-error",e.WLB(10,hn,e.xi3(3,4,0,t.order.currencyCode),e.xi3(4,7,t.settledPaymentsTotal,t.order.currencyCode)))," ")}}function vn(r,n){1&r&&(e.TgZ(0,"div",42),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.refund-total-warning")," "))}const Cn=function(r){return{amount:r}};function yn(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"localeCurrency"),e.BQk()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.refund-with-amount",e.VKq(7,Cn,e.xi3(3,4,t.refundTotal,t.order.currencyCode)))," ")}}function Zn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-selected-items")," ")}function On(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",43),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",44),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e.YNc(4,yn,4,9,"ng-container",45),e.YNc(5,Zn,2,3,"ng-template",null,46,e.W1O),e.qZA()}if(2&r){const t=e.MAs(6),o=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!o.canSubmit()),e.xp6(1),e.Q6J("ngIf",o.isRefunding())("ngIfElse",t)}}class ie{constructor(n){var t;this.i18nService=n,this.lineQuantities={},this.refundShipping=!1,this.adjustment=0,this.reasons=null!==(t=(0,u.hq7)().cancellationReasons)&&void 0!==t?t:[(0,_.J)("order.refund-reason-customer-request"),(0,_.J)("order.refund-reason-not-available")],this.reasons=this.reasons.map(o=>this.i18nService.translate(o))}get refundTotal(){return this.order.lines.reduce((t,o)=>{const i=this.lineQuantities[o.id],l=i.refund&&i.quantity||0;return t+o.proratedUnitPriceWithTax*l},0)+(this.refundShipping?this.order.shippingWithTax:0)+this.adjustment}get settledPaymentsTotal(){return this.settledPayments.map(n=>n.amount-(0,U.summate)(n.refunds.filter(i=>"Failed"!==i.state),"total")).reduce((n,t)=>n+t,0)}lineCanBeRefundedOrCancelled(n){var t,o;const i=null!==(o=null===(t=this.order.payments)||void 0===t?void 0:t.reduce((c,d)=>[...c,...d.refunds],[]))&&void 0!==o?o:[];return 0<n.items.filter(c=>{if(c.cancelled)return!1;if(null==c.refundId)return!0;const d=i.find(g=>g.id===c.refundId);return"Failed"===(null==d?void 0:d.state)}).length}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>Object.assign(Object.assign({},n),{[t.id]:{quantity:0,refund:!1,cancel:!1}}),{}),this.settledPayments=(this.order.payments||[]).filter(n=>"Settled"===n.state),this.settledPayments.length&&(this.selectedPayment=this.settledPayments[0])}handleZeroQuantity(n){0===(null==n?void 0:n.quantity)&&(n.cancel=!1,n.refund=!1)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.refund,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.cancel,!1)}canSubmit(){return this.isRefunding()?!!(this.selectedPayment&&this.reason&&0<this.refundTotal&&this.refundTotal<=this.settledPaymentsTotal):!!this.isCancelling()&&!!this.reason}select(){const n=this.selectedPayment;if(n){const t=this.getOrderLineInput(i=>i.refund),o=this.getOrderLineInput(i=>i.cancel);this.resolveWith({refund:{lines:t,reason:this.reason,shipping:this.refundShipping?this.order.shippingWithTax:0,adjustment:this.adjustment,paymentId:n.id},cancel:{lines:o,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShipping}})}}cancel(){this.resolveWith()}getOrderLineInput(n){return Object.entries(this.lineQuantities).filter(([t,o])=>0<o.quantity&&n(o)).map(([t,o])=>({orderLineId:t,quantity:o.quantity}))}}function bn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.settle-refund"))}function Tn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.transactionId),e.xp6(1),e.hij(" ",e.lcZ(5,5,"order.settle-refund")," ")}}ie.\u0275fac=function(n){return new(n||ie)(e.Y36(u.Dp7))},ie.\u0275cmp=e.Xpm({type:ie,selectors:[["vdr-refund-order-dialog"]],decls:69,vars:76,consts:[["vdrDialogTitle",""],[1,"refund-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",4,"ngFor","ngForOf"],[1,"refund-details","mt4"],[1,"clr-control-label"],["bindLabel","name","autofocus","","bindValue","id",3,"disabled","items","placeholder","addTag","ngModel","ngModelChange"],["clrSelect","","name","options",3,"ngModel","disabled","ngModelChange"],[3,"ngValue","disabled",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"ngModel","disabled","ngModelChange"],["clrInput","",3,"disabled","currencyCode","ngModel","ngModelChange"],[1,"totals"],[1,"order-total"],[1,"refund-total"],["class","refund-total-error",4,"ngIf"],["class","refund-total-warning",4,"ngIf"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[3,"line","payments"],[1,"prorated-wrapper"],[4,"ngIf"],[1,"align-middle","quantity-col"],["type","number","min","0",3,"ngModel","max","ngModelChange","input",4,"ngIf"],[1,"align-middle"],[1,"cancel-checkbox-wrapper"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],["type","number","min","0",3,"ngModel","max","ngModelChange","input"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange"],[3,"ngValue","disabled"],[1,"refund-total-error"],[1,"refund-total-warning"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[4,"ngIf","ngIfElse"],["cancelling",""]],template:function(n,t){1&n&&(e.YNc(0,cn,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.TgZ(22,"th"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.TgZ(25,"th"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"th"),e._uU(29),e.ALo(30,"translate"),e.qZA()()(),e.YNc(31,gn,27,21,"tr",4),e.qZA()(),e.TgZ(32,"div",5)(33,"div")(34,"label",6),e._uU(35),e.ALo(36,"translate"),e.qZA(),e.TgZ(37,"ng-select",7),e.NdJ("ngModelChange",function(i){return t.reason=i}),e.ALo(38,"translate"),e.qZA()(),e.TgZ(39,"div")(40,"clr-select-container")(41,"label"),e._uU(42),e.ALo(43,"translate"),e.qZA(),e.TgZ(44,"select",8),e.NdJ("ngModelChange",function(i){return t.selectedPayment=i}),e.YNc(45,fn,3,8,"option",9),e.qZA()(),e.TgZ(46,"clr-checkbox-wrapper")(47,"input",10),e.NdJ("ngModelChange",function(i){return t.refundShipping=i}),e.qZA(),e.TgZ(48,"label"),e._uU(49),e.ALo(50,"translate"),e.ALo(51,"localeCurrency"),e.qZA()(),e.TgZ(52,"clr-input-container")(53,"label"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.TgZ(56,"vdr-currency-input",11),e.NdJ("ngModelChange",function(i){return t.adjustment=i}),e.qZA()(),e.TgZ(57,"div",12)(58,"div",13),e._uU(59),e.ALo(60,"translate"),e.ALo(61,"localeCurrency"),e.qZA(),e.TgZ(62,"div",14),e._uU(63),e.ALo(64,"translate"),e.ALo(65,"localeCurrency"),e.qZA(),e.YNc(66,xn,5,13,"div",15),e.YNc(67,vn,3,3,"div",16),e.qZA()()()(),e.YNc(68,On,7,6,"ng-template",17)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,37,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,39,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,41,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,43,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(21,45,"order.prorated-unit-price")),e.xp6(3),e.Oqu(e.lcZ(24,47,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(27,49,"order.refund")),e.xp6(3),e.Oqu(e.lcZ(30,51,"order.cancel")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(1),e.ekj("faded",!t.isRefunding()&&!t.isCancelling()),e.xp6(3),e.Oqu(e.lcZ(36,53,"order.refund-cancellation-reason")),e.xp6(2),e.Q6J("disabled",!t.isRefunding()&&!t.isCancelling())("items",t.reasons)("placeholder",e.lcZ(38,55,"order.refund-cancellation-reason-required"))("addTag",!0)("ngModel",t.reason),e.xp6(5),e.Oqu(e.lcZ(43,57,"order.payment-to-refund")),e.xp6(2),e.Q6J("ngModel",t.selectedPayment)("disabled",!t.isRefunding()),e.xp6(1),e.Q6J("ngForOf",t.settledPayments),e.xp6(2),e.Q6J("ngModel",t.refundShipping)("disabled",!t.isRefunding()),e.xp6(2),e.AsE(" ",e.lcZ(50,59,"order.refund-shipping")," (",e.xi3(51,61,t.order.shippingWithTax,t.order.currencyCode),") "),e.xp6(5),e.Oqu(e.lcZ(55,64,"order.refund-adjustment")),e.xp6(2),e.Q6J("disabled",!t.isRefunding())("currencyCode",t.order.currencyCode)("ngModel",t.adjustment),e.xp6(1),e.ekj("disabled",!t.isRefunding()),e.xp6(2),e.AsE(" ",e.lcZ(60,66,"order.payment-amount"),": ",e.xi3(61,68,t.selectedPayment.amount,t.order.currencyCode)," "),e.xp6(4),e.AsE(" ",e.lcZ(64,71,"order.refund-total"),": ",e.xi3(65,73,t.refundTotal,t.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",t.refundTotal<0||t.settledPaymentsTotal<t.refundTotal),e.xp6(1),e.Q6J("ngIf",t.selectedPayment.amount<t.refundTotal))},directives:[T.q,p.sg,I,p.O5,D.J,k.U,m.qvL,E.N,C.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,a.Wl,m.KKC,m.MgK,A.w9,m.dTv,a.EJ,m.otW,a.YN,a.Kr,m.PEh,m.G55,Be.K,m.xRP,J.n],pipes:[f.X$,he.M,v.k,p.H9,p.JJ],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.refund-wrapper[_ngcontent-%COMP%]{flex:1;flex-direction:column}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.refund-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}.quantity-col[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:12px;display:block}.refund-details[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.refund-details.faded[_ngcontent-%COMP%]{opacity:.5}.totals[_ngcontent-%COMP%]{margin-top:48px}.totals[_ngcontent-%COMP%] .refund-total[_ngcontent-%COMP%]{font-size:18px}.totals[_ngcontent-%COMP%] .refund-total-error[_ngcontent-%COMP%]{color:var(--color-error-500)}.totals[_ngcontent-%COMP%] .refund-total-warning[_ngcontent-%COMP%]{color:var(--color-warning-600);max-width:250px}.totals.disabled[_ngcontent-%COMP%]{color:var(--color-grey-300)}.prorated-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center}.line-promotion[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion[_ngcontent-%COMP%] .promotion-amount[_ngcontent-%COMP%]{margin-left:12px}"],changeDetection:0});const An=function(r){return{method:r}};class le{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}}le.\u0275fac=function(n){return new(n||le)},le.\u0275cmp=e.Xpm({type:le,selectors:[["vdr-settle-refund-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[1,"instruction"],["clrInput","","name","transactionId",3,"ngModel","ngModelChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,bn,2,3,"ng-template",0),e.TgZ(1,"p",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"clr-input-container")(5,"label"),e._uU(6),e.ALo(7,"translate"),e.qZA(),e.TgZ(8,"input",2),e.NdJ("ngModelChange",function(i){return t.transactionId=i}),e.qZA()(),e.YNc(9,Tn,6,7,"ng-template",3)),2&n&&(e.xp6(2),e.hij(" ",e.xi3(3,3,"order.settle-refund-manual-instructions",e.VKq(8,An,t.refund.method)),"\n"),e.xp6(4),e.Oqu(e.lcZ(7,6,"order.transaction-id")),e.xp6(2),e.Q6J("ngModel",t.transactionId))},directives:[T.q,m.G55,m.MgK,C.y,a.Fj,m.xRP,a.JJ,a.On,J.n],pipes:[f.X$],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0});var y=s(9720),Ln=s(3158),In=s(1944),We=s(3945);var Fn=s(6441);function wn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-state"))}function Mn(r,n){if(1&r&&(e.TgZ(0,"option",4),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"stateI18nToken"),e.qZA()),2&r){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.hij(" ",e.lcZ(2,2,e.lcZ(3,4,t))," ")}}function Pn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"common.cancel")," "))}const Sn=function(r){return{state:r}};function Nn(r,n){if(1&r){const t=e.EpF();e.YNc(0,Pn,3,3,"button",5),e.TgZ(1,"button",6),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()}if(2&r){const t=e.oxw();e.Q6J("ngIf",t.cancellable),e.xp6(1),e.Q6J("disabled",!t.selectedState),e.xp6(1),e.hij(" ",e.xi3(3,3,"order.transition-to-state",e.VKq(10,Sn,e.lcZ(4,6,e.lcZ(5,8,t.selectedState))))," ")}}class ae{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}}ae.\u0275fac=function(n){return new(n||ae)},ae.\u0275cmp=e.Xpm({type:ae,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["clrSelect","","name","state",3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"value"],["type","submit","class","btn btn-secondary",3,"click",4,"ngIf"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],["type","submit",1,"btn","btn-secondary",3,"click"]],template:function(n,t){1&n&&(e.YNc(0,wn,2,3,"ng-template",0),e.TgZ(1,"p"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"clr-select-container")(5,"select",1),e.NdJ("ngModelChange",function(i){return t.selectedState=i}),e.YNc(6,Mn,4,6,"option",2),e.qZA()(),e.YNc(7,Nn,6,12,"ng-template",3)),2&n&&(e.xp6(2),e.Oqu(e.lcZ(3,3,t.message)),e.xp6(3),e.Q6J("ngModel",t.selectedState),e.xp6(1),e.Q6J("ngForOf",t.nextStates))},directives:[T.q,m.dTv,C.y,a.EJ,m.otW,a.JJ,a.On,p.sg,a.YN,a.Kr,J.n,p.O5],pipes:[f.X$,Z.N],styles:[""],changeDetection:0});class w{constructor(n,t,o,i){this.dataService=n,this.modalService=t,this.notificationService=o,this.i18nService=i}transitionToPreModifyingState(n,t){return this.getPreModifyingState(n).pipe((0,h.w)(o=>{const i={orderId:n,nextStates:t,message:this.i18nService.translate((0,_.J)("order.unable-to-transition-to-state-try-another"),{state:o}),cancellable:!1,retry:10};return o?this.transitionToStateOrThrow(n,o).pipe((0,Ln.K)(l=>this.manuallyTransitionToState(i))):this.manuallyTransitionToState(i)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(ae,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,h.w)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return j.E;throw new Error("An order state must be selected")}),function qn(r){return(0,In.e)((n,t)=>{let o,l,i=!1;const c=()=>{o=n.subscribe((0,We.x)(t,void 0,void 0,d=>{l||(l=new Ae.x,r(l).subscribe((0,We.x)(t,()=>o?c():i=!0))),l&&l.next(d)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,Fn.g)(2e3),(0,Ce.q)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:u.iYD.ORDER_STATE_TRANSITION}},sort:{createdAt:u.Asd.DESC}}).mapSingle(t=>t.order).pipe((0,F.U)(t=>{const o=null==t?void 0:t.history.items.find(i=>"Modifying"===i.data.to);if(o)return o.data.from}))}transitionToStateOrThrow(n,t){return this.dataService.order.transitionToState(n,t).pipe((0,F.U)(({transitionOrderToState:o})=>{switch(null==o?void 0:o.__typename){case"Order":return null==o?void 0:o.state;case"OrderStateTransitionError":throw this.notificationService.error(null==o?void 0:o.transitionError),new Error(null==o?void 0:o.transitionError)}}))}}w.\u0275fac=function(n){return new(n||w)(e.LFG(u.DoR),e.LFG(u.Z7U),e.LFG(u.gqp),e.LFG(u.Dp7))},w.\u0275prov=e.Yz7({token:w,factory:w.\u0275fac,providedIn:"root"});var O=s(7346),Ge=s(3146),Fe=s(5886),Xe=s(8276);function Jn(r,n){if(1&r&&(e._UZ(0,"img",22),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}function Un(r,n){if(1&r&&(e.TgZ(0,"div",25)(1,"a",26),e._uU(2),e.qZA(),e.TgZ(3,"div",27),e._uU(4),e.ALo(5,"localeCurrency"),e.TgZ(6,"div",7),e.ALo(7,"translate"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw(4);e.xp6(1),e.Q6J("routerLink",o.getPromotionLink(t)),e.xp6(1),e.Oqu(t.description),e.xp6(2),e.hij(" ",e.xi3(5,5,t.amountWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(7,8,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(9,10,t.amount,o.order.currencyCode)," ")}}function Qn(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown")(1,"div",23),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-dropdown-menu"),e.YNc(5,Un,10,13,"div",24),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(2),e.hij(" ",e.lcZ(3,2,"order.promotions-applied")," "),e.xp6(3),e.Q6J("ngForOf",t)}}function Dn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Qn,6,4,"vdr-dropdown",21),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function kn(r,n){if(1&r&&(e.TgZ(0,"div",31),e._UZ(1,"vdr-custom-field-control",32),e.qZA()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("compact",!0)("readonly",!0)("customField",t.config)("customFieldsFormGroup",t.formGroup)}}function En(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td",28)(2,"div",29),e.YNc(3,kn,2,4,"div",30),e.qZA()()()),2&r){const t=e.oxw().ngIf;e.xp6(3),e.Q6J("ngForOf",t)}}function Yn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,En,4,1,"tr",21),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function jn(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"tr",11)(2,"td",12),e.YNc(3,Jn,2,4,"img",13),e.qZA(),e.TgZ(4,"td",14),e._uU(5),e.qZA(),e.TgZ(6,"td",15),e._uU(7),e.qZA(),e.TgZ(8,"td",16),e._uU(9),e.ALo(10,"localeCurrency"),e.TgZ(11,"div",7),e.ALo(12,"translate"),e._uU(13),e.ALo(14,"localeCurrency"),e.qZA()(),e.TgZ(15,"td",17),e._uU(16),e._UZ(17,"vdr-line-refunds",18)(18,"vdr-line-fulfillment",19),e.qZA(),e.TgZ(19,"td",20),e._uU(20),e.ALo(21,"localeCurrency"),e.TgZ(22,"div",7),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"localeCurrency"),e.qZA(),e.YNc(26,Dn,2,1,"ng-container",21),e.qZA()(),e.YNc(27,Yn,2,1,"ng-container",21),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(1),e.ekj("is-cancelled",0===t.quantity),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",e.xi3(10,18,t.unitPriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(12,21,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(14,23,t.unitPrice,o.order.currencyCode)," "),e.xp6(3),e.hij(" ",t.quantity," "),e.xp6(1),e.Q6J("line",t)("payments",o.order.payments),e.xp6(1),e.Q6J("line",t)("orderState",o.order.state),e.xp6(2),e.hij(" ",e.xi3(21,26,t.linePriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,29,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,31,t.linePrice,o.order.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",o.getLineDiscounts(t)),e.xp6(1),e.Q6J("ngIf",o.customFieldsForLine[t.id])}}function Rn(r,n){if(1&r&&(e.TgZ(0,"tr",33)(1,"td",34),e._uU(2),e.qZA(),e.TgZ(3,"td",15),e._uU(4),e.qZA(),e._UZ(5,"td",35),e.TgZ(6,"td",20),e._uU(7),e.ALo(8,"localeCurrency"),e.TgZ(9,"div",7),e.ALo(10,"translate"),e._uU(11),e.ALo(12,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(t.sku),e.xp6(3),e.hij(" ",e.xi3(8,5,t.priceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(10,8,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(12,10,t.price,o.order.currencyCode)," ")}}function Hn(r,n){if(1&r&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA()),2&r){const t=n.ngIf;e.xp6(1),e.Oqu(t)}}function $n(r,n){if(1&r&&(e.TgZ(0,"tr",37)(1,"td",38)(2,"a",39),e._uU(3),e.qZA(),e.YNc(4,Hn,2,1,"vdr-chip",21),e.qZA(),e.TgZ(5,"td",6),e._uU(6),e.ALo(7,"localeCurrency"),e.TgZ(8,"div",7),e.ALo(9,"translate"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(2),e.Q6J("routerLink",o.getPromotionLink(t)),e.xp6(1),e.Oqu(t.description),e.xp6(1),e.Q6J("ngIf",o.getCouponCodeForAdjustment(o.order,t)),e.xp6(2),e.hij(" ",e.xi3(7,6,t.amountWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(9,9,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(11,11,t.amount,o.order.currencyCode)," ")}}function Vn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,$n,12,14,"tr",36),e.BQk()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("ngIf","OTHER"!==t.type)}}class H{constructor(){this.orderLineCustomFieldsVisible=!1,this.customFieldsForLine={}}get visibleOrderLineCustomFields(){return this.orderLineCustomFieldsVisible?this.orderLineCustomFields:[]}get showElided(){return!this.orderLineCustomFieldsVisible&&0<this.orderLineCustomFields.length}ngOnInit(){this.orderLineCustomFieldsVisible=this.orderLineCustomFields.length<2,this.getLineCustomFields()}toggleOrderLineCustomFields(){this.orderLineCustomFieldsVisible=!this.orderLineCustomFieldsVisible}getLineDiscounts(n){return n.discounts.filter(t=>t.type===u.S2X.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new a.cw({}),o=this.orderLineCustomFields.map(i=>{const l=n.customFields[i.name];return t.addControl(i.name,new a.NI(l)),{config:i,formGroup:t,value:l}}).filter(i=>!!this.orderLineCustomFieldsVisible||null!=i.value);this.customFieldsForLine[n.id]=o}}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(l=>l.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}}H.\u0275fac=function(n){return new(n||H)},H.\u0275cmp=e.Xpm({type:H,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields"},decls:61,vars:61,consts:[[1,"order-table","table"],[4,"ngFor","ngForOf"],["class","surcharge",4,"ngFor","ngForOf"],[1,"sub-total"],[1,"left","clr-align-middle"],["colspan","4"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["colspan","3"],[1,"total"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],[3,"line","payments"],[3,"line","orderState"],[1,"align-middle","total"],[4,"ngIf"],[3,"src"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"],["colspan","6",1,"custom-fields-row"],[1,"order-line-custom-fields"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],["colspan","2",1,"align-middle"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],["colspan","5",1,"left","clr-align-middle"],[3,"routerLink"]],template:function(n,t){1&n&&(e.TgZ(0,"table",0)(1,"thead")(2,"tr"),e._UZ(3,"th"),e.TgZ(4,"th"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.TgZ(19,"tbody"),e.YNc(20,jn,28,34,"ng-container",1),e.YNc(21,Rn,13,13,"tr",2),e.YNc(22,Vn,2,1,"ng-container",1),e.TgZ(23,"tr",3)(24,"td",4),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"td",5),e.TgZ(28,"td",6),e._uU(29),e.ALo(30,"localeCurrency"),e.TgZ(31,"div",7),e.ALo(32,"translate"),e._uU(33),e.ALo(34,"localeCurrency"),e.qZA()()(),e.TgZ(35,"tr",8)(36,"td",4),e._uU(37),e.ALo(38,"translate"),e.qZA(),e.TgZ(39,"td",6),e._uU(40),e.qZA(),e._UZ(41,"td",9),e.TgZ(42,"td",6),e._uU(43),e.ALo(44,"localeCurrency"),e.TgZ(45,"div",7),e.ALo(46,"translate"),e._uU(47),e.ALo(48,"localeCurrency"),e.qZA()()(),e.TgZ(49,"tr",10)(50,"td",4),e._uU(51),e.ALo(52,"translate"),e.qZA(),e._UZ(53,"td",5),e.TgZ(54,"td",6),e._uU(55),e.ALo(56,"localeCurrency"),e.TgZ(57,"div",7),e.ALo(58,"translate"),e._uU(59),e.ALo(60,"localeCurrency"),e.qZA()()()()()),2&n&&(e.xp6(5),e.Oqu(e.lcZ(6,21,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(9,23,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(12,25,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(15,27,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,29,"order.total")),e.xp6(3),e.Q6J("ngForOf",t.order.lines),e.xp6(1),e.Q6J("ngForOf",t.order.surcharges),e.xp6(1),e.Q6J("ngForOf",t.order.discounts),e.xp6(3),e.Oqu(e.lcZ(26,31,"order.sub-total")),e.xp6(4),e.hij(" ",e.xi3(30,33,t.order.subTotalWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(32,36,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(34,38,t.order.subTotal,t.order.currencyCode)," "),e.xp6(4),e.Oqu(e.lcZ(38,41,"order.shipping")),e.xp6(3),e.Oqu(t.getShippingNames(t.order)),e.xp6(3),e.hij(" ",e.xi3(44,43,t.order.shippingWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(46,46,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(48,48,t.order.shipping,t.order.currencyCode)," "),e.xp6(4),e.Oqu(e.lcZ(52,51,"order.total")),e.xp6(4),e.hij(" ",e.xi3(56,53,t.order.totalWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(58,56,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(60,58,t.order.total,t.order.currencyCode)," "))},directives:[p.sg,p.O5,I,Y,D.J,k.U,E.N,y.yS,Te.M,G.Y],pipes:[f.X$,he.M,v.k],styles:[".order-table[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table[_ngcontent-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-right:18px}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table[_ngcontent-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-left:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0});var Bn=s(2505),Wn=s(2355),Gn=s(4664),Ke=s(2702);function Xn(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.error-message")),e.xp6(2),e.hij(" ",t.payment.errorMessage,"\n")}}function Kn(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.transaction-id")),e.xp6(2),e.hij(" ",t.payment.transactionId,"\n")}}class ${}$.\u0275fac=function(n){return new(n||$)},$.\u0275cmp=e.Xpm({type:$,selectors:[["vdr-payment-detail"]],inputs:{payment:"payment",currencyCode:"currencyCode"},decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA(),e.TgZ(3,"vdr-labeled-data",0),e.ALo(4,"translate"),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.YNc(7,Xn,3,4,"vdr-labeled-data",1),e.YNc(8,Kn,3,4,"vdr-labeled-data",1),e.TgZ(9,"vdr-labeled-data",0),e.ALo(10,"translate"),e._UZ(11,"vdr-object-tree",2),e.qZA()),2&n&&(e.Q6J("label",e.lcZ(1,8,"order.payment-method")),e.xp6(2),e.hij(" ",t.payment.method,"\n"),e.xp6(1),e.Q6J("label",e.lcZ(4,10,"order.amount")),e.xp6(2),e.hij(" ",e.xi3(6,12,t.payment.amount,t.currencyCode),"\n"),e.xp6(2),e.Q6J("ngIf",t.payment.errorMessage),e.xp6(1),e.Q6J("ngIf",t.payment.transactionId),e.xp6(1),e.Q6J("label",e.lcZ(10,15,"order.payment-metadata")),e.xp6(2),e.Q6J("value",t.payment.metadata))},directives:[K.W,p.O5,Ke._],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var zn=s(7388);function er(r,n){1&r&&(e.TgZ(0,"span",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.note-only-visible-to-administrators")," "))}function tr(r,n){1&r&&(e.TgZ(0,"span",13),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.note-visible-to-customer")," "))}function nr(r,n){1&r&&(e.TgZ(0,"div",11),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.history-order-fulfilled")," "))}function rr(r,n){1&r&&(e.TgZ(0,"div",11),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.history-order-cancelled")," "))}const ze=function(r,n){return{from:r,to:n}};function or(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"order.history-order-transition",e.WLB(4,ze,t.data.from,t.data.to))," ")}}function ir(r,n){if(1&r&&(e.ynx(0),e.YNc(1,nr,3,3,"div",17),e.YNc(2,rr,3,3,"div",17),e.YNc(3,or,2,7,"ng-template",18),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf","Delivered"===t.data.to),e.xp6(1),e.Q6J("ngIf","Cancelled"===t.data.to),e.xp6(1),e.Q6J("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function lr(r,n){1&r&&(e.TgZ(0,"vdr-chip",23),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-settled")))}function ar(r,n){1&r&&(e.TgZ(0,"vdr-chip",24),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-not-settled")))}function cr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"strong"),e._uU(4),e.ALo(5,"localeCurrency"),e.qZA(),e.YNc(6,lr,3,3,"vdr-chip",20),e.YNc(7,ar,3,3,"vdr-chip",21),e.TgZ(8,"vdr-history-entry-detail"),e._UZ(9,"vdr-modification-detail",22),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.hij(" ",e.lcZ(2,6,"order.modify-order-price-difference"),": "),e.xp6(3),e.Oqu(e.xi3(5,8,t.priceChange,o.order.currencyCode)),e.xp6(2),e.Q6J("ngIf",t.isSettled),e.xp6(1),e.Q6J("ngIf",!t.isSettled),e.xp6(2),e.Q6J("order",o.order)("modification",t)}}function dr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,cr,10,11,"ng-container",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(2),e.hij(" ",e.lcZ(3,2,"order.history-order-modified")," "),e.xp6(2),e.Q6J("ngIf",o.getModification(t.data.modificationId))}}function sr(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-payment-detail",27),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(4);e.xp6(1),e.Q6J("payment",t)("currencyCode",o.order.currencyCode)}}function ur(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.YNc(6,sr,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,4,"order.history-payment-settled")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,6,"order.transaction-id"),": ",null==(i=o.getPayment(t))?null:i.transactionId," "),e.xp6(2),e.Q6J("ngIf",o.getPayment(t))}}const et=function(r,n,t){return{from:r,to:n,id:t}};function pr(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.hij(" ",e.xi3(1,1,"order.history-payment-transition",e.kEZ(4,et,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function mr(r,n){if(1&r&&(e.ynx(0),e.YNc(1,ur,7,8,"ng-container",25),e.YNc(2,pr,2,8,"ng-template",null,26,e.W1O),e.BQk()),2&r){const t=e.MAs(3),o=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function _r(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-refund-transition",e.kEZ(4,et,t.data.from,t.data.to,t.data.refundId))," ")}}function gr(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",28),e.ALo(2,"translate"),e._uU(3),e.qZA(),e.TgZ(4,"vdr-labeled-data",28),e.ALo(5,"translate"),e._UZ(6,"vdr-simple-item-list",29),e.qZA(),e.TgZ(7,"vdr-labeled-data",28),e.ALo(8,"translate"),e._uU(9),e.qZA()()),2&r){const t=n.ngIf,o=e.oxw(2).$implicit;e.xp6(1),e.Q6J("label",e.lcZ(2,6,"order.cancellation-reason")),e.xp6(2),e.hij(" ",o.data.reason," "),e.xp6(1),e.Q6J("label",e.lcZ(5,8,"order.contents")),e.xp6(2),e.Q6J("items",t),e.xp6(1),e.Q6J("label",e.lcZ(8,10,"order.shipping-cancelled")),e.xp6(2),e.hij(" ",o.data.shippingCancelled," ")}}const fr=function(r){return{count:r}};function hr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,gr,10,12,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,2,"order.history-items-cancelled",e.VKq(5,fr,t.data.orderItemIds.length))," "),e.xp6(2),e.Q6J("ngIf",o.getCancelledItems(t))}}function xr(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",30),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function vr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,xr,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-fulfillment-created")," "),e.xp6(2),e.Q6J("ngIf",o.getFulfillment(t))}}function Cr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,3,"order.history-fulfillment-delivered")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function yr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,3,"order.history-fulfillment-shipped")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function Zr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-fulfillment-transition",e.WLB(4,ze,t.data.from,t.data.to))," ")}}function Or(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",30),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function br(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Cr,6,7,"ng-container",19),e.YNc(2,yr,6,7,"ng-container",19),e.YNc(3,Zr,3,7,"ng-container",19),e.YNc(4,Or,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf","Delivered"===t.data.to),e.xp6(1),e.Q6J("ngIf","Shipped"===t.data.to),e.xp6(1),e.Q6J("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.xp6(1),e.Q6J("ngIf",o.getFulfillment(t))}}function Tr(r,n){1&r&&(e.TgZ(0,"span",43),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.public")))}function Ar(r,n){1&r&&(e.TgZ(0,"span",44),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.private")))}function Lr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",31)(2,"div",32),e.YNc(3,Tr,3,3,"span",33),e.YNc(4,Ar,3,3,"span",34),e._uU(5),e.qZA(),e._UZ(6,"div",35),e.TgZ(7,"vdr-dropdown")(8,"button",36),e._UZ(9,"clr-icon",37),e.qZA(),e.TgZ(10,"vdr-dropdown-menu",38)(11,"button",39),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().updateNote.emit(i)}),e.ALo(12,"hasPermission"),e._UZ(13,"clr-icon",40),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",41),e.TgZ(17,"button",39),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().deleteNote.emit(i)}),e.ALo(18,"hasPermission"),e._UZ(19,"clr-icon",42),e._uU(20),e.ALo(21,"translate"),e.qZA()()()(),e.BQk()}if(2&r){const t=e.oxw().$implicit;e.xp6(3),e.Q6J("ngIf",t.isPublic),e.xp6(1),e.Q6J("ngIf",!t.isPublic),e.xp6(1),e.hij(" ",t.data.note," "),e.xp6(6),e.Q6J("disabled",!e.lcZ(12,7,"UpdateOrder")),e.xp6(3),e.hij(" ",e.lcZ(15,9,"common.edit")," "),e.xp6(3),e.Q6J("disabled",!e.lcZ(18,11,"UpdateOrder")),e.xp6(3),e.hij(" ",e.lcZ(21,13,"common.delete")," ")}}const Ir=function(r){return["/marketing","promotions",r]};function qr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"a",45),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"order.history-coupon-code-applied"),": "),e.xp6(3),e.Q6J("routerLink",e.VKq(5,Ir,t.data.promotionId)),e.xp6(1),e.Oqu(t.data.couponCode)}}function Fr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"span",46),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-coupon-code-removed"),": "),e.xp6(4),e.Oqu(t.data.couponCode)}}function wr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",14),e.NdJ("expandClick",function(){e.CHM(t);const i=e.oxw();return i.expanded=!i.expanded}),e.ynx(1,15),e.YNc(2,ir,4,3,"ng-container",16),e.YNc(3,dr,5,4,"ng-container",16),e.YNc(4,mr,4,2,"ng-container",16),e.YNc(5,_r,3,8,"ng-container",16),e.YNc(6,hr,4,7,"ng-container",16),e.YNc(7,vr,4,4,"ng-container",16),e.YNc(8,br,5,4,"ng-container",16),e.YNc(9,Lr,22,15,"ng-container",16),e.YNc(10,qr,6,7,"ng-container",16),e.YNc(11,Fr,6,4,"ng-container",16),e.BQk(),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw();e.Q6J("displayType",o.getDisplayType(t))("iconShape",o.getTimelineIcon(t))("createdAt",t.createdAt)("name",o.getName(t))("featured",o.isFeatured(t))("collapsed",!o.expanded&&!o.isFeatured(t)),e.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_STATE_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_MODIFIED),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_PAYMENT_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_REFUND_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_CANCELLATION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_FULFILLMENT),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_FULFILLMENT_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_NOTE),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_COUPON_APPLIED),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_COUPON_REMOVED)}}class ce{constructor(){this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=u.iYD}getDisplayType(n){if(n.type===u.iYD.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===u.iYD.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type===u.iYD.ORDER_PAYMENT_TRANSITION&&("Declined"===n.data.to||"Cancelled"===n.data.to)||n.type===u.iYD.ORDER_CANCELLATION?"error":n.type===u.iYD.ORDER_REFUND_TRANSITION?"warning":"default"}getTimelineIcon(n){if(n.type===u.iYD.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===u.iYD.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===u.iYD.ORDER_NOTE?"note":n.type===u.iYD.ORDER_MODIFIED?"pencil":n.type!==u.iYD.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case u.iYD.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case u.iYD.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case u.iYD.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case u.iYD.ORDER_NOTE:case u.iYD.ORDER_MODIFIED:return!0;default:return!1}}getFulfillment(n){if((n.type===u.iYD.ORDER_FULFILLMENT||n.type===u.iYD.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===u.iYD.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getCancelledItems(n){const t=new Map,o=n.data.orderItemIds;for(const i of this.order.lines)for(const l of i.items)if(o.includes(l.id)){const c=t.get(i.productVariant.name);null!=c?t.set(i.productVariant.name,c+1):t.set(i.productVariant.name,1)}return Array.from(t.entries()).map(([i,l])=>({name:i,quantity:l}))}getModification(n){return this.order.modifications.find(t=>t.id===n)}getName(n){const{administrator:t}=n;if(t)return`${t.firstName} ${t.lastName}`;{const o=this.order.customer;if(o)return`${o.firstName} ${o.lastName}`}return""}addNoteToOrder(){this.addNote.emit({note:this.note,isPublic:!this.noteIsPrivate}),this.note="",this.noteIsPrivate=!0}}ce.\u0275fac=function(n){return new(n||ce)},ce.\u0275cmp=e.Xpm({type:ce,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:23,vars:24,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"visibility-select"],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],["class","private",4,"ngIf"],["class","public",4,"ngIf"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick",4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],[3,"ngSwitch"],[4,"ngSwitchCase"],["class","title",4,"ngIf"],[3,"ngIf"],[4,"ngIf"],["colorType","success",4,"ngIf"],["colorType","error",4,"ngIf"],[3,"order","modification"],["colorType","success"],["colorType","error"],[4,"ngIf","ngIfElse"],["regularPaymentTransition",""],[3,"payment","currencyCode"],[3,"label"],[3,"items"],[3,"fulfillmentId","order"],[1,"flex"],[1,"note-text"],["class","note-visibility public",4,"ngIf"],["class","note-visibility private",4,"ngIf"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[1,"note-visibility","public"],[1,"note-visibility","private"],[3,"routerLink"],[1,"cancelled-coupon-code"]],template:function(n,t){1&n&&(e.TgZ(0,"h4"),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"div",0)(4,"vdr-timeline-entry",1)(5,"div",2)(6,"textarea",3),e.NdJ("ngModelChange",function(i){return t.note=i}),e.qZA(),e.TgZ(7,"button",4),e.NdJ("click",function(){return t.addNoteToOrder()}),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e.TgZ(10,"div",5)(11,"clr-checkbox-wrapper")(12,"input",6),e.NdJ("ngModelChange",function(i){return t.noteIsPrivate=i}),e.qZA(),e.TgZ(13,"label"),e._uU(14),e.ALo(15,"translate"),e.qZA()(),e.YNc(16,er,3,3,"span",7),e.YNc(17,tr,3,3,"span",8),e.qZA()(),e.YNc(18,wr,12,17,"vdr-timeline-entry",9),e.TgZ(19,"vdr-timeline-entry",10)(20,"div",11),e._uU(21),e.ALo(22,"translate"),e.qZA()()()),2&n&&(e.xp6(1),e.Oqu(e.lcZ(2,16,"order.order-history")),e.xp6(2),e.ekj("expanded",t.expanded),e.xp6(1),e.Q6J("featured",!0),e.xp6(2),e.Q6J("ngModel",t.note),e.xp6(1),e.Q6J("disabled",!t.note),e.xp6(1),e.hij(" ",e.lcZ(9,18,"common.add-note")," "),e.xp6(4),e.Q6J("ngModel",t.noteIsPrivate),e.xp6(2),e.Oqu(e.lcZ(15,20,"order.note-is-private")),e.xp6(2),e.Q6J("ngIf",t.noteIsPrivate),e.xp6(1),e.Q6J("ngIf",!t.noteIsPrivate),e.xp6(1),e.Q6J("ngForOf",t.history),e.xp6(1),e.Q6J("isLast",!0)("createdAt",t.order.createdAt)("featured",!0),e.xp6(2),e.hij(" ",e.lcZ(22,22,"order.history-order-created")," "))},directives:[Wn._,C.y,a.Fj,a.JJ,a.On,m.PEh,a.Wl,m.KKC,m.MgK,p.O5,p.sg,p.RF,p.n9,G.Y,Gn.C,ee,$,K.W,L,Q,D.J,k.U,m.qvL,E.N,ve.H,y.yS],pipes:[f.X$,v.k,zn.j],styles:["[_nghost-%COMP%]{margin-top:48px;display:block}.entry-list[_ngcontent-%COMP%]{margin-top:24px;margin-left:24px;margin-right:12px}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}.visibility-select[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.visibility-select[_ngcontent-%COMP%] .public[_ngcontent-%COMP%]{color:var(--color-warning-500)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-500)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-right:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap}.cancelled-coupon-code[_ngcontent-%COMP%]{text-decoration:line-through}.note-visibility[_ngcontent-%COMP%]{text-transform:lowercase}.note-visibility.public[_ngcontent-%COMP%]{color:var(--color-warning-500)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-500)}"],changeDetection:0});var tt=s(458);function Mr(r,n){1&r&&e._UZ(0,"clr-icon",2)}class de{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}}function Pr(r,n){1&r&&e._UZ(0,"clr-icon",2)}de.\u0275fac=function(n){return new(n||de)},de.\u0275cmp=e.Xpm({type:de,selectors:[["vdr-payment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Mr,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Settled"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[G.Y,p.O5,m.qvL],pipes:[f.X$,Z.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});class se{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}}function Sr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.BQk()),2&r){const t=e.oxw();e.xp6(1),e.hij("#",t.payment.transactionId,"")}}function Nr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.transaction-id")),e.xp6(2),e.hij(" ",t.transactionId," ")}}function Jr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.refund-reason")),e.xp6(2),e.hij(" ",t.reason," ")}}function Ur(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._UZ(2,"vdr-object-tree",13),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.refund-metadata")),e.xp6(2),e.Q6J("value",t.metadata)}}function Qr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",14)(1,"button",15),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().settleRefund.emit(i)}),e._uU(2),e.ALo(3,"translate"),e.qZA()()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"order.settle-refund")," "))}function Dr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",1),e._UZ(2,"clr-icon",9),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"div",10)(6,"vdr-refund-state-label",4),e.qZA(),e.TgZ(7,"div",5)(8,"vdr-labeled-data",11),e.ALo(9,"translate"),e._uU(10),e.ALo(11,"localeDate"),e.qZA(),e.TgZ(12,"vdr-labeled-data",11),e.ALo(13,"translate"),e._uU(14),e.ALo(15,"localeCurrency"),e.qZA(),e.YNc(16,Nr,3,4,"vdr-labeled-data",12),e.YNc(17,Jr,3,4,"vdr-labeled-data",12),e.YNc(18,Ur,3,4,"vdr-labeled-data",12),e.qZA(),e.YNc(19,Qr,4,3,"div",8),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(3),e.AsE(" ",e.lcZ(4,11,"order.refund")," #",t.id," "),e.xp6(3),e.Q6J("state",t.state),e.xp6(2),e.Q6J("label",e.lcZ(9,13,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(11,15,t.createdAt,"medium")," "),e.xp6(2),e.Q6J("label",e.lcZ(13,18,"order.refund-total")),e.xp6(2),e.hij(" ",e.xi3(15,20,t.total,o.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.transactionId),e.xp6(1),e.Q6J("ngIf",t.reason),e.xp6(1),e.Q6J("ngIf",o.refundHasMetadata(t)),e.xp6(1),e.Q6J("ngIf","Pending"===t.state)}}function kr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",15),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.settlePayment.emit(i.payment)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.settle-payment")," "))}se.\u0275fac=function(n){return new(n||se)},se.\u0275cmp=e.Xpm({type:se,selectors:[["vdr-refund-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Pr,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Settled"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[G.Y,p.O5,m.qvL],pipes:[f.X$,Z.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});const Er=function(r){return{state:r}};function Yr(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"clr-icon",23),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Er,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function jr(r,n){1&r&&(e._UZ(0,"clr-icon",24),e._uU(1),e.ALo(2,"translate")),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-payment")," "))}function Rr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",20),e.NdJ("click",function(){const l=e.CHM(t).$implicit,c=e.oxw(2);return c.transitionPaymentState.emit({payment:c.payment,state:l})}),e.YNc(2,Yr,6,10,"ng-container",21),e.YNc(3,jr,3,3,"ng-template",null,22,e.W1O),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.MAs(4);e.xp6(2),e.Q6J("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Hr(r,n){if(1&r&&(e.TgZ(0,"div",14),e.YNc(1,kr,3,3,"button",16),e.TgZ(2,"vdr-dropdown")(3,"button",17),e._UZ(4,"clr-icon",18),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",19),e.YNc(6,Rr,5,2,"ng-container",7),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.payment.nextStates.includes("Settled")),e.xp6(5),e.Q6J("ngForOf",t.nextOtherStates())}}class ue{constructor(){this.settlePayment=new e.vpe,this.transitionPaymentState=new e.vpe,this.settleRefund=new e.vpe}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}}function $r(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().ngIf;return e.oxw().addManualPayment(i)}),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"localeCurrency"),e.qZA()}if(2&r){const t=e.oxw().ngIf,o=e.oxw();e.xp6(1),e.AsE(" ",e.lcZ(2,2,"order.add-payment-to-order")," (",e.xi3(3,4,o.outstandingPaymentAmount(t),t.currencyCode),") ")}}function Vr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).transitionToState("ArrangingAdditionalPayment")}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.arrange-additional-payment")," "))}function Br(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).transitionToModifying()}),e._UZ(2,"clr-icon",17),e._uU(3),e.ALo(4,"translate"),e.qZA(),e._UZ(5,"div",13),e.BQk()}2&r&&(e.xp6(3),e.hij(" ",e.lcZ(4,1,"order.modify-order")," "))}function Wr(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.refund-and-cancel-order")," "))}function Gr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-order")," ")}function Xr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().ngIf;return e.oxw().cancelOrRefund(i)}),e._UZ(1,"clr-icon",18),e.YNc(2,Wr,3,3,"ng-container",19),e.YNc(3,Gr,2,3,"ng-template",null,20,e.W1O),e.qZA()}if(2&r){const t=e.MAs(4),o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Q6J("ngIf",i.orderHasSettledPayments(o))("ngIfElse",t)}}ue.\u0275fac=function(n){return new(n||ue)},ue.\u0275cmp=e.Xpm({type:ue,selectors:[["vdr-order-payment-card"]],inputs:{payment:"payment",currencyCode:"currencyCode"},outputs:{settlePayment:"settlePayment",transitionPaymentState:"transitionPaymentState",settleRefund:"settleRefund"},decls:12,vars:9,consts:[[1,"card"],[1,"card-header","payment-header"],[4,"ngIf"],[1,"payment-state"],[3,"state"],[1,"card-block"],[3,"payment","currencyCode"],[4,"ngFor","ngForOf"],["class","card-footer",4,"ngIf"],["shape","redo","dir","down",1,"refund-icon"],[1,"clr-flex-fill"],[3,"label"],[3,"label",4,"ngIf"],[3,"value"],[1,"card-footer"],[1,"btn","btn-sm","btn-primary",3,"click"],["class","btn btn-sm btn-primary",3,"click",4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div"),e._uU(3),e.ALo(4,"translate"),e.YNc(5,Sr,2,1,"ng-container",2),e.qZA(),e.TgZ(6,"div",3),e._UZ(7,"vdr-payment-state-label",4),e.qZA()(),e.TgZ(8,"div",5),e._UZ(9,"vdr-payment-detail",6),e.qZA(),e.YNc(10,Dr,20,23,"ng-container",7),e.YNc(11,Hr,7,2,"div",8),e.qZA()),2&n&&(e.xp6(3),e.hij(" ",e.lcZ(4,7,"order.payment")," "),e.xp6(2),e.Q6J("ngIf",t.payment.transactionId),e.xp6(2),e.Q6J("state",t.payment.state),e.xp6(2),e.Q6J("payment",t.payment)("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("ngForOf",t.payment.refunds),e.xp6(1),e.Q6J("ngIf",t.payment.nextStates.length))},directives:[p.O5,de,$,p.sg,m.qvL,He.Lv,se,K.W,Ke._,D.J,k.U,E.N,ve.H],pipes:[f.X$,xe.H,v.k,Z.N],styles:[".payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.refund-icon[_ngcontent-%COMP%]{margin-right:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0});const Kr=function(r){return{state:r}};function zr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).transitionToState(l)}),e._UZ(1,"clr-icon",22),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()}if(2&r){const t=n.$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Kr,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function eo(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"div",13),e.YNc(2,zr,6,10,"button",21),e.ALo(3,"async"),e.BQk()),2&r){const t=e.oxw(2);e.xp6(2),e.Q6J("ngForOf",e.lcZ(3,1,t.nextStates$))}}function to(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e.TgZ(5,"vdr-order-state-label",3)(6,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().openStateDiagram()}),e.ALo(7,"translate"),e._UZ(8,"clr-icon",5),e.qZA()()()(),e.TgZ(9,"vdr-ab-right"),e._UZ(10,"vdr-action-bar-items",6),e.YNc(11,$r,4,7,"button",7),e.YNc(12,Vr,3,3,"button",7),e.TgZ(13,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().fulfillOrder()}),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dropdown")(17,"button",9),e._UZ(18,"clr-icon",10),e.qZA(),e.TgZ(19,"vdr-dropdown-menu",11),e.YNc(20,Br,6,3,"ng-container",0),e.YNc(21,Xr,5,2,"button",12),e.YNc(22,eo,4,3,"ng-container",0),e.ALo(23,"async"),e._UZ(24,"div",13),e.TgZ(25,"button",14),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().manuallyTransitionToState(l)}),e._UZ(26,"clr-icon",15),e._uU(27),e.ALo(28,"translate"),e.qZA()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();let i;e.xp6(3),e.Q6J("entity",e.lcZ(4,11,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(1),e.Q6J("title",e.lcZ(7,13,"order.order-state-diagram")),e.xp6(5),e.Q6J("ngIf",("ArrangingPayment"===t.state||"ArrangingAdditionalPayment"===t.state)&&(o.hasUnsettledModifications(t)||0<o.outstandingPaymentAmount(t))),e.xp6(1),e.Q6J("ngIf",!1===t.active&&"ArrangingAdditionalPayment"!==t.state&&0<o.outstandingPaymentAmount(t)),e.xp6(1),e.Q6J("disabled",!o.canAddFulfillment(t)),e.xp6(1),e.hij(" ",e.lcZ(15,15,"order.fulfill-order")," "),e.xp6(6),e.Q6J("ngIf",t.nextStates.includes("Modifying")),e.xp6(1),e.Q6J("ngIf",t.nextStates.includes("Cancelled")),e.xp6(1),e.Q6J("ngIf",null==(i=e.lcZ(23,17,o.nextStates$))?null:i.length),e.xp6(5),e.hij(" ",e.lcZ(28,19,"order.manually-transition-to-state")," ")}}function no(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.ALo(5,"percent"),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw().ngIf;e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(e.lcZ(5,4,t.taxRate/100)),e.xp6(3),e.Oqu(e.xi3(8,6,t.taxBase,o.currencyCode)),e.xp6(3),e.Oqu(e.xi3(11,9,t.taxTotal,o.currencyCode))}}function ro(r,n){1&r&&(e.TgZ(0,"h6"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.shipping-address")," "))}function oo(r,n){1&r&&(e.TgZ(0,"h6"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.billing-address")," "))}function io(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-order-payment-card",39),e.NdJ("settlePayment",function(i){return e.CHM(t),e.oxw(3).settlePayment(i)})("transitionPaymentState",function(i){return e.CHM(t),e.oxw(3).transitionPaymentState(i)})("settleRefund",function(i){return e.CHM(t),e.oxw(3).settleRefund(i)}),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw(2).ngIf;e.Q6J("currencyCode",o.currencyCode)("payment",t)}}function lo(r,n){if(1&r&&(e.ynx(0),e.YNc(1,io,1,2,"vdr-order-payment-card",38),e.BQk()),2&r){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t.payments)}}function ao(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-fulfillment-card",40),e.NdJ("transitionState",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).transitionFulfillment(c.id,i)}),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf;e.xp6(1),e.Q6J("fulfillment",t)("order",o)}}function co(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",23)(2,"div",24),e._UZ(3,"vdr-order-table",25),e.TgZ(4,"h4"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"table",26)(8,"thead")(9,"tr")(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.TgZ(22,"tbody"),e.YNc(23,no,12,12,"tr",27),e.qZA()(),e._UZ(24,"vdr-custom-detail-component-host",28),e.TgZ(25,"vdr-order-history",29),e.NdJ("addNote",function(i){return e.CHM(t),e.oxw().addNote(i)})("updateNote",function(i){return e.CHM(t),e.oxw().updateNote(i)})("deleteNote",function(i){return e.CHM(t),e.oxw().deleteNote(i)}),e.ALo(26,"async"),e.qZA()(),e.TgZ(27,"div",30)(28,"vdr-order-custom-fields-card",31),e.NdJ("updateClick",function(i){return e.CHM(t),e.oxw().updateCustomFields(i)}),e.qZA(),e.TgZ(29,"div",32)(30,"div",33),e._uU(31),e.ALo(32,"translate"),e.qZA(),e.TgZ(33,"div",34)(34,"div",35),e._UZ(35,"vdr-customer-label",36),e.YNc(36,ro,3,3,"h6",0),e._UZ(37,"vdr-formatted-address",37),e.YNc(38,oo,3,3,"h6",0),e._UZ(39,"vdr-formatted-address",37),e.qZA()()(),e.YNc(40,lo,2,1,"ng-container",0),e.YNc(41,ao,2,2,"ng-container",27),e.qZA()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("order",t)("orderLineCustomFields",o.orderLineCustomFields),e.xp6(2),e.Oqu(e.lcZ(6,22,"order.tax-summary")),e.xp6(6),e.Oqu(e.lcZ(12,24,"common.description")),e.xp6(3),e.Oqu(e.lcZ(15,26,"order.tax-rate")),e.xp6(3),e.Oqu(e.lcZ(18,28,"order.tax-base")),e.xp6(3),e.Oqu(e.lcZ(21,30,"order.tax-total")),e.xp6(3),e.Q6J("ngForOf",t.taxSummary),e.xp6(1),e.Q6J("entity$",o.entity$)("detailForm",o.detailForm),e.xp6(1),e.Q6J("order",t)("history",e.lcZ(26,32,o.history$)),e.xp6(3),e.Q6J("customFieldsConfig",o.customFields)("customFieldValues",t.customFields),e.xp6(3),e.hij(" ",e.lcZ(32,34,"order.customer")," "),e.xp6(4),e.Q6J("customer",t.customer),e.xp6(1),e.Q6J("ngIf",o.getOrderAddressLines(t.shippingAddress).length),e.xp6(1),e.Q6J("address",t.shippingAddress),e.xp6(1),e.Q6J("ngIf",o.getOrderAddressLines(t.billingAddress).length),e.xp6(1),e.Q6J("address",t.billingAddress),e.xp6(1),e.Q6J("ngIf",t.payments&&t.payments.length),e.xp6(1),e.Q6J("ngForOf",t.fulfillments)}}class pe extends u.UT_{constructor(n,t,o,i,l,c,d,g){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=d,this.orderTransitionService=g,this.detailForm=new a.cw({}),this.fetchHistory=new Ae.x,this.defaultStates=["AddingItems","ArrangingPayment","PaymentAuthorized","PaymentSettled","PartiallyShipped","Shipped","PartiallyDelivered","Delivered","Cancelled","Modifying","ArrangingAdditionalPayment"]}ngOnInit(){this.init(),this.entity$.pipe((0,Ce.q)(1)).subscribe(n=>{"Modifying"===n.state&&this.router.navigate(["./","modify"],{relativeTo:this.route})}),this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.history$=this.fetchHistory.pipe((0,$e.O)(null),(0,h.w)(()=>this.dataService.order.getOrderHistory(this.id,{sort:{createdAt:u.Asd.DESC}}).mapStream(n=>{var t;return null===(t=n.order)||void 0===t?void 0:t.history.items}))),this.nextStates$=this.entity$.pipe((0,F.U)(n=>this.defaultStates.includes(n.state)?n.nextStates.filter(o=>!this.defaultStates.includes(o)):n.nextStates))}ngOnDestroy(){this.destroy()}openStateDiagram(){this.entity$.pipe((0,Ce.q)(1),(0,h.w)(n=>this.modalService.fromComponent(oe,{closable:!0,locals:{activeState:n.state}}))).subscribe()}transitionToState(n){this.dataService.order.transitionToState(this.id,n).subscribe(({transitionOrderToState:t})=>{switch(null==t?void 0:t.__typename){case"Order":this.notificationService.success((0,_.J)("order.transitioned-to-state-success"),{state:n}),this.fetchHistory.next();break;case"OrderStateTransitionError":this.notificationService.error(t.transitionError)}})}manuallyTransitionToState(n){this.orderTransitionService.manuallyTransitionToState({orderId:n.id,nextStates:n.nextStates,cancellable:!0,message:(0,_.J)("order.manually-transition-to-state-message"),retry:0}).subscribe()}transitionToModifying(){this.dataService.order.transitionToState(this.id,"Modifying").subscribe(({transitionOrderToState:n})=>{switch(null==n?void 0:n.__typename){case"Order":this.router.navigate(["./modify"],{relativeTo:this.route});break;case"OrderStateTransitionError":this.notificationService.error(n.transitionError)}})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe(()=>{this.notificationService.success((0,_.J)("common.notify-update-success"),{entity:"Order"})})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}settlePayment(n){this.dataService.order.settlePayment(n.id).subscribe(({settlePayment:t})=>{switch(t.__typename){case"Payment":"Settled"===t.state?this.notificationService.success((0,_.J)("order.settle-payment-success")):this.notificationService.error((0,_.J)("order.settle-payment-error")),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"OrderStateTransitionError":case"PaymentStateTransitionError":case"SettlePaymentError":this.notificationService.error(t.message)}})}transitionPaymentState({payment:n,state:t}){"Cancelled"===t?this.dataService.order.cancelPayment(n.id).subscribe(({cancelPayment:o})=>{switch(o.__typename){case"Payment":this.notificationService.success((0,_.J)("order.transitioned-payment-to-state-success"),{state:t}),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"PaymentStateTransitionError":this.notificationService.error(o.transitionError);break;case"CancelPaymentError":this.notificationService.error(o.paymentErrorMessage)}}):this.dataService.order.transitionPaymentToState(n.id,t).subscribe(({transitionPaymentToState:o})=>{switch(o.__typename){case"Payment":this.notificationService.success((0,_.J)("order.transitioned-payment-to-state-success"),{state:t}),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"PaymentStateTransitionError":this.notificationService.error(o.message)}})}canAddFulfillment(n){var t;const o=(null!==(t=n.fulfillments)&&void 0!==t?t:[]).reduce((l,c)=>[...l,...c.summary],[]);let i=!0;for(const l of n.lines)o.filter(d=>d.orderLine.id===l.id).reduce((d,g)=>d+g.quantity,0)<l.quantity&&(i=!1);return!i&&!this.hasUnsettledModifications(n)&&0===this.outstandingPaymentAmount(n)&&(n.nextStates.includes("Shipped")||n.nextStates.includes("PartiallyShipped")||n.nextStates.includes("Delivered"))}hasUnsettledModifications(n){return 0<n.modifications.filter(t=>!t.isSettled).length}getOutstandingModificationAmount(n){return(0,U.summate)(n.modifications.filter(t=>!t.isSettled),"priceChange")}outstandingPaymentAmount(n){var t,o,i;const l=d=>"Cancelled"!==d.state&&"Declined"!==d.state&&"Error"!==d.state;let c=0;for(const d of null!==(o=null===(t=n.payments)||void 0===t?void 0:t.filter(l))&&void 0!==o?o:[]){const g=null!==(i=d.refunds.filter(P=>"Failed"!==P.state))&&void 0!==i?i:[],x=(0,U.summate)(g,"total");c+=d.amount-x}return n.totalWithTax-c}addManualPayment(n){const t=n.state;this.modalService.fromComponent(V,{closable:!0,locals:{outstandingAmount:this.outstandingPaymentAmount(n),currencyCode:n.currencyCode}}).pipe((0,h.w)(o=>o?this.dataService.order.addManualPaymentToOrder({orderId:this.id,transactionId:o.transactionId,method:o.method,metadata:o.metadata||{}}):j.E),(0,h.w)(({addManualPaymentToOrder:o})=>{switch(o.__typename){case"Order":return this.notificationService.success((0,_.J)("order.add-payment-to-order-success")),"ArrangingAdditionalPayment"===t?this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates):this.dataService.order.transitionToState(this.id,"PaymentSettled").pipe((0,Le.h)("PaymentSettled"));case"ManualPaymentStateError":return this.notificationService.error(o.message),j.E;default:return j.E}})).subscribe(o=>{o&&this.refetchOrder({result:o})})}fulfillOrder(){this.entity$.pipe((0,Ce.q)(1),(0,h.w)(n=>this.modalService.fromComponent(W,{size:"xl",locals:{order:n}})),(0,h.w)(n=>n?this.dataService.order.createFulfillment(n):(0,q.of)(void 0)),(0,h.w)(n=>this.refetchOrder(n).pipe((0,Le.h)(n)))).subscribe(n=>{if(n){const{addFulfillmentToOrder:t}=n;switch(t.__typename){case"Fulfillment":this.notificationService.success((0,_.J)("order.create-fulfillment-success"));break;case"EmptyOrderLineSelectionError":case"InsufficientStockOnHandError":case"ItemsAlreadyFulfilledError":case"InvalidFulfillmentHandlerError":this.notificationService.error(t.message);break;case"FulfillmentStateTransitionError":this.notificationService.error(t.transitionError);break;case"CreateFulfillmentError":this.notificationService.error(t.fulfillmentHandlerError);break;case void 0:this.notificationService.error(JSON.stringify(t));break;default:(0,U.assertNever)(t)}}})}transitionFulfillment(n,t){this.dataService.order.transitionFulfillmentToState(n,t).pipe((0,h.w)(o=>this.refetchOrder(o))).subscribe(()=>{this.notificationService.success((0,_.J)("order.successfully-updated-fulfillment"))})}cancelOrRefund(n){const t=this.orderHasSettledPayments(n);"PaymentAuthorized"!==n.state&&!0!==n.active&&t?this.refundOrder(n):this.cancelOrder(n)}settleRefund(n){this.modalService.fromComponent(le,{size:"md",locals:{refund:n}}).pipe((0,h.w)(t=>t?this.dataService.order.settleRefund({transactionId:t,id:n.id},this.id):(0,q.of)(void 0))).subscribe(t=>{t&&this.notificationService.success((0,_.J)("order.settle-refund-success"))})}addNote(n){const{note:t,isPublic:o}=n;this.dataService.order.addNoteToOrder({id:this.id,note:t,isPublic:o}).pipe((0,h.w)(i=>this.refetchOrder(i))).subscribe(i=>{this.notificationService.success((0,_.J)("common.notify-create-success"),{entity:"Note"})})}updateNote(n){this.modalService.fromComponent(u.UlA,{closable:!0,locals:{displayPrivacyControls:!0,note:n.data.note,noteIsPrivate:!n.isPublic}}).pipe((0,h.w)(t=>t?this.dataService.order.updateOrderNote({noteId:n.id,isPublic:!t.isPrivate,note:t.note}):j.E)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,_.J)("common.notify-update-success"),{entity:"Note"})})}deleteNote(n){return this.modalService.dialog({title:(0,_.J)("common.confirm-delete-note"),body:n.data.note,buttons:[{type:"secondary",label:(0,_.J)("common.cancel")},{type:"danger",label:(0,_.J)("common.delete"),returnValue:!0}]}).pipe((0,h.w)(t=>t?this.dataService.order.deleteOrderNote(n.id):j.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,_.J)("common.notify-delete-success"),{entity:"Note"})})}orderHasSettledPayments(n){var t;return!!(null===(t=n.payments)||void 0===t?void 0:t.find(o=>"Settled"===o.state))}cancelOrder(n){this.modalService.fromComponent(B,{size:"xl",locals:{order:n}}).pipe((0,h.w)(t=>t?this.dataService.order.cancelOrder(t):(0,q.of)(void 0)),(0,h.w)(t=>this.refetchOrder(t))).subscribe(t=>{t&&this.notificationService.success((0,_.J)("order.cancelled-order-success"))})}refundOrder(n){this.modalService.fromComponent(ie,{size:"xl",locals:{order:n}}).pipe((0,h.w)(t=>{var o;return t?(null===(o=t.cancel.lines)||void 0===o?void 0:o.length)?this.dataService.order.cancelOrder(t.cancel).pipe((0,F.U)(i=>{const l=i.cancelOrder;switch(l.__typename){case"Order":return this.refetchOrder(l).subscribe(),this.notificationService.success((0,_.J)("order.cancelled-order-success")),t;case"CancelActiveOrderError":case"QuantityTooGreatError":case"MultipleOrderError":case"OrderStateTransitionError":case"EmptyOrderLineSelectionError":return void this.notificationService.error(l.message)}})):[t]:(0,q.of)(void 0)}),(0,h.w)(t=>t?t.refund.lines.length?this.dataService.order.refundOrder(t.refund).pipe((0,F.U)(o=>o.refundOrder)):[void 0]:(0,q.of)(void 0))).subscribe(t=>{if(t)switch(t.__typename){case"Refund":this.refetchOrder(t).subscribe(),"Failed"===t.state?this.notificationService.error((0,_.J)("order.refund-order-failed")):this.notificationService.success((0,_.J)("order.refund-order-success"));break;case"AlreadyRefundedError":case"NothingToRefundError":case"PaymentOrderMismatchError":case"RefundOrderStateError":case"RefundStateTransitionError":this.notificationService.error(t.message)}})}refetchOrder(n){return this.fetchHistory.next(),n?this.dataService.order.getOrder(this.id).single$:(0,q.of)(void 0)}setFormValues(n){}}pe.\u0275fac=function(n){return new(n||pe)(e.Y36(y.F0),e.Y36(y.gz),e.Y36(u.iHG),e.Y36(e.sBO),e.Y36(u.DoR),e.Y36(u.gqp),e.Y36(u.Z7U),e.Y36(w))},pe.\u0275cmp=e.Xpm({type:pe,selectors:[["vdr-order-detail"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"icon-button",3,"title","click"],["shape","list"],["locationId","order-detail"],["class","btn btn-primary",3,"click",4,"ngIf"],[1,"btn","btn-primary",3,"disabled","click"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","class","btn","vdrDropdownItem","",3,"click",4,"ngIf"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],["shape","step-forward-2",1,"is-warning"],[1,"btn","btn-primary",3,"click"],["shape","pencil"],["shape","error-standard",1,"is-error"],[4,"ngIf","ngIfElse"],["cancelOnly",""],["type","button","class","btn","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["shape","step-forward-2"],[1,"clr-row"],[1,"clr-col-lg-8"],[3,"order","orderLineCustomFields"],[1,"table"],[4,"ngFor","ngForOf"],["locationId","order-detail",3,"entity$","detailForm"],[3,"order","history","addNote","updateNote","deleteNote"],[1,"clr-col-lg-4","order-cards"],[3,"customFieldsConfig","customFieldValues","updateClick"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text"],[3,"customer"],[3,"address"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund",4,"ngFor","ngForOf"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund"],[3,"fulfillment","order","transitionState"]],template:function(n,t){1&n&&(e.YNc(0,to,29,21,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,co,42,36,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[p.O5,O.Kk,O.BN,Ge.V,Fe.G,m.qvL,O.mz,Xe.W,D.J,k.U,E.N,ve.H,p.sg,H,Bn.C,ce,te,tt.d,je.b,ue,z],pipes:[p.Ov,f.X$,v.k,Z.N,p.Zx],styles:[".shipping-address[_ngcontent-%COMP%]{list-style-type:none;line-height:1.3em}.order-cards[_ngcontent-%COMP%] h6[_ngcontent-%COMP%]{margin-top:6px;color:var(--color-text-200)}"],changeDetection:0});var b,r,so=s(9319),ye=s(8951),nt=s(8977),uo=s(9196);function po(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.confirm-modifications"))}function mo(r,n){if(1&r&&(e.TgZ(0,"option",9),e._uU(1),e.ALo(2,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw(2);e.Q6J("ngValue",t),e.xp6(1),e.lnq(" #",t.id," ",t.method,": ",e.xi3(2,4,t.amount,o.order.currencyCode)," ")}}function _o(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"clr-select-container")(2,"label"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"select",5),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().selectedPayment=i}),e.YNc(6,mo,3,7,"option",6),e.qZA()(),e.TgZ(7,"label",7),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"textarea",8),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().refundNote=i}),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,5,"order.payment-to-refund")),e.xp6(2),e.Q6J("ngModel",t.selectedPayment),e.xp6(1),e.Q6J("ngForOf",t.order.payments),e.xp6(2),e.Oqu(e.lcZ(9,7,"order.refund-cancellation-reason")),e.xp6(2),e.Q6J("ngModel",t.refundNote)}}function go(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.priceDifference<0&&!t.selectedPayment),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.confirm")," ")}}(r=b||(b={}))[r.Refund=0]="Refund",r[r.Payment=1]="Payment",r[r.PriceUnchanged=2]="PriceUnchanged",r[r.Cancel=3]="Cancel";class me{get priceDifference(){return this.order.totalWithTax-this.originalTotalWithTax}ngOnInit(){this.refundNote=this.modifyOrderInput.note||""}cancel(){this.resolveWith({result:b.Cancel})}submit(){0<this.priceDifference?this.resolveWith({result:b.Payment}):this.priceDifference<0?this.resolveWith({result:b.Refund,refundPaymentId:this.selectedPayment.id,refundNote:this.refundNote}):this.resolveWith({result:b.PriceUnchanged})}}me.\u0275fac=function(n){return new(n||me)},me.\u0275cmp=e.Xpm({type:me,selectors:[["vdr-order-edits-preview-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[3,"order","orderLineCustomFields"],[1,"h4"],[4,"ngIf"],["vdrDialogButtons",""],["clrSelect","","name","options",3,"ngModel","ngModelChange"],[3,"ngValue",4,"ngFor","ngForOf"],[1,"clr-control-label"],["name","refundNote","clrTextarea","","required","",3,"ngModel","ngModelChange"],[3,"ngValue"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,po,2,3,"ng-template",0),e._UZ(1,"vdr-order-table",1),e.TgZ(2,"h4",2),e._uU(3),e.ALo(4,"translate"),e.TgZ(5,"strong"),e._uU(6),e.ALo(7,"localeCurrency"),e.qZA()(),e.YNc(8,_o,11,9,"div",3),e.YNc(9,go,6,7,"ng-template",4)),2&n&&(e.xp6(1),e.Q6J("order",t.order)("orderLineCustomFields",t.orderLineCustomFields),e.xp6(2),e.hij(" ",e.lcZ(4,5,"order.modify-order-price-difference"),": "),e.xp6(3),e.Oqu(e.xi3(7,7,t.priceDifference,t.order.currencyCode)),e.xp6(2),e.Q6J("ngIf",t.priceDifference<0))},directives:[T.q,H,p.O5,m.dTv,m.MgK,C.y,a.EJ,m.otW,a.JJ,a.On,p.sg,a.YN,a.Kr,a.Fj,m.XE5,a.Q7,J.n],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var fo=s(5983),ho=s(7122),xo=s(1480);function vo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e._UZ(5,"vdr-order-state-label",3),e.qZA()(),e.TgZ(6,"vdr-ab-right")(7,"button",4),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().transitionToPriorState(l)}),e._uU(8),e.ALo(9,"translate"),e.qZA()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("entity",e.lcZ(4,3,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(3),e.hij(" ",e.lcZ(9,5,"order.cancel-modification")," ")}}function Co(r,n){1&r&&(e.TgZ(0,"th"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.custom-fields")))}function yo(r,n){if(1&r&&(e._UZ(0,"img",41),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}const rt=function(r){return[r]};function Zo(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",44),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(2).index,i=e.oxw(2);e.xp6(1),e.Q6J("customField",t)("customFieldsFormGroup",i.orderLineCustomFieldsFormArray.get(e.VKq(3,rt,o)))("compact",!0)}}function Oo(r,n){if(1&r&&(e.TgZ(0,"td",42),e.YNc(1,Zo,2,5,"ng-container",43),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function bo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",29)(1,"td",30),e.YNc(2,yo,2,4,"img",31),e.qZA(),e.TgZ(3,"td",32),e._uU(4),e.qZA(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e.TgZ(7,"td",34),e._uU(8),e.ALo(9,"localeCurrency"),e.TgZ(10,"div",16),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.TgZ(14,"td",35)(15,"input",36),e.NdJ("input",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).updateLineQuantity(c,i.target.value)}),e.qZA(),e._UZ(16,"vdr-line-refunds",37)(17,"vdr-line-fulfillment",38),e.qZA(),e.YNc(18,Oo,2,1,"td",39),e.TgZ(19,"td",40),e._uU(20),e.ALo(21,"localeCurrency"),e.TgZ(22,"div",16),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"localeCurrency"),e.qZA()()()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.ekj("is-cancelled",0===t.quantity)("modified",i.isLineModified(t)),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",e.xi3(9,19,t.unitPriceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(11,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(13,24,t.unitPrice,o.currencyCode)," "),e.xp6(3),e.Q6J("value",t.quantity),e.xp6(1),e.Q6J("line",t)("payments",o.payments),e.xp6(1),e.Q6J("line",t)("orderState",o.state),e.xp6(1),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(21,27,t.linePriceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,30,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,32,t.linePrice,o.currencyCode)," ")}}function To(r,n){if(1&r&&(e._UZ(0,"img",41),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.productAsset,"tiny"),e.LSH)}}function Ao(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",44),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(2).index,i=e.oxw(2);e.xp6(1),e.Q6J("customField",t)("customFieldsFormGroup",i.addItemCustomFieldsFormArray.get(e.VKq(3,rt,o)))("compact",!0)}}function Lo(r,n){if(1&r&&(e.TgZ(0,"td",42),e.YNc(1,Ao,2,5,"ng-container",43),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function Io(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",45)(1,"td",30),e.YNc(2,To,2,4,"img",31),e.qZA(),e.TgZ(3,"td",32),e._uU(4),e.qZA(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e.TgZ(7,"td",34),e._uU(8),e.ALo(9,"localeCurrency"),e.TgZ(10,"div",16),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.TgZ(14,"td",35)(15,"input",36),e.NdJ("input",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).updateAddedItemQuantity(c,i.target.value)}),e.qZA(),e.TgZ(16,"button",46),e.NdJ("click",function(){const l=e.CHM(t).index;return e.oxw(2).removeAddedItem(l)}),e._UZ(17,"clr-icon",47),e.qZA()(),e.YNc(18,Lo,2,1,"td",39),e.TgZ(19,"td",40),e._uU(20),e.ALo(21,"currency"),e.TgZ(22,"div",16),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"currency"),e.qZA()()()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Q6J("ngIf",t.productAsset),e.xp6(2),e.Oqu(t.productVariantName),e.xp6(2),e.Oqu(t.sku),e.xp6(2),e.hij(" ",e.xi3(9,11,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(11,14,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(13,16,t.price,o.currencyCode)," "),e.xp6(3),e.Q6J("value",t.quantity),e.xp6(3),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(21,19,t.priceWithTax*t.quantity/100,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,24,t.price*t.quantity/100,o.currencyCode)," ")}}function qo(r,n){1&r&&e._UZ(0,"td")}function Fo(r,n){if(1&r&&(e.TgZ(0,"tr",48)(1,"td",49),e._uU(2),e.qZA(),e.TgZ(3,"td",33),e._uU(4),e.qZA(),e._UZ(5,"td",50)(6,"td"),e.YNc(7,qo,1,0,"td",0),e.TgZ(8,"td",40),e._uU(9),e.ALo(10,"localeCurrency"),e.TgZ(11,"div",16),e.ALo(12,"translate"),e._uU(13),e.ALo(14,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(t.sku),e.xp6(3),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(10,6,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(12,9,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(14,11,t.price,o.currencyCode)," ")}}function wo(r,n){1&r&&e._UZ(0,"td")}function Mo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"localeCurrency"),e.TgZ(3,"div",16),e.ALo(4,"translate"),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(2).ngIf;e.xp6(1),e.hij(" ",e.xi3(2,3,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(4,6,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(6,8,t.price,o.currencyCode)," ")}}function Po(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",51)(1,"td",49),e._uU(2),e.TgZ(3,"button",46),e.NdJ("click",function(){const l=e.CHM(t).index;return e.oxw(2).removeSurcharge(l)}),e._UZ(4,"clr-icon",47),e.qZA()(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e._UZ(7,"td",50)(8,"td"),e.YNc(9,wo,1,0,"td",0),e.TgZ(10,"td",40),e.YNc(11,Mo,7,11,"ng-container",0),e.qZA()()}if(2&r){const t=n.$implicit,o=e.oxw(2);e.xp6(2),e.hij(" ",t.description," "),e.xp6(4),e.Oqu(t.sku),e.xp6(3),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.Q6J("ngIf",o.getSurchargePrices(t))}}function So(r,n){1&r&&e._UZ(0,"td")}function No(r,n){if(1&r&&(e._UZ(0,"img",58),e.ALo(1,"assetPreview")),2&r){const t=n.ngIf;e.Q6J("src",e.xi3(1,1,t,"tiny"),e.LSH)}}function Jo(r,n){if(1&r&&(e.TgZ(0,"div",55),e.YNc(1,No,2,4,"img",56),e.TgZ(2,"div")(3,"strong",57),e._uU(4),e.qZA(),e.TgZ(5,"small"),e._uU(6),e.qZA(),e.TgZ(7,"div"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA()()()),2&r){const t=e.oxw(2).ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.addItemSelectedVariant.productAsset),e.xp6(3),e.Oqu(o.addItemSelectedVariant.productVariantName),e.xp6(2),e.Oqu(o.addItemSelectedVariant.sku),e.xp6(2),e.hij(" ",e.xi3(9,4,o.getSelectedItemPrice(o.addItemSelectedVariant),t.currencyCode)," ")}}function Uo(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",59),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(3);e.xp6(1),e.Q6J("readonly",!o.addItemSelectedVariant)("customField",t)("customFieldsFormGroup",o.addItemCustomFieldsForm)("compact",!0)}}function Qo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"vdr-product-variant-selector",52),e.NdJ("productSelected",function(i){e.CHM(t);return e.oxw(2).addItemSelectedVariant=i}),e.qZA(),e.YNc(2,Jo,10,7,"div",53),e.YNc(3,Uo,2,4,"ng-container",43),e.TgZ(4,"button",54),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.addItemToOrder(i.addItemSelectedVariant)}),e._uU(5),e.ALo(6,"translate"),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(2),e.Q6J("ngIf",t.addItemSelectedVariant),e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields),e.xp6(1),e.Q6J("disabled",!t.addItemSelectedVariant||t.addItemCustomFieldsForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(6,4,"order.add-item-to-order")," ")}}function Do(r,n){if(1&r&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA(),e._uU(2)),2&r){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(1),e.hij(" ",t.promotionName," ")}}function ko(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content")(1,"ng-select",60),e.ALo(2,"async"),e.YNc(3,Do,3,2,"ng-template",61),e.qZA()()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("items",e.lcZ(2,7,t.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",t.couponCodeInput$)("formControl",t.couponCodesControl)}}const Eo=function(r){return{rate:r}};function Yo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"form",62),e.NdJ("submit",function(){e.CHM(t);const i=e.oxw(2);return i.addSurcharge(i.surchargeForm.value)}),e.TgZ(2,"vdr-form-field",63),e.ALo(3,"translate"),e._UZ(4,"input",64),e.qZA(),e.TgZ(5,"vdr-form-field",65),e.ALo(6,"translate"),e._UZ(7,"input",66),e.qZA(),e.TgZ(8,"vdr-form-field",67),e.ALo(9,"translate"),e._UZ(10,"vdr-currency-input",68),e.qZA(),e.TgZ(11,"vdr-form-field",69),e.ALo(12,"translate"),e._UZ(13,"input",70),e.qZA(),e.TgZ(14,"vdr-form-field",71),e.ALo(15,"translate"),e.TgZ(16,"vdr-affixed-input",72),e._UZ(17,"input",73),e.qZA()(),e.TgZ(18,"vdr-form-field",74),e.ALo(19,"translate"),e._UZ(20,"input",75),e.qZA(),e.TgZ(21,"button",76),e._uU(22),e.ALo(23,"translate"),e.qZA()()()}if(2&r){const t=e.oxw().ngIf,o=e.oxw();let i,l;e.xp6(1),e.Q6J("formGroup",o.surchargeForm),e.xp6(1),e.Q6J("label",e.lcZ(3,10,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(6,12,"order.product-sku")),e.xp6(3),e.Q6J("label",e.lcZ(9,14,"common.price")),e.xp6(2),e.Q6J("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("label",e.xi3(12,16,"catalog.price-includes-tax-at",e.VKq(25,Eo,null==(i=o.surchargeForm.get("taxRate"))?null:i.value))),e.xp6(3),e.Q6J("label",e.lcZ(15,19,"order.tax-rate")),e.xp6(4),e.Q6J("label",e.lcZ(19,21,"order.tax-description")),e.xp6(3),e.Q6J("disabled",o.surchargeForm.invalid||o.surchargeForm.pristine||0===(null==(l=o.surchargeForm.get("price"))?null:l.value)),e.xp6(1),e.hij(" ",e.lcZ(23,23,"order.add-surcharge")," ")}}function jo(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-address-form",77),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.shippingAddressForm)("availableCountries",e.lcZ(2,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function Ro(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-address-form",77),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.billingAddressForm)("availableCountries",e.lcZ(2,3,t.availableCountries$))("customFields",t.addressCustomFields)}}const we=function(r){return{count:r}};function Ho(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adding-items",e.VKq(4,we,null==t.modifyOrderInput.addItems?null:t.modifyOrderInput.addItems.length))," ")}}function $o(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adjusting-lines",e.VKq(4,we,null==t.modifyOrderInput.adjustOrderLines?null:t.modifyOrderInput.adjustOrderLines.length))," ")}}function Vo(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adding-surcharges",e.VKq(4,we,null==t.modifyOrderInput.surcharges?null:t.modifyOrderInput.surcharges.length))," ")}}function Bo(r,n){1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.modification-updating-shipping-address")," "))}function Wo(r,n){1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.modification-updating-billing-address")," "))}function Go(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",5)(2,"div",6)(3,"table",7)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.YNc(19,Co,3,3,"th",0),e.TgZ(20,"th"),e._uU(21),e.ALo(22,"translate"),e.qZA()()(),e.TgZ(23,"tbody"),e.YNc(24,bo,26,35,"tr",8),e.YNc(25,Io,26,27,"tr",9),e.YNc(26,Fo,15,14,"tr",10),e.YNc(27,Po,12,4,"tr",11),e.TgZ(28,"tr",12)(29,"td",13),e._uU(30),e.ALo(31,"translate"),e.qZA(),e.TgZ(32,"td",14),e._uU(33),e.qZA(),e._UZ(34,"td",15),e.YNc(35,So,1,0,"td",0),e.TgZ(36,"td",14),e._uU(37),e.ALo(38,"localeCurrency"),e.TgZ(39,"div",16),e.ALo(40,"translate"),e._uU(41),e.ALo(42,"localeCurrency"),e.qZA()()()()(),e.TgZ(43,"h4",17),e._uU(44),e.ALo(45,"translate"),e.qZA(),e.TgZ(46,"clr-accordion")(47,"clr-accordion-panel")(48,"clr-accordion-title"),e._uU(49),e.ALo(50,"translate"),e.qZA(),e.YNc(51,Qo,7,6,"clr-accordion-content",18),e.qZA(),e.TgZ(52,"clr-accordion-panel")(53,"clr-accordion-title"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.YNc(56,ko,4,9,"clr-accordion-content",18),e.qZA(),e.TgZ(57,"clr-accordion-panel")(58,"clr-accordion-title"),e._uU(59),e.ALo(60,"translate"),e.qZA(),e.YNc(61,Yo,24,27,"clr-accordion-content",18),e.qZA(),e.TgZ(62,"clr-accordion-panel")(63,"clr-accordion-title"),e._uU(64),e.ALo(65,"translate"),e.qZA(),e.YNc(66,jo,3,5,"clr-accordion-content",18),e.qZA(),e.TgZ(67,"clr-accordion-panel")(68,"clr-accordion-title"),e._uU(69),e.ALo(70,"translate"),e.qZA(),e.YNc(71,Ro,3,5,"clr-accordion-content",18),e.qZA()()(),e.TgZ(72,"div",19)(73,"div",20)(74,"div",21),e._uU(75),e.ALo(76,"translate"),e.qZA(),e.TgZ(77,"div",22)(78,"ul"),e.YNc(79,Ho,3,6,"li",0),e.YNc(80,$o,3,6,"li",0),e.YNc(81,Vo,3,6,"li",0),e.YNc(82,Bo,3,3,"li",0),e.YNc(83,Wo,3,3,"li",0),e.qZA()(),e.TgZ(84,"div",22)(85,"label",23),e._uU(86),e.ALo(87,"translate"),e.qZA(),e.TgZ(88,"textarea",24),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().note=i}),e.qZA(),e.TgZ(89,"clr-checkbox-wrapper",25)(90,"input",26),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().recalculateShipping=i}),e.qZA(),e.TgZ(91,"label"),e._uU(92),e.ALo(93,"translate"),e.qZA()()(),e.TgZ(94,"div",27)(95,"button",28),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().previewAndModify(l)}),e._uU(96),e.ALo(97,"translate"),e.qZA()()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(8),e.Oqu(e.lcZ(9,35,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,37,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,39,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(18,41,"order.quantity")),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.Oqu(e.lcZ(22,43,"order.total")),e.xp6(3),e.Q6J("ngForOf",t.lines),e.xp6(1),e.Q6J("ngForOf",o.addedLines)("ngForTrackBy",o.trackByProductVariantId),e.xp6(1),e.Q6J("ngForOf",t.surcharges),e.xp6(1),e.Q6J("ngForOf",o.modifyOrderInput.surcharges),e.xp6(3),e.Oqu(e.lcZ(31,45,"order.shipping")),e.xp6(3),e.Oqu(null==t.shippingLines[0]||null==t.shippingLines[0].shippingMethod?null:t.shippingLines[0].shippingMethod.name),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(38,47,t.shippingWithTax,t.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(40,50,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(42,52,t.shipping,t.currencyCode)," "),e.xp6(3),e.Oqu(e.lcZ(45,55,"order.modifications")),e.xp6(5),e.Oqu(e.lcZ(50,57,"order.add-item-to-order")),e.xp6(5),e.Oqu(e.lcZ(55,59,"order.set-coupon-codes")),e.xp6(5),e.Oqu(e.lcZ(60,61,"order.add-surcharge")),e.xp6(5),e.Oqu(e.lcZ(65,63,"order.edit-shipping-address")),e.xp6(5),e.Oqu(e.lcZ(70,65,"order.edit-billing-address")),e.xp6(6),e.hij(" ",e.lcZ(76,67,"order.modification-summary")," "),e.xp6(4),e.Q6J("ngIf",null==o.modifyOrderInput.addItems?null:o.modifyOrderInput.addItems.length),e.xp6(1),e.Q6J("ngIf",null==o.modifyOrderInput.adjustOrderLines?null:o.modifyOrderInput.adjustOrderLines.length),e.xp6(1),e.Q6J("ngIf",null==o.modifyOrderInput.surcharges?null:o.modifyOrderInput.surcharges.length),e.xp6(1),e.Q6J("ngIf",o.shippingAddressForm.dirty),e.xp6(1),e.Q6J("ngIf",o.billingAddressForm.dirty),e.xp6(3),e.Oqu(e.lcZ(87,69,"order.note")),e.xp6(2),e.Q6J("ngModel",o.note),e.xp6(2),e.Q6J("ngModel",o.recalculateShipping),e.xp6(2),e.Oqu(e.lcZ(93,71,"order.modification-recalculate-shipping")),e.xp6(3),e.Q6J("disabled",!o.canPreviewChanges()),e.xp6(1),e.hij(" ",e.lcZ(97,73,"order.preview-changes")," ")}}class _e extends u.UT_{constructor(n,t,o,i,l,c,d,g){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=d,this.orderTransitionService=g,this.couponCodeInput$=new Ae.x,this.detailForm=new a.cw({}),this.couponCodesControl=new a.NI,this.modifyOrderInput={dryRun:!0,orderId:"",addItems:[],adjustOrderLines:[],surcharges:[],note:"",updateShippingAddress:{},updateBillingAddress:{}},this.note="",this.recalculateShipping=!0,this.addedVariants=new Map}get addedLines(){const n=t=>"SinglePrice"===t.__typename?t.value:0;return(this.modifyOrderInput.addItems||[]).map(t=>{const o=this.addedVariants.get(t.productVariantId);if(o)return Object.assign(Object.assign({},o),{price:n(o.price),priceWithTax:n(o.priceWithTax),quantity:t.quantity})}).filter(U.notNullOrUndefined)}ngOnInit(){this.init(),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.modifyOrderInput.orderId=this.route.snapshot.paramMap.get("id"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.entity$.pipe((0,ye.R)(this.destroy$)).subscribe(n=>{var t,o,i,l,c,d,g,x,P,S,N,Pe,Se,Ne,Je,Ue,Qe,De;n.couponCodes.length&&this.couponCodesControl.setValue(n.couponCodes),this.surchargeForm=new a.cw({description:new a.NI("",a.kI.required),sku:new a.NI(""),price:new a.NI(0,a.kI.required),priceIncludesTax:new a.NI(!0),taxRate:new a.NI(0),taxDescription:new a.NI("")}),this.shippingAddressForm||(this.shippingAddressForm=new a.cw({fullName:new a.NI(null===(t=n.shippingAddress)||void 0===t?void 0:t.fullName),company:new a.NI(null===(o=n.shippingAddress)||void 0===o?void 0:o.company),streetLine1:new a.NI(null===(i=n.shippingAddress)||void 0===i?void 0:i.streetLine1),streetLine2:new a.NI(null===(l=n.shippingAddress)||void 0===l?void 0:l.streetLine2),city:new a.NI(null===(c=n.shippingAddress)||void 0===c?void 0:c.city),province:new a.NI(null===(d=n.shippingAddress)||void 0===d?void 0:d.province),postalCode:new a.NI(null===(g=n.shippingAddress)||void 0===g?void 0:g.postalCode),countryCode:new a.NI(null===(x=n.shippingAddress)||void 0===x?void 0:x.countryCode),phoneNumber:new a.NI(null===(P=n.shippingAddress)||void 0===P?void 0:P.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.shippingAddressForm,n.shippingAddress)),this.billingAddressForm||(this.billingAddressForm=new a.cw({fullName:new a.NI(null===(S=n.billingAddress)||void 0===S?void 0:S.fullName),company:new a.NI(null===(N=n.billingAddress)||void 0===N?void 0:N.company),streetLine1:new a.NI(null===(Pe=n.billingAddress)||void 0===Pe?void 0:Pe.streetLine1),streetLine2:new a.NI(null===(Se=n.billingAddress)||void 0===Se?void 0:Se.streetLine2),city:new a.NI(null===(Ne=n.billingAddress)||void 0===Ne?void 0:Ne.city),province:new a.NI(null===(Je=n.billingAddress)||void 0===Je?void 0:Je.province),postalCode:new a.NI(null===(Ue=n.billingAddress)||void 0===Ue?void 0:Ue.postalCode),countryCode:new a.NI(null===(Qe=n.billingAddress)||void 0===Qe?void 0:Qe.countryCode),phoneNumber:new a.NI(null===(De=n.billingAddress)||void 0===De?void 0:De.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.billingAddressForm,n.billingAddress)),this.orderLineCustomFieldsFormArray=new a.Oe([]);for(const Ze of n.lines){const ke=new a.cw({});for(const{name:Oe}of this.orderLineCustomFields)ke.addControl(Oe,new a.NI(Ze.customFields[Oe]));ke.valueChanges.pipe((0,ye.R)(this.destroy$)).subscribe(Oe=>{let be=this.modifyOrderInput.adjustOrderLines.find(si=>si.orderLineId===Ze.id);be||(be={orderLineId:Ze.id,quantity:Ze.quantity},this.modifyOrderInput.adjustOrderLines.push(be)),this.orderLineCustomFields.length&&(be.customFields=Oe)}),this.orderLineCustomFieldsFormArray.push(ke)}}),this.availableCouponCodes$=(0,so.z)(this.couponCodeInput$.pipe((0,nt.x)(),(0,h.w)(n=>this.dataService.promotion.getPromotions(10,0,{couponCode:{contains:n}}).single$),(0,F.U)(({promotions:n})=>n.items.map(t=>({code:t.couponCode,promotionName:t.name}))),(0,$e.O)([]))),this.addItemCustomFieldsFormArray=new a.Oe([]),this.addItemCustomFieldsForm=new a.cw({});for(const n of this.orderLineCustomFields)this.addItemCustomFieldsForm.addControl(n.name,new a.NI);this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(n=>n.countries.items).pipe((0,uo.d)(1)),this.dataService.order.getOrderHistory(this.id,{take:1,sort:{createdAt:u.Asd.DESC},filter:{type:{eq:u.iYD.ORDER_STATE_TRANSITION}}}).single$.subscribe(({order:n})=>{this.previousState=null==n?void 0:n.history.items[0].data.from})}ngOnDestroy(){this.destroy()}transitionToPriorState(n){this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates).subscribe(t=>{this.router.navigate([".."],{relativeTo:this.route})})}canPreviewChanges(){const{addItems:n,adjustOrderLines:t,surcharges:o}=this.modifyOrderInput;return!!(null==n?void 0:n.length)||!!(null==o?void 0:o.length)||!!(null==t?void 0:t.length)||this.shippingAddressForm.dirty&&this.shippingAddressForm.valid||this.billingAddressForm.dirty&&this.billingAddressForm.valid||this.couponCodesControl.dirty}isLineModified(n){var t;return!!(null===(t=this.modifyOrderInput.adjustOrderLines)||void 0===t?void 0:t.find(o=>o.orderLineId===n.id&&o.quantity!==n.quantity))}updateLineQuantity(n,t){const{adjustOrderLines:o}=this.modifyOrderInput;let i=null==o?void 0:o.find(l=>l.orderLineId===n.id);i&&+t===n.quantity&&(null==o||o.splice(null==o?void 0:o.indexOf(i),1)),i||(i={orderLineId:n.id,quantity:+t},null==o||o.push(i)),i.quantity=+t}updateAddedItemQuantity(n,t){var o;const i=null===(o=this.modifyOrderInput.addItems)||void 0===o?void 0:o.find(l=>l.productVariantId===n.productVariantId);i&&(i.quantity=+t)}trackByProductVariantId(n,t){return t.productVariantId}getSelectedItemPrice(n){return"SinglePrice"===(null==n?void 0:n.priceWithTax.__typename)?n.priceWithTax.value:0}addItemToOrder(n){var t,o;if(!n)return;const i=this.orderLineCustomFields.length?this.addItemCustomFieldsForm.value:void 0;let l=null===(t=this.modifyOrderInput.addItems)||void 0===t?void 0:t.find(c=>this.isMatchingAddItemRow(c,n,i));if(l?l.quantity++:(l={productVariantId:n.productVariantId,quantity:1},i&&(l.customFields=i),null===(o=this.modifyOrderInput.addItems)||void 0===o||o.push(l)),i){const c=new a.cw({});for(const[d,g]of Object.entries(i))c.addControl(d,new a.NI(g));this.addItemCustomFieldsFormArray.push(c),c.valueChanges.pipe((0,ye.R)(this.destroy$)).subscribe(d=>{l&&(l.customFields=d)})}this.addItemCustomFieldsForm.reset({}),this.addItemSelectedVariant=void 0,this.addedVariants.set(n.productVariantId,n)}isMatchingAddItemRow(n,t,o){return n.productVariantId===t.productVariantId&&JSON.stringify(n.customFields)===JSON.stringify(o)}removeAddedItem(n){this.modifyOrderInput.addItems.splice(n,1),-1<n&&this.addItemCustomFieldsFormArray.removeAt(n)}getSurchargePrices(n){const t=n.priceIncludesTax?n.price:Math.round(n.price*((100+(n.taxRate||0))/100));return{price:n.priceIncludesTax?Math.round(n.price/((100+(n.taxRate||0))/100)):n.price,priceWithTax:t}}addSurcharge(n){var t;null===(t=this.modifyOrderInput.surcharges)||void 0===t||t.push(n),this.surchargeForm.reset({price:0,priceIncludesTax:!0,taxRate:0})}removeSurcharge(n){var t;null===(t=this.modifyOrderInput.surcharges)||void 0===t||t.splice(n,1)}previewAndModify(n){var t;const o=Object.assign(Object.assign(Object.assign(Object.assign({},this.modifyOrderInput),this.billingAddressForm.dirty?{updateBillingAddress:this.billingAddressForm.value}:{}),this.shippingAddressForm.dirty?{updateShippingAddress:this.shippingAddressForm.value}:{}),{dryRun:!0,couponCodes:this.couponCodesControl.dirty?this.couponCodesControl.value:void 0,note:null!==(t=this.note)&&void 0!==t?t:"",options:{recalculateShipping:this.recalculateShipping}}),i=n.totalWithTax;this.dataService.order.modifyOrder(o).pipe((0,h.w)(({modifyOrder:l})=>{switch(l.__typename){case"Order":return this.modalService.fromComponent(me,{size:"xl",closable:!1,locals:{originalTotalWithTax:i,order:l,orderLineCustomFields:this.orderLineCustomFields,modifyOrderInput:o}});case"InsufficientStockError":case"NegativeQuantityError":case"NoChangesSpecifiedError":case"OrderLimitError":case"OrderModificationStateError":case"PaymentMethodMissingError":case"RefundPaymentIdMissingError":case"CouponCodeLimitError":case"CouponCodeExpiredError":case"CouponCodeInvalidError":return this.notificationService.error(l.message),(0,q.of)(!1);case null:case void 0:return(0,q.of)(!1);default:(0,U.assertNever)(l)}}),(0,h.w)(l=>{if(!l||l.result===b.Cancel)return this.dataService.order.getOrder(this.id).mapSingle(()=>!1);{const c=Object.assign(Object.assign({},o),{dryRun:!1});return l.result===b.Refund&&(c.refund={paymentId:l.refundPaymentId,reason:l.refundNote}),this.dataService.order.modifyOrder(c).pipe((0,h.w)(({modifyOrder:d})=>{if("Order"===d.__typename){const x=0<d.totalWithTax-i?"ArrangingAdditionalPayment":this.previousState;return this.dataService.order.transitionToState(n.id,x).pipe((0,Le.h)(!0))}return this.notificationService.error(d.message),j.E}))}})).subscribe(l=>{l&&this.router.navigate(["../"],{relativeTo:this.route})})}addAddressCustomFieldsFormGroup(n,t){var o;if(t&&this.addressCustomFields.length){const i=new a.cw({});for(const l of this.addressCustomFields){const c=l.name,d=null===(o=t.customFields)||void 0===o?void 0:o[c];i.addControl(c,new a.NI(d))}n.addControl("customFields",i)}}setFormValues(n,t){}}_e.\u0275fac=function(n){return new(n||_e)(e.Y36(y.F0),e.Y36(y.gz),e.Y36(u.iHG),e.Y36(e.sBO),e.Y36(u.DoR),e.Y36(u.gqp),e.Y36(u.Z7U),e.Y36(w))},_e.\u0275cmp=e.Xpm({type:_e,selectors:[["vdr-order-editor"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"btn","btn-secondary",3,"click"],[1,"clr-row"],[1,"clr-col-lg-8"],[1,"order-table","table"],["class","order-line",3,"is-cancelled","modified",4,"ngFor","ngForOf"],["class","modified",4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],["class","surcharge modified",4,"ngFor","ngForOf"],[1,"shipping"],[1,"left","clr-align-middle"],[1,"clr-align-middle"],["colspan","3"],[1,"net-price",3,"title"],[1,"mb2"],[4,"clrIfExpanded"],[1,"clr-col-lg-4","order-cards"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"clr-control-label"],["name","note","clrTextarea","","required","",3,"ngModel","ngModelChange"],[1,""],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],[1,"card-footer"],[1,"btn","btn-primary",3,"disabled","click"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],["type","number","min","0",3,"value","input"],[3,"line","payments"],[3,"line","orderState"],["class","order-line-custom-field align-middle",4,"ngIf"],[1,"align-middle","total"],[3,"src"],[1,"order-line-custom-field","align-middle"],[4,"ngFor","ngForOf"],["entityName","OrderLine",3,"customField","customFieldsFormGroup","compact"],[1,"modified"],[1,"icon-button",3,"click"],["shape","trash"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle"],[1,"surcharge","modified"],[1,"mb4",3,"productSelected"],["class","flex mb4",4,"ngIf"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"flex","mb4"],["class","mr4",3,"src",4,"ngIf"],[1,"mr4"],[1,"mr4",3,"src"],["entityName","OrderLine",3,"readonly","customField","customFieldsFormGroup","compact"],["appendTo","body","bindLabel","code","bindValue","code","typeToSearchText","",3,"items","addTag","multiple","hideSelected","minTermLength","typeahead","formControl"],["ng-option-tmp",""],[3,"formGroup","submit"],["for","description",3,"label"],["id","description","type","text","formControlName","description"],["for","sku",3,"label"],["id","sku","type","text","formControlName","sku"],["for","price",3,"label"],["id","price","formControlName","price",3,"currencyCode"],["for","priceIncludesTax",3,"label"],["id","priceIncludesTax","type","checkbox","clrCheckbox","","formControlName","priceIncludesTax"],["for","taxRate",3,"label"],["suffix","%"],["id","taxRate","type","number","min","0","max","100","formControlName","taxRate"],["for","taxDescription",3,"label"],["id","taxDescription","type","text","formControlName","taxDescription"],[1,"btn","btn-secondary",3,"disabled"],[3,"formGroup","availableCountries","customFields"]],template:function(n,t){1&n&&(e.YNc(0,vo,10,7,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,Go,98,75,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[p.O5,O.Kk,O.BN,Ge.V,Fe.G,O.mz,p.sg,C.y,I,Y,Te.M,m.q0d,m.qvL,m.bZL,m.twP,m.GmI,m.dxz,m.UJ5,m.Nz$,m.DbV,m.r6y,fo.e,A.w9,a.JJ,a.oH,A.ir,G.Y,a._Y,a.JL,a.sg,Ye.h,a.Fj,a.u,Be.K,a.Wl,m.KKC,ho.K,a.qQ,a.Fd,a.wV,xo.C,m.MgK,m.XE5,a.Q7,a.On,m.PEh],pipes:[p.Ov,f.X$,he.M,v.k,p.H9],styles:[".order-table[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table[_ngcontent-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-right:18px}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table[_ngcontent-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}.order-table[_ngcontent-%COMP%] tr.modified[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}"],changeDetection:0});var ot=s(6646),Xo=s(116),Ko=s(6852),zo=s(365),ei=s(901),ti=s(8899),ni=s(6826);function ri(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",18),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).selectFilterPreset(l.name)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf;e.ekj("btn-primary",o===t.name),e.xp6(1),e.hij(" ",e.lcZ(2,3,t.label)," ")}}function oi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",16),e.YNc(1,ri,3,5,"button",17),e.TgZ(2,"button",18),e.NdJ("click",function(){return e.CHM(t),e.oxw().selectFilterPreset("custom")}),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"clr-icon",19),e.qZA()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngForOf",o.filterPresets),e.xp6(1),e.ekj("btn-primary","custom"===t),e.xp6(1),e.hij(" ",e.lcZ(4,4,"order.filter-custom")," ")}}function ii(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate"),e.ALo(2,"stateI18nToken")),2&r){const t=n.item;e.Oqu(e.lcZ(1,1,e.lcZ(2,3,t)))}}function li(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"span",20),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"stateI18nToken"),e.qZA(),e.TgZ(4,"span",21),e.NdJ("click",function(){const i=e.CHM(t),l=i.item;return i.clear(l)}),e._uU(5,"\xd7"),e.qZA()}if(2&r){const t=n.item;e.xp6(1),e.hij(" ",e.lcZ(2,1,e.lcZ(3,3,t)),"")}}const ai=function(r){return["./",r,"modify"]},ci=function(r){return["./",r]};function di(r,n){if(1&r&&(e.TgZ(0,"td",22),e._uU(1),e.qZA(),e.TgZ(2,"td",22),e._UZ(3,"vdr-customer-label",23),e.qZA(),e.TgZ(4,"td",22),e._UZ(5,"vdr-order-state-label",24),e.qZA(),e.TgZ(6,"td",22),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td",22),e._uU(10),e.ALo(11,"timeAgo"),e.qZA(),e.TgZ(12,"td",22),e._uU(13),e.ALo(14,"localeDate"),e.qZA(),e.TgZ(15,"td",22),e._uU(16),e.qZA(),e.TgZ(17,"td",25),e._UZ(18,"vdr-table-row-action",26),e.ALo(19,"translate"),e.qZA()),2&r){const t=n.item,o=e.oxw();e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Q6J("customer",t.customer),e.xp6(2),e.Q6J("state",t.state),e.xp6(2),e.Oqu(e.xi3(8,9,t.totalWithTax,t.currencyCode)),e.xp6(3),e.Oqu(e.lcZ(11,12,t.updatedAt)),e.xp6(3),e.Oqu(e.xi3(14,14,t.orderPlacedAt,"medium")),e.xp6(3),e.Oqu(o.getShippingNames(t)),e.xp6(2),e.Q6J("label",e.lcZ(19,17,"common.open"))("linkTo","Modifying"===t.state?e.VKq(19,ai,t.id):e.VKq(21,ci,t.id))}}class ge extends u.t7C{constructor(n,t,o,i,l){super(i,l),this.serverConfigService=n,this.dataService=t,this.localStorageService=o,this.searchControl=new a.NI(""),this.searchOrderCodeControl=new a.NI(""),this.searchLastNameControl=new a.NI(""),this.orderStates=this.serverConfigService.getOrderProcessStates().map(d=>d.name),this.filterPresets=[{name:"open",label:(0,_.J)("order.filter-preset-open"),config:{active:!1,states:this.orderStates.filter(d=>"Delivered"!==d&&"Cancelled"!==d&&"Shipped"!==d)}},{name:"shipped",label:(0,_.J)("order.filter-preset-shipped"),config:{active:!1,states:["Shipped"]}},{name:"completed",label:(0,_.J)("order.filter-preset-completed"),config:{active:!1,states:["Delivered","Cancelled"]}},{name:"active",label:(0,_.J)("order.filter-preset-active"),config:{active:!0}}],super.setQueryFn((d,g)=>this.dataService.order.getOrders({take:d,skip:g}).refetchOnChannelChange(),d=>d.orders,(d,g)=>this.createQueryOptions(d,g,this.searchControl.value,this.route.snapshot.queryParamMap.get("filter")||"open"));const c=this.localStorageService.get("orderListLastCustomFilters");c&&this.setQueryParam(c,{replaceUrl:!0})}ngOnInit(){var n;super.ngOnInit(),this.activePreset$=this.route.queryParamMap.pipe((0,F.U)(i=>i.get("filter")||"open"),(0,nt.x)());const t=(0,ot.T)(this.searchControl.valueChanges).pipe((0,Xo.h)(i=>2<i.length||0===i.length),(0,Ve.b)(250));(0,ot.T)(t,this.route.queryParamMap).pipe((0,ye.R)(this.destroy$)).subscribe(i=>{this.refresh()});const o=this.route.snapshot.queryParamMap;this.customFilterForm=new a.cw({states:new a.NI(null!==(n=o.getAll("states"))&&void 0!==n?n:[]),placedAtStart:new a.NI(o.get("placedAtStart")),placedAtEnd:new a.NI(o.get("placedAtEnd"))})}selectFilterPreset(n){var t;const o=null!==(t=this.localStorageService.get("orderListLastCustomFilters"))&&void 0!==t?t:{},l="custom"===n?o:{states:void 0,placedAtStart:void 0,placedAtEnd:void 0};this.setQueryParam(Object.assign({filter:n,page:1},l),{replaceUrl:!0})}applyCustomFilters(){const n=this.customFilterForm.value,t={states:n.states,placedAtStart:n.placedAtStart,placedAtEnd:n.placedAtEnd};this.setQueryParam(Object.assign({filter:"custom"},t)),this.customFilterForm.markAsPristine(),this.localStorageService.set("orderListLastCustomFilters",t)}createQueryOptions(n,t,o,i){var l;const c=this.filterPresets.find(x=>x.name===i);let d={},g=u.FnJ.AND;if(c)null!=c.config.active&&(d.active={eq:c.config.active}),c.config.states&&(d.state={in:c.config.states});else if("custom"===i){const x=this.route.snapshot.queryParamMap,P=null!==(l=x.getAll("states"))&&void 0!==l?l:[],S=x.get("placedAtStart"),N=x.get("placedAtEnd");P.length&&(d.state={in:P}),S&&N?d.orderPlacedAt={between:{start:S,end:N}}:S?d.orderPlacedAt={after:S}:N&&(d.orderPlacedAt={before:N})}return o&&(d={customerLastName:{contains:o},transactionId:{contains:o},code:{contains:o}},g=u.FnJ.OR),{options:{skip:n,take:t,filter:Object.assign({},null!=d?d:{}),sort:{updatedAt:u.Asd.DESC},filterOperator:g}}}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}}ge.\u0275fac=function(n){return new(n||ge)(e.Y36(u.iHG),e.Y36(u.DoR),e.Y36(u.n2A),e.Y36(y.F0),e.Y36(y.gz))},ge.\u0275cmp=e.Xpm({type:ge,selectors:[["vdr-order-list"]],features:[e.qOj],decls:60,vars:63,consts:[[1,"search-form"],["class","btn-group btn-outline-primary",4,"ngIf"],["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[1,"custom-filters"],[3,"formGroup"],[1,"flex","align-center"],["appendTo","body","formControlName","states",3,"items","addTag","multiple","placeholder","clearable","searchable"],["ng-option-tmp",""],["ng-label-tmp",""],[1,"btn","btn-secondary",3,"disabled","click"],["shape","filter"],[1,"flex"],["formControlName","placedAtStart"],["formControlName","placedAtEnd"],["locationId","order-list"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn-group","btn-outline-primary"],["class","btn",3,"btn-primary","click",4,"ngFor","ngForOf"],[1,"btn",3,"click"],["shape","angle down"],[1,"ng-value-label"],["aria-hidden","true",1,"ng-value-icon","right",3,"click"],[1,"left","align-middle"],[3,"customer"],[3,"state"],[1,"right","align-middle"],["iconShape","shopping-cart",3,"label","linkTo"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),e.YNc(3,oi,6,6,"div",1),e.ALo(4,"async"),e._UZ(5,"input",2),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"div",3),e.ALo(8,"async"),e.TgZ(9,"form",4)(10,"div",5)(11,"ng-select",6),e.ALo(12,"translate"),e.YNc(13,ii,3,5,"ng-template",7),e.YNc(14,li,6,5,"ng-template",8),e.qZA(),e.TgZ(15,"button",9),e.NdJ("click",function(){return t.applyCustomFilters()}),e._uU(16),e.ALo(17,"translate"),e._UZ(18,"clr-icon",10),e.qZA()(),e.TgZ(19,"div",11)(20,"div")(21,"label"),e._uU(22),e.ALo(23,"translate"),e.qZA(),e._UZ(24,"vdr-datetime-picker",12),e.qZA(),e.TgZ(25,"div")(26,"label"),e._uU(27),e.ALo(28,"translate"),e.qZA(),e._UZ(29,"vdr-datetime-picker",13),e.qZA()()()()(),e.TgZ(30,"vdr-ab-right"),e._UZ(31,"vdr-action-bar-items",14),e.qZA()(),e.TgZ(32,"vdr-data-table",15),e.NdJ("pageChange",function(i){return t.setPageNumber(i)})("itemsPerPageChange",function(i){return t.setItemsPerPage(i)}),e.ALo(33,"async"),e.ALo(34,"async"),e.ALo(35,"async"),e.ALo(36,"async"),e.TgZ(37,"vdr-dt-column"),e._uU(38),e.ALo(39,"translate"),e.qZA(),e.TgZ(40,"vdr-dt-column"),e._uU(41),e.ALo(42,"translate"),e.qZA(),e.TgZ(43,"vdr-dt-column"),e._uU(44),e.ALo(45,"translate"),e.qZA(),e.TgZ(46,"vdr-dt-column"),e._uU(47),e.ALo(48,"translate"),e.qZA(),e.TgZ(49,"vdr-dt-column"),e._uU(50),e.ALo(51,"translate"),e.qZA(),e.TgZ(52,"vdr-dt-column"),e._uU(53),e.ALo(54,"translate"),e.qZA(),e.TgZ(55,"vdr-dt-column"),e._uU(56),e.ALo(57,"translate"),e.qZA(),e._UZ(58,"vdr-dt-column"),e.YNc(59,di,20,23,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("ngIf",e.lcZ(4,27,t.activePreset$)),e.xp6(2),e.Q6J("formControl",t.searchControl)("placeholder",e.lcZ(6,29,"order.search-by-order-filters")),e.xp6(2),e.ekj("expanded","custom"===e.lcZ(8,31,t.activePreset$)),e.xp6(2),e.Q6J("formGroup",t.customFilterForm),e.xp6(2),e.Q6J("items",t.orderStates)("addTag",!1)("multiple",!0)("placeholder",e.lcZ(12,33,"state.all-orders"))("clearable",!0)("searchable",!1),e.xp6(4),e.Q6J("disabled",t.customFilterForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(17,35,"order.apply-filters")," "),e.xp6(6),e.Oqu(e.lcZ(23,37,"order.placed-at-start")),e.xp6(5),e.Oqu(e.lcZ(28,39,"order.placed-at-end")),e.xp6(5),e.Q6J("items",e.lcZ(33,41,t.items$))("itemsPerPage",e.lcZ(34,43,t.itemsPerPage$))("totalItems",e.lcZ(35,45,t.totalItems$))("currentPage",e.lcZ(36,47,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(39,49,"common.code")),e.xp6(3),e.Oqu(e.lcZ(42,51,"order.customer")),e.xp6(3),e.Oqu(e.lcZ(45,53,"order.state")),e.xp6(3),e.Oqu(e.lcZ(48,55,"order.total")),e.xp6(3),e.Oqu(e.lcZ(51,57,"common.updated-at")),e.xp6(3),e.Oqu(e.lcZ(54,59,"order.placed-at")),e.xp6(3),e.Oqu(e.lcZ(57,61,"order.shipping")))},directives:[O.Kk,O.BN,p.O5,p.sg,m.qvL,C.y,a.Fj,a.JJ,a.oH,a._Y,a.JL,a.sg,A.w9,a.u,A.ir,A.mR,m.MgK,Ko.I,O.mz,Xe.W,zo.Q,ei.E,tt.d,Fe.G,ti.v],pipes:[p.Ov,f.X$,Z.N,v.k,ni.e,xe.H],styles:[".search-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:baseline;width:100%;margin-bottom:6px}@media screen and (min-width: 768px){.search-form[_ngcontent-%COMP%]{flex-direction:row}}.search-input[_ngcontent-%COMP%]{margin-left:6px;margin-top:6px;min-width:300px}.custom-filters[_ngcontent-%COMP%]{overflow:hidden;max-height:0;padding-bottom:6px}.custom-filters.expanded[_ngcontent-%COMP%]{max-height:initial}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{width:100%}ng-select[_ngcontent-%COMP%]{flex:1;min-width:200px;height:36px}ng-select[_ngcontent-%COMP%] .ng-select-container{height:36px}"],changeDetection:0});class M extends u.p_9{constructor(n,t){super(n,{__typename:"Order",id:"",code:"",createdAt:"",updatedAt:"",total:0},o=>t.order.getOrder(o).mapStream(i=>i.order))}}M.\u0275fac=function(n){return new(n||M)(e.LFG(y.F0),e.LFG(u.DoR))},M.\u0275prov=e.Yz7({token:M,factory:M.\u0275fac,providedIn:"root"});const it=[{path:"",component:ge,data:{breadcrumb:(0,_.J)("breadcrumb.orders")}},{path:":id",component:pe,resolve:(0,u.Po4)(M),canDeactivate:[u.TSp],data:{breadcrumb:Me}},{path:":id/modify",component:_e,resolve:(0,u.Po4)(M),data:{breadcrumb:lt}}];function Me(r,n){return(0,u.YWC)({entity:r.entity,id:n.id,breadcrumbKey:"breadcrumb.orders",getName:t=>t.code,route:""})}function lt(r,n){return Me(r,n).pipe((0,F.U)(t=>{const o=t.slice();return o[0].link[0]="../",o[1].link[0]="../orders",o.concat({label:(0,_.J)("breadcrumb.modifying"),link:[""]})}))}class fe{}fe.\u0275fac=function(n){return new(n||fe)},fe.\u0275mod=e.oAB({type:fe}),fe.\u0275inj=e.cJS({imports:[[u.m81,y.Bz.forChild(it)]]})}}]);
2
- //# sourceMappingURL=849.a5b2f52c180a376b.js.map
1
+ "use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[849],{3849:(ui,Ee,s)=>{s.r(Ee),s.d(Ee,{AddManualPaymentDialogComponent:()=>V,CancelOrderDialogComponent:()=>B,FulfillOrderDialogComponent:()=>W,FulfillmentCardComponent:()=>z,FulfillmentDetailComponent:()=>Q,FulfillmentStateLabelComponent:()=>X,LineFulfillmentComponent:()=>Y,LineRefundsComponent:()=>I,ModificationDetailComponent:()=>ee,NODE_HEIGHT:()=>qe,OrderCustomFieldsCardComponent:()=>te,OrderDetailComponent:()=>pe,OrderEditResultType:()=>b,OrderEditorComponent:()=>_e,OrderEditsPreviewDialogComponent:()=>me,OrderHistoryComponent:()=>ce,OrderListComponent:()=>ge,OrderModule:()=>fe,OrderPaymentCardComponent:()=>ue,OrderProcessEdgeComponent:()=>ne,OrderProcessGraphComponent:()=>re,OrderProcessGraphDialogComponent:()=>oe,OrderProcessNodeComponent:()=>R,OrderResolver:()=>M,OrderStateSelectDialogComponent:()=>ae,OrderTableComponent:()=>H,OrderTransitionService:()=>w,PaymentDetailComponent:()=>$,PaymentStateLabelComponent:()=>de,RefundOrderDialogComponent:()=>ie,RefundStateLabelComponent:()=>se,SettleRefundDialogComponent:()=>le,SimpleItemListComponent:()=>L,modifyingOrderBreadcrumb:()=>lt,orderBreadcrumb:()=>Me,orderRoutes:()=>it});var a=s(587),e=s(3184),u=s(8102),T=s(309),Ye=s(4652),A=s(8660),C=s(7890),J=s(8318),f=s(7514),p=s(6362),v=s(4187);function at(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.add-payment-to-order"))}function ct(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"localeCurrency"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.form.invalid||t.form.pristine),e.xp6(1),e.AsE(" ",e.lcZ(5,6,"order.add-payment")," (",e.xi3(6,8,t.outstandingAmount,t.currencyCode),") ")}}class V{constructor(n){this.dataService=n,this.form=new a.cw({method:new a.NI("",a.kI.required),transactionId:new a.NI("",a.kI.required)})}ngOnInit(){this.paymentMethods$=this.dataService.settings.getPaymentMethods(999).mapSingle(n=>n.paymentMethods.items)}submit(){const n=this.form.value;this.resolveWith({method:n.method,transactionId:n.transactionId})}cancel(){this.resolveWith()}}V.\u0275fac=function(n){return new(n||V)(e.Y36(u.DoR))},V.\u0275cmp=e.Xpm({type:V,selectors:[["vdr-add-manual-payment-dialog"]],decls:10,vars:11,consts:[["vdrDialogTitle",""],[3,"formGroup"],["for","method",3,"label"],["bindLabel","code","autofocus","","bindValue","code","formControlName","method",3,"items","addTag"],["for","transactionId",3,"label"],["id","transactionId","type","text","formControlName","transactionId"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,at,2,3,"ng-template",0),e.TgZ(1,"form",1)(2,"vdr-form-field",2),e.ALo(3,"translate"),e._UZ(4,"ng-select",3),e.ALo(5,"async"),e.qZA(),e.TgZ(6,"vdr-form-field",4),e.ALo(7,"translate"),e._UZ(8,"input",5),e.qZA()(),e.YNc(9,ct,7,11,"ng-template",6)),2&n&&(e.xp6(1),e.Q6J("formGroup",t.form),e.xp6(1),e.Q6J("label",e.lcZ(3,5,"order.payment-method")),e.xp6(2),e.Q6J("items",e.lcZ(5,7,t.paymentMethods$))("addTag",!0),e.xp6(2),e.Q6J("label",e.lcZ(7,9,"order.transaction-id")))},directives:[T.q,a._Y,a.JL,a.sg,Ye.h,A.w9,a.JJ,a.u,C.y,a.Fj,J.n],pipes:[f.X$,p.Ov,v.k],styles:[".ng-select[_ngcontent-%COMP%]{min-width:100%}"],changeDetection:0});var _=s(8270),m=s(2748),he=s(1353);function dt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.cancel-order"))}function st(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",19),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id]=i})("input",function(){return e.CHM(t),e.oxw(2).checkIfAllSelected()}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("ngModel",o.lineQuantities[t.id])("disabled",o.cancelAll)("max",t.quantity)}}function ut(r,n){if(1&r&&e._uU(0),2&r){const t=e.oxw().$implicit;e.Oqu(t.quantity)}}function pt(r,n){if(1&r&&(e.TgZ(0,"tr",10)(1,"td",11),e._UZ(2,"img",12),e.ALo(3,"assetPreview"),e.qZA(),e.TgZ(4,"td",13),e._uU(5),e.qZA(),e.TgZ(6,"td",14),e._uU(7),e.qZA(),e.TgZ(8,"td",15),e._uU(9),e.qZA(),e.TgZ(10,"td",15),e._uU(11),e.ALo(12,"localeCurrency"),e.qZA(),e.TgZ(13,"td",16),e.YNc(14,st,1,3,"input",17),e.YNc(15,ut,1,1,"ng-template",null,18,e.W1O),e.qZA()()),2&r){const t=n.$implicit,o=e.MAs(16),i=e.oxw();e.ekj("is-disabled",i.cancelAll)("is-cancelled",0===t.quantity),e.xp6(2),e.Q6J("src",e.xi3(3,11,t.featuredAsset,"tiny"),e.LSH),e.xp6(3),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.Oqu(t.quantity),e.xp6(2),e.hij(" ",e.xi3(12,14,t.unitPriceWithTax,i.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",t.quantity>0&&!i.order.active)("ngIfElse",o)}}function mt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"clr-radio-wrapper")(2,"input",20),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().cancelAll=i})("ngModelChange",function(){return e.CHM(t),e.oxw().radioChanged()}),e.qZA(),e.TgZ(3,"label"),e._uU(4),e.ALo(5,"translate"),e.qZA()(),e.TgZ(6,"clr-radio-wrapper")(7,"input",20),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().cancelAll=i})("ngModelChange",function(){return e.CHM(t),e.oxw().radioChanged()}),e.qZA(),e.TgZ(8,"label"),e._uU(9),e.ALo(10,"translate"),e.qZA()(),e.BQk()}if(2&r){const t=e.oxw();e.xp6(2),e.Q6J("value",!0)("ngModel",t.cancelAll),e.xp6(2),e.Oqu(e.lcZ(5,6,"order.cancel-entire-order")),e.xp6(3),e.Q6J("value",!1)("ngModel",t.cancelAll),e.xp6(2),e.Oqu(e.lcZ(10,8,"order.cancel-specified-items"))}}function _t(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-selected-items")," "))}function gt(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-order")," "))}function ft(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",21),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",22),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e.YNc(4,_t,3,3,"ng-container",6),e.YNc(5,gt,3,3,"ng-container",6),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.reason||!t.order.active&&0===t.selectionCount),e.xp6(1),e.Q6J("ngIf",!t.order.active),e.xp6(1),e.Q6J("ngIf",t.order.active)}}class B{constructor(n){var t;this.i18nService=n,this.cancelAll=!0,this.lineQuantities={},this.reasons=null!==(t=(0,u.hq7)().cancellationReasons)&&void 0!==t?t:[(0,_.J)("order.cancel-reason-customer-request"),(0,_.J)("order.cancel-reason-not-available")],this.reasons=this.reasons.map(o=>this.i18nService.translate(o))}get selectionCount(){return Object.values(this.lineQuantities).reduce((n,t)=>n+t,0)}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>Object.assign(Object.assign({},n),{[t.id]:t.quantity}),{})}radioChanged(){if(this.cancelAll)for(const n of this.order.lines)this.lineQuantities[n.id]=n.quantity;else for(const n of this.order.lines)this.lineQuantities[n.id]=0}checkIfAllSelected(){var n;for(const[t,o]of Object.entries(this.lineQuantities)){const i=null===(n=this.order.lines.find(l=>l.id===t))||void 0===n?void 0:n.quantity;if(i&&o<i)return}this.cancelAll=!0}select(){this.resolveWith({orderId:this.order.id,lines:this.getLineInputs(),reason:this.reason,cancelShipping:this.cancelAll})}cancel(){this.resolveWith()}getLineInputs(){if(!this.order.active)return Object.entries(this.lineQuantities).map(([n,t])=>({orderLineId:n,quantity:t})).filter(n=>0<n.quantity)}}B.\u0275fac=function(n){return new(n||B)(e.Y36(u.Dp7))},B.\u0275cmp=e.Xpm({type:B,selectors:[["vdr-cancel-order-dialog"]],decls:30,vars:23,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-lines"],[1,"table"],["class","order-line",3,"is-disabled","is-cancelled",4,"ngFor","ngForOf"],[1,"cancellation-details"],[4,"ngIf"],[1,"clr-control-label"],["bindLabel","name","autofocus","","bindValue","id",3,"items","addTag","ngModel","ngModelChange"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"ngModel","disabled","max","ngModelChange","input",4,"ngIf","ngIfElse"],["nonEditable",""],["type","number","min","0",3,"ngModel","disabled","max","ngModelChange","input"],["type","radio","clrRadio","","name","options",3,"value","ngModel","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,dt,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.YNc(22,pt,17,17,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e.YNc(24,mt,11,10,"ng-container",6),e.TgZ(25,"label",7),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"ng-select",8),e.NdJ("ngModelChange",function(i){return t.reason=i}),e.qZA()()(),e.YNc(29,ft,6,6,"ng-template",9)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,11,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,13,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,15,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,17,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(21,19,"order.cancel")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(2),e.Q6J("ngIf",!0!==t.order.active),e.xp6(2),e.Oqu(e.lcZ(27,21,"order.cancellation-reason")),e.xp6(2),e.Q6J("items",t.reasons)("addTag",!0)("ngModel",t.reason))},directives:[T.q,p.sg,p.O5,C.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,m.EeQ,a._,m.asN,m.MgK,A.w9,J.n],pipes:[f.X$,he.M,v.k],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .cancellation-details[_ngcontent-%COMP%]{margin-top:0;margin-left:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-lines[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%], .fulfillment-wrapper[_ngcontent-%COMP%] .is-disabled[_ngcontent-%COMP%] td[_ngcontent-%COMP%] input[_ngcontent-%COMP%]{background-color:var(--color-component-bg-200)}"],changeDetection:0});var je=s(9667),ht=s(8931);function xt(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.fulfill-order"))}function vt(r,n){if(1&r&&(e._UZ(0,"img",17),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}function Ct(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",18),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().fulfillmentQuantities[l.id].fulfillCount=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.getUnfulfilledCount(t))("ngModel",o.fulfillmentQuantities[t.id].fulfillCount)("max",o.fulfillmentQuantities[t.id].max)}}function yt(r,n){if(1&r&&(e.TgZ(0,"tr",9)(1,"td",10),e.YNc(2,vt,2,4,"img",11),e.qZA(),e.TgZ(3,"td",12),e._uU(4),e.qZA(),e.TgZ(5,"td",13),e._uU(6),e.qZA(),e.TgZ(7,"td",14),e._uU(8),e.qZA(),e.TgZ(9,"td",14),e._uU(10),e.qZA(),e.TgZ(11,"td",15),e.YNc(12,Ct,1,3,"input",16),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw();e.ekj("ignore",0===o.getUnfulfilledCount(t)),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.Oqu(o.getUnfulfilledCount(t)),e.xp6(2),e.Oqu(t.productVariant.stockOnHand),e.xp6(2),e.Q6J("ngIf",o.fulfillmentQuantities[t.id])}}function Zt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",19),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",20),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.canSubmit()),e.xp6(1),e.hij(" ",e.lcZ(5,5,"order.create-fulfillment")," ")}}class W{constructor(n,t){this.dataService=n,this.changeDetector=t,this.fulfillmentHandlerControl=new a.NI,this.fulfillmentQuantities={}}ngOnInit(){this.dataService.settings.getGlobalSettings().single$.subscribe(({globalSettings:n})=>{this.fulfillmentQuantities=this.order.lines.reduce((t,o)=>{const i=this.getFulfillableCount(o,n.trackInventory);return Object.assign(Object.assign({},t),{[o.id]:{fulfillCount:i,max:i}})},{}),this.changeDetector.markForCheck()}),this.dataService.shippingMethod.getShippingMethodOperations().mapSingle(n=>n.fulfillmentHandlers).subscribe(n=>{this.fulfillmentHandlerDef=n.find(t=>{var o,i;return t.code===(null===(i=null===(o=this.order.shippingLines[0])||void 0===o?void 0:o.shippingMethod)||void 0===i?void 0:i.fulfillmentHandlerCode)})||n[0],this.fulfillmentHandler=(0,u.miO)(this.fulfillmentHandlerDef),this.fulfillmentHandlerControl.patchValue(this.fulfillmentHandler),this.changeDetector.markForCheck()})}getFulfillableCount(n,t){const{trackInventory:o,stockOnHand:i}=n.productVariant,l=o===u.TvZ.INHERIT?t:o===u.TvZ.TRUE,c=this.getUnfulfilledCount(n);return l?Math.min(c,i):c}getUnfulfilledCount(n){var t,o;const i=null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.map(l=>l.summary).flat().filter(l=>l.orderLine.id===n.id).reduce((l,c)=>l+c.quantity,0))&&void 0!==o?o:0;return n.quantity-i}canSubmit(){const n=Object.values(this.fulfillmentQuantities).reduce((o,{fulfillCount:i})=>o+i,0);return(0,u.dOS)(this.fulfillmentHandlerDef,this.fulfillmentHandlerControl.value)&&this.fulfillmentHandlerControl.valid&&0<n}select(){const n=Object.entries(this.fulfillmentQuantities).map(([t,{fulfillCount:o}])=>({orderLineId:t,quantity:o}));this.resolveWith({lines:n,handler:(0,u.RnJ)(this.fulfillmentHandler,this.fulfillmentHandlerControl.value)})}cancel(){this.resolveWith()}}W.\u0275fac=function(n){return new(n||W)(e.Y36(u.DoR),e.Y36(e.sBO))},W.\u0275cmp=e.Xpm({type:W,selectors:[["vdr-fulfill-order-dialog"]],decls:34,vars:29,consts:[["vdrDialogTitle",""],[1,"fulfillment-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",3,"ignore",4,"ngFor","ngForOf"],[1,"shipping-details"],[3,"address"],[3,"operationDefinition","operation","formControl","removable"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[1,"align-middle","fulfil"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange",4,"ngIf"],[3,"src"],["type","number","min","0",3,"disabled","ngModel","max","ngModelChange"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,xt,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.YNc(22,yt,13,8,"tr",4),e.qZA()(),e.TgZ(23,"div",5),e._UZ(24,"vdr-formatted-address",6),e.TgZ(25,"h6"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e._uU(28),e.TgZ(29,"strong"),e._uU(30),e.ALo(31,"localeCurrency"),e.qZA(),e._UZ(32,"vdr-configurable-input",7),e.qZA()(),e.YNc(33,Zt,6,7,"ng-template",8)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,14,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,16,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,18,"order.unfulfilled")),e.xp6(3),e.Oqu(e.lcZ(18,20,"catalog.stock-on-hand")),e.xp6(3),e.Oqu(e.lcZ(21,22,"order.fulfill")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(2),e.Q6J("address",t.order.shippingAddress),e.xp6(2),e.Oqu(e.lcZ(27,24,"order.shipping-method")),e.xp6(2),e.hij(" ",null==t.order.shippingLines[0]||null==t.order.shippingLines[0].shippingMethod?null:t.order.shippingLines[0].shippingMethod.name," "),e.xp6(2),e.Oqu(e.xi3(31,26,t.order.shipping,t.order.currencyCode)),e.xp6(2),e.Q6J("operationDefinition",t.fulfillmentHandlerDef)("operation",t.fulfillmentHandler)("formControl",t.fulfillmentHandlerControl)("removable",!1))},directives:[T.q,p.sg,p.O5,C.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,je.b,ht.q,a.oH,J.n],pipes:[f.X$,he.M,v.k],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.fulfillment-wrapper[_ngcontent-%COMP%]{flex:1}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%]{display:flex;flex-direction:row}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:24px}@media screen and (min-width: 768px){.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%]{margin-top:0;margin-left:24px;width:250px}}.fulfillment-wrapper[_ngcontent-%COMP%] .shipping-details[_ngcontent-%COMP%] clr-input-container[_ngcontent-%COMP%]{margin-top:24px}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.fulfillment-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.fulfillment-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}"],changeDetection:0});var G=s(4447),Z=s(858);function Ot(r,n){1&r&&e._UZ(0,"clr-icon",2)}class X{get chipColorType(){switch(this.state){case"Pending":case"Shipped":return"warning";case"Delivered":return"success";case"Cancelled":return"error"}}}X.\u0275fac=function(n){return new(n||X)},X.\u0275cmp=e.Xpm({type:X,selectors:[["vdr-fulfillment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Ot,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Delivered"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[G.Y,p.O5,m.qvL],pipes:[f.X$,Z.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});var U=s(234),K=s(7368);function bt(r,n){if(1&r&&(e.TgZ(0,"li",2)(1,"div",3),e._uU(2),e.qZA(),e._UZ(3,"clr-icon",4),e._uU(4),e.qZA()),2&r){const t=n.$implicit;e.Q6J("title",t.name),e.xp6(2),e.Oqu(t.quantity),e.xp6(2),e.hij(" ",t.name," ")}}class L{}L.\u0275fac=function(n){return new(n||L)},L.\u0275cmp=e.Xpm({type:L,selectors:[["vdr-simple-item-list"]],inputs:{items:"items"},decls:3,vars:1,consts:[[1,"items-list"],[3,"title",4,"ngFor","ngForOf"],[3,"title"],[1,"quantity"],["shape","times","size","12"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"ul"),e.YNc(2,bt,5,3,"li",1),e.qZA()()),2&n&&(e.xp6(2),e.Q6J("ngForOf",t.items))},directives:[p.sg,m.qvL],styles:[".items-list[_ngcontent-%COMP%]{font-size:12px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%]{margin-top:6px;list-style-type:none;margin-left:2px}.items-list[_ngcontent-%COMP%] ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{line-height:14px;text-overflow:ellipsis;overflow:hidden}.items-list[_ngcontent-%COMP%] .quantity[_ngcontent-%COMP%]{min-width:16px;display:inline-block}"],changeDetection:0});var Te=s(2231),xe=s(2651);function Tt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.tracking-code")),e.xp6(2),e.hij(" ",null==t.fulfillment?null:t.fulfillment.trackingCode,"\n")}}function At(r,n){if(1&r&&e._UZ(0,"vdr-custom-field-control",5),2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("readonly",!0)("compact",!0)("customField",t)("customFieldsFormGroup",o.customFieldFormGroup)}}function Lt(r,n){if(1&r&&(e.ynx(0),e.YNc(1,At,1,4,"vdr-custom-field-control",4),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.customFieldFormGroup.get(t.name))}}class Q{constructor(n){this.serverConfigService=n,this.customFieldConfig=[],this.customFieldFormGroup=new a.cw({})}ngOnInit(){this.customFieldConfig=this.serverConfigService.getCustomFieldsFor("Fulfillment")}ngOnChanges(n){this.buildCustomFieldsFormGroup()}get fulfillment(){return this.order.fulfillments&&this.order.fulfillments.find(n=>n.id===this.fulfillmentId)}get items(){var n,t;return null!==(t=null===(n=this.fulfillment)||void 0===n?void 0:n.summary.map(o=>{var i,l;return{name:null!==(l=null===(i=this.order.lines.find(c=>c.id===o.orderLine.id))||void 0===i?void 0:i.productVariant.name)&&void 0!==l?l:"",quantity:o.quantity}}))&&void 0!==t?t:[]}buildCustomFieldsFormGroup(){const n=this.fulfillment.customFields;for(const t of this.serverConfigService.getCustomFieldsFor("Fulfillment"))this.customFieldFormGroup.addControl(t.name,new a.NI(n[t.name]))}customFieldIsObject(n){return Array.isArray(n)||(0,U.isObject)(n)}}Q.\u0275fac=function(n){return new(n||Q)(e.Y36(u.iHG))},Q.\u0275cmp=e.Xpm({type:Q,selectors:[["vdr-fulfillment-detail"]],inputs:{fulfillmentId:"fulfillmentId",order:"order"},features:[e.TTD],decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"items"],[4,"ngFor","ngForOf"],[3,"readonly","compact","customField","customFieldsFormGroup",4,"ngIf"],[3,"readonly","compact","customField","customFieldsFormGroup"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeDate"),e.qZA(),e.TgZ(4,"vdr-labeled-data",0),e.ALo(5,"translate"),e._uU(6),e.qZA(),e.YNc(7,Tt,3,4,"vdr-labeled-data",1),e.TgZ(8,"vdr-labeled-data",0),e.ALo(9,"translate"),e._UZ(10,"vdr-simple-item-list",2),e.qZA(),e.YNc(11,Lt,2,1,"ng-container",3)),2&n&&(e.Q6J("label",e.lcZ(1,8,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(3,10,null==t.fulfillment?null:t.fulfillment.createdAt,"medium"),"\n"),e.xp6(2),e.Q6J("label",e.lcZ(5,13,"order.fulfillment-method")),e.xp6(2),e.hij(" ",null==t.fulfillment?null:t.fulfillment.method,"\n"),e.xp6(1),e.Q6J("ngIf",null==t.fulfillment?null:t.fulfillment.trackingCode),e.xp6(1),e.Q6J("label",e.lcZ(9,15,"order.contents")),e.xp6(2),e.Q6J("items",t.items),e.xp6(1),e.Q6J("ngForOf",t.customFieldConfig))},directives:[K.W,p.O5,L,p.sg,Te.M],pipes:[f.X$,xe.H],styles:[""],changeDetection:0});var D=s(735),k=s(1519),E=s(8854),ve=s(5111);function It(r,n){if(1&r&&e._UZ(0,"vdr-fulfillment-detail",7),2&r){const t=e.oxw();e.Q6J("fulfillmentId",null==t.fulfillment?null:t.fulfillment.id)("order",t.order)}}const Re=function(r){return{state:r}};function qt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw(2).transitionState.emit(l)}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA(),e.BQk()}if(2&r){const t=n.ngIf;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.set-fulfillment-state",e.VKq(8,Re,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function Ft(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"clr-icon",18),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Re,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function wt(r,n){1&r&&(e._UZ(0,"clr-icon",19),e._uU(1),e.ALo(2,"translate")),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-fulfillment")," "))}function Mt(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",15),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).transitionState.emit(l)}),e.YNc(2,Ft,6,10,"ng-container",16),e.YNc(3,wt,3,3,"ng-template",null,17,e.W1O),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.MAs(4);e.xp6(2),e.Q6J("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Pt(r,n){if(1&r&&(e.TgZ(0,"div",8),e.YNc(1,qt,6,10,"ng-container",9),e.TgZ(2,"vdr-dropdown")(3,"button",10),e._UZ(4,"clr-icon",11),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",12),e.YNc(6,Mt,5,2,"ng-container",13),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.nextSuggestedState()),e.xp6(5),e.Q6J("ngForOf",t.nextOtherStates())}}class z{constructor(){this.transitionState=new e.vpe}nextSuggestedState(){var n;if(!this.fulfillment)return;const{nextStates:t}=this.fulfillment,o=i=>t.includes(i)?i:t[0];switch(null===(n=this.fulfillment)||void 0===n?void 0:n.state){case"Pending":return o("Shipped");case"Shipped":return o("Delivered");default:return t.find(i=>"Cancelled"!==i)}}nextOtherStates(){if(!this.fulfillment)return[];const n=this.nextSuggestedState();return this.fulfillment.nextStates.filter(t=>t!==n)}}function St(r,n){1&r&&e._UZ(0,"clr-icon",9)}function Nt(r,n){1&r&&e._UZ(0,"clr-icon",10)}function Jt(r,n){1&r&&e._UZ(0,"clr-icon",11)}function Ut(r,n){1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.line-fulfillment-all")," "))}z.\u0275fac=function(n){return new(n||z)},z.\u0275cmp=e.Xpm({type:z,selectors:[["vdr-fulfillment-card"]],inputs:{fulfillment:"fulfillment",order:"order"},outputs:{transitionState:"transitionState"},decls:10,vars:6,consts:[[1,"card"],[1,"card-header","fulfillment-header"],[1,"fulfillment-state"],[3,"state"],[1,"card-block"],[3,"fulfillmentId","order",4,"ngIf"],["class","card-footer",4,"ngIf"],[3,"fulfillmentId","order"],[1,"card-footer"],[4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],[4,"ngFor","ngForOf"],[1,"btn","btn-sm","btn-primary",3,"click"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"div",2),e._UZ(6,"vdr-fulfillment-state-label",3),e.qZA()(),e.TgZ(7,"div",4),e.YNc(8,It,1,2,"vdr-fulfillment-detail",5),e.qZA(),e.YNc(9,Pt,7,2,"div",6),e.qZA()),2&n&&(e.xp6(3),e.Oqu(e.lcZ(4,4,"order.fulfillment")),e.xp6(3),e.Q6J("state",null==t.fulfillment?null:t.fulfillment.state),e.xp6(2),e.Q6J("ngIf",!!t.fulfillment),e.xp6(1),e.Q6J("ngIf",null==t.fulfillment?null:t.fulfillment.nextStates.length))},directives:[X,p.O5,Q,D.J,k.U,m.qvL,E.N,p.sg,ve.H],pipes:[f.X$,Z.N],styles:[".fulfillment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0});const Qt=function(r,n){return{total:r,count:n}};function Dt(r,n){if(1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.line-fulfillment-partial",e.WLB(4,Qt,t.line.quantity,t.fulfilledCount))," ")}}function kt(r,n){1&r&&(e.TgZ(0,"label",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.line-fulfillment-none")," "))}function Et(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",15),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.tracking-code")),e.xp6(2),e.hij(" ",t.fulfillment.trackingCode," ")}}const Yt=function(r){return{count:r}};function jt(r,n){if(1&r&&(e.TgZ(0,"div",13)(1,"div",14),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"vdr-labeled-data",15),e.ALo(6,"translate"),e._uU(7),e.ALo(8,"localeDate"),e.qZA(),e.TgZ(9,"vdr-labeled-data",15),e.ALo(10,"translate"),e._uU(11),e.qZA(),e.YNc(12,Et,3,4,"vdr-labeled-data",16),e.qZA()),2&r){const t=n.$implicit;e.xp6(2),e.lnq(" ",e.lcZ(3,8,"order.fulfillment")," #",t.fulfillment.id," (",e.xi3(4,10,"order.item-count",e.VKq(20,Yt,t.count)),") "),e.xp6(3),e.Q6J("label",e.lcZ(6,13,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(8,15,t.fulfillment.createdAt,"medium")," "),e.xp6(2),e.Q6J("label",e.lcZ(10,18,"order.fulfillment-method")),e.xp6(2),e.hij(" ",t.fulfillment.method," "),e.xp6(1),e.Q6J("ngIf",t.fulfillment.trackingCode)}}function Rt(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown",1)(1,"button",2),e.YNc(2,St,1,0,"clr-icon",3),e.YNc(3,Nt,1,0,"clr-icon",4),e.YNc(4,Jt,1,0,"clr-icon",5),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",6),e.YNc(6,Ut,3,3,"label",7),e.YNc(7,Dt,3,7,"label",7),e.YNc(8,kt,3,3,"label",7),e.YNc(9,jt,13,22,"div",8),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.Q6J("ngIf","full"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","partial"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","none"===t.fulfillmentStatus),e.xp6(2),e.Q6J("ngIf","full"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","partial"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngIf","none"===t.fulfillmentStatus),e.xp6(1),e.Q6J("ngForOf",t.fulfillments)}}class Y{constructor(){this.fulfilledCount=0,this.fulfillments=[]}ngOnChanges(n){this.line&&(this.fulfilledCount=this.getDeliveredCount(this.line),this.fulfillmentStatus=this.getFulfillmentStatus(this.fulfilledCount,this.line.items.length),this.fulfillments=this.getFulfillments(this.line))}getDeliveredCount(n){var t,o;return null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.reduce((i,l)=>{var c,d;return i+(null!==(d=null===(c=l.summary.find(g=>g.orderLine.id===n.id))||void 0===c?void 0:c.quantity)&&void 0!==d?d:0)},0))&&void 0!==o?o:0}getFulfillmentStatus(n,t){return n===t?"full":0<n&&n<t?"partial":"none"}getFulfillments(n){var t,o;return null!==(o=null===(t=n.fulfillments)||void 0===t?void 0:t.map(i=>{var l;const c=i.summary.find(d=>d.orderLine.id===n.id);return{count:null!==(l=null==c?void 0:c.quantity)&&void 0!==l?l:0,fulfillment:i}}))&&void 0!==o?o:[]}}Y.\u0275fac=function(n){return new(n||Y)},Y.\u0275cmp=e.Xpm({type:Y,selectors:[["vdr-line-fulfillment"]],inputs:{line:"line",orderState:"orderState"},features:[e.TTD],decls:1,vars:1,consts:[["class","search-settings-menu",4,"ngIf"],[1,"search-settings-menu"],["type","button","vdrDropdownTrigger","",1,"icon-button"],["class","item-fulfilled","shape","check-circle",4,"ngIf"],["class","item-partially-fulfilled","shape","check-circle",4,"ngIf"],["class","item-not-fulfilled","shape","exclamation-circle",4,"ngIf"],["vdrPosition","bottom-right"],["class","dropdown-header",4,"ngIf"],["class","fulfillment-detail",4,"ngFor","ngForOf"],["shape","check-circle",1,"item-fulfilled"],["shape","check-circle",1,"item-partially-fulfilled"],["shape","exclamation-circle",1,"item-not-fulfilled"],[1,"dropdown-header"],[1,"fulfillment-detail"],[1,"fulfillment-title"],[3,"label"],[3,"label",4,"ngIf"]],template:function(n,t){1&n&&e.YNc(0,Rt,10,7,"vdr-dropdown",0),2&n&&e.Q6J("ngIf",t.fulfilledCount||"PartiallyDelivered"===t.orderState)},directives:[p.O5,D.J,k.U,m.qvL,E.N,m.MgK,p.sg,K.W],pipes:[f.X$,xe.H],styles:[".item-fulfilled[_ngcontent-%COMP%]{color:var(--color-success-500)}.item-partially-fulfilled[_ngcontent-%COMP%]{color:var(--color-warning-500)}.item-not-fulfilled[_ngcontent-%COMP%]{color:var(--color-error-500)}.fulfillment-detail[_ngcontent-%COMP%]{margin:6px 12px}.fulfillment-detail[_ngcontent-%COMP%]:not(:last-of-type){border-bottom:1px dashed var(--color-component-border-200)}"],changeDetection:0});var He=s(1588);const Ht=function(r){return{count:r}};function $t(r,n){if(1&r&&(e.TgZ(0,"span",1),e.ALo(1,"translate"),e._UZ(2,"clr-icon",2),e.qZA()),2&r){const t=e.oxw();e.Q6J("title",e.xi3(1,1,"order.refunded-count",e.VKq(4,Ht,t.getRefundedCount())))}}class I{getRefundedCount(){var n,t;const o=null!==(t=null===(n=this.payments)||void 0===n?void 0:n.reduce((i,l)=>[...i,...l.refunds],[]))&&void 0!==t?t:[];return this.line.items.filter(i=>{if(null===i.refundId&&!i.cancelled)return!1;if(i.refundId){const l=o.find(c=>c.id===i.refundId);return"Failed"!==(null==l?void 0:l.state)}return!1}).length}}function Vt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.note")),e.xp6(2),e.Oqu(t.modification.note)}}function Bt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.ALo(3,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw();let i;e.Q6J("label",e.lcZ(1,3,"order.surcharges")),e.xp6(2),e.AsE(" ",null==(i=o.getSurcharge(t.id))?null:i.description," ",e.xi3(3,5,null==(i=o.getSurcharge(t.id))?null:i.priceWithTax,o.order.currencyCode),"")}}function Wt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._UZ(2,"vdr-simple-item-list",3),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.added-items")),e.xp6(2),e.Q6J("items",t.getAddedItems())}}function Gt(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._UZ(2,"vdr-simple-item-list",3),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.removed-items")),e.xp6(2),e.Q6J("items",t.getRemovedItems())}}I.\u0275fac=function(n){return new(n||I)},I.\u0275cmp=e.Xpm({type:I,selectors:[["vdr-line-refunds"]],inputs:{line:"line",payments:"payments"},decls:1,vars:1,consts:[[3,"title",4,"ngIf"],[3,"title"],["shape","redo","dir","down",1,"is-solid"]],template:function(n,t){1&n&&e.YNc(0,$t,3,6,"span",0),2&n&&e.Q6J("ngIf",t.getRefundedCount())},directives:[p.O5,m.qvL,He.Lv],pipes:[f.X$],styles:["[_nghost-%COMP%]{color:var(--color-error-500)}"],changeDetection:0});class ee{constructor(){this.addedItems=new Map,this.removedItems=new Map}ngOnChanges(){const{added:n,removed:t}=this.getModifiedLines();this.addedItems=n,this.removedItems=t}getSurcharge(n){return this.order.surcharges.find(t=>t.id===n)}getAddedItems(){return[...this.addedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getRemovedItems(){return[...this.removedItems.entries()].map(([n,t])=>({name:n.productVariant.name,quantity:t}))}getModifiedLines(){var n,t;const o=new Map,i=new Map;for(const l of this.modification.orderItems||[]){const c=this.getOrderLineAndItem(l.id);if(c){const{line:d,item:g}=c;if(g.cancelled){const x=null!==(n=i.get(d))&&void 0!==n?n:0;i.set(d,x+1)}else{const x=null!==(t=o.get(d))&&void 0!==t?t:0;o.set(d,x+1)}}}return{added:o,removed:i}}getOrderLineAndItem(n){for(const t of this.order.lines){const o=t.items.find(i=>i.id===n);if(o)return{line:t,item:o}}}}ee.\u0275fac=function(n){return new(n||ee)},ee.\u0275cmp=e.Xpm({type:ee,selectors:[["vdr-modification-detail"]],inputs:{order:"order",modification:"modification"},features:[e.TTD],decls:7,vars:8,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"label",4,"ngFor","ngForOf"],[3,"items"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA(),e.YNc(3,Vt,3,4,"vdr-labeled-data",1),e.YNc(4,Bt,4,8,"vdr-labeled-data",2),e.YNc(5,Wt,3,4,"vdr-labeled-data",1),e.YNc(6,Gt,3,4,"vdr-labeled-data",1)),2&n&&(e.Q6J("label",e.lcZ(1,6,"common.ID")),e.xp6(2),e.Oqu(t.modification.id),e.xp6(1),e.Q6J("ngIf",t.modification.note),e.xp6(1),e.Q6J("ngForOf",t.modification.surcharges),e.xp6(1),e.Q6J("ngIf",t.getAddedItems().length),e.xp6(1),e.Q6J("ngIf",t.getRemovedItems().length))},directives:[K.W,p.O5,p.sg,L],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var Xt=s(837);function Kt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){e.CHM(t);return e.oxw(2).editable=!0}),e._UZ(1,"clr-icon",10),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"common.edit")," "))}function zt(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).onUpdateClick()}),e._UZ(1,"clr-icon",12),e._uU(2),e.ALo(3,"translate"),e.qZA()}if(2&r){const t=e.oxw(2);e.Q6J("disabled",t.customFieldForm.pristine||t.customFieldForm.invalid),e.xp6(2),e.hij(" ",e.lcZ(3,2,"common.update")," ")}}function en(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",9),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).onCancelClick()}),e._UZ(1,"clr-icon",13),e._uU(2),e.ALo(3,"translate"),e.qZA()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"common.cancel")," "))}function tn(r,n){if(1&r&&(e.TgZ(0,"div",1)(1,"div",2),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"div",3)(5,"div",4),e._UZ(6,"vdr-tabbed-custom-fields",5),e.qZA()(),e.TgZ(7,"div",6),e.YNc(8,Kt,4,3,"button",7),e.YNc(9,zt,4,4,"button",8),e.YNc(10,en,4,3,"button",7),e.qZA()()),2&r){const t=e.oxw();e.xp6(2),e.hij(" ",e.lcZ(3,10,"common.custom-fields")," "),e.xp6(3),e.ekj("editable",t.editable),e.xp6(1),e.Q6J("customFields",t.customFieldsConfig)("customFieldsFormGroup",t.customFieldForm)("readonly",!t.editable)("compact",!0),e.xp6(2),e.Q6J("ngIf",!t.editable),e.xp6(1),e.Q6J("ngIf",t.editable),e.xp6(1),e.Q6J("ngIf",t.editable)}}class te{constructor(n,t){this.formBuilder=n,this.modalService=t,this.customFieldsConfig=[],this.customFieldValues={},this.updateClick=new e.vpe,this.editable=!1}ngOnInit(){this.customFieldForm=this.formBuilder.group({});for(const n of this.customFieldsConfig)this.customFieldForm.addControl(n.name,this.formBuilder.control(this.customFieldValues[n.name]))}onUpdateClick(){this.updateClick.emit(this.customFieldForm.value),this.customFieldForm.markAsPristine(),this.editable=!1}onCancelClick(){this.customFieldForm.dirty?this.modalService.dialog({title:(0,_.J)("catalog.confirm-cancel"),buttons:[{type:"secondary",label:(0,_.J)("common.keep-editing")},{type:"danger",label:(0,_.J)("common.discard-changes"),returnValue:!0}]}).subscribe(n=>{n&&(this.customFieldForm.reset(),this.customFieldForm.markAsPristine(),this.editable=!1)}):this.editable=!1}}te.\u0275fac=function(n){return new(n||te)(e.Y36(a.qu),e.Y36(u.Z7U))},te.\u0275cmp=e.Xpm({type:te,selectors:[["vdr-order-custom-fields-card"]],inputs:{customFieldsConfig:"customFieldsConfig",customFieldValues:"customFieldValues"},outputs:{updateClick:"updateClick"},decls:1,vars:1,consts:[["class","card",4,"ngIf"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text","custom-field-form"],["entityName","Order",3,"customFields","customFieldsFormGroup","readonly","compact"],[1,"card-footer"],["class","btn btn-sm btn-secondary",3,"click",4,"ngIf"],["class","btn btn-sm btn-primary",3,"disabled","click",4,"ngIf"],[1,"btn","btn-sm","btn-secondary",3,"click"],["shape","pencil"],[1,"btn","btn-sm","btn-primary",3,"disabled","click"],["shape","check"],["shape","times"]],template:function(n,t){1&n&&e.YNc(0,tn,11,12,"div",0),2&n&&e.Q6J("ngIf",t.customFieldsConfig.length)},directives:[p.O5,Xt.y,m.qvL],pipes:[f.X$],styles:["vdr-custom-field-control[_ngcontent-%COMP%]{margin-bottom:6px;display:block}.custom-field-form[_ngcontent-%COMP%] .clr-control-label{color:var(--color-grey-400)}.custom-field-form.editable[_ngcontent-%COMP%] .clr-control-label{color:inherit}"],changeDetection:0});var Ae=s(253),j=s(591),q=s(745),Ce=s(9295),$e=s(4874),h=s(2673),F=s(635),Le=s(73),Ie=s(6317),Ve=s(1989);const qe=72;function nn(r,n){if(1&r&&(e.TgZ(0,"div",3),e._UZ(1,"div",4)(2,"clr-icon",5),e.TgZ(3,"div",6),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"stateI18nToken"),e.qZA()()),2&r){const t=e.oxw();e.xp6(4),e.hij(" ",e.lcZ(5,1,e.lcZ(6,3,t.cancelledState))," ")}}class R{constructor(n){this.elementRef=n,this.active$=new Ie.X(!1),this.activeTarget$=new Ie.X(!1),this.isCancellable=!1,this.cancelledState="Cancelled"}ngOnChanges(n){this.isCancellable=!!this.node.to.find(t=>"Cancelled"===t.name),n.active&&this.active$.next(this.active)}getPos(n="top"){var t,o;this.elementRef.nativeElement.getBoundingClientRect();const l=null!==(o=null===(t=this.elementRef.nativeElement.querySelector(".node"))||void 0===t?void 0:t.getBoundingClientRect().height)&&void 0!==o?o:0;return{x:10,y:this.index*qe+("bottom"===n?l:0)}}getStyle(){const n=this.getPos();return{"top.px":n.y,"left.px":n.x}}}R.\u0275fac=function(n){return new(n||R)(e.Y36(e.SBq))},R.\u0275cmp=e.Xpm({type:R,selectors:[["vdr-order-process-node"]],inputs:{node:"node",index:"index",active:"active"},features:[e.TTD],decls:8,vars:15,consts:[[1,"node-wrapper",3,"ngStyle"],[1,"node"],["class","cancelled-wrapper",4,"ngIf"],[1,"cancelled-wrapper"],[1,"cancelled-edge"],["shape","dot-circle"],[1,"cancelled-node"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0),e.ALo(1,"async"),e.TgZ(2,"div",1),e.ALo(3,"async"),e._uU(4),e.ALo(5,"translate"),e.ALo(6,"stateI18nToken"),e.qZA(),e.YNc(7,nn,7,5,"div",2),e.qZA()),2&n&&(e.ekj("active",e.lcZ(1,7,t.active$)),e.Q6J("ngStyle",t.getStyle()),e.xp6(2),e.ekj("active-target",e.lcZ(3,9,t.activeTarget$)),e.xp6(2),e.hij(" ",e.lcZ(5,11,e.lcZ(6,13,t.node.name))," "),e.xp6(3),e.Q6J("ngIf",t.isCancellable))},directives:[p.PC,p.O5,m.qvL],pipes:[p.Ov,f.X$,Z.N],styles:["[_nghost-%COMP%]{display:block}.node-wrapper[_ngcontent-%COMP%]{position:absolute;z-index:1;display:flex;align-items:center}.node[_ngcontent-%COMP%]{display:inline-block;border:2px solid var(--color-component-border-200);border-radius:3px;padding:3px 6px;z-index:1;background-color:var(--color-component-bg-100);opacity:.7;transition:opacity .2s,background-color .2s,color .2s;cursor:default}.node.active-target[_ngcontent-%COMP%]{border-color:var(--color-primary-500);opacity:.9}.cancelled-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;color:var(--color-grey-300);transition:color .2s,opacity .2s;opacity:.7}.cancelled-edge[_ngcontent-%COMP%]{width:48px;height:2px;background-color:var(--color-component-bg-300);transition:background-color .2s}clr-icon[_ngcontent-%COMP%]{margin-left:-1px}.cancelled-node[_ngcontent-%COMP%]{margin-left:6px}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{opacity:1}.active[_ngcontent-%COMP%] .node[_ngcontent-%COMP%]{opacity:1;background-color:var(--color-primary-600);border-color:var(--color-primary-600);color:var(--color-primary-100)}.active[_ngcontent-%COMP%] .cancelled-wrapper[_ngcontent-%COMP%]{color:var(--color-error-500)}.active[_ngcontent-%COMP%] .cancelled-edge[_ngcontent-%COMP%]{background-color:var(--color-error-500)}"],changeDetection:0});var rn=s(9337);class ne{ngOnInit(){this.active$=this.from.active$.asObservable().pipe((0,rn.b)(n=>this.to.activeTarget$.next(n)))}getStyle(){const n=this.from.index<this.to.index?"down":"up",t=this.from.getPos("down"===n?"bottom":"top"),o=this.to.getPos("down"===n?"top":"bottom"),i=Math.abs(t.x-o.x),l=Math.abs(t.y-o.y),c=Math.sqrt(Math.pow(i,2)+Math.pow(l,2));return Object.assign({"top.px":t.y,"left.px":t.x+("down"===n?10:40)+12*this.index,"height.px":c,"width.px":1},"up"===n?{transform:"rotateZ(180deg)","transform-origin":"top"}:{})}}function on(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-order-process-node",1),e.NdJ("mouseenter",function(){const l=e.CHM(t).$implicit;return e.oxw().onMouseOver(l.name)})("mouseleave",function(){return e.CHM(t),e.oxw().onMouseOut()}),e.ALo(2,"async"),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=n.index,i=e.oxw();e.xp6(1),e.Q6J("node",t)("index",o)("active",e.lcZ(2,3,i.activeState$)===t.name)}}function ln(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-order-process-edge",2),e.BQk()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("from",t.from)("to",t.to)("index",t.index)}}ne.\u0275fac=function(n){return new(n||ne)},ne.\u0275cmp=e.Xpm({type:ne,selectors:[["vdr-order-process-edge"]],inputs:{from:"from",to:"to",index:"index"},decls:3,vars:7,consts:[[1,"edge",3,"ngStyle"],["shape","arrow","flip","vertical",1,"arrow"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0),e.ALo(1,"async"),e._UZ(2,"clr-icon",1),e.qZA()),2&n&&(e.ekj("active",e.lcZ(1,5,t.active$)),e.Q6J("ngStyle",t.getStyle()),e.uIk("data-from",t.from.node.name)("data-to",t.to.node.name))},directives:[p.PC,m.qvL],pipes:[p.Ov],styles:[".edge[_ngcontent-%COMP%]{position:absolute;border:1px solid var(--color-component-border-200);background-color:var(--color-component-bg-300);opacity:.3;transition:border .2s,opacity .2s,background-color .2s}.edge.active[_ngcontent-%COMP%]{border-color:var(--color-primary-500);background-color:var(--color-primary-500);opacity:1}.edge.active[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{color:var(--color-primary-500)}.edge[_ngcontent-%COMP%] .arrow[_ngcontent-%COMP%]{position:absolute;bottom:-4px;left:-8px;color:var(--color-grey-300)}"],changeDetection:0});class re{constructor(n){this.changeDetector=n,this.setActiveState$=new Ie.X(void 0),this.nodes=[],this.edges=[]}get outerHeight(){return this.nodes.length*qe}ngOnInit(){this.setActiveState$.next(this.initialState),this.activeState$=this.setActiveState$.pipe((0,Ve.b)(150))}ngOnChanges(n){this.populateNodes()}ngAfterViewInit(){setTimeout(()=>this.populateEdges())}onMouseOver(n){this.setActiveState$.next(n)}onMouseOut(){this.setActiveState$.next(this.initialState)}getNodeFor(n){if(this.nodeComponents)return this.nodeComponents.find(t=>t.node.name===n)}populateNodes(){var n,t;const o=new Map;for(const i of this.states)o.set(i.name,{name:i.name,to:[]});for(const[i,l]of o.entries()){const c=null!==(t=null===(n=this.states.find(d=>d.name===i))||void 0===n?void 0:n.to)&&void 0!==t?t:[];for(const d of c){const g=o.get(d);g&&l.to.push(g)}}this.nodes=[...o.values()].filter(i=>"Cancelled"!==i.name)}populateEdges(){for(const n of this.nodes){const t=this.getNodeFor(n.name);let o=0;for(const i of n.to){const l=this.getNodeFor(i.name);t&&l&&t!==l&&(this.edges.push({to:l,from:t,index:o}),o++)}}this.edges=[...this.edges],this.changeDetector.markForCheck()}}function an(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.order-state-diagram"))}re.\u0275fac=function(n){return new(n||re)(e.Y36(e.sBO))},re.\u0275cmp=e.Xpm({type:re,selectors:[["vdr-order-process-graph"]],viewQuery:function(n,t){if(1&n&&e.Gf(R,5),2&n){let o;e.iGM(o=e.CRH())&&(t.nodeComponents=o)}},hostVars:2,hostBindings:function(n,t){2&n&&e.Udp("height",t.outerHeight,"px")},inputs:{states:"states",initialState:"initialState"},features:[e.TTD],decls:2,vars:2,consts:[[4,"ngFor","ngForOf"],[3,"node","index","active","mouseenter","mouseleave"],[3,"from","to","index"]],template:function(n,t){1&n&&(e.YNc(0,on,3,5,"ng-container",0),e.YNc(1,ln,2,3,"ng-container",0)),2&n&&(e.Q6J("ngForOf",t.nodes),e.xp6(1),e.Q6J("ngForOf",t.edges))},directives:[p.sg,R,ne],pipes:[p.Ov],styles:["[_nghost-%COMP%]{display:block;border:1px hotpink;margin:20px;padding:12px;position:relative}.state-row[_ngcontent-%COMP%]{display:flex}"],changeDetection:0});class oe{constructor(n){this.serverConfigService=n,this.states=[]}ngOnInit(){this.states=this.serverConfigService.getOrderProcessStates()}}oe.\u0275fac=function(n){return new(n||oe)(e.Y36(u.iHG))},oe.\u0275cmp=e.Xpm({type:oe,selectors:[["vdr-order-process-graph-dialog"]],decls:2,vars:2,consts:[["vdrDialogTitle",""],[3,"states","initialState"]],template:function(n,t){1&n&&(e.YNc(0,an,2,3,"ng-template",0),e._UZ(1,"vdr-order-process-graph",1)),2&n&&(e.xp6(1),e.Q6J("states",t.states)("initialState",t.activeState))},directives:[T.q,re],pipes:[f.X$],styles:[""],changeDetection:0});var Be=s(7283);function cn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.refund-and-cancel-order"))}function dn(r,n){if(1&r&&(e.TgZ(0,"div",36),e._uU(1),e.TgZ(2,"div",37),e._uU(3),e.ALo(4,"currency"),e.ALo(5,"number"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw(3).$implicit,i=e.oxw();e.xp6(1),e.hij(" ",t.description," "),e.xp6(2),e.hij(" ",e.xi3(4,2,e.xi3(5,5,t.amount/100/o.quantity,"1.0-2"),i.order.currencyCode)," ")}}function sn(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown")(1,"div",32)(2,"button",33),e._UZ(3,"clr-icon",34),e.qZA()(),e.TgZ(4,"vdr-dropdown-menu"),e.YNc(5,dn,6,8,"div",35),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(5),e.Q6J("ngForOf",t)}}function un(r,n){if(1&r&&(e.ynx(0),e.YNc(1,sn,6,1,"vdr-dropdown",26),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function pn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",38),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].quantity=i})("input",function(){e.CHM(t);const i=e.oxw().$implicit,l=e.oxw();return l.handleZeroQuantity(l.lineQuantities[i.id])}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("ngModel",o.lineQuantities[t.id].quantity)("max",t.quantity)}}function mn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].refund=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.lineQuantities[t.id].quantity)("ngModel",o.lineQuantities[t.id].refund)}}function _n(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"input",39),e.NdJ("ngModelChange",function(i){e.CHM(t);const l=e.oxw().$implicit;return e.oxw().lineQuantities[l.id].cancel=i}),e.qZA()}if(2&r){const t=e.oxw().$implicit,o=e.oxw();e.Q6J("disabled",0===o.lineQuantities[t.id].quantity)("ngModel",o.lineQuantities[t.id].cancel)}}function gn(r,n){if(1&r&&(e.TgZ(0,"tr",18)(1,"td",19),e._UZ(2,"img",20),e.ALo(3,"assetPreview"),e.qZA(),e.TgZ(4,"td",21),e._uU(5),e.qZA(),e.TgZ(6,"td",22),e._uU(7),e.qZA(),e.TgZ(8,"td",23),e._uU(9),e._UZ(10,"vdr-line-refunds",24),e.qZA(),e.TgZ(11,"td",23),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA(),e.TgZ(14,"td",23)(15,"div",25),e._uU(16),e.ALo(17,"localeCurrency"),e.YNc(18,un,2,1,"ng-container",26),e.qZA()(),e.TgZ(19,"td",27),e.YNc(20,pn,1,2,"input",28),e.qZA(),e.TgZ(21,"td",29)(22,"div",30),e.YNc(23,mn,1,2,"input",31),e.qZA()(),e.TgZ(24,"td",29)(25,"div",30),e.YNc(26,_n,1,2,"input",31),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(2),e.Q6J("src",e.xi3(3,12,t.featuredAsset,"tiny"),e.LSH),e.xp6(3),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",t.quantity," "),e.xp6(1),e.Q6J("line",t)("payments",o.order.payments),e.xp6(2),e.hij(" ",e.xi3(13,15,t.unitPriceWithTax,o.order.currencyCode)," "),e.xp6(4),e.hij(" ",e.xi3(17,18,t.proratedUnitPriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.discounts),e.xp6(2),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.xp6(3),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t)),e.xp6(3),e.Q6J("ngIf",o.lineCanBeRefundedOrCancelled(t))}}function fn(r,n){if(1&r&&(e.TgZ(0,"option",40),e._uU(1),e.ALo(2,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw();e.Q6J("ngValue",t)("disabled","Settled"!==t.state),e.xp6(1),e.lnq(" #",t.id," ",t.method,": ",e.xi3(2,5,t.amount,o.order.currencyCode)," ")}}const hn=function(r,n){return{min:r,max:n}};function xn(r,n){if(1&r&&(e.TgZ(0,"div",41),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"currency"),e.ALo(4,"localeCurrency"),e.qZA()),2&r){const t=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,1,"order.refund-total-error",e.WLB(10,hn,e.xi3(3,4,0,t.order.currencyCode),e.xi3(4,7,t.settledPaymentsTotal,t.order.currencyCode)))," ")}}function vn(r,n){1&r&&(e.TgZ(0,"div",42),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.refund-total-warning")," "))}const Cn=function(r){return{amount:r}};function yn(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"localeCurrency"),e.BQk()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.refund-with-amount",e.VKq(7,Cn,e.xi3(3,4,t.refundTotal,t.order.currencyCode)))," ")}}function Zn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-selected-items")," ")}function On(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",43),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",44),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e.YNc(4,yn,4,9,"ng-container",45),e.YNc(5,Zn,2,3,"ng-template",null,46,e.W1O),e.qZA()}if(2&r){const t=e.MAs(6),o=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,4,"common.cancel")),e.xp6(2),e.Q6J("disabled",!o.canSubmit()),e.xp6(1),e.Q6J("ngIf",o.isRefunding())("ngIfElse",t)}}class ie{constructor(n){var t;this.i18nService=n,this.lineQuantities={},this.refundShipping=!1,this.adjustment=0,this.reasons=null!==(t=(0,u.hq7)().cancellationReasons)&&void 0!==t?t:[(0,_.J)("order.refund-reason-customer-request"),(0,_.J)("order.refund-reason-not-available")],this.reasons=this.reasons.map(o=>this.i18nService.translate(o))}get refundTotal(){return this.order.lines.reduce((t,o)=>{const i=this.lineQuantities[o.id],l=i.refund&&i.quantity||0;return t+o.proratedUnitPriceWithTax*l},0)+(this.refundShipping?this.order.shippingWithTax:0)+this.adjustment}get settledPaymentsTotal(){return this.settledPayments.map(n=>n.amount-(0,U.summate)(n.refunds.filter(i=>"Failed"!==i.state),"total")).reduce((n,t)=>n+t,0)}lineCanBeRefundedOrCancelled(n){var t,o;const i=null!==(o=null===(t=this.order.payments)||void 0===t?void 0:t.reduce((c,d)=>[...c,...d.refunds],[]))&&void 0!==o?o:[];return 0<n.items.filter(c=>{if(c.cancelled)return!1;if(null==c.refundId)return!0;const d=i.find(g=>g.id===c.refundId);return"Failed"===(null==d?void 0:d.state)}).length}ngOnInit(){this.lineQuantities=this.order.lines.reduce((n,t)=>Object.assign(Object.assign({},n),{[t.id]:{quantity:0,refund:!1,cancel:!1}}),{}),this.settledPayments=(this.order.payments||[]).filter(n=>"Settled"===n.state),this.settledPayments.length&&(this.selectedPayment=this.settledPayments[0])}handleZeroQuantity(n){0===(null==n?void 0:n.quantity)&&(n.cancel=!1,n.refund=!1)}isRefunding(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.refund,!1)}isCancelling(){return Object.values(this.lineQuantities).reduce((t,o)=>t||0<o.quantity&&o.cancel,!1)}canSubmit(){return this.isRefunding()?!!(this.selectedPayment&&this.reason&&0<this.refundTotal&&this.refundTotal<=this.settledPaymentsTotal):!!this.isCancelling()&&!!this.reason}select(){const n=this.selectedPayment;if(n){const t=this.getOrderLineInput(i=>i.refund),o=this.getOrderLineInput(i=>i.cancel);this.resolveWith({refund:{lines:t,reason:this.reason,shipping:this.refundShipping?this.order.shippingWithTax:0,adjustment:this.adjustment,paymentId:n.id},cancel:{lines:o,orderId:this.order.id,reason:this.reason,cancelShipping:this.refundShipping}})}}cancel(){this.resolveWith()}getOrderLineInput(n){return Object.entries(this.lineQuantities).filter(([t,o])=>0<o.quantity&&n(o)).map(([t,o])=>({orderLineId:t,quantity:o.quantity}))}}function bn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.settle-refund"))}function Tn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",5),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",!t.transactionId),e.xp6(1),e.hij(" ",e.lcZ(5,5,"order.settle-refund")," ")}}ie.\u0275fac=function(n){return new(n||ie)(e.Y36(u.Dp7))},ie.\u0275cmp=e.Xpm({type:ie,selectors:[["vdr-refund-order-dialog"]],decls:69,vars:76,consts:[["vdrDialogTitle",""],[1,"refund-wrapper"],[1,"order-table"],[1,"table"],["class","order-line",4,"ngFor","ngForOf"],[1,"refund-details","mt4"],[1,"clr-control-label"],["bindLabel","name","autofocus","","bindValue","id",3,"disabled","items","placeholder","addTag","ngModel","ngModelChange"],["clrSelect","","name","options",3,"ngModel","disabled","ngModelChange"],[3,"ngValue","disabled",4,"ngFor","ngForOf"],["type","checkbox","clrCheckbox","",3,"ngModel","disabled","ngModelChange"],["clrInput","",3,"disabled","currencyCode","ngModel","ngModelChange"],[1,"totals"],[1,"order-total"],[1,"refund-total"],["class","refund-total-error",4,"ngIf"],["class","refund-total-warning",4,"ngIf"],["vdrDialogButtons",""],[1,"order-line"],[1,"align-middle","thumb"],[3,"src"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","quantity"],[3,"line","payments"],[1,"prorated-wrapper"],[4,"ngIf"],[1,"align-middle","quantity-col"],["type","number","min","0",3,"ngModel","max","ngModelChange","input",4,"ngIf"],[1,"align-middle"],[1,"cancel-checkbox-wrapper"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange",4,"ngIf"],["vdrDropdownTrigger","",1,"promotions-label"],[1,"icon-button"],["shape","info"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-amount"],["type","number","min","0",3,"ngModel","max","ngModelChange","input"],["type","checkbox","clrCheckbox","",3,"disabled","ngModel","ngModelChange"],[3,"ngValue","disabled"],[1,"refund-total-error"],[1,"refund-total-warning"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],[4,"ngIf","ngIfElse"],["cancelling",""]],template:function(n,t){1&n&&(e.YNc(0,cn,2,3,"ng-template",0),e.TgZ(1,"div",1)(2,"div",2)(3,"table",3)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA(),e.TgZ(22,"th"),e._uU(23),e.ALo(24,"translate"),e.qZA(),e.TgZ(25,"th"),e._uU(26),e.ALo(27,"translate"),e.qZA(),e.TgZ(28,"th"),e._uU(29),e.ALo(30,"translate"),e.qZA()()(),e.YNc(31,gn,27,21,"tr",4),e.qZA()(),e.TgZ(32,"div",5)(33,"div")(34,"label",6),e._uU(35),e.ALo(36,"translate"),e.qZA(),e.TgZ(37,"ng-select",7),e.NdJ("ngModelChange",function(i){return t.reason=i}),e.ALo(38,"translate"),e.qZA()(),e.TgZ(39,"div")(40,"clr-select-container")(41,"label"),e._uU(42),e.ALo(43,"translate"),e.qZA(),e.TgZ(44,"select",8),e.NdJ("ngModelChange",function(i){return t.selectedPayment=i}),e.YNc(45,fn,3,8,"option",9),e.qZA()(),e.TgZ(46,"clr-checkbox-wrapper")(47,"input",10),e.NdJ("ngModelChange",function(i){return t.refundShipping=i}),e.qZA(),e.TgZ(48,"label"),e._uU(49),e.ALo(50,"translate"),e.ALo(51,"localeCurrency"),e.qZA()(),e.TgZ(52,"clr-input-container")(53,"label"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.TgZ(56,"vdr-currency-input",11),e.NdJ("ngModelChange",function(i){return t.adjustment=i}),e.qZA()(),e.TgZ(57,"div",12)(58,"div",13),e._uU(59),e.ALo(60,"translate"),e.ALo(61,"localeCurrency"),e.qZA(),e.TgZ(62,"div",14),e._uU(63),e.ALo(64,"translate"),e.ALo(65,"localeCurrency"),e.qZA(),e.YNc(66,xn,5,13,"div",15),e.YNc(67,vn,3,3,"div",16),e.qZA()()()(),e.YNc(68,On,7,6,"ng-template",17)),2&n&&(e.xp6(8),e.Oqu(e.lcZ(9,37,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,39,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,41,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,43,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(21,45,"order.prorated-unit-price")),e.xp6(3),e.Oqu(e.lcZ(24,47,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(27,49,"order.refund")),e.xp6(3),e.Oqu(e.lcZ(30,51,"order.cancel")),e.xp6(2),e.Q6J("ngForOf",t.order.lines),e.xp6(1),e.ekj("faded",!t.isRefunding()&&!t.isCancelling()),e.xp6(3),e.Oqu(e.lcZ(36,53,"order.refund-cancellation-reason")),e.xp6(2),e.Q6J("disabled",!t.isRefunding()&&!t.isCancelling())("items",t.reasons)("placeholder",e.lcZ(38,55,"order.refund-cancellation-reason-required"))("addTag",!0)("ngModel",t.reason),e.xp6(5),e.Oqu(e.lcZ(43,57,"order.payment-to-refund")),e.xp6(2),e.Q6J("ngModel",t.selectedPayment)("disabled",!t.isRefunding()),e.xp6(1),e.Q6J("ngForOf",t.settledPayments),e.xp6(2),e.Q6J("ngModel",t.refundShipping)("disabled",!t.isRefunding()),e.xp6(2),e.AsE(" ",e.lcZ(50,59,"order.refund-shipping")," (",e.xi3(51,61,t.order.shippingWithTax,t.order.currencyCode),") "),e.xp6(5),e.Oqu(e.lcZ(55,64,"order.refund-adjustment")),e.xp6(2),e.Q6J("disabled",!t.isRefunding())("currencyCode",t.order.currencyCode)("ngModel",t.adjustment),e.xp6(1),e.ekj("disabled",!t.isRefunding()),e.xp6(2),e.AsE(" ",e.lcZ(60,66,"order.payment-amount"),": ",e.xi3(61,68,t.selectedPayment.amount,t.order.currencyCode)," "),e.xp6(4),e.AsE(" ",e.lcZ(64,71,"order.refund-total"),": ",e.xi3(65,73,t.refundTotal,t.order.currencyCode)," "),e.xp6(3),e.Q6J("ngIf",t.refundTotal<0||t.settledPaymentsTotal<t.refundTotal),e.xp6(1),e.Q6J("ngIf",t.selectedPayment.amount<t.refundTotal))},directives:[T.q,p.sg,I,p.O5,D.J,k.U,m.qvL,E.N,C.y,a.qQ,a.wV,a.Fd,a.Fj,a.JJ,a.On,a.Wl,m.KKC,m.MgK,A.w9,m.dTv,a.EJ,m.otW,a.YN,a.Kr,m.PEh,m.G55,Be.K,m.xRP,J.n],pipes:[f.X$,he.M,v.k,p.H9,p.JJ],styles:["[_nghost-%COMP%]{height:100%;display:flex;min-height:64vh}.refund-wrapper[_ngcontent-%COMP%]{flex:1;flex-direction:column}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%]{flex:1;overflow-y:auto}.refund-wrapper[_ngcontent-%COMP%] .order-table[_ngcontent-%COMP%] table[_ngcontent-%COMP%]{margin-top:0}.refund-wrapper[_ngcontent-%COMP%] tr.ignore[_ngcontent-%COMP%]{color:var(--color-grey-300)}.quantity-col[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}.cancel-checkbox-wrapper[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center}clr-checkbox-wrapper[_ngcontent-%COMP%]{margin-top:12px;margin-bottom:12px;display:block}.refund-details[_ngcontent-%COMP%]{display:flex;justify-content:space-between}.refund-details.faded[_ngcontent-%COMP%]{opacity:.5}.totals[_ngcontent-%COMP%]{margin-top:48px}.totals[_ngcontent-%COMP%] .refund-total[_ngcontent-%COMP%]{font-size:18px}.totals[_ngcontent-%COMP%] .refund-total-error[_ngcontent-%COMP%]{color:var(--color-error-500)}.totals[_ngcontent-%COMP%] .refund-total-warning[_ngcontent-%COMP%]{color:var(--color-warning-600);max-width:250px}.totals.disabled[_ngcontent-%COMP%]{color:var(--color-grey-300)}.prorated-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:center}.line-promotion[_ngcontent-%COMP%]{display:flex;justify-content:space-between;font-size:12px;padding:3px 6px}.line-promotion[_ngcontent-%COMP%] .promotion-amount[_ngcontent-%COMP%]{margin-left:12px}"],changeDetection:0});const An=function(r){return{method:r}};class le{constructor(){this.transactionId=""}submit(){this.resolveWith(this.transactionId)}cancel(){this.resolveWith()}}le.\u0275fac=function(n){return new(n||le)},le.\u0275cmp=e.Xpm({type:le,selectors:[["vdr-settle-refund-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[1,"instruction"],["clrInput","","name","transactionId",3,"ngModel","ngModelChange"],["vdrDialogButtons",""],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,bn,2,3,"ng-template",0),e.TgZ(1,"p",1),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"clr-input-container")(5,"label"),e._uU(6),e.ALo(7,"translate"),e.qZA(),e.TgZ(8,"input",2),e.NdJ("ngModelChange",function(i){return t.transactionId=i}),e.qZA()(),e.YNc(9,Tn,6,7,"ng-template",3)),2&n&&(e.xp6(2),e.hij(" ",e.xi3(3,3,"order.settle-refund-manual-instructions",e.VKq(8,An,t.refund.method)),"\n"),e.xp6(4),e.Oqu(e.lcZ(7,6,"order.transaction-id")),e.xp6(2),e.Q6J("ngModel",t.transactionId))},directives:[T.q,m.G55,m.MgK,C.y,a.Fj,m.xRP,a.JJ,a.On,J.n],pipes:[f.X$],styles:["[_nghost-%COMP%]{padding-bottom:32px}.instruction[_ngcontent-%COMP%]{margin-top:0;margin-bottom:24px}"],changeDetection:0});var y=s(9720),Ln=s(3158),In=s(1944),We=s(3945);var Fn=s(1339);function wn(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.select-state"))}function Mn(r,n){if(1&r&&(e.TgZ(0,"option",4),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"stateI18nToken"),e.qZA()),2&r){const t=n.$implicit;e.Q6J("value",t),e.xp6(1),e.hij(" ",e.lcZ(2,2,e.lcZ(3,4,t))," ")}}function Pn(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",7),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"common.cancel")," "))}const Sn=function(r){return{state:r}};function Nn(r,n){if(1&r){const t=e.EpF();e.YNc(0,Pn,3,3,"button",5),e.TgZ(1,"button",6),e.NdJ("click",function(){return e.CHM(t),e.oxw().select()}),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()}if(2&r){const t=e.oxw();e.Q6J("ngIf",t.cancellable),e.xp6(1),e.Q6J("disabled",!t.selectedState),e.xp6(1),e.hij(" ",e.xi3(3,3,"order.transition-to-state",e.VKq(10,Sn,e.lcZ(4,6,e.lcZ(5,8,t.selectedState))))," ")}}class ae{constructor(){this.nextStates=[],this.message="",this.selectedState=""}select(){this.selectedState&&this.resolveWith(this.selectedState)}cancel(){this.resolveWith()}}ae.\u0275fac=function(n){return new(n||ae)},ae.\u0275cmp=e.Xpm({type:ae,selectors:[["vdr-order-state-select-dialog"]],decls:8,vars:5,consts:[["vdrDialogTitle",""],["clrSelect","","name","state",3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["vdrDialogButtons",""],[3,"value"],["type","submit","class","btn btn-secondary",3,"click",4,"ngIf"],["type","submit",1,"btn","btn-primary",3,"disabled","click"],["type","submit",1,"btn","btn-secondary",3,"click"]],template:function(n,t){1&n&&(e.YNc(0,wn,2,3,"ng-template",0),e.TgZ(1,"p"),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"clr-select-container")(5,"select",1),e.NdJ("ngModelChange",function(i){return t.selectedState=i}),e.YNc(6,Mn,4,6,"option",2),e.qZA()(),e.YNc(7,Nn,6,12,"ng-template",3)),2&n&&(e.xp6(2),e.Oqu(e.lcZ(3,3,t.message)),e.xp6(3),e.Q6J("ngModel",t.selectedState),e.xp6(1),e.Q6J("ngForOf",t.nextStates))},directives:[T.q,m.dTv,C.y,a.EJ,m.otW,a.JJ,a.On,p.sg,a.YN,a.Kr,J.n,p.O5],pipes:[f.X$,Z.N],styles:[""],changeDetection:0});class w{constructor(n,t,o,i){this.dataService=n,this.modalService=t,this.notificationService=o,this.i18nService=i}transitionToPreModifyingState(n,t){return this.getPreModifyingState(n).pipe((0,h.w)(o=>{const i={orderId:n,nextStates:t,message:this.i18nService.translate((0,_.J)("order.unable-to-transition-to-state-try-another"),{state:o}),cancellable:!1,retry:10};return o?this.transitionToStateOrThrow(n,o).pipe((0,Ln.K)(l=>this.manuallyTransitionToState(i))):this.manuallyTransitionToState(i)}))}manuallyTransitionToState(n){return this.modalService.fromComponent(ae,{locals:{nextStates:n.nextStates,cancellable:n.cancellable,message:n.message},closable:!1,size:"md"}).pipe((0,h.w)(t=>{if(t)return this.transitionToStateOrThrow(n.orderId,t);if(n.cancellable)return j.E;throw new Error("An order state must be selected")}),function qn(r){return(0,In.e)((n,t)=>{let o,l,i=!1;const c=()=>{o=n.subscribe((0,We.x)(t,void 0,void 0,d=>{l||(l=new Ae.x,r(l).subscribe((0,We.x)(t,()=>o?c():i=!0))),l&&l.next(d)})),i&&(o.unsubscribe(),o=null,i=!1,c())};c()})}(t=>t.pipe((0,Fn.g)(2e3),(0,Ce.q)(n.retry))))}getPreModifyingState(n){return this.dataService.order.getOrderHistory(n,{filter:{type:{eq:u.iYD.ORDER_STATE_TRANSITION}},sort:{createdAt:u.Asd.DESC}}).mapSingle(t=>t.order).pipe((0,F.U)(t=>{const o=null==t?void 0:t.history.items.find(i=>"Modifying"===i.data.to);if(o)return o.data.from}))}transitionToStateOrThrow(n,t){return this.dataService.order.transitionToState(n,t).pipe((0,F.U)(({transitionOrderToState:o})=>{switch(null==o?void 0:o.__typename){case"Order":return null==o?void 0:o.state;case"OrderStateTransitionError":throw this.notificationService.error(null==o?void 0:o.transitionError),new Error(null==o?void 0:o.transitionError)}}))}}w.\u0275fac=function(n){return new(n||w)(e.LFG(u.DoR),e.LFG(u.Z7U),e.LFG(u.gqp),e.LFG(u.Dp7))},w.\u0275prov=e.Yz7({token:w,factory:w.\u0275fac,providedIn:"root"});var O=s(7346),Ge=s(3146),Fe=s(5886),Xe=s(8276);function Jn(r,n){if(1&r&&(e._UZ(0,"img",22),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}function Un(r,n){if(1&r&&(e.TgZ(0,"div",25)(1,"a",26),e._uU(2),e.qZA(),e.TgZ(3,"div",27),e._uU(4),e.ALo(5,"localeCurrency"),e.TgZ(6,"div",7),e.ALo(7,"translate"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw(4);e.xp6(1),e.Q6J("routerLink",o.getPromotionLink(t)),e.xp6(1),e.Oqu(t.description),e.xp6(2),e.hij(" ",e.xi3(5,5,t.amountWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(7,8,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(9,10,t.amount,o.order.currencyCode)," ")}}function Qn(r,n){if(1&r&&(e.TgZ(0,"vdr-dropdown")(1,"div",23),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.TgZ(4,"vdr-dropdown-menu"),e.YNc(5,Un,10,13,"div",24),e.qZA()()),2&r){const t=e.oxw().ngIf;e.xp6(2),e.hij(" ",e.lcZ(3,2,"order.promotions-applied")," "),e.xp6(3),e.Q6J("ngForOf",t)}}function Dn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Qn,6,4,"vdr-dropdown",21),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function kn(r,n){if(1&r&&(e.TgZ(0,"div",31),e._UZ(1,"vdr-custom-field-control",32),e.qZA()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("compact",!0)("readonly",!0)("customField",t.config)("customFieldsFormGroup",t.formGroup)}}function En(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td",28)(2,"div",29),e.YNc(3,kn,2,4,"div",30),e.qZA()()()),2&r){const t=e.oxw().ngIf;e.xp6(3),e.Q6J("ngForOf",t)}}function Yn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,En,4,1,"tr",21),e.BQk()),2&r){const t=n.ngIf;e.xp6(1),e.Q6J("ngIf",t.length)}}function jn(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"tr",11)(2,"td",12),e.YNc(3,Jn,2,4,"img",13),e.qZA(),e.TgZ(4,"td",14),e._uU(5),e.qZA(),e.TgZ(6,"td",15),e._uU(7),e.qZA(),e.TgZ(8,"td",16),e._uU(9),e.ALo(10,"localeCurrency"),e.TgZ(11,"div",7),e.ALo(12,"translate"),e._uU(13),e.ALo(14,"localeCurrency"),e.qZA()(),e.TgZ(15,"td",17),e._uU(16),e._UZ(17,"vdr-line-refunds",18)(18,"vdr-line-fulfillment",19),e.qZA(),e.TgZ(19,"td",20),e._uU(20),e.ALo(21,"localeCurrency"),e.TgZ(22,"div",7),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"localeCurrency"),e.qZA(),e.YNc(26,Dn,2,1,"ng-container",21),e.qZA()(),e.YNc(27,Yn,2,1,"ng-container",21),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(1),e.ekj("is-cancelled",0===t.quantity),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",e.xi3(10,18,t.unitPriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(12,21,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(14,23,t.unitPrice,o.order.currencyCode)," "),e.xp6(3),e.hij(" ",t.quantity," "),e.xp6(1),e.Q6J("line",t)("payments",o.order.payments),e.xp6(1),e.Q6J("line",t)("orderState",o.order.state),e.xp6(2),e.hij(" ",e.xi3(21,26,t.linePriceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,29,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,31,t.linePrice,o.order.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",o.getLineDiscounts(t)),e.xp6(1),e.Q6J("ngIf",o.customFieldsForLine[t.id])}}function Rn(r,n){if(1&r&&(e.TgZ(0,"tr",33)(1,"td",34),e._uU(2),e.qZA(),e.TgZ(3,"td",15),e._uU(4),e.qZA(),e._UZ(5,"td",35),e.TgZ(6,"td",20),e._uU(7),e.ALo(8,"localeCurrency"),e.TgZ(9,"div",7),e.ALo(10,"translate"),e._uU(11),e.ALo(12,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(t.sku),e.xp6(3),e.hij(" ",e.xi3(8,5,t.priceWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(10,8,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(12,10,t.price,o.order.currencyCode)," ")}}function Hn(r,n){if(1&r&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA()),2&r){const t=n.ngIf;e.xp6(1),e.Oqu(t)}}function $n(r,n){if(1&r&&(e.TgZ(0,"tr",37)(1,"td",38)(2,"a",39),e._uU(3),e.qZA(),e.YNc(4,Hn,2,1,"vdr-chip",21),e.qZA(),e.TgZ(5,"td",6),e._uU(6),e.ALo(7,"localeCurrency"),e.TgZ(8,"div",7),e.ALo(9,"translate"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(2),e.Q6J("routerLink",o.getPromotionLink(t)),e.xp6(1),e.Oqu(t.description),e.xp6(1),e.Q6J("ngIf",o.getCouponCodeForAdjustment(o.order,t)),e.xp6(2),e.hij(" ",e.xi3(7,6,t.amountWithTax,o.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(9,9,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(11,11,t.amount,o.order.currencyCode)," ")}}function Vn(r,n){if(1&r&&(e.ynx(0),e.YNc(1,$n,12,14,"tr",36),e.BQk()),2&r){const t=n.$implicit;e.xp6(1),e.Q6J("ngIf","OTHER"!==t.type)}}class H{constructor(){this.orderLineCustomFieldsVisible=!1,this.customFieldsForLine={}}get visibleOrderLineCustomFields(){return this.orderLineCustomFieldsVisible?this.orderLineCustomFields:[]}get showElided(){return!this.orderLineCustomFieldsVisible&&0<this.orderLineCustomFields.length}ngOnInit(){this.orderLineCustomFieldsVisible=this.orderLineCustomFields.length<2,this.getLineCustomFields()}toggleOrderLineCustomFields(){this.orderLineCustomFieldsVisible=!this.orderLineCustomFieldsVisible}getLineDiscounts(n){return n.discounts.filter(t=>t.type===u.S2X.PROMOTION)}getLineCustomFields(){for(const n of this.order.lines){const t=new a.cw({}),o=this.orderLineCustomFields.map(i=>{const l=n.customFields[i.name];return t.addControl(i.name,new a.NI(l)),{config:i,formGroup:t,value:l}}).filter(i=>!!this.orderLineCustomFieldsVisible||null!=i.value);this.customFieldsForLine[n.id]=o}}getPromotionLink(n){return["/marketing","promotions",n.adjustmentSource.split(":")[1]]}getCouponCodeForAdjustment(n,t){const o=t.adjustmentSource.split(":")[1],i=n.promotions.find(l=>l.id===o);if(i)return i.couponCode||void 0}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}}H.\u0275fac=function(n){return new(n||H)},H.\u0275cmp=e.Xpm({type:H,selectors:[["vdr-order-table"]],inputs:{order:"order",orderLineCustomFields:"orderLineCustomFields"},decls:61,vars:61,consts:[[1,"order-table","table"],[4,"ngFor","ngForOf"],["class","surcharge",4,"ngFor","ngForOf"],[1,"sub-total"],[1,"left","clr-align-middle"],["colspan","4"],[1,"clr-align-middle"],[1,"net-price",3,"title"],[1,"shipping"],["colspan","3"],[1,"total"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],[3,"line","payments"],[3,"line","orderState"],[1,"align-middle","total"],[4,"ngIf"],[3,"src"],["vdrDropdownTrigger","",1,"promotions-label"],["class","line-promotion",4,"ngFor","ngForOf"],[1,"line-promotion"],[1,"promotion-name",3,"routerLink"],[1,"promotion-amount"],["colspan","6",1,"custom-fields-row"],[1,"order-line-custom-fields"],["class","custom-field",4,"ngFor","ngForOf"],[1,"custom-field"],[3,"compact","readonly","customField","customFieldsFormGroup"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],["colspan","2",1,"align-middle"],["class","order-adjustment",4,"ngIf"],[1,"order-adjustment"],["colspan","5",1,"left","clr-align-middle"],[3,"routerLink"]],template:function(n,t){1&n&&(e.TgZ(0,"table",0)(1,"thead")(2,"tr"),e._UZ(3,"th"),e.TgZ(4,"th"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA()()(),e.TgZ(19,"tbody"),e.YNc(20,jn,28,34,"ng-container",1),e.YNc(21,Rn,13,13,"tr",2),e.YNc(22,Vn,2,1,"ng-container",1),e.TgZ(23,"tr",3)(24,"td",4),e._uU(25),e.ALo(26,"translate"),e.qZA(),e._UZ(27,"td",5),e.TgZ(28,"td",6),e._uU(29),e.ALo(30,"localeCurrency"),e.TgZ(31,"div",7),e.ALo(32,"translate"),e._uU(33),e.ALo(34,"localeCurrency"),e.qZA()()(),e.TgZ(35,"tr",8)(36,"td",4),e._uU(37),e.ALo(38,"translate"),e.qZA(),e.TgZ(39,"td",6),e._uU(40),e.qZA(),e._UZ(41,"td",9),e.TgZ(42,"td",6),e._uU(43),e.ALo(44,"localeCurrency"),e.TgZ(45,"div",7),e.ALo(46,"translate"),e._uU(47),e.ALo(48,"localeCurrency"),e.qZA()()(),e.TgZ(49,"tr",10)(50,"td",4),e._uU(51),e.ALo(52,"translate"),e.qZA(),e._UZ(53,"td",5),e.TgZ(54,"td",6),e._uU(55),e.ALo(56,"localeCurrency"),e.TgZ(57,"div",7),e.ALo(58,"translate"),e._uU(59),e.ALo(60,"localeCurrency"),e.qZA()()()()()),2&n&&(e.xp6(5),e.Oqu(e.lcZ(6,21,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(9,23,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(12,25,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(15,27,"order.quantity")),e.xp6(3),e.Oqu(e.lcZ(18,29,"order.total")),e.xp6(3),e.Q6J("ngForOf",t.order.lines),e.xp6(1),e.Q6J("ngForOf",t.order.surcharges),e.xp6(1),e.Q6J("ngForOf",t.order.discounts),e.xp6(3),e.Oqu(e.lcZ(26,31,"order.sub-total")),e.xp6(4),e.hij(" ",e.xi3(30,33,t.order.subTotalWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(32,36,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(34,38,t.order.subTotal,t.order.currencyCode)," "),e.xp6(4),e.Oqu(e.lcZ(38,41,"order.shipping")),e.xp6(3),e.Oqu(t.getShippingNames(t.order)),e.xp6(3),e.hij(" ",e.xi3(44,43,t.order.shippingWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(46,46,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(48,48,t.order.shipping,t.order.currencyCode)," "),e.xp6(4),e.Oqu(e.lcZ(52,51,"order.total")),e.xp6(4),e.hij(" ",e.xi3(56,53,t.order.totalWithTax,t.order.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(58,56,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(60,58,t.order.total,t.order.currencyCode)," "))},directives:[p.sg,p.O5,I,Y,D.J,k.U,E.N,y.yS,Te.M,G.Y],pipes:[f.X$,he.M,v.k],styles:[".order-table[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table[_ngcontent-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-right:18px}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table[_ngcontent-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px} .line-promotion{display:flex;justify-content:space-between;padding:6px 12px} .line-promotion .promotion-amount{margin-left:12px} .line-promotion .net-price{font-size:11px;color:var(--color-text-300)}"],changeDetection:0});var Bn=s(2505),Wn=s(2355),Gn=s(4664),Ke=s(2702);function Xn(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.error-message")),e.xp6(2),e.hij(" ",t.payment.errorMessage,"\n")}}function Kn(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw();e.Q6J("label",e.lcZ(1,2,"order.transaction-id")),e.xp6(2),e.hij(" ",t.payment.transactionId,"\n")}}class ${}$.\u0275fac=function(n){return new(n||$)},$.\u0275cmp=e.Xpm({type:$,selectors:[["vdr-payment-detail"]],inputs:{payment:"payment",currencyCode:"currencyCode"},decls:12,vars:17,consts:[[3,"label"],[3,"label",4,"ngIf"],[3,"value"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-labeled-data",0),e.ALo(1,"translate"),e._uU(2),e.qZA(),e.TgZ(3,"vdr-labeled-data",0),e.ALo(4,"translate"),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.YNc(7,Xn,3,4,"vdr-labeled-data",1),e.YNc(8,Kn,3,4,"vdr-labeled-data",1),e.TgZ(9,"vdr-labeled-data",0),e.ALo(10,"translate"),e._UZ(11,"vdr-object-tree",2),e.qZA()),2&n&&(e.Q6J("label",e.lcZ(1,8,"order.payment-method")),e.xp6(2),e.hij(" ",t.payment.method,"\n"),e.xp6(1),e.Q6J("label",e.lcZ(4,10,"order.amount")),e.xp6(2),e.hij(" ",e.xi3(6,12,t.payment.amount,t.currencyCode),"\n"),e.xp6(2),e.Q6J("ngIf",t.payment.errorMessage),e.xp6(1),e.Q6J("ngIf",t.payment.transactionId),e.xp6(1),e.Q6J("label",e.lcZ(10,15,"order.payment-metadata")),e.xp6(2),e.Q6J("value",t.payment.metadata))},directives:[K.W,p.O5,Ke._],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var zn=s(7388);function er(r,n){1&r&&(e.TgZ(0,"span",12),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.note-only-visible-to-administrators")," "))}function tr(r,n){1&r&&(e.TgZ(0,"span",13),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.note-visible-to-customer")," "))}function nr(r,n){1&r&&(e.TgZ(0,"div",11),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.history-order-fulfilled")," "))}function rr(r,n){1&r&&(e.TgZ(0,"div",11),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.history-order-cancelled")," "))}const ze=function(r,n){return{from:r,to:n}};function or(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(2).$implicit;e.hij(" ",e.xi3(1,1,"order.history-order-transition",e.WLB(4,ze,t.data.from,t.data.to))," ")}}function ir(r,n){if(1&r&&(e.ynx(0),e.YNc(1,nr,3,3,"div",17),e.YNc(2,rr,3,3,"div",17),e.YNc(3,or,2,7,"ng-template",18),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf","Delivered"===t.data.to),e.xp6(1),e.Q6J("ngIf","Cancelled"===t.data.to),e.xp6(1),e.Q6J("ngIf","Cancelled"!==t.data.to&&"Delivered"!==t.data.to)}}function lr(r,n){1&r&&(e.TgZ(0,"vdr-chip",23),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-settled")))}function ar(r,n){1&r&&(e.TgZ(0,"vdr-chip",24),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"order.modification-not-settled")))}function cr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"strong"),e._uU(4),e.ALo(5,"localeCurrency"),e.qZA(),e.YNc(6,lr,3,3,"vdr-chip",20),e.YNc(7,ar,3,3,"vdr-chip",21),e.TgZ(8,"vdr-history-entry-detail"),e._UZ(9,"vdr-modification-detail",22),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.hij(" ",e.lcZ(2,6,"order.modify-order-price-difference"),": "),e.xp6(3),e.Oqu(e.xi3(5,8,t.priceChange,o.order.currencyCode)),e.xp6(2),e.Q6J("ngIf",t.isSettled),e.xp6(1),e.Q6J("ngIf",!t.isSettled),e.xp6(2),e.Q6J("order",o.order)("modification",t)}}function dr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e.YNc(4,cr,10,11,"ng-container",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(2),e.hij(" ",e.lcZ(3,2,"order.history-order-modified")," "),e.xp6(2),e.Q6J("ngIf",o.getModification(t.data.modificationId))}}function sr(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-payment-detail",27),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(4);e.xp6(1),e.Q6J("payment",t)("currencyCode",o.order.currencyCode)}}function ur(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.YNc(6,sr,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,4,"order.history-payment-settled")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,6,"order.transaction-id"),": ",null==(i=o.getPayment(t))?null:i.transactionId," "),e.xp6(2),e.Q6J("ngIf",o.getPayment(t))}}const et=function(r,n,t){return{from:r,to:n,id:t}};function pr(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate")),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.hij(" ",e.xi3(1,1,"order.history-payment-transition",e.kEZ(4,et,t.data.from,t.data.to,null==(i=o.getPayment(t))?null:i.transactionId))," ")}}function mr(r,n){if(1&r&&(e.ynx(0),e.YNc(1,ur,7,8,"ng-container",25),e.YNc(2,pr,2,8,"ng-template",null,26,e.W1O),e.BQk()),2&r){const t=e.MAs(3),o=e.oxw().$implicit;e.xp6(1),e.Q6J("ngIf","Settled"===o.data.to)("ngIfElse",t)}}function _r(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-refund-transition",e.kEZ(4,et,t.data.from,t.data.to,t.data.refundId))," ")}}function gr(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail")(1,"vdr-labeled-data",28),e.ALo(2,"translate"),e._uU(3),e.qZA(),e.TgZ(4,"vdr-labeled-data",28),e.ALo(5,"translate"),e._UZ(6,"vdr-simple-item-list",29),e.qZA(),e.TgZ(7,"vdr-labeled-data",28),e.ALo(8,"translate"),e._uU(9),e.qZA()()),2&r){const t=n.ngIf,o=e.oxw(2).$implicit;e.xp6(1),e.Q6J("label",e.lcZ(2,6,"order.cancellation-reason")),e.xp6(2),e.hij(" ",o.data.reason," "),e.xp6(1),e.Q6J("label",e.lcZ(5,8,"order.contents")),e.xp6(2),e.Q6J("items",t),e.xp6(1),e.Q6J("label",e.lcZ(8,10,"order.shipping-cancelled")),e.xp6(2),e.hij(" ",o.data.shippingCancelled," ")}}const fr=function(r){return{count:r}};function hr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,gr,10,12,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.xi3(2,2,"order.history-items-cancelled",e.VKq(5,fr,t.data.orderItemIds.length))," "),e.xp6(2),e.Q6J("ngIf",o.getCancelledItems(t))}}function xr(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",30),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function vr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.YNc(3,xr,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-fulfillment-created")," "),e.xp6(2),e.Q6J("ngIf",o.getFulfillment(t))}}function Cr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,3,"order.history-fulfillment-delivered")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function yr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",11),e._uU(2),e.ALo(3,"translate"),e.qZA(),e._uU(4),e.ALo(5,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit,o=e.oxw();let i;e.xp6(2),e.hij(" ",e.lcZ(3,3,"order.history-fulfillment-shipped")," "),e.xp6(2),e.AsE(" ",e.lcZ(5,5,"order.tracking-code"),": ",null==(i=o.getFulfillment(t))?null:i.trackingCode," ")}}function Zr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r){const t=e.oxw(2).$implicit;e.xp6(1),e.hij(" ",e.xi3(2,1,"order.history-fulfillment-transition",e.WLB(4,ze,t.data.from,t.data.to))," ")}}function Or(r,n){if(1&r&&(e.TgZ(0,"vdr-history-entry-detail"),e._UZ(1,"vdr-fulfillment-detail",30),e.qZA()),2&r){const t=n.ngIf,o=e.oxw(3);e.xp6(1),e.Q6J("fulfillmentId",t.id)("order",o.order)}}function br(r,n){if(1&r&&(e.ynx(0),e.YNc(1,Cr,6,7,"ng-container",19),e.YNc(2,yr,6,7,"ng-container",19),e.YNc(3,Zr,3,7,"ng-container",19),e.YNc(4,Or,2,2,"vdr-history-entry-detail",19),e.BQk()),2&r){const t=e.oxw().$implicit,o=e.oxw();e.xp6(1),e.Q6J("ngIf","Delivered"===t.data.to),e.xp6(1),e.Q6J("ngIf","Shipped"===t.data.to),e.xp6(1),e.Q6J("ngIf","Delivered"!==t.data.to&&"Shipped"!==t.data.to),e.xp6(1),e.Q6J("ngIf",o.getFulfillment(t))}}function Tr(r,n){1&r&&(e.TgZ(0,"span",43),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.public")))}function Ar(r,n){1&r&&(e.TgZ(0,"span",44),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.private")))}function Lr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"div",31)(2,"div",32),e.YNc(3,Tr,3,3,"span",33),e.YNc(4,Ar,3,3,"span",34),e._uU(5),e.qZA(),e._UZ(6,"div",35),e.TgZ(7,"vdr-dropdown")(8,"button",36),e._UZ(9,"clr-icon",37),e.qZA(),e.TgZ(10,"vdr-dropdown-menu",38)(11,"button",39),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().updateNote.emit(i)}),e.ALo(12,"hasPermission"),e._UZ(13,"clr-icon",40),e._uU(14),e.ALo(15,"translate"),e.qZA(),e._UZ(16,"div",41),e.TgZ(17,"button",39),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().deleteNote.emit(i)}),e.ALo(18,"hasPermission"),e._UZ(19,"clr-icon",42),e._uU(20),e.ALo(21,"translate"),e.qZA()()()(),e.BQk()}if(2&r){const t=e.oxw().$implicit;e.xp6(3),e.Q6J("ngIf",t.isPublic),e.xp6(1),e.Q6J("ngIf",!t.isPublic),e.xp6(1),e.hij(" ",t.data.note," "),e.xp6(6),e.Q6J("disabled",!e.lcZ(12,7,"UpdateOrder")),e.xp6(3),e.hij(" ",e.lcZ(15,9,"common.edit")," "),e.xp6(3),e.Q6J("disabled",!e.lcZ(18,11,"UpdateOrder")),e.xp6(3),e.hij(" ",e.lcZ(21,13,"common.delete")," ")}}const Ir=function(r){return["/marketing","promotions",r]};function qr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"a",45),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,3,"order.history-coupon-code-applied"),": "),e.xp6(3),e.Q6J("routerLink",e.VKq(5,Ir,t.data.promotionId)),e.xp6(1),e.Oqu(t.data.couponCode)}}function Fr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.TgZ(3,"vdr-chip")(4,"span",46),e._uU(5),e.qZA()(),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(1),e.hij(" ",e.lcZ(2,2,"order.history-coupon-code-removed"),": "),e.xp6(4),e.Oqu(t.data.couponCode)}}function wr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-timeline-entry",14),e.NdJ("expandClick",function(){e.CHM(t);const i=e.oxw();return i.expanded=!i.expanded}),e.ynx(1,15),e.YNc(2,ir,4,3,"ng-container",16),e.YNc(3,dr,5,4,"ng-container",16),e.YNc(4,mr,4,2,"ng-container",16),e.YNc(5,_r,3,8,"ng-container",16),e.YNc(6,hr,4,7,"ng-container",16),e.YNc(7,vr,4,4,"ng-container",16),e.YNc(8,br,5,4,"ng-container",16),e.YNc(9,Lr,22,15,"ng-container",16),e.YNc(10,qr,6,7,"ng-container",16),e.YNc(11,Fr,6,4,"ng-container",16),e.BQk(),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw();e.Q6J("displayType",o.getDisplayType(t))("iconShape",o.getTimelineIcon(t))("createdAt",t.createdAt)("name",o.getName(t))("featured",o.isFeatured(t))("collapsed",!o.expanded&&!o.isFeatured(t)),e.xp6(1),e.Q6J("ngSwitch",t.type),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_STATE_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_MODIFIED),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_PAYMENT_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_REFUND_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_CANCELLATION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_FULFILLMENT),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_FULFILLMENT_TRANSITION),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_NOTE),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_COUPON_APPLIED),e.xp6(1),e.Q6J("ngSwitchCase",o.type.ORDER_COUPON_REMOVED)}}class ce{constructor(){this.addNote=new e.vpe,this.updateNote=new e.vpe,this.deleteNote=new e.vpe,this.note="",this.noteIsPrivate=!0,this.expanded=!1,this.type=u.iYD}getDisplayType(n){if(n.type===u.iYD.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return"success";if("Cancelled"===n.data.to)return"error"}return n.type===u.iYD.ORDER_FULFILLMENT_TRANSITION&&"Delivered"===n.data.to?"success":n.type===u.iYD.ORDER_PAYMENT_TRANSITION&&("Declined"===n.data.to||"Cancelled"===n.data.to)||n.type===u.iYD.ORDER_CANCELLATION?"error":n.type===u.iYD.ORDER_REFUND_TRANSITION?"warning":"default"}getTimelineIcon(n){if(n.type===u.iYD.ORDER_STATE_TRANSITION){if("Delivered"===n.data.to)return["success-standard","is-solid"];if("Cancelled"===n.data.to)return"ban"}return n.type===u.iYD.ORDER_PAYMENT_TRANSITION&&"Settled"===n.data.to?"credit-card":n.type===u.iYD.ORDER_NOTE?"note":n.type===u.iYD.ORDER_MODIFIED?"pencil":n.type!==u.iYD.ORDER_FULFILLMENT_TRANSITION||"Shipped"!==n.data.to&&"Delivered"!==n.data.to?void 0:"truck"}isFeatured(n){switch(n.type){case u.iYD.ORDER_STATE_TRANSITION:return"Delivered"===n.data.to||"Cancelled"===n.data.to||"Settled"===n.data.to;case u.iYD.ORDER_PAYMENT_TRANSITION:return"Settled"===n.data.to||"Cancelled"===n.data.to;case u.iYD.ORDER_FULFILLMENT_TRANSITION:return"Delivered"===n.data.to||"Shipped"===n.data.to;case u.iYD.ORDER_NOTE:case u.iYD.ORDER_MODIFIED:return!0;default:return!1}}getFulfillment(n){if((n.type===u.iYD.ORDER_FULFILLMENT||n.type===u.iYD.ORDER_FULFILLMENT_TRANSITION)&&this.order.fulfillments)return this.order.fulfillments.find(t=>t.id===n.data.fulfillmentId)}getPayment(n){if(n.type===u.iYD.ORDER_PAYMENT_TRANSITION&&this.order.payments)return this.order.payments.find(t=>t.id===n.data.paymentId)}getCancelledItems(n){const t=new Map,o=n.data.orderItemIds;for(const i of this.order.lines)for(const l of i.items)if(o.includes(l.id)){const c=t.get(i.productVariant.name);null!=c?t.set(i.productVariant.name,c+1):t.set(i.productVariant.name,1)}return Array.from(t.entries()).map(([i,l])=>({name:i,quantity:l}))}getModification(n){return this.order.modifications.find(t=>t.id===n)}getName(n){const{administrator:t}=n;if(t)return`${t.firstName} ${t.lastName}`;{const o=this.order.customer;if(o)return`${o.firstName} ${o.lastName}`}return""}addNoteToOrder(){this.addNote.emit({note:this.note,isPublic:!this.noteIsPrivate}),this.note="",this.noteIsPrivate=!0}}ce.\u0275fac=function(n){return new(n||ce)},ce.\u0275cmp=e.Xpm({type:ce,selectors:[["vdr-order-history"]],inputs:{order:"order",history:"history"},outputs:{addNote:"addNote",updateNote:"updateNote",deleteNote:"deleteNote"},decls:23,vars:24,consts:[[1,"entry-list"],["iconShape","note","displayType","muted",3,"featured"],[1,"note-entry"],["name","note",1,"note",3,"ngModel","ngModelChange"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"visibility-select"],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],["class","private",4,"ngIf"],["class","public",4,"ngIf"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick",4,"ngFor","ngForOf"],[3,"isLast","createdAt","featured"],[1,"title"],[1,"private"],[1,"public"],[3,"displayType","iconShape","createdAt","name","featured","collapsed","expandClick"],[3,"ngSwitch"],[4,"ngSwitchCase"],["class","title",4,"ngIf"],[3,"ngIf"],[4,"ngIf"],["colorType","success",4,"ngIf"],["colorType","error",4,"ngIf"],[3,"order","modification"],["colorType","success"],["colorType","error"],[4,"ngIf","ngIfElse"],["regularPaymentTransition",""],[3,"payment","currencyCode"],[3,"label"],[3,"items"],[3,"fulfillmentId","order"],[1,"flex"],[1,"note-text"],["class","note-visibility public",4,"ngIf"],["class","note-visibility private",4,"ngIf"],[1,"flex-spacer"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["vdrDropdownItem","",1,"button",3,"disabled","click"],["shape","edit"],[1,"dropdown-divider"],["shape","trash",1,"is-danger"],[1,"note-visibility","public"],[1,"note-visibility","private"],[3,"routerLink"],[1,"cancelled-coupon-code"]],template:function(n,t){1&n&&(e.TgZ(0,"h4"),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"div",0)(4,"vdr-timeline-entry",1)(5,"div",2)(6,"textarea",3),e.NdJ("ngModelChange",function(i){return t.note=i}),e.qZA(),e.TgZ(7,"button",4),e.NdJ("click",function(){return t.addNoteToOrder()}),e._uU(8),e.ALo(9,"translate"),e.qZA()(),e.TgZ(10,"div",5)(11,"clr-checkbox-wrapper")(12,"input",6),e.NdJ("ngModelChange",function(i){return t.noteIsPrivate=i}),e.qZA(),e.TgZ(13,"label"),e._uU(14),e.ALo(15,"translate"),e.qZA()(),e.YNc(16,er,3,3,"span",7),e.YNc(17,tr,3,3,"span",8),e.qZA()(),e.YNc(18,wr,12,17,"vdr-timeline-entry",9),e.TgZ(19,"vdr-timeline-entry",10)(20,"div",11),e._uU(21),e.ALo(22,"translate"),e.qZA()()()),2&n&&(e.xp6(1),e.Oqu(e.lcZ(2,16,"order.order-history")),e.xp6(2),e.ekj("expanded",t.expanded),e.xp6(1),e.Q6J("featured",!0),e.xp6(2),e.Q6J("ngModel",t.note),e.xp6(1),e.Q6J("disabled",!t.note),e.xp6(1),e.hij(" ",e.lcZ(9,18,"common.add-note")," "),e.xp6(4),e.Q6J("ngModel",t.noteIsPrivate),e.xp6(2),e.Oqu(e.lcZ(15,20,"order.note-is-private")),e.xp6(2),e.Q6J("ngIf",t.noteIsPrivate),e.xp6(1),e.Q6J("ngIf",!t.noteIsPrivate),e.xp6(1),e.Q6J("ngForOf",t.history),e.xp6(1),e.Q6J("isLast",!0)("createdAt",t.order.createdAt)("featured",!0),e.xp6(2),e.hij(" ",e.lcZ(22,22,"order.history-order-created")," "))},directives:[Wn._,C.y,a.Fj,a.JJ,a.On,m.PEh,a.Wl,m.KKC,m.MgK,p.O5,p.sg,p.RF,p.n9,G.Y,Gn.C,ee,$,K.W,L,Q,D.J,k.U,m.qvL,E.N,ve.H,y.yS],pipes:[f.X$,v.k,zn.j],styles:["[_nghost-%COMP%]{margin-top:48px;display:block}.entry-list[_ngcontent-%COMP%]{margin-top:24px;margin-left:24px;margin-right:12px}.note-entry[_ngcontent-%COMP%]{display:flex;align-items:center}.note-entry[_ngcontent-%COMP%] .note[_ngcontent-%COMP%]{flex:1}.note-entry[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{margin:0}.visibility-select[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:baseline}.visibility-select[_ngcontent-%COMP%] .public[_ngcontent-%COMP%]{color:var(--color-warning-500)}.visibility-select[_ngcontent-%COMP%] .private[_ngcontent-%COMP%]{color:var(--color-success-500)}textarea.note[_ngcontent-%COMP%]{flex:1;height:36px;border-radius:3px;margin-right:6px}.note-text[_ngcontent-%COMP%]{color:var(--color-grey-800);white-space:pre-wrap}.cancelled-coupon-code[_ngcontent-%COMP%]{text-decoration:line-through}.note-visibility[_ngcontent-%COMP%]{text-transform:lowercase}.note-visibility.public[_ngcontent-%COMP%]{color:var(--color-warning-500)}.note-visibility.private[_ngcontent-%COMP%]{color:var(--color-success-500)}"],changeDetection:0});var tt=s(458);function Mr(r,n){1&r&&e._UZ(0,"clr-icon",2)}class de{get chipColorType(){switch(this.state){case"Authorized":return"warning";case"Settled":return"success";case"Declined":case"Cancelled":return"error"}}}function Pr(r,n){1&r&&e._UZ(0,"clr-icon",2)}de.\u0275fac=function(n){return new(n||de)},de.\u0275cmp=e.Xpm({type:de,selectors:[["vdr-payment-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Mr,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Settled"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[G.Y,p.O5,m.qvL],pipes:[f.X$,Z.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});class se{get chipColorType(){switch(this.state){case"Pending":return"warning";case"Settled":return"success";case"Failed":return"error"}}}function Sr(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.BQk()),2&r){const t=e.oxw();e.xp6(1),e.hij("#",t.payment.transactionId,"")}}function Nr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.transaction-id")),e.xp6(2),e.hij(" ",t.transactionId," ")}}function Jr(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._uU(2),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.refund-reason")),e.xp6(2),e.hij(" ",t.reason," ")}}function Ur(r,n){if(1&r&&(e.TgZ(0,"vdr-labeled-data",11),e.ALo(1,"translate"),e._UZ(2,"vdr-object-tree",13),e.qZA()),2&r){const t=e.oxw().$implicit;e.Q6J("label",e.lcZ(1,2,"order.refund-metadata")),e.xp6(2),e.Q6J("value",t.metadata)}}function Qr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",14)(1,"button",15),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().$implicit;return e.oxw().settleRefund.emit(i)}),e._uU(2),e.ALo(3,"translate"),e.qZA()()}2&r&&(e.xp6(2),e.hij(" ",e.lcZ(3,1,"order.settle-refund")," "))}function Dr(r,n){if(1&r&&(e.ynx(0),e.TgZ(1,"div",1),e._UZ(2,"clr-icon",9),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"div",10)(6,"vdr-refund-state-label",4),e.qZA(),e.TgZ(7,"div",5)(8,"vdr-labeled-data",11),e.ALo(9,"translate"),e._uU(10),e.ALo(11,"localeDate"),e.qZA(),e.TgZ(12,"vdr-labeled-data",11),e.ALo(13,"translate"),e._uU(14),e.ALo(15,"localeCurrency"),e.qZA(),e.YNc(16,Nr,3,4,"vdr-labeled-data",12),e.YNc(17,Jr,3,4,"vdr-labeled-data",12),e.YNc(18,Ur,3,4,"vdr-labeled-data",12),e.qZA(),e.YNc(19,Qr,4,3,"div",8),e.BQk()),2&r){const t=n.$implicit,o=e.oxw();e.xp6(3),e.AsE(" ",e.lcZ(4,11,"order.refund")," #",t.id," "),e.xp6(3),e.Q6J("state",t.state),e.xp6(2),e.Q6J("label",e.lcZ(9,13,"common.created-at")),e.xp6(2),e.hij(" ",e.xi3(11,15,t.createdAt,"medium")," "),e.xp6(2),e.Q6J("label",e.lcZ(13,18,"order.refund-total")),e.xp6(2),e.hij(" ",e.xi3(15,20,t.total,o.currencyCode)," "),e.xp6(2),e.Q6J("ngIf",t.transactionId),e.xp6(1),e.Q6J("ngIf",t.reason),e.xp6(1),e.Q6J("ngIf",o.refundHasMetadata(t)),e.xp6(1),e.Q6J("ngIf","Pending"===t.state)}}function kr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",15),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.settlePayment.emit(i.payment)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.settle-payment")," "))}se.\u0275fac=function(n){return new(n||se)},se.\u0275cmp=e.Xpm({type:se,selectors:[["vdr-refund-state-label"]],inputs:{state:"state"},decls:6,vars:10,consts:[[3,"title","colorType"],["shape","check-circle",4,"ngIf"],["shape","check-circle"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-chip",0),e.ALo(1,"translate"),e.YNc(2,Pr,1,0,"clr-icon",1),e._uU(3),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()),2&n&&(e.Q6J("title",e.lcZ(1,4,"order.payment-state"))("colorType",t.chipColorType),e.xp6(2),e.Q6J("ngIf","Settled"===t.state),e.xp6(1),e.hij(" ",e.lcZ(4,6,e.lcZ(5,8,t.state)),"\n"))},directives:[G.Y,p.O5,m.qvL],pipes:[f.X$,Z.N],styles:["[_nghost-%COMP%]{font-size:14px}"],changeDetection:0});const Er=function(r){return{state:r}};function Yr(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"clr-icon",23),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.BQk()),2&r){const t=e.oxw().$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Er,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function jr(r,n){1&r&&(e._UZ(0,"clr-icon",24),e._uU(1),e.ALo(2,"translate")),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.cancel-payment")," "))}function Rr(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",20),e.NdJ("click",function(){const l=e.CHM(t).$implicit,c=e.oxw(2);return c.transitionPaymentState.emit({payment:c.payment,state:l})}),e.YNc(2,Yr,6,10,"ng-container",21),e.YNc(3,jr,3,3,"ng-template",null,22,e.W1O),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.MAs(4);e.xp6(2),e.Q6J("ngIf","Cancelled"!==t)("ngIfElse",o)}}function Hr(r,n){if(1&r&&(e.TgZ(0,"div",14),e.YNc(1,kr,3,3,"button",16),e.TgZ(2,"vdr-dropdown")(3,"button",17),e._UZ(4,"clr-icon",18),e.qZA(),e.TgZ(5,"vdr-dropdown-menu",19),e.YNc(6,Rr,5,2,"ng-container",7),e.qZA()()()),2&r){const t=e.oxw();e.xp6(1),e.Q6J("ngIf",t.payment.nextStates.includes("Settled")),e.xp6(5),e.Q6J("ngForOf",t.nextOtherStates())}}class ue{constructor(){this.settlePayment=new e.vpe,this.transitionPaymentState=new e.vpe,this.settleRefund=new e.vpe}refundHasMetadata(n){return!!n&&Object.keys(n.metadata).length>0}nextOtherStates(){return this.payment?this.payment.nextStates.filter(n=>"Settled"!==n&&"Error"!==n):[]}}function $r(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().ngIf;return e.oxw().addManualPayment(i)}),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"localeCurrency"),e.qZA()}if(2&r){const t=e.oxw().ngIf,o=e.oxw();e.xp6(1),e.AsE(" ",e.lcZ(2,2,"order.add-payment-to-order")," (",e.xi3(3,4,o.outstandingPaymentAmount(t),t.currencyCode),") ")}}function Vr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",16),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).transitionToState("ArrangingAdditionalPayment")}),e._uU(1),e.ALo(2,"translate"),e.qZA()}2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.arrange-additional-payment")," "))}function Br(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"button",14),e.NdJ("click",function(){return e.CHM(t),e.oxw(2).transitionToModifying()}),e._UZ(2,"clr-icon",17),e._uU(3),e.ALo(4,"translate"),e.qZA(),e._UZ(5,"div",13),e.BQk()}2&r&&(e.xp6(3),e.hij(" ",e.lcZ(4,1,"order.modify-order")," "))}function Wr(r,n){1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"translate"),e.BQk()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.refund-and-cancel-order")," "))}function Gr(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.hij(" ",e.lcZ(1,1,"order.cancel-order")," ")}function Xr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){e.CHM(t);const i=e.oxw().ngIf;return e.oxw().cancelOrRefund(i)}),e._UZ(1,"clr-icon",18),e.YNc(2,Wr,3,3,"ng-container",19),e.YNc(3,Gr,2,3,"ng-template",null,20,e.W1O),e.qZA()}if(2&r){const t=e.MAs(4),o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Q6J("ngIf",i.orderHasSettledPayments(o))("ngIfElse",t)}}ue.\u0275fac=function(n){return new(n||ue)},ue.\u0275cmp=e.Xpm({type:ue,selectors:[["vdr-order-payment-card"]],inputs:{payment:"payment",currencyCode:"currencyCode"},outputs:{settlePayment:"settlePayment",transitionPaymentState:"transitionPaymentState",settleRefund:"settleRefund"},decls:12,vars:9,consts:[[1,"card"],[1,"card-header","payment-header"],[4,"ngIf"],[1,"payment-state"],[3,"state"],[1,"card-block"],[3,"payment","currencyCode"],[4,"ngFor","ngForOf"],["class","card-footer",4,"ngIf"],["shape","redo","dir","down",1,"refund-icon"],[1,"clr-flex-fill"],[3,"label"],[3,"label",4,"ngIf"],[3,"value"],[1,"card-footer"],[1,"btn","btn-sm","btn-primary",3,"click"],["class","btn btn-sm btn-primary",3,"click",4,"ngIf"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],[4,"ngIf","ngIfElse"],["cancel",""],["shape","step-forward-2"],["shape","error-standard",1,"is-error"]],template:function(n,t){1&n&&(e.TgZ(0,"div",0)(1,"div",1)(2,"div"),e._uU(3),e.ALo(4,"translate"),e.YNc(5,Sr,2,1,"ng-container",2),e.qZA(),e.TgZ(6,"div",3),e._UZ(7,"vdr-payment-state-label",4),e.qZA()(),e.TgZ(8,"div",5),e._UZ(9,"vdr-payment-detail",6),e.qZA(),e.YNc(10,Dr,20,23,"ng-container",7),e.YNc(11,Hr,7,2,"div",8),e.qZA()),2&n&&(e.xp6(3),e.hij(" ",e.lcZ(4,7,"order.payment")," "),e.xp6(2),e.Q6J("ngIf",t.payment.transactionId),e.xp6(2),e.Q6J("state",t.payment.state),e.xp6(2),e.Q6J("payment",t.payment)("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("ngForOf",t.payment.refunds),e.xp6(1),e.Q6J("ngIf",t.payment.nextStates.length))},directives:[p.O5,de,$,p.sg,m.qvL,He.Lv,se,K.W,Ke._,D.J,k.U,E.N,ve.H],pipes:[f.X$,xe.H,v.k,Z.N],styles:[".payment-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.refund-icon[_ngcontent-%COMP%]{margin-right:6px;color:var(--color-grey-400)}.card-footer[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end}"],changeDetection:0});const Kr=function(r){return{state:r}};function zr(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",14),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(3).transitionToState(l)}),e._UZ(1,"clr-icon",22),e._uU(2),e.ALo(3,"translate"),e.ALo(4,"translate"),e.ALo(5,"stateI18nToken"),e.qZA()}if(2&r){const t=n.$implicit;e.xp6(2),e.hij(" ",e.xi3(3,1,"order.transition-to-state",e.VKq(8,Kr,e.lcZ(4,4,e.lcZ(5,6,t))))," ")}}function eo(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"div",13),e.YNc(2,zr,6,10,"button",21),e.ALo(3,"async"),e.BQk()),2&r){const t=e.oxw(2);e.xp6(2),e.Q6J("ngForOf",e.lcZ(3,1,t.nextStates$))}}function to(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e.TgZ(5,"vdr-order-state-label",3)(6,"button",4),e.NdJ("click",function(){return e.CHM(t),e.oxw().openStateDiagram()}),e.ALo(7,"translate"),e._UZ(8,"clr-icon",5),e.qZA()()()(),e.TgZ(9,"vdr-ab-right"),e._UZ(10,"vdr-action-bar-items",6),e.YNc(11,$r,4,7,"button",7),e.YNc(12,Vr,3,3,"button",7),e.TgZ(13,"button",8),e.NdJ("click",function(){return e.CHM(t),e.oxw().fulfillOrder()}),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"vdr-dropdown")(17,"button",9),e._UZ(18,"clr-icon",10),e.qZA(),e.TgZ(19,"vdr-dropdown-menu",11),e.YNc(20,Br,6,3,"ng-container",0),e.YNc(21,Xr,5,2,"button",12),e.YNc(22,eo,4,3,"ng-container",0),e.ALo(23,"async"),e._UZ(24,"div",13),e.TgZ(25,"button",14),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().manuallyTransitionToState(l)}),e._UZ(26,"clr-icon",15),e._uU(27),e.ALo(28,"translate"),e.qZA()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();let i;e.xp6(3),e.Q6J("entity",e.lcZ(4,11,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(1),e.Q6J("title",e.lcZ(7,13,"order.order-state-diagram")),e.xp6(5),e.Q6J("ngIf",("ArrangingPayment"===t.state||"ArrangingAdditionalPayment"===t.state)&&(o.hasUnsettledModifications(t)||0<o.outstandingPaymentAmount(t))),e.xp6(1),e.Q6J("ngIf",!1===t.active&&"ArrangingAdditionalPayment"!==t.state&&0<o.outstandingPaymentAmount(t)),e.xp6(1),e.Q6J("disabled",!o.canAddFulfillment(t)),e.xp6(1),e.hij(" ",e.lcZ(15,15,"order.fulfill-order")," "),e.xp6(6),e.Q6J("ngIf",t.nextStates.includes("Modifying")),e.xp6(1),e.Q6J("ngIf",t.nextStates.includes("Cancelled")),e.xp6(1),e.Q6J("ngIf",null==(i=e.lcZ(23,17,o.nextStates$))?null:i.length),e.xp6(5),e.hij(" ",e.lcZ(28,19,"order.manually-transition-to-state")," ")}}function no(r,n){if(1&r&&(e.TgZ(0,"tr")(1,"td"),e._uU(2),e.qZA(),e.TgZ(3,"td"),e._uU(4),e.ALo(5,"percent"),e.qZA(),e.TgZ(6,"td"),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td"),e._uU(10),e.ALo(11,"localeCurrency"),e.qZA()()),2&r){const t=n.$implicit,o=e.oxw().ngIf;e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(e.lcZ(5,4,t.taxRate/100)),e.xp6(3),e.Oqu(e.xi3(8,6,t.taxBase,o.currencyCode)),e.xp6(3),e.Oqu(e.xi3(11,9,t.taxTotal,o.currencyCode))}}function ro(r,n){1&r&&(e.TgZ(0,"h6"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.shipping-address")," "))}function oo(r,n){1&r&&(e.TgZ(0,"h6"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.billing-address")," "))}function io(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-order-payment-card",39),e.NdJ("settlePayment",function(i){return e.CHM(t),e.oxw(3).settlePayment(i)})("transitionPaymentState",function(i){return e.CHM(t),e.oxw(3).transitionPaymentState(i)})("settleRefund",function(i){return e.CHM(t),e.oxw(3).settleRefund(i)}),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw(2).ngIf;e.Q6J("currencyCode",o.currencyCode)("payment",t)}}function lo(r,n){if(1&r&&(e.ynx(0),e.YNc(1,io,1,2,"vdr-order-payment-card",38),e.BQk()),2&r){const t=e.oxw().ngIf;e.xp6(1),e.Q6J("ngForOf",t.payments)}}function ao(r,n){if(1&r){const t=e.EpF();e.ynx(0),e.TgZ(1,"vdr-fulfillment-card",40),e.NdJ("transitionState",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).transitionFulfillment(c.id,i)}),e.qZA(),e.BQk()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf;e.xp6(1),e.Q6J("fulfillment",t)("order",o)}}function co(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",23)(2,"div",24),e._UZ(3,"vdr-order-table",25),e.TgZ(4,"h4"),e._uU(5),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"table",26)(8,"thead")(9,"tr")(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.TgZ(19,"th"),e._uU(20),e.ALo(21,"translate"),e.qZA()()(),e.TgZ(22,"tbody"),e.YNc(23,no,12,12,"tr",27),e.qZA()(),e._UZ(24,"vdr-custom-detail-component-host",28),e.TgZ(25,"vdr-order-history",29),e.NdJ("addNote",function(i){return e.CHM(t),e.oxw().addNote(i)})("updateNote",function(i){return e.CHM(t),e.oxw().updateNote(i)})("deleteNote",function(i){return e.CHM(t),e.oxw().deleteNote(i)}),e.ALo(26,"async"),e.qZA()(),e.TgZ(27,"div",30)(28,"vdr-order-custom-fields-card",31),e.NdJ("updateClick",function(i){return e.CHM(t),e.oxw().updateCustomFields(i)}),e.qZA(),e.TgZ(29,"div",32)(30,"div",33),e._uU(31),e.ALo(32,"translate"),e.qZA(),e.TgZ(33,"div",34)(34,"div",35),e._UZ(35,"vdr-customer-label",36),e.YNc(36,ro,3,3,"h6",0),e._UZ(37,"vdr-formatted-address",37),e.YNc(38,oo,3,3,"h6",0),e._UZ(39,"vdr-formatted-address",37),e.qZA()()(),e.YNc(40,lo,2,1,"ng-container",0),e.YNc(41,ao,2,2,"ng-container",27),e.qZA()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("order",t)("orderLineCustomFields",o.orderLineCustomFields),e.xp6(2),e.Oqu(e.lcZ(6,22,"order.tax-summary")),e.xp6(6),e.Oqu(e.lcZ(12,24,"common.description")),e.xp6(3),e.Oqu(e.lcZ(15,26,"order.tax-rate")),e.xp6(3),e.Oqu(e.lcZ(18,28,"order.tax-base")),e.xp6(3),e.Oqu(e.lcZ(21,30,"order.tax-total")),e.xp6(3),e.Q6J("ngForOf",t.taxSummary),e.xp6(1),e.Q6J("entity$",o.entity$)("detailForm",o.detailForm),e.xp6(1),e.Q6J("order",t)("history",e.lcZ(26,32,o.history$)),e.xp6(3),e.Q6J("customFieldsConfig",o.customFields)("customFieldValues",t.customFields),e.xp6(3),e.hij(" ",e.lcZ(32,34,"order.customer")," "),e.xp6(4),e.Q6J("customer",t.customer),e.xp6(1),e.Q6J("ngIf",o.getOrderAddressLines(t.shippingAddress).length),e.xp6(1),e.Q6J("address",t.shippingAddress),e.xp6(1),e.Q6J("ngIf",o.getOrderAddressLines(t.billingAddress).length),e.xp6(1),e.Q6J("address",t.billingAddress),e.xp6(1),e.Q6J("ngIf",t.payments&&t.payments.length),e.xp6(1),e.Q6J("ngForOf",t.fulfillments)}}class pe extends u.UT_{constructor(n,t,o,i,l,c,d,g){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=d,this.orderTransitionService=g,this.detailForm=new a.cw({}),this.fetchHistory=new Ae.x,this.defaultStates=["AddingItems","ArrangingPayment","PaymentAuthorized","PaymentSettled","PartiallyShipped","Shipped","PartiallyDelivered","Delivered","Cancelled","Modifying","ArrangingAdditionalPayment"]}ngOnInit(){this.init(),this.entity$.pipe((0,Ce.q)(1)).subscribe(n=>{"Modifying"===n.state&&this.router.navigate(["./","modify"],{relativeTo:this.route})}),this.customFields=this.getCustomFieldConfig("Order"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.history$=this.fetchHistory.pipe((0,$e.O)(null),(0,h.w)(()=>this.dataService.order.getOrderHistory(this.id,{sort:{createdAt:u.Asd.DESC}}).mapStream(n=>{var t;return null===(t=n.order)||void 0===t?void 0:t.history.items}))),this.nextStates$=this.entity$.pipe((0,F.U)(n=>this.defaultStates.includes(n.state)?n.nextStates.filter(o=>!this.defaultStates.includes(o)):n.nextStates))}ngOnDestroy(){this.destroy()}openStateDiagram(){this.entity$.pipe((0,Ce.q)(1),(0,h.w)(n=>this.modalService.fromComponent(oe,{closable:!0,locals:{activeState:n.state}}))).subscribe()}transitionToState(n){this.dataService.order.transitionToState(this.id,n).subscribe(({transitionOrderToState:t})=>{switch(null==t?void 0:t.__typename){case"Order":this.notificationService.success((0,_.J)("order.transitioned-to-state-success"),{state:n}),this.fetchHistory.next();break;case"OrderStateTransitionError":this.notificationService.error(t.transitionError)}})}manuallyTransitionToState(n){this.orderTransitionService.manuallyTransitionToState({orderId:n.id,nextStates:n.nextStates,cancellable:!0,message:(0,_.J)("order.manually-transition-to-state-message"),retry:0}).subscribe()}transitionToModifying(){this.dataService.order.transitionToState(this.id,"Modifying").subscribe(({transitionOrderToState:n})=>{switch(null==n?void 0:n.__typename){case"Order":this.router.navigate(["./modify"],{relativeTo:this.route});break;case"OrderStateTransitionError":this.notificationService.error(n.transitionError)}})}updateCustomFields(n){this.dataService.order.updateOrderCustomFields({id:this.id,customFields:n}).subscribe(()=>{this.notificationService.success((0,_.J)("common.notify-update-success"),{entity:"Order"})})}getOrderAddressLines(n){return n?Object.values(n).filter(t=>"OrderAddress"!==t).filter(t=>!!t):[]}settlePayment(n){this.dataService.order.settlePayment(n.id).subscribe(({settlePayment:t})=>{switch(t.__typename){case"Payment":"Settled"===t.state?this.notificationService.success((0,_.J)("order.settle-payment-success")):this.notificationService.error((0,_.J)("order.settle-payment-error")),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"OrderStateTransitionError":case"PaymentStateTransitionError":case"SettlePaymentError":this.notificationService.error(t.message)}})}transitionPaymentState({payment:n,state:t}){"Cancelled"===t?this.dataService.order.cancelPayment(n.id).subscribe(({cancelPayment:o})=>{switch(o.__typename){case"Payment":this.notificationService.success((0,_.J)("order.transitioned-payment-to-state-success"),{state:t}),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"PaymentStateTransitionError":this.notificationService.error(o.transitionError);break;case"CancelPaymentError":this.notificationService.error(o.paymentErrorMessage)}}):this.dataService.order.transitionPaymentToState(n.id,t).subscribe(({transitionPaymentToState:o})=>{switch(o.__typename){case"Payment":this.notificationService.success((0,_.J)("order.transitioned-payment-to-state-success"),{state:t}),this.dataService.order.getOrder(this.id).single$.subscribe(),this.fetchHistory.next();break;case"PaymentStateTransitionError":this.notificationService.error(o.message)}})}canAddFulfillment(n){var t;const o=(null!==(t=n.fulfillments)&&void 0!==t?t:[]).reduce((l,c)=>[...l,...c.summary],[]);let i=!0;for(const l of n.lines)o.filter(d=>d.orderLine.id===l.id).reduce((d,g)=>d+g.quantity,0)<l.quantity&&(i=!1);return!i&&!this.hasUnsettledModifications(n)&&0===this.outstandingPaymentAmount(n)&&(n.nextStates.includes("Shipped")||n.nextStates.includes("PartiallyShipped")||n.nextStates.includes("Delivered"))}hasUnsettledModifications(n){return 0<n.modifications.filter(t=>!t.isSettled).length}getOutstandingModificationAmount(n){return(0,U.summate)(n.modifications.filter(t=>!t.isSettled),"priceChange")}outstandingPaymentAmount(n){var t,o,i;const l=d=>"Cancelled"!==d.state&&"Declined"!==d.state&&"Error"!==d.state;let c=0;for(const d of null!==(o=null===(t=n.payments)||void 0===t?void 0:t.filter(l))&&void 0!==o?o:[]){const g=null!==(i=d.refunds.filter(P=>"Failed"!==P.state))&&void 0!==i?i:[],x=(0,U.summate)(g,"total");c+=d.amount-x}return n.totalWithTax-c}addManualPayment(n){const t=n.state;this.modalService.fromComponent(V,{closable:!0,locals:{outstandingAmount:this.outstandingPaymentAmount(n),currencyCode:n.currencyCode}}).pipe((0,h.w)(o=>o?this.dataService.order.addManualPaymentToOrder({orderId:this.id,transactionId:o.transactionId,method:o.method,metadata:o.metadata||{}}):j.E),(0,h.w)(({addManualPaymentToOrder:o})=>{switch(o.__typename){case"Order":return this.notificationService.success((0,_.J)("order.add-payment-to-order-success")),"ArrangingAdditionalPayment"===t?this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates):this.dataService.order.transitionToState(this.id,"PaymentSettled").pipe((0,Le.h)("PaymentSettled"));case"ManualPaymentStateError":return this.notificationService.error(o.message),j.E;default:return j.E}})).subscribe(o=>{o&&this.refetchOrder({result:o})})}fulfillOrder(){this.entity$.pipe((0,Ce.q)(1),(0,h.w)(n=>this.modalService.fromComponent(W,{size:"xl",locals:{order:n}})),(0,h.w)(n=>n?this.dataService.order.createFulfillment(n):(0,q.of)(void 0)),(0,h.w)(n=>this.refetchOrder(n).pipe((0,Le.h)(n)))).subscribe(n=>{if(n){const{addFulfillmentToOrder:t}=n;switch(t.__typename){case"Fulfillment":this.notificationService.success((0,_.J)("order.create-fulfillment-success"));break;case"EmptyOrderLineSelectionError":case"InsufficientStockOnHandError":case"ItemsAlreadyFulfilledError":case"InvalidFulfillmentHandlerError":this.notificationService.error(t.message);break;case"FulfillmentStateTransitionError":this.notificationService.error(t.transitionError);break;case"CreateFulfillmentError":this.notificationService.error(t.fulfillmentHandlerError);break;case void 0:this.notificationService.error(JSON.stringify(t));break;default:(0,U.assertNever)(t)}}})}transitionFulfillment(n,t){this.dataService.order.transitionFulfillmentToState(n,t).pipe((0,h.w)(o=>this.refetchOrder(o))).subscribe(()=>{this.notificationService.success((0,_.J)("order.successfully-updated-fulfillment"))})}cancelOrRefund(n){const t=this.orderHasSettledPayments(n);"PaymentAuthorized"!==n.state&&!0!==n.active&&t?this.refundOrder(n):this.cancelOrder(n)}settleRefund(n){this.modalService.fromComponent(le,{size:"md",locals:{refund:n}}).pipe((0,h.w)(t=>t?this.dataService.order.settleRefund({transactionId:t,id:n.id},this.id):(0,q.of)(void 0))).subscribe(t=>{t&&this.notificationService.success((0,_.J)("order.settle-refund-success"))})}addNote(n){const{note:t,isPublic:o}=n;this.dataService.order.addNoteToOrder({id:this.id,note:t,isPublic:o}).pipe((0,h.w)(i=>this.refetchOrder(i))).subscribe(i=>{this.notificationService.success((0,_.J)("common.notify-create-success"),{entity:"Note"})})}updateNote(n){this.modalService.fromComponent(u.UlA,{closable:!0,locals:{displayPrivacyControls:!0,note:n.data.note,noteIsPrivate:!n.isPublic}}).pipe((0,h.w)(t=>t?this.dataService.order.updateOrderNote({noteId:n.id,isPublic:!t.isPrivate,note:t.note}):j.E)).subscribe(t=>{this.fetchHistory.next(),this.notificationService.success((0,_.J)("common.notify-update-success"),{entity:"Note"})})}deleteNote(n){return this.modalService.dialog({title:(0,_.J)("common.confirm-delete-note"),body:n.data.note,buttons:[{type:"secondary",label:(0,_.J)("common.cancel")},{type:"danger",label:(0,_.J)("common.delete"),returnValue:!0}]}).pipe((0,h.w)(t=>t?this.dataService.order.deleteOrderNote(n.id):j.E)).subscribe(()=>{this.fetchHistory.next(),this.notificationService.success((0,_.J)("common.notify-delete-success"),{entity:"Note"})})}orderHasSettledPayments(n){var t;return!!(null===(t=n.payments)||void 0===t?void 0:t.find(o=>"Settled"===o.state))}cancelOrder(n){this.modalService.fromComponent(B,{size:"xl",locals:{order:n}}).pipe((0,h.w)(t=>t?this.dataService.order.cancelOrder(t):(0,q.of)(void 0)),(0,h.w)(t=>this.refetchOrder(t))).subscribe(t=>{t&&this.notificationService.success((0,_.J)("order.cancelled-order-success"))})}refundOrder(n){this.modalService.fromComponent(ie,{size:"xl",locals:{order:n}}).pipe((0,h.w)(t=>{var o;return t?(null===(o=t.cancel.lines)||void 0===o?void 0:o.length)?this.dataService.order.cancelOrder(t.cancel).pipe((0,F.U)(i=>{const l=i.cancelOrder;switch(l.__typename){case"Order":return this.refetchOrder(l).subscribe(),this.notificationService.success((0,_.J)("order.cancelled-order-success")),t;case"CancelActiveOrderError":case"QuantityTooGreatError":case"MultipleOrderError":case"OrderStateTransitionError":case"EmptyOrderLineSelectionError":return void this.notificationService.error(l.message)}})):[t]:(0,q.of)(void 0)}),(0,h.w)(t=>t?t.refund.lines.length?this.dataService.order.refundOrder(t.refund).pipe((0,F.U)(o=>o.refundOrder)):[void 0]:(0,q.of)(void 0))).subscribe(t=>{if(t)switch(t.__typename){case"Refund":this.refetchOrder(t).subscribe(),"Failed"===t.state?this.notificationService.error((0,_.J)("order.refund-order-failed")):this.notificationService.success((0,_.J)("order.refund-order-success"));break;case"AlreadyRefundedError":case"NothingToRefundError":case"PaymentOrderMismatchError":case"RefundOrderStateError":case"RefundStateTransitionError":this.notificationService.error(t.message)}})}refetchOrder(n){return this.fetchHistory.next(),n?this.dataService.order.getOrder(this.id).single$:(0,q.of)(void 0)}setFormValues(n){}}pe.\u0275fac=function(n){return new(n||pe)(e.Y36(y.F0),e.Y36(y.gz),e.Y36(u.iHG),e.Y36(e.sBO),e.Y36(u.DoR),e.Y36(u.gqp),e.Y36(u.Z7U),e.Y36(w))},pe.\u0275cmp=e.Xpm({type:pe,selectors:[["vdr-order-detail"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"icon-button",3,"title","click"],["shape","list"],["locationId","order-detail"],["class","btn btn-primary",3,"click",4,"ngIf"],[1,"btn","btn-primary",3,"disabled","click"],["vdrDropdownTrigger","",1,"icon-button"],["shape","ellipsis-vertical"],["vdrPosition","bottom-right"],["type","button","class","btn","vdrDropdownItem","",3,"click",4,"ngIf"],[1,"dropdown-divider"],["type","button","vdrDropdownItem","",1,"btn",3,"click"],["shape","step-forward-2",1,"is-warning"],[1,"btn","btn-primary",3,"click"],["shape","pencil"],["shape","error-standard",1,"is-error"],[4,"ngIf","ngIfElse"],["cancelOnly",""],["type","button","class","btn","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["shape","step-forward-2"],[1,"clr-row"],[1,"clr-col-lg-8"],[3,"order","orderLineCustomFields"],[1,"table"],[4,"ngFor","ngForOf"],["locationId","order-detail",3,"entity$","detailForm"],[3,"order","history","addNote","updateNote","deleteNote"],[1,"clr-col-lg-4","order-cards"],[3,"customFieldsConfig","customFieldValues","updateClick"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"card-text"],[3,"customer"],[3,"address"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund",4,"ngFor","ngForOf"],[3,"currencyCode","payment","settlePayment","transitionPaymentState","settleRefund"],[3,"fulfillment","order","transitionState"]],template:function(n,t){1&n&&(e.YNc(0,to,29,21,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,co,42,36,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[p.O5,O.Kk,O.BN,Ge.V,Fe.G,m.qvL,O.mz,Xe.W,D.J,k.U,E.N,ve.H,p.sg,H,Bn.C,ce,te,tt.d,je.b,ue,z],pipes:[p.Ov,f.X$,v.k,Z.N,p.Zx],styles:[".shipping-address[_ngcontent-%COMP%]{list-style-type:none;line-height:1.3em}.order-cards[_ngcontent-%COMP%] h6[_ngcontent-%COMP%]{margin-top:6px;color:var(--color-text-200)}"],changeDetection:0});var b,r,so=s(9319),ye=s(8951),nt=s(8977),uo=s(9196);function po(r,n){1&r&&(e._uU(0),e.ALo(1,"translate")),2&r&&e.Oqu(e.lcZ(1,1,"order.confirm-modifications"))}function mo(r,n){if(1&r&&(e.TgZ(0,"option",9),e._uU(1),e.ALo(2,"localeCurrency"),e.qZA()),2&r){const t=n.$implicit,o=e.oxw(2);e.Q6J("ngValue",t),e.xp6(1),e.lnq(" #",t.id," ",t.method,": ",e.xi3(2,4,t.amount,o.order.currencyCode)," ")}}function _o(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"clr-select-container")(2,"label"),e._uU(3),e.ALo(4,"translate"),e.qZA(),e.TgZ(5,"select",5),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().selectedPayment=i}),e.YNc(6,mo,3,7,"option",6),e.qZA()(),e.TgZ(7,"label",7),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"textarea",8),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().refundNote=i}),e.qZA()()}if(2&r){const t=e.oxw();e.xp6(3),e.Oqu(e.lcZ(4,5,"order.payment-to-refund")),e.xp6(2),e.Q6J("ngModel",t.selectedPayment),e.xp6(1),e.Q6J("ngForOf",t.order.payments),e.xp6(2),e.Oqu(e.lcZ(9,7,"order.refund-cancellation-reason")),e.xp6(2),e.Q6J("ngModel",t.refundNote)}}function go(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",10),e.NdJ("click",function(){return e.CHM(t),e.oxw().cancel()}),e._uU(1),e.ALo(2,"translate"),e.qZA(),e.TgZ(3,"button",11),e.NdJ("click",function(){return e.CHM(t),e.oxw().submit()}),e._uU(4),e.ALo(5,"translate"),e.qZA()}if(2&r){const t=e.oxw();e.xp6(1),e.Oqu(e.lcZ(2,3,"common.cancel")),e.xp6(2),e.Q6J("disabled",t.priceDifference<0&&!t.selectedPayment),e.xp6(1),e.hij(" ",e.lcZ(5,5,"common.confirm")," ")}}(r=b||(b={}))[r.Refund=0]="Refund",r[r.Payment=1]="Payment",r[r.PriceUnchanged=2]="PriceUnchanged",r[r.Cancel=3]="Cancel";class me{get priceDifference(){return this.order.totalWithTax-this.originalTotalWithTax}ngOnInit(){this.refundNote=this.modifyOrderInput.note||""}cancel(){this.resolveWith({result:b.Cancel})}submit(){0<this.priceDifference?this.resolveWith({result:b.Payment}):this.priceDifference<0?this.resolveWith({result:b.Refund,refundPaymentId:this.selectedPayment.id,refundNote:this.refundNote}):this.resolveWith({result:b.PriceUnchanged})}}me.\u0275fac=function(n){return new(n||me)},me.\u0275cmp=e.Xpm({type:me,selectors:[["vdr-order-edits-preview-dialog"]],decls:10,vars:10,consts:[["vdrDialogTitle",""],[3,"order","orderLineCustomFields"],[1,"h4"],[4,"ngIf"],["vdrDialogButtons",""],["clrSelect","","name","options",3,"ngModel","ngModelChange"],[3,"ngValue",4,"ngFor","ngForOf"],[1,"clr-control-label"],["name","refundNote","clrTextarea","","required","",3,"ngModel","ngModelChange"],[3,"ngValue"],["type","button",1,"btn",3,"click"],["type","submit",1,"btn","btn-primary",3,"disabled","click"]],template:function(n,t){1&n&&(e.YNc(0,po,2,3,"ng-template",0),e._UZ(1,"vdr-order-table",1),e.TgZ(2,"h4",2),e._uU(3),e.ALo(4,"translate"),e.TgZ(5,"strong"),e._uU(6),e.ALo(7,"localeCurrency"),e.qZA()(),e.YNc(8,_o,11,9,"div",3),e.YNc(9,go,6,7,"ng-template",4)),2&n&&(e.xp6(1),e.Q6J("order",t.order)("orderLineCustomFields",t.orderLineCustomFields),e.xp6(2),e.hij(" ",e.lcZ(4,5,"order.modify-order-price-difference"),": "),e.xp6(3),e.Oqu(e.xi3(7,7,t.priceDifference,t.order.currencyCode)),e.xp6(2),e.Q6J("ngIf",t.priceDifference<0))},directives:[T.q,H,p.O5,m.dTv,m.MgK,C.y,a.EJ,m.otW,a.JJ,a.On,p.sg,a.YN,a.Kr,a.Fj,m.XE5,a.Q7,J.n],pipes:[f.X$,v.k],styles:[""],changeDetection:0});var fo=s(5983),ho=s(7122),xo=s(1480);function vo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",1),e._UZ(3,"vdr-entity-info",2),e.ALo(4,"async"),e._UZ(5,"vdr-order-state-label",3),e.qZA()(),e.TgZ(6,"vdr-ab-right")(7,"button",4),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().transitionToPriorState(l)}),e._uU(8),e.ALo(9,"translate"),e.qZA()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(3),e.Q6J("entity",e.lcZ(4,3,o.entity$)),e.xp6(2),e.Q6J("state",t.state),e.xp6(3),e.hij(" ",e.lcZ(9,5,"order.cancel-modification")," ")}}function Co(r,n){1&r&&(e.TgZ(0,"th"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.Oqu(e.lcZ(2,1,"common.custom-fields")))}function yo(r,n){if(1&r&&(e._UZ(0,"img",41),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.featuredAsset,"tiny"),e.LSH)}}const rt=function(r){return[r]};function Zo(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",44),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(2).index,i=e.oxw(2);e.xp6(1),e.Q6J("customField",t)("customFieldsFormGroup",i.orderLineCustomFieldsFormArray.get(e.VKq(3,rt,o)))("compact",!0)}}function Oo(r,n){if(1&r&&(e.TgZ(0,"td",42),e.YNc(1,Zo,2,5,"ng-container",43),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function bo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",29)(1,"td",30),e.YNc(2,yo,2,4,"img",31),e.qZA(),e.TgZ(3,"td",32),e._uU(4),e.qZA(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e.TgZ(7,"td",34),e._uU(8),e.ALo(9,"localeCurrency"),e.TgZ(10,"div",16),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.TgZ(14,"td",35)(15,"input",36),e.NdJ("input",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).updateLineQuantity(c,i.target.value)}),e.qZA(),e._UZ(16,"vdr-line-refunds",37)(17,"vdr-line-fulfillment",38),e.qZA(),e.YNc(18,Oo,2,1,"td",39),e.TgZ(19,"td",40),e._uU(20),e.ALo(21,"localeCurrency"),e.TgZ(22,"div",16),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"localeCurrency"),e.qZA()()()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.ekj("is-cancelled",0===t.quantity)("modified",i.isLineModified(t)),e.xp6(2),e.Q6J("ngIf",t.featuredAsset),e.xp6(2),e.Oqu(t.productVariant.name),e.xp6(2),e.Oqu(t.productVariant.sku),e.xp6(2),e.hij(" ",e.xi3(9,19,t.unitPriceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(11,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(13,24,t.unitPrice,o.currencyCode)," "),e.xp6(3),e.Q6J("value",t.quantity),e.xp6(1),e.Q6J("line",t)("payments",o.payments),e.xp6(1),e.Q6J("line",t)("orderState",o.state),e.xp6(1),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(21,27,t.linePriceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,30,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,32,t.linePrice,o.currencyCode)," ")}}function To(r,n){if(1&r&&(e._UZ(0,"img",41),e.ALo(1,"assetPreview")),2&r){const t=e.oxw().$implicit;e.Q6J("src",e.xi3(1,1,t.productAsset,"tiny"),e.LSH)}}function Ao(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",44),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(2).index,i=e.oxw(2);e.xp6(1),e.Q6J("customField",t)("customFieldsFormGroup",i.addItemCustomFieldsFormArray.get(e.VKq(3,rt,o)))("compact",!0)}}function Lo(r,n){if(1&r&&(e.TgZ(0,"td",42),e.YNc(1,Ao,2,5,"ng-container",43),e.qZA()),2&r){const t=e.oxw(3);e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields)}}function Io(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",45)(1,"td",30),e.YNc(2,To,2,4,"img",31),e.qZA(),e.TgZ(3,"td",32),e._uU(4),e.qZA(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e.TgZ(7,"td",34),e._uU(8),e.ALo(9,"localeCurrency"),e.TgZ(10,"div",16),e.ALo(11,"translate"),e._uU(12),e.ALo(13,"localeCurrency"),e.qZA()(),e.TgZ(14,"td",35)(15,"input",36),e.NdJ("input",function(i){const c=e.CHM(t).$implicit;return e.oxw(2).updateAddedItemQuantity(c,i.target.value)}),e.qZA(),e.TgZ(16,"button",46),e.NdJ("click",function(){const l=e.CHM(t).index;return e.oxw(2).removeAddedItem(l)}),e._UZ(17,"clr-icon",47),e.qZA()(),e.YNc(18,Lo,2,1,"td",39),e.TgZ(19,"td",40),e._uU(20),e.ALo(21,"currency"),e.TgZ(22,"div",16),e.ALo(23,"translate"),e._uU(24),e.ALo(25,"currency"),e.qZA()()()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Q6J("ngIf",t.productAsset),e.xp6(2),e.Oqu(t.productVariantName),e.xp6(2),e.Oqu(t.sku),e.xp6(2),e.hij(" ",e.xi3(9,11,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(11,14,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(13,16,t.price,o.currencyCode)," "),e.xp6(3),e.Q6J("value",t.quantity),e.xp6(3),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(21,19,t.priceWithTax*t.quantity/100,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(23,22,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(25,24,t.price*t.quantity/100,o.currencyCode)," ")}}function qo(r,n){1&r&&e._UZ(0,"td")}function Fo(r,n){if(1&r&&(e.TgZ(0,"tr",48)(1,"td",49),e._uU(2),e.qZA(),e.TgZ(3,"td",33),e._uU(4),e.qZA(),e._UZ(5,"td",50)(6,"td"),e.YNc(7,qo,1,0,"td",0),e.TgZ(8,"td",40),e._uU(9),e.ALo(10,"localeCurrency"),e.TgZ(11,"div",16),e.ALo(12,"translate"),e._uU(13),e.ALo(14,"localeCurrency"),e.qZA()()()),2&r){const t=n.$implicit,o=e.oxw().ngIf,i=e.oxw();e.xp6(2),e.Oqu(t.description),e.xp6(2),e.Oqu(t.sku),e.xp6(3),e.Q6J("ngIf",i.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(10,6,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(12,9,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(14,11,t.price,o.currencyCode)," ")}}function wo(r,n){1&r&&e._UZ(0,"td")}function Mo(r,n){if(1&r&&(e.ynx(0),e._uU(1),e.ALo(2,"localeCurrency"),e.TgZ(3,"div",16),e.ALo(4,"translate"),e._uU(5),e.ALo(6,"localeCurrency"),e.qZA(),e.BQk()),2&r){const t=n.ngIf,o=e.oxw(2).ngIf;e.xp6(1),e.hij(" ",e.xi3(2,3,t.priceWithTax,o.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(4,6,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(6,8,t.price,o.currencyCode)," ")}}function Po(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"tr",51)(1,"td",49),e._uU(2),e.TgZ(3,"button",46),e.NdJ("click",function(){const l=e.CHM(t).index;return e.oxw(2).removeSurcharge(l)}),e._UZ(4,"clr-icon",47),e.qZA()(),e.TgZ(5,"td",33),e._uU(6),e.qZA(),e._UZ(7,"td",50)(8,"td"),e.YNc(9,wo,1,0,"td",0),e.TgZ(10,"td",40),e.YNc(11,Mo,7,11,"ng-container",0),e.qZA()()}if(2&r){const t=n.$implicit,o=e.oxw(2);e.xp6(2),e.hij(" ",t.description," "),e.xp6(4),e.Oqu(t.sku),e.xp6(3),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.Q6J("ngIf",o.getSurchargePrices(t))}}function So(r,n){1&r&&e._UZ(0,"td")}function No(r,n){if(1&r&&(e._UZ(0,"img",58),e.ALo(1,"assetPreview")),2&r){const t=n.ngIf;e.Q6J("src",e.xi3(1,1,t,"tiny"),e.LSH)}}function Jo(r,n){if(1&r&&(e.TgZ(0,"div",55),e.YNc(1,No,2,4,"img",56),e.TgZ(2,"div")(3,"strong",57),e._uU(4),e.qZA(),e.TgZ(5,"small"),e._uU(6),e.qZA(),e.TgZ(7,"div"),e._uU(8),e.ALo(9,"localeCurrency"),e.qZA()()()),2&r){const t=e.oxw(2).ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngIf",o.addItemSelectedVariant.productAsset),e.xp6(3),e.Oqu(o.addItemSelectedVariant.productVariantName),e.xp6(2),e.Oqu(o.addItemSelectedVariant.sku),e.xp6(2),e.hij(" ",e.xi3(9,4,o.getSelectedItemPrice(o.addItemSelectedVariant),t.currencyCode)," ")}}function Uo(r,n){if(1&r&&(e.ynx(0),e._UZ(1,"vdr-custom-field-control",59),e.BQk()),2&r){const t=n.$implicit,o=e.oxw(3);e.xp6(1),e.Q6J("readonly",!o.addItemSelectedVariant)("customField",t)("customFieldsFormGroup",o.addItemCustomFieldsForm)("compact",!0)}}function Qo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"vdr-product-variant-selector",52),e.NdJ("productSelected",function(i){e.CHM(t);return e.oxw(2).addItemSelectedVariant=i}),e.qZA(),e.YNc(2,Jo,10,7,"div",53),e.YNc(3,Uo,2,4,"ng-container",43),e.TgZ(4,"button",54),e.NdJ("click",function(){e.CHM(t);const i=e.oxw(2);return i.addItemToOrder(i.addItemSelectedVariant)}),e._uU(5),e.ALo(6,"translate"),e.qZA()()}if(2&r){const t=e.oxw(2);e.xp6(2),e.Q6J("ngIf",t.addItemSelectedVariant),e.xp6(1),e.Q6J("ngForOf",t.orderLineCustomFields),e.xp6(1),e.Q6J("disabled",!t.addItemSelectedVariant||t.addItemCustomFieldsForm.invalid),e.xp6(1),e.hij(" ",e.lcZ(6,4,"order.add-item-to-order")," ")}}function Do(r,n){if(1&r&&(e.TgZ(0,"vdr-chip"),e._uU(1),e.qZA(),e._uU(2)),2&r){const t=n.item;e.xp6(1),e.Oqu(t.code),e.xp6(1),e.hij(" ",t.promotionName," ")}}function ko(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content")(1,"ng-select",60),e.ALo(2,"async"),e.YNc(3,Do,3,2,"ng-template",61),e.qZA()()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("items",e.lcZ(2,7,t.availableCouponCodes$))("addTag",!1)("multiple",!0)("hideSelected",!0)("minTermLength",2)("typeahead",t.couponCodeInput$)("formControl",t.couponCodesControl)}}const Eo=function(r){return{rate:r}};function Yo(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"clr-accordion-content")(1,"form",62),e.NdJ("submit",function(){e.CHM(t);const i=e.oxw(2);return i.addSurcharge(i.surchargeForm.value)}),e.TgZ(2,"vdr-form-field",63),e.ALo(3,"translate"),e._UZ(4,"input",64),e.qZA(),e.TgZ(5,"vdr-form-field",65),e.ALo(6,"translate"),e._UZ(7,"input",66),e.qZA(),e.TgZ(8,"vdr-form-field",67),e.ALo(9,"translate"),e._UZ(10,"vdr-currency-input",68),e.qZA(),e.TgZ(11,"vdr-form-field",69),e.ALo(12,"translate"),e._UZ(13,"input",70),e.qZA(),e.TgZ(14,"vdr-form-field",71),e.ALo(15,"translate"),e.TgZ(16,"vdr-affixed-input",72),e._UZ(17,"input",73),e.qZA()(),e.TgZ(18,"vdr-form-field",74),e.ALo(19,"translate"),e._UZ(20,"input",75),e.qZA(),e.TgZ(21,"button",76),e._uU(22),e.ALo(23,"translate"),e.qZA()()()}if(2&r){const t=e.oxw().ngIf,o=e.oxw();let i,l;e.xp6(1),e.Q6J("formGroup",o.surchargeForm),e.xp6(1),e.Q6J("label",e.lcZ(3,10,"common.description")),e.xp6(3),e.Q6J("label",e.lcZ(6,12,"order.product-sku")),e.xp6(3),e.Q6J("label",e.lcZ(9,14,"common.price")),e.xp6(2),e.Q6J("currencyCode",t.currencyCode),e.xp6(1),e.Q6J("label",e.xi3(12,16,"catalog.price-includes-tax-at",e.VKq(25,Eo,null==(i=o.surchargeForm.get("taxRate"))?null:i.value))),e.xp6(3),e.Q6J("label",e.lcZ(15,19,"order.tax-rate")),e.xp6(4),e.Q6J("label",e.lcZ(19,21,"order.tax-description")),e.xp6(3),e.Q6J("disabled",o.surchargeForm.invalid||o.surchargeForm.pristine||0===(null==(l=o.surchargeForm.get("price"))?null:l.value)),e.xp6(1),e.hij(" ",e.lcZ(23,23,"order.add-surcharge")," ")}}function jo(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-address-form",77),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.shippingAddressForm)("availableCountries",e.lcZ(2,3,t.availableCountries$))("customFields",t.addressCustomFields)}}function Ro(r,n){if(1&r&&(e.TgZ(0,"clr-accordion-content"),e._UZ(1,"vdr-address-form",77),e.ALo(2,"async"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.Q6J("formGroup",t.billingAddressForm)("availableCountries",e.lcZ(2,3,t.availableCountries$))("customFields",t.addressCustomFields)}}const we=function(r){return{count:r}};function Ho(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adding-items",e.VKq(4,we,null==t.modifyOrderInput.addItems?null:t.modifyOrderInput.addItems.length))," ")}}function $o(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adjusting-lines",e.VKq(4,we,null==t.modifyOrderInput.adjustOrderLines?null:t.modifyOrderInput.adjustOrderLines.length))," ")}}function Vo(r,n){if(1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r){const t=e.oxw(2);e.xp6(1),e.hij(" ",e.xi3(2,1,"order.modification-adding-surcharges",e.VKq(4,we,null==t.modifyOrderInput.surcharges?null:t.modifyOrderInput.surcharges.length))," ")}}function Bo(r,n){1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.modification-updating-shipping-address")," "))}function Wo(r,n){1&r&&(e.TgZ(0,"li"),e._uU(1),e.ALo(2,"translate"),e.qZA()),2&r&&(e.xp6(1),e.hij(" ",e.lcZ(2,1,"order.modification-updating-billing-address")," "))}function Go(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div")(1,"div",5)(2,"div",6)(3,"table",7)(4,"thead")(5,"tr"),e._UZ(6,"th"),e.TgZ(7,"th"),e._uU(8),e.ALo(9,"translate"),e.qZA(),e.TgZ(10,"th"),e._uU(11),e.ALo(12,"translate"),e.qZA(),e.TgZ(13,"th"),e._uU(14),e.ALo(15,"translate"),e.qZA(),e.TgZ(16,"th"),e._uU(17),e.ALo(18,"translate"),e.qZA(),e.YNc(19,Co,3,3,"th",0),e.TgZ(20,"th"),e._uU(21),e.ALo(22,"translate"),e.qZA()()(),e.TgZ(23,"tbody"),e.YNc(24,bo,26,35,"tr",8),e.YNc(25,Io,26,27,"tr",9),e.YNc(26,Fo,15,14,"tr",10),e.YNc(27,Po,12,4,"tr",11),e.TgZ(28,"tr",12)(29,"td",13),e._uU(30),e.ALo(31,"translate"),e.qZA(),e.TgZ(32,"td",14),e._uU(33),e.qZA(),e._UZ(34,"td",15),e.YNc(35,So,1,0,"td",0),e.TgZ(36,"td",14),e._uU(37),e.ALo(38,"localeCurrency"),e.TgZ(39,"div",16),e.ALo(40,"translate"),e._uU(41),e.ALo(42,"localeCurrency"),e.qZA()()()()(),e.TgZ(43,"h4",17),e._uU(44),e.ALo(45,"translate"),e.qZA(),e.TgZ(46,"clr-accordion")(47,"clr-accordion-panel")(48,"clr-accordion-title"),e._uU(49),e.ALo(50,"translate"),e.qZA(),e.YNc(51,Qo,7,6,"clr-accordion-content",18),e.qZA(),e.TgZ(52,"clr-accordion-panel")(53,"clr-accordion-title"),e._uU(54),e.ALo(55,"translate"),e.qZA(),e.YNc(56,ko,4,9,"clr-accordion-content",18),e.qZA(),e.TgZ(57,"clr-accordion-panel")(58,"clr-accordion-title"),e._uU(59),e.ALo(60,"translate"),e.qZA(),e.YNc(61,Yo,24,27,"clr-accordion-content",18),e.qZA(),e.TgZ(62,"clr-accordion-panel")(63,"clr-accordion-title"),e._uU(64),e.ALo(65,"translate"),e.qZA(),e.YNc(66,jo,3,5,"clr-accordion-content",18),e.qZA(),e.TgZ(67,"clr-accordion-panel")(68,"clr-accordion-title"),e._uU(69),e.ALo(70,"translate"),e.qZA(),e.YNc(71,Ro,3,5,"clr-accordion-content",18),e.qZA()()(),e.TgZ(72,"div",19)(73,"div",20)(74,"div",21),e._uU(75),e.ALo(76,"translate"),e.qZA(),e.TgZ(77,"div",22)(78,"ul"),e.YNc(79,Ho,3,6,"li",0),e.YNc(80,$o,3,6,"li",0),e.YNc(81,Vo,3,6,"li",0),e.YNc(82,Bo,3,3,"li",0),e.YNc(83,Wo,3,3,"li",0),e.qZA()(),e.TgZ(84,"div",22)(85,"label",23),e._uU(86),e.ALo(87,"translate"),e.qZA(),e.TgZ(88,"textarea",24),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().note=i}),e.qZA(),e.TgZ(89,"clr-checkbox-wrapper",25)(90,"input",26),e.NdJ("ngModelChange",function(i){e.CHM(t);return e.oxw().recalculateShipping=i}),e.qZA(),e.TgZ(91,"label"),e._uU(92),e.ALo(93,"translate"),e.qZA()()(),e.TgZ(94,"div",27)(95,"button",28),e.NdJ("click",function(){const l=e.CHM(t).ngIf;return e.oxw().previewAndModify(l)}),e._uU(96),e.ALo(97,"translate"),e.qZA()()()()()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(8),e.Oqu(e.lcZ(9,35,"order.product-name")),e.xp6(3),e.Oqu(e.lcZ(12,37,"order.product-sku")),e.xp6(3),e.Oqu(e.lcZ(15,39,"order.unit-price")),e.xp6(3),e.Oqu(e.lcZ(18,41,"order.quantity")),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.Oqu(e.lcZ(22,43,"order.total")),e.xp6(3),e.Q6J("ngForOf",t.lines),e.xp6(1),e.Q6J("ngForOf",o.addedLines)("ngForTrackBy",o.trackByProductVariantId),e.xp6(1),e.Q6J("ngForOf",t.surcharges),e.xp6(1),e.Q6J("ngForOf",o.modifyOrderInput.surcharges),e.xp6(3),e.Oqu(e.lcZ(31,45,"order.shipping")),e.xp6(3),e.Oqu(null==t.shippingLines[0]||null==t.shippingLines[0].shippingMethod?null:t.shippingLines[0].shippingMethod.name),e.xp6(2),e.Q6J("ngIf",o.orderLineCustomFields.length),e.xp6(2),e.hij(" ",e.xi3(38,47,t.shippingWithTax,t.currencyCode)," "),e.xp6(2),e.Q6J("title",e.lcZ(40,50,"order.net-price")),e.xp6(2),e.hij(" ",e.xi3(42,52,t.shipping,t.currencyCode)," "),e.xp6(3),e.Oqu(e.lcZ(45,55,"order.modifications")),e.xp6(5),e.Oqu(e.lcZ(50,57,"order.add-item-to-order")),e.xp6(5),e.Oqu(e.lcZ(55,59,"order.set-coupon-codes")),e.xp6(5),e.Oqu(e.lcZ(60,61,"order.add-surcharge")),e.xp6(5),e.Oqu(e.lcZ(65,63,"order.edit-shipping-address")),e.xp6(5),e.Oqu(e.lcZ(70,65,"order.edit-billing-address")),e.xp6(6),e.hij(" ",e.lcZ(76,67,"order.modification-summary")," "),e.xp6(4),e.Q6J("ngIf",null==o.modifyOrderInput.addItems?null:o.modifyOrderInput.addItems.length),e.xp6(1),e.Q6J("ngIf",null==o.modifyOrderInput.adjustOrderLines?null:o.modifyOrderInput.adjustOrderLines.length),e.xp6(1),e.Q6J("ngIf",null==o.modifyOrderInput.surcharges?null:o.modifyOrderInput.surcharges.length),e.xp6(1),e.Q6J("ngIf",o.shippingAddressForm.dirty),e.xp6(1),e.Q6J("ngIf",o.billingAddressForm.dirty),e.xp6(3),e.Oqu(e.lcZ(87,69,"order.note")),e.xp6(2),e.Q6J("ngModel",o.note),e.xp6(2),e.Q6J("ngModel",o.recalculateShipping),e.xp6(2),e.Oqu(e.lcZ(93,71,"order.modification-recalculate-shipping")),e.xp6(3),e.Q6J("disabled",!o.canPreviewChanges()),e.xp6(1),e.hij(" ",e.lcZ(97,73,"order.preview-changes")," ")}}class _e extends u.UT_{constructor(n,t,o,i,l,c,d,g){super(t,n,o,l),this.changeDetector=i,this.dataService=l,this.notificationService=c,this.modalService=d,this.orderTransitionService=g,this.couponCodeInput$=new Ae.x,this.detailForm=new a.cw({}),this.couponCodesControl=new a.NI,this.modifyOrderInput={dryRun:!0,orderId:"",addItems:[],adjustOrderLines:[],surcharges:[],note:"",updateShippingAddress:{},updateBillingAddress:{}},this.note="",this.recalculateShipping=!0,this.addedVariants=new Map}get addedLines(){const n=t=>"SinglePrice"===t.__typename?t.value:0;return(this.modifyOrderInput.addItems||[]).map(t=>{const o=this.addedVariants.get(t.productVariantId);if(o)return Object.assign(Object.assign({},o),{price:n(o.price),priceWithTax:n(o.priceWithTax),quantity:t.quantity})}).filter(U.notNullOrUndefined)}ngOnInit(){this.init(),this.addressCustomFields=this.getCustomFieldConfig("Address"),this.modifyOrderInput.orderId=this.route.snapshot.paramMap.get("id"),this.orderLineCustomFields=this.getCustomFieldConfig("OrderLine"),this.entity$.pipe((0,ye.R)(this.destroy$)).subscribe(n=>{var t,o,i,l,c,d,g,x,P,S,N,Pe,Se,Ne,Je,Ue,Qe,De;n.couponCodes.length&&this.couponCodesControl.setValue(n.couponCodes),this.surchargeForm=new a.cw({description:new a.NI("",a.kI.required),sku:new a.NI(""),price:new a.NI(0,a.kI.required),priceIncludesTax:new a.NI(!0),taxRate:new a.NI(0),taxDescription:new a.NI("")}),this.shippingAddressForm||(this.shippingAddressForm=new a.cw({fullName:new a.NI(null===(t=n.shippingAddress)||void 0===t?void 0:t.fullName),company:new a.NI(null===(o=n.shippingAddress)||void 0===o?void 0:o.company),streetLine1:new a.NI(null===(i=n.shippingAddress)||void 0===i?void 0:i.streetLine1),streetLine2:new a.NI(null===(l=n.shippingAddress)||void 0===l?void 0:l.streetLine2),city:new a.NI(null===(c=n.shippingAddress)||void 0===c?void 0:c.city),province:new a.NI(null===(d=n.shippingAddress)||void 0===d?void 0:d.province),postalCode:new a.NI(null===(g=n.shippingAddress)||void 0===g?void 0:g.postalCode),countryCode:new a.NI(null===(x=n.shippingAddress)||void 0===x?void 0:x.countryCode),phoneNumber:new a.NI(null===(P=n.shippingAddress)||void 0===P?void 0:P.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.shippingAddressForm,n.shippingAddress)),this.billingAddressForm||(this.billingAddressForm=new a.cw({fullName:new a.NI(null===(S=n.billingAddress)||void 0===S?void 0:S.fullName),company:new a.NI(null===(N=n.billingAddress)||void 0===N?void 0:N.company),streetLine1:new a.NI(null===(Pe=n.billingAddress)||void 0===Pe?void 0:Pe.streetLine1),streetLine2:new a.NI(null===(Se=n.billingAddress)||void 0===Se?void 0:Se.streetLine2),city:new a.NI(null===(Ne=n.billingAddress)||void 0===Ne?void 0:Ne.city),province:new a.NI(null===(Je=n.billingAddress)||void 0===Je?void 0:Je.province),postalCode:new a.NI(null===(Ue=n.billingAddress)||void 0===Ue?void 0:Ue.postalCode),countryCode:new a.NI(null===(Qe=n.billingAddress)||void 0===Qe?void 0:Qe.countryCode),phoneNumber:new a.NI(null===(De=n.billingAddress)||void 0===De?void 0:De.phoneNumber)}),this.addAddressCustomFieldsFormGroup(this.billingAddressForm,n.billingAddress)),this.orderLineCustomFieldsFormArray=new a.Oe([]);for(const Ze of n.lines){const ke=new a.cw({});for(const{name:Oe}of this.orderLineCustomFields)ke.addControl(Oe,new a.NI(Ze.customFields[Oe]));ke.valueChanges.pipe((0,ye.R)(this.destroy$)).subscribe(Oe=>{let be=this.modifyOrderInput.adjustOrderLines.find(si=>si.orderLineId===Ze.id);be||(be={orderLineId:Ze.id,quantity:Ze.quantity},this.modifyOrderInput.adjustOrderLines.push(be)),this.orderLineCustomFields.length&&(be.customFields=Oe)}),this.orderLineCustomFieldsFormArray.push(ke)}}),this.availableCouponCodes$=(0,so.z)(this.couponCodeInput$.pipe((0,nt.x)(),(0,h.w)(n=>this.dataService.promotion.getPromotions(10,0,{couponCode:{contains:n}}).single$),(0,F.U)(({promotions:n})=>n.items.map(t=>({code:t.couponCode,promotionName:t.name}))),(0,$e.O)([]))),this.addItemCustomFieldsFormArray=new a.Oe([]),this.addItemCustomFieldsForm=new a.cw({});for(const n of this.orderLineCustomFields)this.addItemCustomFieldsForm.addControl(n.name,new a.NI);this.availableCountries$=this.dataService.settings.getAvailableCountries().mapSingle(n=>n.countries.items).pipe((0,uo.d)(1)),this.dataService.order.getOrderHistory(this.id,{take:1,sort:{createdAt:u.Asd.DESC},filter:{type:{eq:u.iYD.ORDER_STATE_TRANSITION}}}).single$.subscribe(({order:n})=>{this.previousState=null==n?void 0:n.history.items[0].data.from})}ngOnDestroy(){this.destroy()}transitionToPriorState(n){this.orderTransitionService.transitionToPreModifyingState(n.id,n.nextStates).subscribe(t=>{this.router.navigate([".."],{relativeTo:this.route})})}canPreviewChanges(){const{addItems:n,adjustOrderLines:t,surcharges:o}=this.modifyOrderInput;return!!(null==n?void 0:n.length)||!!(null==o?void 0:o.length)||!!(null==t?void 0:t.length)||this.shippingAddressForm.dirty&&this.shippingAddressForm.valid||this.billingAddressForm.dirty&&this.billingAddressForm.valid||this.couponCodesControl.dirty}isLineModified(n){var t;return!!(null===(t=this.modifyOrderInput.adjustOrderLines)||void 0===t?void 0:t.find(o=>o.orderLineId===n.id&&o.quantity!==n.quantity))}updateLineQuantity(n,t){const{adjustOrderLines:o}=this.modifyOrderInput;let i=null==o?void 0:o.find(l=>l.orderLineId===n.id);i&&+t===n.quantity&&(null==o||o.splice(null==o?void 0:o.indexOf(i),1)),i||(i={orderLineId:n.id,quantity:+t},null==o||o.push(i)),i.quantity=+t}updateAddedItemQuantity(n,t){var o;const i=null===(o=this.modifyOrderInput.addItems)||void 0===o?void 0:o.find(l=>l.productVariantId===n.productVariantId);i&&(i.quantity=+t)}trackByProductVariantId(n,t){return t.productVariantId}getSelectedItemPrice(n){return"SinglePrice"===(null==n?void 0:n.priceWithTax.__typename)?n.priceWithTax.value:0}addItemToOrder(n){var t,o;if(!n)return;const i=this.orderLineCustomFields.length?this.addItemCustomFieldsForm.value:void 0;let l=null===(t=this.modifyOrderInput.addItems)||void 0===t?void 0:t.find(c=>this.isMatchingAddItemRow(c,n,i));if(l?l.quantity++:(l={productVariantId:n.productVariantId,quantity:1},i&&(l.customFields=i),null===(o=this.modifyOrderInput.addItems)||void 0===o||o.push(l)),i){const c=new a.cw({});for(const[d,g]of Object.entries(i))c.addControl(d,new a.NI(g));this.addItemCustomFieldsFormArray.push(c),c.valueChanges.pipe((0,ye.R)(this.destroy$)).subscribe(d=>{l&&(l.customFields=d)})}this.addItemCustomFieldsForm.reset({}),this.addItemSelectedVariant=void 0,this.addedVariants.set(n.productVariantId,n)}isMatchingAddItemRow(n,t,o){return n.productVariantId===t.productVariantId&&JSON.stringify(n.customFields)===JSON.stringify(o)}removeAddedItem(n){this.modifyOrderInput.addItems.splice(n,1),-1<n&&this.addItemCustomFieldsFormArray.removeAt(n)}getSurchargePrices(n){const t=n.priceIncludesTax?n.price:Math.round(n.price*((100+(n.taxRate||0))/100));return{price:n.priceIncludesTax?Math.round(n.price/((100+(n.taxRate||0))/100)):n.price,priceWithTax:t}}addSurcharge(n){var t;null===(t=this.modifyOrderInput.surcharges)||void 0===t||t.push(n),this.surchargeForm.reset({price:0,priceIncludesTax:!0,taxRate:0})}removeSurcharge(n){var t;null===(t=this.modifyOrderInput.surcharges)||void 0===t||t.splice(n,1)}previewAndModify(n){var t;const o=Object.assign(Object.assign(Object.assign(Object.assign({},this.modifyOrderInput),this.billingAddressForm.dirty?{updateBillingAddress:this.billingAddressForm.value}:{}),this.shippingAddressForm.dirty?{updateShippingAddress:this.shippingAddressForm.value}:{}),{dryRun:!0,couponCodes:this.couponCodesControl.dirty?this.couponCodesControl.value:void 0,note:null!==(t=this.note)&&void 0!==t?t:"",options:{recalculateShipping:this.recalculateShipping}}),i=n.totalWithTax;this.dataService.order.modifyOrder(o).pipe((0,h.w)(({modifyOrder:l})=>{switch(l.__typename){case"Order":return this.modalService.fromComponent(me,{size:"xl",closable:!1,locals:{originalTotalWithTax:i,order:l,orderLineCustomFields:this.orderLineCustomFields,modifyOrderInput:o}});case"InsufficientStockError":case"NegativeQuantityError":case"NoChangesSpecifiedError":case"OrderLimitError":case"OrderModificationStateError":case"PaymentMethodMissingError":case"RefundPaymentIdMissingError":case"CouponCodeLimitError":case"CouponCodeExpiredError":case"CouponCodeInvalidError":return this.notificationService.error(l.message),(0,q.of)(!1);case null:case void 0:return(0,q.of)(!1);default:(0,U.assertNever)(l)}}),(0,h.w)(l=>{if(!l||l.result===b.Cancel)return this.dataService.order.getOrder(this.id).mapSingle(()=>!1);{const c=Object.assign(Object.assign({},o),{dryRun:!1});return l.result===b.Refund&&(c.refund={paymentId:l.refundPaymentId,reason:l.refundNote}),this.dataService.order.modifyOrder(c).pipe((0,h.w)(({modifyOrder:d})=>{if("Order"===d.__typename){const x=0<d.totalWithTax-i?"ArrangingAdditionalPayment":this.previousState;return this.dataService.order.transitionToState(n.id,x).pipe((0,Le.h)(!0))}return this.notificationService.error(d.message),j.E}))}})).subscribe(l=>{l&&this.router.navigate(["../"],{relativeTo:this.route})})}addAddressCustomFieldsFormGroup(n,t){var o;if(t&&this.addressCustomFields.length){const i=new a.cw({});for(const l of this.addressCustomFields){const c=l.name,d=null===(o=t.customFields)||void 0===o?void 0:o[c];i.addControl(c,new a.NI(d))}n.addControl("customFields",i)}}setFormValues(n,t){}}_e.\u0275fac=function(n){return new(n||_e)(e.Y36(y.F0),e.Y36(y.gz),e.Y36(u.iHG),e.Y36(e.sBO),e.Y36(u.DoR),e.Y36(u.gqp),e.Y36(u.Z7U),e.Y36(w))},_e.\u0275cmp=e.Xpm({type:_e,selectors:[["vdr-order-editor"]],features:[e.qOj],decls:4,vars:6,consts:[[4,"ngIf"],[1,"flex","clr-align-items-center"],[3,"entity"],[3,"state"],[1,"btn","btn-secondary",3,"click"],[1,"clr-row"],[1,"clr-col-lg-8"],[1,"order-table","table"],["class","order-line",3,"is-cancelled","modified",4,"ngFor","ngForOf"],["class","modified",4,"ngFor","ngForOf","ngForTrackBy"],["class","surcharge",4,"ngFor","ngForOf"],["class","surcharge modified",4,"ngFor","ngForOf"],[1,"shipping"],[1,"left","clr-align-middle"],[1,"clr-align-middle"],["colspan","3"],[1,"net-price",3,"title"],[1,"mb2"],[4,"clrIfExpanded"],[1,"clr-col-lg-4","order-cards"],[1,"card"],[1,"card-header"],[1,"card-block"],[1,"clr-control-label"],["name","note","clrTextarea","","required","",3,"ngModel","ngModelChange"],[1,""],["type","checkbox","clrCheckbox","",3,"ngModel","ngModelChange"],[1,"card-footer"],[1,"btn","btn-primary",3,"disabled","click"],[1,"order-line"],[1,"align-middle","thumb"],[3,"src",4,"ngIf"],[1,"align-middle","name"],[1,"align-middle","sku"],[1,"align-middle","unit-price"],[1,"align-middle","quantity"],["type","number","min","0",3,"value","input"],[3,"line","payments"],[3,"line","orderState"],["class","order-line-custom-field align-middle",4,"ngIf"],[1,"align-middle","total"],[3,"src"],[1,"order-line-custom-field","align-middle"],[4,"ngFor","ngForOf"],["entityName","OrderLine",3,"customField","customFieldsFormGroup","compact"],[1,"modified"],[1,"icon-button",3,"click"],["shape","trash"],[1,"surcharge"],["colspan","2",1,"align-middle","name","left"],[1,"align-middle"],[1,"surcharge","modified"],[1,"mb4",3,"productSelected"],["class","flex mb4",4,"ngIf"],[1,"btn","btn-secondary",3,"disabled","click"],[1,"flex","mb4"],["class","mr4",3,"src",4,"ngIf"],[1,"mr4"],[1,"mr4",3,"src"],["entityName","OrderLine",3,"readonly","customField","customFieldsFormGroup","compact"],["appendTo","body","bindLabel","code","bindValue","code","typeToSearchText","",3,"items","addTag","multiple","hideSelected","minTermLength","typeahead","formControl"],["ng-option-tmp",""],[3,"formGroup","submit"],["for","description",3,"label"],["id","description","type","text","formControlName","description"],["for","sku",3,"label"],["id","sku","type","text","formControlName","sku"],["for","price",3,"label"],["id","price","formControlName","price",3,"currencyCode"],["for","priceIncludesTax",3,"label"],["id","priceIncludesTax","type","checkbox","clrCheckbox","","formControlName","priceIncludesTax"],["for","taxRate",3,"label"],["suffix","%"],["id","taxRate","type","number","min","0","max","100","formControlName","taxRate"],["for","taxDescription",3,"label"],["id","taxDescription","type","text","formControlName","taxDescription"],[1,"btn","btn-secondary",3,"disabled"],[3,"formGroup","availableCountries","customFields"]],template:function(n,t){1&n&&(e.YNc(0,vo,10,7,"vdr-action-bar",0),e.ALo(1,"async"),e.YNc(2,Go,98,75,"div",0),e.ALo(3,"async")),2&n&&(e.Q6J("ngIf",e.lcZ(1,2,t.entity$)),e.xp6(2),e.Q6J("ngIf",e.lcZ(3,4,t.entity$)))},directives:[p.O5,O.Kk,O.BN,Ge.V,Fe.G,O.mz,p.sg,C.y,I,Y,Te.M,m.q0d,m.qvL,m.bZL,m.twP,m.GmI,m.dxz,m.UJ5,m.Nz$,m.DbV,m.r6y,fo.e,A.w9,a.JJ,a.oH,A.ir,G.Y,a._Y,a.JL,a.sg,Ye.h,a.Fj,a.u,Be.K,a.Wl,m.KKC,ho.K,a.qQ,a.Fd,a.wV,xo.C,m.MgK,m.XE5,a.Q7,a.On,m.PEh],pipes:[p.Ov,f.X$,he.M,v.k,p.H9],styles:[".order-table[_ngcontent-%COMP%] .is-cancelled[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{text-decoration:line-through;background-color:var(--color-component-bg-200)}.order-table[_ngcontent-%COMP%] .sub-total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] .total[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{font-weight:700;border-top:1px dashed var(--color-component-border-200)}.order-table[_ngcontent-%COMP%] td.custom-fields-row[_ngcontent-%COMP%]{border-top-style:dashed;border-top-color:var(--color-grey-200)}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}.order-table[_ngcontent-%COMP%] .order-line-custom-fields[_ngcontent-%COMP%] .custom-field[_ngcontent-%COMP%]{text-align:start;max-width:200px;overflow:hidden;text-overflow:ellipsis;margin-bottom:6px;margin-right:18px}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%]{background-color:var(--color-component-bg-100)}.order-table[_ngcontent-%COMP%] .order-line-custom-field[_ngcontent-%COMP%] .custom-field-ellipsis[_ngcontent-%COMP%]{color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .net-price[_ngcontent-%COMP%]{font-size:11px;color:var(--color-text-300)}.order-table[_ngcontent-%COMP%] .promotions-label[_ngcontent-%COMP%]{-webkit-text-decoration:underline dotted var(--color-text-200);text-decoration:underline dotted var(--color-text-200);font-size:11px;margin-top:6px;cursor:pointer;text-transform:lowercase}.order-table[_ngcontent-%COMP%] .thumb[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{width:50px;height:50px}.order-table[_ngcontent-%COMP%] tr.modified[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{background-color:var(--color-warning-100)}"],changeDetection:0});var ot=s(6646),Xo=s(116),Ko=s(6852),zo=s(365),ei=s(901),ti=s(8899),ni=s(6826);function ri(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"button",18),e.NdJ("click",function(){const l=e.CHM(t).$implicit;return e.oxw(2).selectFilterPreset(l.name)}),e._uU(1),e.ALo(2,"translate"),e.qZA()}if(2&r){const t=n.$implicit,o=e.oxw().ngIf;e.ekj("btn-primary",o===t.name),e.xp6(1),e.hij(" ",e.lcZ(2,3,t.label)," ")}}function oi(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"div",16),e.YNc(1,ri,3,5,"button",17),e.TgZ(2,"button",18),e.NdJ("click",function(){return e.CHM(t),e.oxw().selectFilterPreset("custom")}),e._uU(3),e.ALo(4,"translate"),e._UZ(5,"clr-icon",19),e.qZA()()}if(2&r){const t=n.ngIf,o=e.oxw();e.xp6(1),e.Q6J("ngForOf",o.filterPresets),e.xp6(1),e.ekj("btn-primary","custom"===t),e.xp6(1),e.hij(" ",e.lcZ(4,4,"order.filter-custom")," ")}}function ii(r,n){if(1&r&&(e._uU(0),e.ALo(1,"translate"),e.ALo(2,"stateI18nToken")),2&r){const t=n.item;e.Oqu(e.lcZ(1,1,e.lcZ(2,3,t)))}}function li(r,n){if(1&r){const t=e.EpF();e.TgZ(0,"span",20),e._uU(1),e.ALo(2,"translate"),e.ALo(3,"stateI18nToken"),e.qZA(),e.TgZ(4,"span",21),e.NdJ("click",function(){const i=e.CHM(t),l=i.item;return i.clear(l)}),e._uU(5,"\xd7"),e.qZA()}if(2&r){const t=n.item;e.xp6(1),e.hij(" ",e.lcZ(2,1,e.lcZ(3,3,t)),"")}}const ai=function(r){return["./",r,"modify"]},ci=function(r){return["./",r]};function di(r,n){if(1&r&&(e.TgZ(0,"td",22),e._uU(1),e.qZA(),e.TgZ(2,"td",22),e._UZ(3,"vdr-customer-label",23),e.qZA(),e.TgZ(4,"td",22),e._UZ(5,"vdr-order-state-label",24),e.qZA(),e.TgZ(6,"td",22),e._uU(7),e.ALo(8,"localeCurrency"),e.qZA(),e.TgZ(9,"td",22),e._uU(10),e.ALo(11,"timeAgo"),e.qZA(),e.TgZ(12,"td",22),e._uU(13),e.ALo(14,"localeDate"),e.qZA(),e.TgZ(15,"td",22),e._uU(16),e.qZA(),e.TgZ(17,"td",25),e._UZ(18,"vdr-table-row-action",26),e.ALo(19,"translate"),e.qZA()),2&r){const t=n.item,o=e.oxw();e.xp6(1),e.Oqu(t.code),e.xp6(2),e.Q6J("customer",t.customer),e.xp6(2),e.Q6J("state",t.state),e.xp6(2),e.Oqu(e.xi3(8,9,t.totalWithTax,t.currencyCode)),e.xp6(3),e.Oqu(e.lcZ(11,12,t.updatedAt)),e.xp6(3),e.Oqu(e.xi3(14,14,t.orderPlacedAt,"medium")),e.xp6(3),e.Oqu(o.getShippingNames(t)),e.xp6(2),e.Q6J("label",e.lcZ(19,17,"common.open"))("linkTo","Modifying"===t.state?e.VKq(19,ai,t.id):e.VKq(21,ci,t.id))}}class ge extends u.t7C{constructor(n,t,o,i,l){super(i,l),this.serverConfigService=n,this.dataService=t,this.localStorageService=o,this.searchControl=new a.NI(""),this.searchOrderCodeControl=new a.NI(""),this.searchLastNameControl=new a.NI(""),this.orderStates=this.serverConfigService.getOrderProcessStates().map(d=>d.name),this.filterPresets=[{name:"open",label:(0,_.J)("order.filter-preset-open"),config:{active:!1,states:this.orderStates.filter(d=>"Delivered"!==d&&"Cancelled"!==d&&"Shipped"!==d)}},{name:"shipped",label:(0,_.J)("order.filter-preset-shipped"),config:{active:!1,states:["Shipped"]}},{name:"completed",label:(0,_.J)("order.filter-preset-completed"),config:{active:!1,states:["Delivered","Cancelled"]}},{name:"active",label:(0,_.J)("order.filter-preset-active"),config:{active:!0}}],super.setQueryFn((d,g)=>this.dataService.order.getOrders({take:d,skip:g}).refetchOnChannelChange(),d=>d.orders,(d,g)=>this.createQueryOptions(d,g,this.searchControl.value,this.route.snapshot.queryParamMap.get("filter")||"open"));const c=this.localStorageService.get("orderListLastCustomFilters");c&&this.setQueryParam(c,{replaceUrl:!0})}ngOnInit(){var n;super.ngOnInit(),this.activePreset$=this.route.queryParamMap.pipe((0,F.U)(i=>i.get("filter")||"open"),(0,nt.x)());const t=(0,ot.T)(this.searchControl.valueChanges).pipe((0,Xo.h)(i=>2<i.length||0===i.length),(0,Ve.b)(250));(0,ot.T)(t,this.route.queryParamMap).pipe((0,ye.R)(this.destroy$)).subscribe(i=>{this.refresh()});const o=this.route.snapshot.queryParamMap;this.customFilterForm=new a.cw({states:new a.NI(null!==(n=o.getAll("states"))&&void 0!==n?n:[]),placedAtStart:new a.NI(o.get("placedAtStart")),placedAtEnd:new a.NI(o.get("placedAtEnd"))})}selectFilterPreset(n){var t;const o=null!==(t=this.localStorageService.get("orderListLastCustomFilters"))&&void 0!==t?t:{},l="custom"===n?o:{states:void 0,placedAtStart:void 0,placedAtEnd:void 0};this.setQueryParam(Object.assign({filter:n,page:1},l),{replaceUrl:!0})}applyCustomFilters(){const n=this.customFilterForm.value,t={states:n.states,placedAtStart:n.placedAtStart,placedAtEnd:n.placedAtEnd};this.setQueryParam(Object.assign({filter:"custom"},t)),this.customFilterForm.markAsPristine(),this.localStorageService.set("orderListLastCustomFilters",t)}createQueryOptions(n,t,o,i){var l;const c=this.filterPresets.find(x=>x.name===i);let d={},g=u.FnJ.AND;if(c)null!=c.config.active&&(d.active={eq:c.config.active}),c.config.states&&(d.state={in:c.config.states});else if("custom"===i){const x=this.route.snapshot.queryParamMap,P=null!==(l=x.getAll("states"))&&void 0!==l?l:[],S=x.get("placedAtStart"),N=x.get("placedAtEnd");P.length&&(d.state={in:P}),S&&N?d.orderPlacedAt={between:{start:S,end:N}}:S?d.orderPlacedAt={after:S}:N&&(d.orderPlacedAt={before:N})}return o&&(d={customerLastName:{contains:o},transactionId:{contains:o},code:{contains:o}},g=u.FnJ.OR),{options:{skip:n,take:t,filter:Object.assign({},null!=d?d:{}),sort:{updatedAt:u.Asd.DESC},filterOperator:g}}}getShippingNames(n){return n.shippingLines.length?n.shippingLines.map(t=>t.shippingMethod.name).join(", "):""}}ge.\u0275fac=function(n){return new(n||ge)(e.Y36(u.iHG),e.Y36(u.DoR),e.Y36(u.n2A),e.Y36(y.F0),e.Y36(y.gz))},ge.\u0275cmp=e.Xpm({type:ge,selectors:[["vdr-order-list"]],features:[e.qOj],decls:60,vars:63,consts:[[1,"search-form"],["class","btn-group btn-outline-primary",4,"ngIf"],["type","text","name","searchTerm",1,"search-input",3,"formControl","placeholder"],[1,"custom-filters"],[3,"formGroup"],[1,"flex","align-center"],["appendTo","body","formControlName","states",3,"items","addTag","multiple","placeholder","clearable","searchable"],["ng-option-tmp",""],["ng-label-tmp",""],[1,"btn","btn-secondary",3,"disabled","click"],["shape","filter"],[1,"flex"],["formControlName","placedAtStart"],["formControlName","placedAtEnd"],["locationId","order-list"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn-group","btn-outline-primary"],["class","btn",3,"btn-primary","click",4,"ngFor","ngForOf"],[1,"btn",3,"click"],["shape","angle down"],[1,"ng-value-label"],["aria-hidden","true",1,"ng-value-icon","right",3,"click"],[1,"left","align-middle"],[3,"customer"],[3,"state"],[1,"right","align-middle"],["iconShape","shopping-cart",3,"label","linkTo"]],template:function(n,t){1&n&&(e.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),e.YNc(3,oi,6,6,"div",1),e.ALo(4,"async"),e._UZ(5,"input",2),e.ALo(6,"translate"),e.qZA(),e.TgZ(7,"div",3),e.ALo(8,"async"),e.TgZ(9,"form",4)(10,"div",5)(11,"ng-select",6),e.ALo(12,"translate"),e.YNc(13,ii,3,5,"ng-template",7),e.YNc(14,li,6,5,"ng-template",8),e.qZA(),e.TgZ(15,"button",9),e.NdJ("click",function(){return t.applyCustomFilters()}),e._uU(16),e.ALo(17,"translate"),e._UZ(18,"clr-icon",10),e.qZA()(),e.TgZ(19,"div",11)(20,"div")(21,"label"),e._uU(22),e.ALo(23,"translate"),e.qZA(),e._UZ(24,"vdr-datetime-picker",12),e.qZA(),e.TgZ(25,"div")(26,"label"),e._uU(27),e.ALo(28,"translate"),e.qZA(),e._UZ(29,"vdr-datetime-picker",13),e.qZA()()()()(),e.TgZ(30,"vdr-ab-right"),e._UZ(31,"vdr-action-bar-items",14),e.qZA()(),e.TgZ(32,"vdr-data-table",15),e.NdJ("pageChange",function(i){return t.setPageNumber(i)})("itemsPerPageChange",function(i){return t.setItemsPerPage(i)}),e.ALo(33,"async"),e.ALo(34,"async"),e.ALo(35,"async"),e.ALo(36,"async"),e.TgZ(37,"vdr-dt-column"),e._uU(38),e.ALo(39,"translate"),e.qZA(),e.TgZ(40,"vdr-dt-column"),e._uU(41),e.ALo(42,"translate"),e.qZA(),e.TgZ(43,"vdr-dt-column"),e._uU(44),e.ALo(45,"translate"),e.qZA(),e.TgZ(46,"vdr-dt-column"),e._uU(47),e.ALo(48,"translate"),e.qZA(),e.TgZ(49,"vdr-dt-column"),e._uU(50),e.ALo(51,"translate"),e.qZA(),e.TgZ(52,"vdr-dt-column"),e._uU(53),e.ALo(54,"translate"),e.qZA(),e.TgZ(55,"vdr-dt-column"),e._uU(56),e.ALo(57,"translate"),e.qZA(),e._UZ(58,"vdr-dt-column"),e.YNc(59,di,20,23,"ng-template"),e.qZA()),2&n&&(e.xp6(3),e.Q6J("ngIf",e.lcZ(4,27,t.activePreset$)),e.xp6(2),e.Q6J("formControl",t.searchControl)("placeholder",e.lcZ(6,29,"order.search-by-order-filters")),e.xp6(2),e.ekj("expanded","custom"===e.lcZ(8,31,t.activePreset$)),e.xp6(2),e.Q6J("formGroup",t.customFilterForm),e.xp6(2),e.Q6J("items",t.orderStates)("addTag",!1)("multiple",!0)("placeholder",e.lcZ(12,33,"state.all-orders"))("clearable",!0)("searchable",!1),e.xp6(4),e.Q6J("disabled",t.customFilterForm.pristine),e.xp6(1),e.hij(" ",e.lcZ(17,35,"order.apply-filters")," "),e.xp6(6),e.Oqu(e.lcZ(23,37,"order.placed-at-start")),e.xp6(5),e.Oqu(e.lcZ(28,39,"order.placed-at-end")),e.xp6(5),e.Q6J("items",e.lcZ(33,41,t.items$))("itemsPerPage",e.lcZ(34,43,t.itemsPerPage$))("totalItems",e.lcZ(35,45,t.totalItems$))("currentPage",e.lcZ(36,47,t.currentPage$)),e.xp6(6),e.Oqu(e.lcZ(39,49,"common.code")),e.xp6(3),e.Oqu(e.lcZ(42,51,"order.customer")),e.xp6(3),e.Oqu(e.lcZ(45,53,"order.state")),e.xp6(3),e.Oqu(e.lcZ(48,55,"order.total")),e.xp6(3),e.Oqu(e.lcZ(51,57,"common.updated-at")),e.xp6(3),e.Oqu(e.lcZ(54,59,"order.placed-at")),e.xp6(3),e.Oqu(e.lcZ(57,61,"order.shipping")))},directives:[O.Kk,O.BN,p.O5,p.sg,m.qvL,C.y,a.Fj,a.JJ,a.oH,a._Y,a.JL,a.sg,A.w9,a.u,A.ir,A.mR,m.MgK,Ko.I,O.mz,Xe.W,zo.Q,ei.E,tt.d,Fe.G,ti.v],pipes:[p.Ov,f.X$,Z.N,v.k,ni.e,xe.H],styles:[".search-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:baseline;width:100%;margin-bottom:6px}@media screen and (min-width: 768px){.search-form[_ngcontent-%COMP%]{flex-direction:row}}.search-input[_ngcontent-%COMP%]{margin-left:6px;margin-top:6px;min-width:300px}.custom-filters[_ngcontent-%COMP%]{overflow:hidden;max-height:0;padding-bottom:6px}.custom-filters.expanded[_ngcontent-%COMP%]{max-height:initial}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center}.custom-filters[_ngcontent-%COMP%] > form[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{width:100%}ng-select[_ngcontent-%COMP%]{flex:1;min-width:200px;height:36px}ng-select[_ngcontent-%COMP%] .ng-select-container{height:36px}"],changeDetection:0});class M extends u.p_9{constructor(n,t){super(n,{__typename:"Order",id:"",code:"",createdAt:"",updatedAt:"",total:0},o=>t.order.getOrder(o).mapStream(i=>i.order))}}M.\u0275fac=function(n){return new(n||M)(e.LFG(y.F0),e.LFG(u.DoR))},M.\u0275prov=e.Yz7({token:M,factory:M.\u0275fac,providedIn:"root"});const it=[{path:"",component:ge,data:{breadcrumb:(0,_.J)("breadcrumb.orders")}},{path:":id",component:pe,resolve:(0,u.Po4)(M),canDeactivate:[u.TSp],data:{breadcrumb:Me}},{path:":id/modify",component:_e,resolve:(0,u.Po4)(M),data:{breadcrumb:lt}}];function Me(r,n){return(0,u.YWC)({entity:r.entity,id:n.id,breadcrumbKey:"breadcrumb.orders",getName:t=>t.code,route:""})}function lt(r,n){return Me(r,n).pipe((0,F.U)(t=>{const o=t.slice();return o[0].link[0]="../",o[1].link[0]="../orders",o.concat({label:(0,_.J)("breadcrumb.modifying"),link:[""]})}))}class fe{}fe.\u0275fac=function(n){return new(n||fe)},fe.\u0275mod=e.oAB({type:fe}),fe.\u0275inj=e.cJS({imports:[[u.m81,y.Bz.forChild(it)]]})}}]);
2
+ //# sourceMappingURL=849.21d37348d17a9559.js.map