"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gem-sdk/core"),t=require("../../../helpers.js"),s=require("@gem-sdk/system"),a=require("./common/classes.js"),i=require("./common/styles.js"),r=require("./common/helpers.js"),l=require("../../settings/product-description/configs/translate.js");exports.default=c=>{let{setting:o,advanced:n,builderProps:p,pageContext:d}=c,{htmlTag:u,viewMoreText:g,viewLessText:m}=o??{},$="html"===u?"div":"p",C=s.createClass({"gp-product-description":!0,[n?.cssClass]:!0}),S=s.createClass(a.getClasses({setting:o,isLiquid:!0})),v=s.createClass(a.getButtonClasses({setting:o})),y=s.createClass({"gp-show-more-text":!0}),x=s.createClass({"gp-show-more-icon gp-ml-1":!0}),L=s.createStyle({...i.getTextStyle({setting:o,renderMaxHeight:!0}),...e.makeStyleResponsive("line-clamp",e.makeLineClamp(o?.lineClamp,o?.hasLineClamp))}),q=s.createClass(a.getClassPreBuilt()),I=s.createStyle(i.getButtonStyle({setting:o})),f=s.createAttr({"data-id":`${p?.uid}`}),w=s.createAttr({"data-gp-text":""}),{textDescriptionCss:h,gpDescriptionCss:b}=i.getStaticCss(),j="product.description == blank",M=t.getDynamicSourceLocales({val:g,uid:p?.uid,settingId:t.createSettingId({id:l.ProductDescription?.viewMoreText?.id}),pageContext:d??{}}),P=t.getDynamicSourceLocales({val:m,uid:p?.uid,settingId:t.createSettingId({id:l.ProductDescription?.viewLessText?.id}),pageContext:d??{}}),k=s.createStateOrContext({setting:{lineClamp:o?.lineClamp,hasLineClamp:o?.hasLineClamp,viewMoreText:M,viewLessText:P,enableViewMoreIcon:o?.enableViewMoreIcon},textStyle:L});return s.LiquidIf(j,"",s.Liquid(e.template`
    <gp-product-description
      ${f}
      class="${C}"
      gp-data='${e.dataStringify(k).replaceAll("'","&#039;")}'
      data-view-more-text="${M}"
      data-view-less-text="${P}"
    >
      <style>${h}</style>
      <style>${b}</style>
      <div class="${q}" ></div>
      ${s.LiquidUnless("product","<p>Product not found</p>",e.template`<${$} ${w} class="${S}" style="${L}">
          {{product.description}}
        </${$}>
        ${s.LiquidUnless(j,e.template`<button type="button" class="${v}" style="${I}">
          <span class="${y}">
            ${s.If(!1,P?.toString(),M?.toString())}
          </span>
          ${s.If(o?.enableViewMoreIcon,e.template`<span class="${x}">${r.ICON_SVG}</span>`," ")}
          </button>`)}`)}
    </gp-product-description>

    ${(()=>{let s=e.isLocalEnv?"{{ 'gp-product-description-v7-5.js' | asset_url }}":`${e.baseAssetURL}/assets-v2/gp-product-description-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${t.getSettingPreloadData('class="gps-link" delay',"src")}="${s}" defer="defer"></script>`})()}
  `))};
