import{h as t,r as e,H as i,g as o}from"./p-6b2342e0.js";import{c as r,V as s,I as a}from"./p-6e1ab235.js";import{V as n,I as l}from"./p-4415ad28.js";import{s as f}from"./p-519a7d55.js";import{D as c,d as p}from"./p-f28a6074.js";import{B as h,H as v,a as d,h as m}from"./p-c5eb0fa6.js";import{n as u,c as g}from"./p-262ec334.js";import{f as b}from"./p-6e70d3cc.js";import{C as j}from"./p-2d0d575f.js";import{u as y}from"./p-aa985d73.js";import{C as x}from"./p-edda10f7.js";import"./p-331a62d5.js";import"./p-6e9f832f.js";import"./p-5f377954.js";import"./p-18e8d9b7.js";import"./p-5a25014f.js";var R=function(t,e,i,o){var r,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};class C extends s{constructor(){super(...arguments),this.handleChange=()=>{if(this.inputRef.value){const t=u(g(this.inputRef.value,1),1,this.pageCount);this.inputRef.value=t.toString(),this.prevAndNextButtonRenderer.notifyParentPagination(t.toString())}}}render(){return"pageSelectorMobile"===this.type?this.renderPageSelectorMobile():this.renderPageSelectorMobileAndGoTo()}renderPageSelectorMobile(){return t("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},this.prevAndNextButtonRenderer.render("prev"),t("vega-font",{variant:"font-field-label",color:"text-primary"},this.current.toString()),t("vega-font",{variant:"font-field-label",color:"text-primary"},"/"),t("vega-font",{variant:"font-field-label",color:"text-primary"},this.pageCount.toString()),this.prevAndNextButtonRenderer.render("next"))}renderPageSelectorMobileAndGoTo(){return t("vega-flex",{alignItems:"center",justifyContent:"center",gap:"size-8"},this.prevAndNextButtonRenderer.render("prev"),t("vega-form",{ref:t=>{c.addUniqueObserverToNode(t,h,this.handleChange)}},t("vega-input",{"data-vega-form":"pageSelectorMobile_goTo",size:"small",showClearIcon:!1,style:{width:"54px"},maskConfig:{type:"number",options:{allowNegative:!1,precision:0}},value:this.current.toString(),ref:t=>{this.inputRef=t,c.addUniqueObserverToNode(t,v,this.handleChange)}})),t("vega-font",{variant:"font-field-label",color:"text-primary"},"/"),t("vega-font",{variant:"font-field-label",color:"text-primary"},this.pageCount.toString()),this.prevAndNextButtonRenderer.render("next"))}}R([r()],C.prototype,"host",void 0),R([r()],C.prototype,"type",void 0),R([r()],C.prototype,"current",void 0),R([r()],C.prototype,"pageCount",void 0),R([r()],C.prototype,"prevAndNextButtonRenderer",void 0);var w=function(t,e,i,o){var r,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};class S extends s{constructor(){super(...arguments),this.pagerButton=(e,i,o)=>t("vega-button-circle",{variant:"icon-only",icon:e,iconColor:"text-link",size:"small",disabled:i,ref:t=>{c.addUniqueObserverToNode(t,d,o)}}),this.renderPrevButton=()=>this.pagerButton("chevron-left",0===this.total||1===this.current,(()=>{this.notifyParentPagination((this.current-1).toString())})),this.renderNextButton=()=>this.pagerButton("chevron-right",0===this.total||this.current===this.pageCount,(()=>{this.notifyParentPagination((this.current+1).toString())}))}notifyParentPagination(t){const e=b(this.host,"vega-pagination");e&&j.notify(p.getSubject(e,y),{host:this.host,detail:t})}render(t){return"prev"===t?this.renderPrevButton():this.renderNextButton()}}w([r()],S.prototype,"host",void 0),w([r()],S.prototype,"current",void 0),w([r()],S.prototype,"total",void 0),w([r()],S.prototype,"pageCount",void 0);var M=function(t,e,i,o){var r,s=arguments.length,a=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,o);else for(var n=t.length-1;n>=0;n--)(r=t[n])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const O=class{constructor(t){e(this,t),this.globalSlimmers={},this.vegaComponentUsageRuntimeMetricsSlimmer=new n,this.childEventPrevent=new x([m],(()=>this.host)),this.pageSelectorMobileRenderer=new C,this.prevAndNextButtonRenderer=new S,this.pageCount=0,this.current=1,this.total=0}render(){return f(t(i,null,this.pageSelectorMobileRenderer.render()),this.host)}get host(){return o(this)}};M([l()],O.prototype,"globalSlimmers",void 0),M([a()],O.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),M([a()],O.prototype,"childEventPrevent",void 0),M([a()],O.prototype,"pageSelectorMobileRenderer",void 0),M([a()],O.prototype,"prevAndNextButtonRenderer",void 0),O.style=":host{display:inline-block}";export{O as vega_pagination_page_selector_mobile}