'use client';
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{useRenderMode as s,useCollection as i,makeStyleResponsive as r,makeLineClamp as n}from"@gem-sdk/core";import{getDefaultStyleCollectionDes as l,getStyleDefaultViewMore as a,getStaticCss as m}from"./common/styles.js";import{getClassContainerCollectionDes as c,getClassEmptyCollectionDes as d,getClassButtonViewMore as p,getDescriptionClasses as h,getShowMoreIconClasses as y,getShowMoreTextClasses as u,getClassPreBuilt as g}from"./common/classes.js";import{createClass as f,createStyle as N,createAttr as v,If as S}from"@gem-sdk/system";import{getViewLessText as _,getViewMoreText as j,ICON_SVG as C}from"./common/helpers.js";import{useGpDescription as H}from"../../hooks/useDescription.js";let DescriptionNotFoundString="This collection does not have a description",CollectionDescription=({setting:T,builderProps:k,pageContext:D,advanced:I})=>{let{isPreviewSharePageMode:L}=s(),M=i(),{ref:b,open:x,isShowViewMore:w,handleToggleShowMore:F,hasLineClamp:V}=H(T),$=M?.descriptionHtml,q=f(c({setting:T})),z=f(d()),A=f(p({setting:T})),B=f(h({advanced:I})),E=f({...y(),...x?{"gp-rotate-180":!0}:{}}),G=f(u()),J=f(g()),K=N({...l({setting:T}),...x?{}:r("line-clamp",n(T?.lineClamp,T?.hasLineClamp))}),O=N({...a(T)}),P=_({setting:T,builderProps:k,pageContext:D,type:"react"}),Q=j({setting:T,builderProps:k,pageContext:D,type:"react"}),R=v({"data-id":`${k?.uid}`}),U=v({"data-gp-text":""}),{gpDescriptionCss:W,textDescriptionCss:X}=m(),Y=L?"":e("div",{className:z,dangerouslySetInnerHTML:{__html:"This collection does not have a description"}});return e(t,{children:S(!$,Y,o("div",{...R,className:B,children:[e("style",{children:X}),e("style",{children:W}),e("div",{className:J}),e("div",{ref:b,className:q,style:K,dangerouslySetInnerHTML:{__html:M?.descriptionHtml??""},...U}),S(V&&w,o("button",{type:"button",className:A,style:O,onClick:F,children:[e("span",{className:G,children:S(x,P?.toString()??"",Q?.toString()??"")}),S(T?.enableViewMoreIcon,e("span",{className:E,dangerouslySetInnerHTML:{__html:C}}),"")]}),"")]}))})};export{CollectionDescription as default};
