'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),system=require("@gem-sdk/system"),helpers=require("./common/helpers.js"),useDescription=require("../../hooks/useDescription.js");const DescriptionNotFoundString="This collection does not have a description",CollectionDescription=({setting:e,builderProps:s,pageContext:t,advanced:l})=>{let{isPreviewSharePageMode:r}=core.useRenderMode(),i=core.useCollection(),{ref:a,open:n,isShowViewMore:o,handleToggleShowMore:c,hasLineClamp:m}=useDescription.useGpDescription(e),u=i?.descriptionHtml,y=system.createClass(classes.getClassContainerCollectionDes({setting:e})),p=system.createClass(classes.getClassEmptyCollectionDes()),d=system.createClass(classes.getClassButtonViewMore({setting:e})),x=system.createClass(classes.getDescriptionClasses({advanced:l})),j=system.createClass({...classes.getShowMoreIconClasses(),...n?{"gp-rotate-180":!0}:{}}),C=system.createClass(classes.getShowMoreTextClasses()),g=system.createClass(classes.getClassPreBuilt()),h=system.createStyle({...styles.getDefaultStyleCollectionDes({setting:e}),...n?{}:core.makeStyleResponsive("line-clamp",core.makeLineClamp(e?.lineClamp,e?.hasLineClamp))}),S=system.createStyle({...styles.getStyleDefaultViewMore(e)}),R=helpers.getViewLessText({setting:e,builderProps:s,pageContext:t,type:"react"}),D=helpers.getViewMoreText({setting:e,builderProps:s,pageContext:t,type:"react"}),M=system.createAttr({"data-id":`${s?.uid}`}),I=system.createAttr({"data-gp-text":""}),{gpDescriptionCss:f,textDescriptionCss:v}=styles.getStaticCss(),N=r?"":jsxRuntime.jsx("div",{className:p,dangerouslySetInnerHTML:{__html:"This collection does not have a description"}});return jsxRuntime.jsx(jsxRuntime.Fragment,{children:system.If(!u,N,jsxRuntime.jsxs("div",{...M,className:x,children:[jsxRuntime.jsx("style",{children:v}),jsxRuntime.jsx("style",{children:f}),jsxRuntime.jsx("div",{className:g}),jsxRuntime.jsx("div",{ref:a,className:y,style:h,dangerouslySetInnerHTML:{__html:i?.descriptionHtml??""},...I}),system.If(m&&o,jsxRuntime.jsxs("button",{type:"button",className:d,style:S,onClick:c,children:[jsxRuntime.jsx("span",{className:C,children:system.If(n,R?.toString()??"",D?.toString()??"")}),system.If(e?.enableViewMoreIcon,jsxRuntime.jsx("span",{className:j,dangerouslySetInnerHTML:{__html:helpers.ICON_SVG}}),"")]}),"")]}))})};exports.default=CollectionDescription;
