System.register(["./p-c4df9d4b.system.js","./p-23628d1c.system.js","./p-a2544376.system.js","./p-75920676.system.js","./p-ab47f4f5.system.js","./p-2db4f08c.system.js","./p-0c4c76d0.system.js","./p-7e44bde4.system.js","./p-fe1f76a3.system.js","./p-13713b08.system.js"],(function(t){"use strict";var e,n,s,i,r,a,c,o,u,d;return{setters:[function(t){e=t.r;n=t.h;s=t.H},function(t){i=t.g},function(t){r=t.I},function(t){a=t.L},function(t){c=t.C},function(t){o=t.g},function(t){u=t.g;d=t.a},function(){},function(){},function(){}],execute:function(){var l=t("atama_received_request_list",function(){function t(t){var n=this;e(this,t);this.list=a.init();this.actionStatus=r.init();this.showHeader=true;this.acceptRequest=function(t){return n.performAction("accept",t)};this.rejectRequest=function(t){return n.performAction("reject",t)}}t.prototype.fetchList=function(t){var e=this;if(t===void 0){t=false}var n=this,s=n.list,i=n.table;if(s.isPending||s.error&&!t){return}this.list=s.beforeFetch();this.apiAtama.getReceivedRequests(i.base,i.name).then((function(t){e.list=s.afterFetch(t,false)}),(function(t){e.list=s.afterFetchError(t)}))};t.prototype.performAction=function(t,e){var n=this;var s=this,i=s.actionStatus,r=s.table;if(i.isPending){return}this.actionStatus=i.beforeFetch();var a=function(t){n.actionStatus=i.afterFetch(t);n.onActionDone();n.fetchList()};var c=function(t){n.actionStatus=i.afterFetchError(t)};if(t==="accept"){this.apiAtama.acceptPairRequest(r.base,r.name,e._id).then(a,c)}else{this.apiAtama.rejectPairRequest(r.base,r.name,e._id).then(a,c)}};t.prototype.componentWillLoad=function(){this.fetchList()};t.prototype.render=function(){var t=this;var e;var r=this,a=r.i18n,l=r.actionStatus,f=r.list,m=r.showHeader;var p=f.isPending&&f.data;return n(s,null,(m||p)&&n("div",{class:"ml-2 mb-2 d-flex align-items-center"},m&&n("small",null,n("b",null,((e=a.receivedRequests)===null||e===void 0?void 0:e.toLocaleUpperCase())||"RECEIVED REQUESTS")," "),p&&n("dvn-progress",{indefinite:true,size:14,strokeWidth:2,tint:"primary"})),f.isPending&&!f.data&&n("div",{class:"d-flex justify-content-center"},n("dvn-progress",{indefinite:true})),(f.data&&f.data.length)===0&&n("dvn-card",{elevation:0,leaned:true,tint:"neutral"},a.noReceivedRequests||"There are no pending requests."),f.data&&f.data.map((function(e){return n("dvn-card",{key:e._id,elevation:0,leaned:true,bodyLeaned:true,style:{margin:"0 0 1rem 0"}},n("div",{class:"d-flex justify-content-between align-items-center pr-2"},n("div",{style:{cursor:"pointer"}},n("dvn-info-summary",{title:o(i(e,"sentBy")),subTitle:e.requestedAt?c.format(new Date(e.requestedAt*1e3),a.sentOnDateFormat||"DD MMM YYYY, HH:mm"):undefined,onClick:function(){return t.onViewRequestSender(i(e,"sentBy"))}},n("dvn-image",{slot:"media",src:i(e,"sentBy").imageUrl,shape:"circle"}))),e.status!=="requested"&&n("dvn-button",{leaned:true,scale:"small",shape:"rounded",tagMode:true,tint:u(e),view:"ghost"},d(a.statusLabels,e))),e.status==="requested"&&n("dvn-card-footer",{slot:"footer",alignRight:true},n("dvn-button",{disabled:l.isPending,leaned:true,scale:"small",tint:"secondary",onClick:function(){return t.acceptRequest(e)}},a.accept||"Accept"),n("dvn-button",{disabled:l.isPending,scale:"small",tint:"danger",onClick:function(){return t.rejectRequest(e)}},a.reject||"Reject")))})))};return t}())}}}));