'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),l=require("../common/helpers.js"),t=require("../../helpers.js");exports.default=i=>{let{styles:a,setting:s,className:r,children:n,builderProps:o,advanced:c,style:g}=i??{},{border:d,rounded:m,hasBoxShadow:p,boxShadow:u}=c??{},[y]=e.splitStyle(["pos","top","left","bottom","right","z","d"],g),b=e.composeAdvanceStyle({border:d,rounded:m,hasBoxShadow:p,boxShadow:u,"spacing-setting":c?.["spacing-setting"]}),h=s?.articleSetting,S=s?.articleOrderBy??"UPDATED_AT_REVERSE",_=h?.articlePickType??"manually",v="manually"===_&&h?.articleHandles?.length?h?.articleHandles:[],f="manually"===_&&h?.articleBlogTitles?.length?h?.articleBlogTitles:[],T=h?.blogHandle??"",k=t.convertUnitToNumber(s?.numberOfArticle,4);return e.template`
    <div
    style="${y}"
    data-id="${o?.uid}"
      items-repeat
    >
      <div style="${{...b,...e.makeStyleWithDefault("w",e.makeWidth(a?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...e.makeStyleResponsive("rg",a?.horizontalGutter),...e.makeStyleResponsive("cg",a?.verticalGutter),...e.getStyleBackgroundByDevice(s?.background),...e.getGradientBgrStyleByDevice(s?.background),...e.makeStyleResponsive("gtc",{desktop:`repeat(${e.getResponsiveValueByScreen(s?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:s?.slideToShow?.tablet&&`repeat(${e.getResponsiveValueByScreen(s?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:s?.slideToShow?.mobile&&`repeat(${e.getResponsiveValueByScreen(s?.slideToShow,"mobile")}, minmax(0, 1fr))`})}}"
          class="${e.cls(r,"gp-grid !gp-m-auto gp-w-full",c?.cssClass)}"
        >
        {% liquid
            assign articlePickType = '${_}'
            assign articleHandles = '${v.toString()}'| split: ","
            assign articleBlogTitle = "${l.convertSpecialCharacter(f.toString())}" | split: ","
            assign limit = "${"manually"===_?h?.articleIds?.length:k}"
            assign blogTitle = ''
            assign all_articles = null | sort

            if articlePickType == 'manually'
              for handle in articleHandles
                assign articleByHandle = articles[handle] | sort
                assign all_articles = all_articles | concat: articleByHandle
              endfor
            else
              assign current_blog_handle = blogs['${T}']
              if gp_enable_custom_dynamic_blog == true
                assign current_blog_handle = blogs[blog.handle]
              endif
              assign all_articles = current_blog_handle.articles | limit: limit | sort: "${S.replace("_REVERSE","").toLowerCase()}" ${S.includes("_REVERSE")?"| reverse":""}
              assign blogTitle = current_blog_handle.title
            endif

        %}
        {% for article in all_articles limit: limit %}
          {% if articlePickType == 'manually' %}
              {% assign blogTitle = articleBlogTitle[forloop.index0] %}
          {% endif %}
          <div>${n??""}</div>
        {% endfor %}
      </div>
    </div>

  `};
