var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function o(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n["throw"](t))}catch(t){s(t)}}function l(t){t.done?i(t.value):r(t.value).then(o,a)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(o){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(s=o[0]&2?r["return"]:o[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,o[1])).done)return s;if(r=0,s)o=[o[0]&2,s.value];switch(o[0]){case 0:case 1:s=o;break;case 4:i.label++;return{value:o[1],done:false};case 5:i.label++;r=o[1];o=[0];continue;case 7:o=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(o[0]===6||o[0]===2)){i=0;continue}if(o[0]===3&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(o[0]===6&&i.label<s[1]){i.label=s[1];s=o;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(o);break}if(s[2])i.ops.pop();i.trys.pop();continue}o=e.call(t,i)}catch(t){o=[6,t];r=0}finally{n=s=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};System.register(["./p-343b3b10.system.js","./p-87065f68.system.js","./p-cc2dfee2.system.js","./p-9ba968ca.system.js","./p-70552f4e.system.js","./p-da593370.system.js","./p-cb044807.system.js"],(function(t){"use strict";var e,i,n,r,s,o,a,l,c;return{setters:[function(t){e=t.r;i=t.h;n=t.H;r=t.g},function(t){s=t.g},function(t){o=t.r;a=t.c},function(t){l=t.d},function(t){c=t.L},function(){},function(){}],execute:function(){function u(t){if(t&&t.sort){return t.sort}return undefined}function f(t,e,i){var n=t?t.filter:undefined;if(e){if(t&&t.filter){n={operator:"and",filters:[t.filter,e]}}else{n=e}}if(!n){return undefined}return o(a(n),i)}var d="dvn-app-view-list-view-card{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;padding:1rem}dvn-app-view-list-view-card dvn-filter-simple{margin-bottom:1rem}dvn-app-view-list-view-card .list-container{-ms-flex:1;flex:1;overflow-y:auto;overflow-x:hidden}";var h=t("dvn_app_view_list_view_card",function(){function t(t){var i=this;e(this,t);this.list=c.init();this.onSimpleFilterChange=function(t){var e=t.filter;i.quickFilter=e;i.fetchList(true,true)}}t.prototype.invalidate=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.fetchList(true,true);return[2]}))}))};t.prototype.retainPosition=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){t=this.el.querySelector(".list-container");if(t){t.scrollTop=this.scrollPosition}return[2]}))}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:t=this;return[4,this.apiSozluk.getContent(this.view.i18nEntryId,l)];case 1:t.strings=e.sent();this.fetchList();return[2]}}))}))};t.prototype.fetchList=function(t,e){var i=this;if(t===void 0){t=false}if(e===void 0){e=false}var n=this,r=n.list,o=n.quickFilter;if(r.isPending||!e&&r.isEndReached()||r.error&&!t){return}var a=this.view,l=a.query,c=a.table,d=a.ui;var h=d.quickSearch?s(d.quickSearch,c.fields):undefined;var p=f(l,o||h,this.params);this.list=r.beforeFetch();this.apiData.query(c.name,{fields:l.fields,filter:p,limit:25,skip:e?0:r.data?r.data.length:0,sort:u(l)}).then((function(t){i.list=r.afterFetch(t,!e)}),(function(t){i.list=r.afterFetchError(t)}))};t.prototype.render=function(){var t=this;var e=this,r=e.list,s=e.view;var o=s.ui;return i(n,null,o.quickSearch&&i("dvn-filter-simple",{fields:this.view.table.fields,progressing:r.isPending&&!!r.data,config:o.quickSearch,onFilterChange:function(e){return t.onSimpleFilterChange(e.detail)}}),r.data&&i("div",{class:"list-container",onScroll:function(e){var i=e.target;t.scrollPosition=i.scrollTop;if(i.offsetHeight+i.scrollTop>=i.scrollHeight-100){t.fetchList()}}},i("dvn-card-list-view",{config:s.ui,fields:s.table.fields,items:r.data,strings:this.strings}),r.isPending&&!o.quickSearch&&i("div",{class:"d-flex justify-content-center pb-3"},i("dvn-progress",{indefinite:true,tint:"primary"}))),r.isPending&&!r.data&&i("div",{class:"d-flex justify-content-center"},i("dvn-progress",{indefinite:true,tint:"primary"})),r.error&&i("devingen-error-card",{error:r.error,message:"Fetching list failed.",onRetry:function(){return t.fetchList(true)}}))};Object.defineProperty(t.prototype,"el",{get:function(){return r(this)},enumerable:false,configurable:true});return t}());h.style=d}}}));