import{aD as e,aF as t,aX as i,b1 as s,bK as r,b_ as o,aT as a,aH as n,aR as l,c5 as c,a$ as h,b0 as d,b2 as p,b3 as f}from"./p-BTBbFFOR.js";import{I as v,V as g}from"./p-ULeawcYN.js";import{s as u}from"./p-C2rs7Hxy.js";import{T as b}from"./p-D3j7BcfS.js";import{i as m,n as S,s as j,P as y}from"./p-B7dt7KOM.js";var R=function(e,t,i,s){var r,o=arguments.length,a=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};class w extends t{constructor(){super()}render(){return"pageSizeSelectorMobile"===this.type?this.renderPageSizeSelectorMobile():this.renderPageSizeSelectorMobileAndCurrentPageLabel()}renderPageSizeSelectorMobile(){const e=i.tWithPreservedBlocks("Show [{0} items / page]",w.clickableReg,this.pageSize);return this.renderTranslatedMessage(e)}renderPageSizeSelectorMobileAndCurrentPageLabel(){const e=this.total>0?this.pageSize*(this.current-1)+1:0,t=Math.min(this.current*this.pageSize,this.total),s=i.tWithPreservedBlocks("Viewing [{0}-{1}] of {2}",w.clickableReg,e,t,this.total);return this.renderTranslatedMessage(s)}renderTranslatedMessage(e){return s("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-4"},e.map((e=>e.isPreserved?this.pageSizeSelectorMobileDropdownRenderer.render(s("vega-button-link",{label:e.content})):s("vega-font",{variant:"font-field-label",color:"text-primary"},e.content))))}}w.clickableReg=/(\[[^\]]*\])/g,R([e()],w.prototype,"translationSlimmer",void 0),R([e()],w.prototype,"type",void 0),R([e()],w.prototype,"pageSize",void 0),R([e()],w.prototype,"total",void 0),R([e()],w.prototype,"current",void 0),R([e()],w.prototype,"pageSizeSelectorMobileDropdownRenderer",void 0);var z=function(e,t,i,s){var r,o=arguments.length,a=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};class M extends t{constructor(){super()}render(e){var t;const i=(this.isAllActive||m(this.pageSizeSelectorOptions,this.pageSize)?this.pageSizeSelectorOptions:[...this.pageSizeSelectorOptions,this.pageSize]).map(S),a=j(i),n=this.translationSlimmer.t("Items Per Page");return s("vega-dropdown",{trigger:"click",selectType:"single",alignment:"center",minWidth:160,selectedSourceKey:(this.isAllActive?y:this.pageSize).toString(),source:[{key:"items-per-page",label:n,children:[...a.map((e=>({key:e.value.toString(),label:e.label})))]}],ref:e=>{r.addUniqueObserverToNode(e,o,(e=>{this.notifyParentPagination(e.detail)}))},isScreenPosition:null===(t=this.dropdownProps)||void 0===t?void 0:t.isScreenPosition},e)}notifyParentPagination(e){const t=a(this.host,"vega-pagination");t&&n.notify(l.getSubject(t,c),{host:this.host,detail:e})}}z([e()],M.prototype,"host",void 0),z([e()],M.prototype,"translationSlimmer",void 0),z([e()],M.prototype,"pageSizeSelectorOptions",void 0),z([e({writable:!0})],M.prototype,"pageSize",void 0),z([e()],M.prototype,"dropdownProps",void 0),z([e()],M.prototype,"total",void 0),z([e()],M.prototype,"isAllActive",void 0);var P=function(e,t,i,s){var r,o=arguments.length,a=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(a=(o<3?r(a):o>3?r(t,i,a):r(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};const O=class{constructor(e){d(this,e),this.globalSlimmers={},this.translationSlimmer=new b,this.vegaComponentUsageRuntimeMetricsSlimmer=new g,this.pageSizeSelectorMobileRenderer=new w,this.pageSizeSelectorMobileDropdownRenderer=new M,this.pageSize=10,this.pageSizeSelectorOptions=[10,20,50,100],this.total=0,this.current=1,this.isAllActive=!1}render(){return u(s(p,null,this.pageSizeSelectorMobileRenderer.render()),this.host)}get host(){return f(this)}};P([v()],O.prototype,"globalSlimmers",void 0),P([h()],O.prototype,"translationSlimmer",void 0),P([h()],O.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),P([h()],O.prototype,"pageSizeSelectorMobileRenderer",void 0),P([h()],O.prototype,"pageSizeSelectorMobileDropdownRenderer",void 0),O.style=":host{display:inline-block}";export{O as vega_pagination_page_size_selector_mobile}