'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),NoDataState=require("../../../common/components/NoDataState.js"),helpers=require("./common/helpers.js"),system=require("@gem-sdk/system"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),useGpDescription=require("./hooks/useGpDescription.js");const ProductDescription=e=>{let{setting:s,advanced:t,builderProps:r}=e,{htmlTag:i}=s??{},a="html"===i?"div":"p",c=core.useProduct(),l=core.useCurrentDevice(),n=core.getResponsiveValueByScreen(s?.hasLineClamp,l),{ref:o,open:m,isShowViewMore:u,handleToggleShowMore:p,mode:d,redirectProductShopifyLink:y}=useGpDescription.useGpDescription(s),{t:x}=core.useI18nStore(),j=system.createClass({"gp-product-description":!0,[t?.cssClass]:!0}),g=system.createClass(classes.getClasses({setting:s,isLiquid:!1})),h=system.createClass(classes.getButtonClasses({setting:s})),C=system.createClass({"gp-show-more-text":!0}),R=system.createClass({"gp-show-more-icon gp-ml-1":!0,...m?{"gp-rotate-180":!0}:{}}),S=system.createClass(classes.getClassPreBuilt()),v=system.createStyle({...styles.getTextStyle({setting:s}),...m?{}:core.makeStyleResponsive("line-clamp",core.makeLineClamp(s?.lineClamp,s?.hasLineClamp))}),D=system.createStyle(styles.getButtonStyle({setting:s})),N=system.createAttr({"data-id":`${r?.uid}`}),f=system.createAttr({"data-gp-text":""}),{gpDescriptionCss:k,textDescriptionCss:q}=styles.getStaticCss(),I=!c?.descriptionHtml;return I&&"edit"===d?jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:x("Highlight key benefits with product description."),descriptionActions:[{text:x("Add description"),callback:y},{text:x("sync data"),callback:"syncProduct"}]}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:system.If(I,"",jsxRuntime.jsxs("div",{...N,className:j,children:[jsxRuntime.jsx("style",{children:q}),jsxRuntime.jsx("style",{children:k}),jsxRuntime.jsx("div",{className:S}),jsxRuntime.jsx(a,{ref:o,...f,className:g,style:v,dangerouslySetInnerHTML:{__html:c?.descriptionHtml||""}}),system.If(n&&u,jsxRuntime.jsxs("button",{className:h,style:D,onClick:p,children:[jsxRuntime.jsx("span",{className:C,children:system.If(m,s?.viewLessText||"",s?.viewMoreText)}),system.If(s?.enableViewMoreIcon,jsxRuntime.jsx("span",{className:R,dangerouslySetInnerHTML:{__html:helpers.ICON_SVG}}))]})," ")]}))})};exports.default=ProductDescription;
