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

    ${w()}
  `))};exports.default=ProductDescription;
