import{makeStyleResponsive as e,makeLineClamp as s,template as i,baseAssetURL as t,isLocalEnv as l}from"@gem-sdk/core";import{getSettingPreloadData as o}from"../../../helpers.js";import{getDefaultStyleCollectionDes as n,getStyleDefaultViewMore as r,getStaticCss as c}from"./common/styles.js";import{createClass as p,createStyle as a,createAttr as m,createStateOrContext as $,If as d,Liquid as g,LiquidUnless as v,LiquidIf as y}from"@gem-sdk/system";import{getClassContainerCollectionDes as f,getClassButtonViewMore as u,getDescriptionClasses as w,getShowMoreIconClasses as C,getShowMoreTextClasses as b,getClassPreBuilt as S}from"./common/classes.js";import{getViewLessText as h,getViewMoreText as j,ICON_SVG as x}from"./common/helpers.js";let M=({setting:M,advanced:k,builderProps:E,pageContext:I})=>{let L=p(f({setting:M})),P=p(u({setting:M})),V=p(w({advanced:k})),A=p(C()),T=p(b()),q=p(S()),G=a({...n({setting:M}),...e("line-clamp",s(M?.lineClamp,M?.hasLineClamp))}),N=a({...r(M)}),O=h({setting:M,builderProps:E,pageContext:I,type:"liquid"}),_=j({setting:M,builderProps:E,pageContext:I,type:"liquid"}),D=m({"data-id":`${E?.uid}`,"view-more-text":`${I?.isPreviewing?_:`{{${_}}}`}`,"view-less-text":`${I?.isPreviewing?O:`{{${O}}}`}`}),J=m({"data-gp-text":""}),{gpDescriptionCss:R,textDescriptionCss:z}=c(),B=$({setting:{lineClamp:M?.lineClamp,hasLineClamp:M?.hasLineClamp,viewMoreText:_,viewLessText:O,enableViewMoreIcon:M?.enableViewMoreIcon},textStyle:G});return d(!1,"",g(i`
    <gp-collection-description
      ${D}
      class="${V}"
      gp-data='${JSON.stringify(B).replaceAll("'","&#039;")}'
    >
      <style>${z}</style>
      <style>${R}</style>
      <div class="${q}" ></div>
      ${v("collection","<p>Collection not found</p>",i`<div ${J} class="${L}" style="${G}">
          {{collection.description}}
        </div>
        ${y("collection.description != blank",i`<button type="button" class="${P}" style="${N}">
          <span class="${T}">
            ${d(I?.isPreviewing,_?.toString()||"",`{{${_}}}`)}
          </span>
          ${d(M?.enableViewMoreIcon,i`<span class="${A}">${x}</span>`," ")}
          </button>`)}`)}
    </gp-collection-description>
    ${(()=>{let e=l?"{{ 'gp-collection-description-v7-5.js' | asset_url }}":`${t}/assets-v2/gp-collection-description-v7-5.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${o('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`})()}
    `))};export{M as default};
