import{makeStyleResponsive as e,makeLineClamp as i,template as s,isLocalEnv as t,baseAssetURL as l}from"@gem-sdk/core";import{getSettingPreloadData as o}from"../../../helpers.js";import{getDefaultStyleCollectionDes as n,getStyleDefaultViewMore as c,getStaticCss as r}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 CollectionDescription=({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()),D=a({...n({setting:M}),...e("line-clamp",i(M?.lineClamp,M?.hasLineClamp))}),G=a({...c(M)}),N=h({setting:M,builderProps:E,pageContext:I,type:"liquid"}),O=j({setting:M,builderProps:E,pageContext:I,type:"liquid"}),_=m({"data-id":`${E?.uid}`,"view-more-text":`${I?.isPreviewing?O:`{{${O}}}`}`,"view-less-text":`${I?.isPreviewing?N:`{{${N}}}`}`}),J=m({"data-gp-text":""}),{gpDescriptionCss:R,textDescriptionCss:z}=r(),B=$({setting:{lineClamp:M?.lineClamp,hasLineClamp:M?.hasLineClamp,viewMoreText:O,viewLessText:N,enableViewMoreIcon:M?.enableViewMoreIcon},textStyle:D}),F=()=>{let e=t?"{{ 'gp-collection-description-v7-5.js' | asset_url }}":`${l}/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>`};return d(!1,"",g(s`
    <gp-collection-description
      ${_}
      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>",s`<div ${J} class="${L}" style="${D}">
          {{collection.description}}
        </div>
        ${y("collection.description != blank",s`<button type="button" class="${P}" style="${G}">
          <span class="${T}">
            ${d(I?.isPreviewing,O?.toString()||"",`{{${O}}}`)}
          </span>
          ${d(M?.enableViewMoreIcon,s`<span class="${A}">${x}</span>`," ")}
          </button>`)}`)}
    </gp-collection-description>
    ${F()}
    `))};export{CollectionDescription as default};
