text: 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,o){function a(t){try{s(n.next(t))}catch(t){o(t)}}function l(t){try{s(n["throw"](t))}catch(t){o(t)}}function s(t){t.done?i(t.value):r(t.value).then(a,l)}s((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(t){return function(e){return s([t,e])}}function s(a){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];r=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-92f7c087.system.js","./p-7c3866d2.system.js","./p-5fcc633d.system.js"],(function(t){"use strict";var e,i,n,r,o,a,l,s,c;return{setters:[function(t){e=t.r;i=t.e;n=t.c;r=t.i;o=t.h;a=t.H;l=t.g},function(t){s=t.o},function(t){c=t.s}],execute:function(){var u=".paginator-enabled{display:block}.paginator-infinite.paginator-enabled{min-height:84px}.paginator-loading-content{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:none;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%;min-height:84px;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.paginator-loading-text{margin-left:32px;margin-right:32px;margin-top:4px;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.paginator-loading-text{margin-left:unset;margin-right:unset;-webkit-margin-start:32px;margin-inline-start:32px;-webkit-margin-end:32px;margin-inline-end:32px}}.paginator-loading>.paginator-loading-content{display:-ms-flexbox;display:flex}.paginator-toolbar{padding-top:var(--bkkr-spacer)}::slotted(bkkr-button){min-width:44.8px}";var h=t("bkkr_paginator",function(){function t(t){var n=this;e(this,t);this.bkkrPaginator=i(this,"bkkrPaginator",7);this.thrPx=0;this.thrPc=0;this.didFire=false;this.isBusy=false;this.isLoading=false;this.threshold="15%";this.page=1;this.infinite=false;this.toolbar=true;this.position="bottom";this.loadingSpinner="crescent";this.disabled=false;this.routerDirection="forward";this.onScroll=function(){var t=n.scrollEl;if(!t||!n.canStart()){return 1}var e=n.el.offsetHeight;console.log(n.el.offsetHeight);if(e===0){return 2}var i=t.scrollTop;var r=t.scrollHeight;var o=t.offsetHeight;var a=n.thrPc!==0?o*n.thrPc:n.thrPx;var l=n.position==="bottom"?r-e-i-a-o:i-e-a;if(l<0){if(!n.didFire){n.isLoading=true;n.didFire=true;n.page+=1;n.bkkrPaginator.emit();return 3}}else{n.didFire=false}return 4};this.handleClick=function(t,e){n.changeIndex(e);if(n.href!==undefined){s(n.href+e,t,n.routerDirection)}}}t.prototype.thresholdChanged=function(){var t=this.threshold;if(t.lastIndexOf("%")>-1){this.thrPx=0;this.thrPc=parseFloat(t)/100}else{this.thrPx=parseFloat(t);this.thrPc=0}};t.prototype.infiniteChanged=function(){var t=this.infinite&&!this.disabled;if(!t){this.isLoading=false;this.isBusy=false}this.enableScrollEvents(t)};t.prototype.disabledChanged=function(){var t=this.disabled;if(t){this.isLoading=false;this.isBusy=false;this.infinite=false}};t.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var t,e;var i=this;return __generator(this,(function(r){switch(r.label){case 0:t=this.el.closest("bkkr-content");if(!t){console.error("<bkkr-paginator> must be used inside an <bkkr-content>");return[2]}e=this;return[4,t.getScrollElement()];case 1:e.scrollEl=r.sent();if(this.position==="top"){n((function(){if(i.scrollEl){i.scrollEl.scrollTop=i.scrollEl.scrollHeight-i.scrollEl.clientHeight}}))}return[2]}}))}))};t.prototype.disconnectedCallback=function(){this.enableScrollEvents(false);this.scrollEl=undefined};t.prototype.changeIndex=function(t){if(!this.isLoading){this.isLoading=true;this.page=t;this.bkkrPaginator.emit()}};t.prototype.complete=function(){return __awaiter(this,void 0,void 0,(function(){var t,e;var i=this;return __generator(this,(function(o){t=this.scrollEl;if(!this.isLoading||!t){return[2]}this.isLoading=false;if(this.position==="top"){this.isBusy=true;e=t.scrollHeight-t.scrollTop;requestAnimationFrame((function(){r((function(){var r=t.scrollHeight;var o=r-e;requestAnimationFrame((function(){n((function(){t.scrollTop=o;i.isBusy=false}))}))}))}))}return[2]}))}))};t.prototype.canStart=function(){return!this.disabled&&!this.isBusy&&!!this.scrollEl&&!this.isLoading&&!!this.infinite};t.prototype.enableScrollEvents=function(t){if(this.scrollEl){if(t){this.scrollEl.addEventListener("scroll",this.onScroll)}else{this.scrollEl.removeEventListener("scroll",this.onScroll)}}};t.prototype.render=function(){var t=this;var e=this,i=e.disabled,n=e.infinite,r=e.items,l=e.href,s=e.lenght,u=e.page,h=e.isLoading,d=e.loadingSpinner,p=e.loadingText,g=e.toolbar,b=e.handleClick;var k=n?1:u*s-(s-1);var m=Math.min(u*s,r);var v=Math.ceil(r/s);var y=k>1;var x=m<r;var w=[];var E=false;for(var C=1;C<=v;C++){if(C===1||C===v||C>=u-1&&C<u+2){w.push({index:C,label:C,selected:C===u?true:null});E=false}else{if(!E&&C>1&&(C>=u-1||C<u+2)){w.push({index:null,label:"..."});E=true}}}return o(a,{class:{"paginator-loading":h,"paginator-enabled":!i,"paginator-infinite":n}},o("div",{class:"paginator-loading-content"},d&&o("div",{class:"paginator-loading-spinner"},o("bkkr-spinner",{type:d})),p&&o("div",{class:"paginator-loading-text",innerHTML:c(p)})),g&&!n&&o("bkkr-row",{class:"paginator-toolbar align-items-center"},o("bkkr-col",null,o("small",null,k," - ",m," of ",r)),o("bkkr-col",{size:"12","size-lg":"auto",class:"text-center"},o("bkkr-button",{fill:"clear",href:l!==undefined?l+(u-1):null,disabled:!y,onClick:function(e){return t.handleClick(e,u-1)}},o("bkkr-icon",{name:"chevron-left"})),w.map((function(t){return f(t,{href:l,handleClick:b})})),o("bkkr-button",{fill:"clear",href:l!==undefined?l+(u+1):null,disabled:!x,onClick:function(e){return t.handleClick(e,u+1)}},o("bkkr-icon",{name:"chevron-right"})))))};Object.defineProperty(t.prototype,"el",{get:function(){return l(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{threshold:["thresholdChanged"],infinite:["infiniteChanged"],disabled:["disabledChanged"]}},enumerable:false,configurable:true});return t}());var f=function(t,e){var i=e.href,n=e.handleClick;return o("bkkr-button",{href:i&&t.index?i+t.index:null,onClick:function(e){return n(e,t.index)},fill:t.selected?"solid":"clear",disabled:t.index===null},o("bkkr-label",null,t.label))};h.style=u}}}));