"use strict";var e=require("@gem-sdk/core"),t=require("../../../../helpers.js"),s=require("./classes.js"),a=require("html-react-parser"),r=require("@gem-sdk/system"),i=require("./styles.js"),l=require("../../../settings/collection-paginator/configs/translate.js");const c=({setting:e,builderProps:t,pageContext:s})=>{let a=n({setting:e,builderProps:t,pageContext:s},"liquid"),r=p({setting:e,builderProps:t,pageContext:s},"liquid"),i=e?.numberOfProducts||s?.numberOfProductOfProductList||0,l=e=>e?.replace(/"/g,'\\"')??"",c=`"${l(a??"")}"`,o=`"${l(r??"")}"`;return`
    {% paginate collection.products by ${i>0?i:4} %}
      {% assign previousText = ${s?.isPreviewing?c:a||'""'} %}
      {% assign nextText = ${s?.isPreviewing?o:r||'""'} %}

      {{ paginate | default_pagination: previous: previousText, next: nextText }}
    {% endpaginate %}
  `},o=({setting:t,builderProps:l,pageContext:c})=>{let{pageQuantity:o,typo:m,normalColor:g,activeColor:d}=t??{},y=[],C=parseInt(o??"0"),x=6;6>C&&(x=C-1);let S=x>1?x-1:0,q=n({setting:t,builderProps:l,pageContext:c},"react"),k=p({setting:t,builderProps:l,pageContext:c},"react"),h=r.createClass({...s.customClass("prev",g,t)}),v=r.createClass({...s.customClass("page",g,t)}),f=r.createClass({...s.customClass("deco",g,t)}),L=e=>r.createClass({...s.customClass("page",e===S?d:g,t)}),P=r.createClass({...s.customClass("deco",g,t)}),$=r.createClass({...s.customClass("page",g,t)}),N=r.createClass({...s.customClass("next",g,t)}),w=e=>r.createStyle({...i.getPaginatorStyle(e===S,i.getCustomStyle(t),d)}),z=r.createStyle({...i.getCustomStyle(t),...e.makeStyle({w:"auto"})}),I=r.createStyle({...i.getCustomStyle(t)}),T=r.createStyle({...i.getCustomStyle(t),...e.makeStyle({w:"auto"})});S>0&&y.push(u({key:"prev",text:m?.attrs?.transform==="capitalize"?q?.toLocaleLowerCase():q,className:h,style:z})),S>2&&y.push(u({key:1,text:1,className:v,style:I})),S>3&&y.push(u({key:"deco",text:"...",className:f,style:I}));for(let e=Math.max(0,S-2);e<=Math.min(S+2,C-1);e++)y.push(u({key:e+1,text:e+1,className:L(e),style:w(e)}));return S<C-4&&y.push(u({key:"deco-2",text:"...",className:P,style:I})),S<C-3&&y.push(u({key:C,text:C,className:$,style:I})),S!==C-1&&0!==C&&y.push(u({key:"next",text:m?.attrs?.transform==="capitalize"?k?.toLocaleLowerCase():k,className:N,style:T})),y.map(e=>a(e))},u=({key:t,text:s,className:a,style:r})=>e.template`<span key="${t}" className="${a}" style="${r}"> ${s} </span>`,n=({setting:e,builderProps:s,pageContext:a},r)=>{let{previousText:i,typo:c}=e??{};return"liquid"===r?t.getDynamicSourceLocales({val:i,uid:s?.uid,settingId:t.createSettingId({id:l.CollectionPaginator?.previousText?.id}),pageContext:a??{},isLiquid:!0,isCapitalize:c?.attrs?.transform==="capitalize"}).toString():i},p=({setting:e,builderProps:s,pageContext:a},r)=>{let{nextText:i,typo:c}=e??{};return"liquid"===r?t.getDynamicSourceLocales({val:i,uid:s?.uid,settingId:t.createSettingId({id:l.CollectionPaginator?.nextText?.id}),pageContext:a??{},isLiquid:!0,isCapitalize:c?.attrs?.transform==="capitalize"}).toString():i};exports.renderPaginatorItem=({setting:e,builderProps:t,pageContext:s},a)=>"liquid"===a?c({setting:e,builderProps:t,pageContext:s}):o({setting:e,builderProps:t,pageContext:s});
