'use client';
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),NoDataState=require("../../common/components/NoDataState.js"),helpers=require("../common/helpers.js");const ArticleContent=({styles:e,builderProps:t})=>{let r=core.useArticleStore(e=>e.article),[i,o]=React.useState(!1),p=React.useRef(null),s=core.useCurrentDevice(),c=core.useShopStore(e=>e.storefrontUrl),n=core.getResponsiveValueByScreen(e?.hasLineClamp,s),a=core.getResponsiveValueByScreen(e?.lineClamp,s),l=()=>{if(!c)return;let e=new URL(c);window.open(`${e.protocol}//${e.host}/admin/content/articles`)};React.useEffect(()=>{o(!1)},[n,a,r?.description]);let d=core.composeTypographyClassName(e?.typo,e?.typography),m=core.composeTypographyStyle(e?.typo,e?.typography),y=`
    .gp-p-description-text a:empty,
    .gp-p-description-text ul:empty,
    .gp-p-description-text dl:empty,
    .gp-p-description-text div:empty,
    .gp-p-description-text section:empty,
    .gp-p-description-text article:empty,
    .gp-p-description-text p:empty,
    .gp-p-description-text h1:empty,
    .gp-p-description-text h2:empty,
    .gp-p-description-text h3:empty,
    .gp-p-description-text h4:empty,
    .gp-p-description-text h5:empty,
    .gp-p-description-text h6:empty {
        display: none;
    }
   ${helpers.styleOverride}
  `;return jsxRuntime.jsx("div",{"data-id":t?.uid,id:`shopify-text-element-${t?.uid}`,className:"gp-article-description","data-article-id":r?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:r?.content?.html?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!core.isSafari()&&jsxRuntime.jsx("style",{children:y}),jsxRuntime.jsx("div",{ref:p,className:core.cls("gp-p-description-text gp-content-text-override gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre",d),style:{...core.getGlobalColorStateStyle("c",e?.color),...core.makeStyleResponsive("ta",e?.textAlign),...n&&!i?core.makeStyleResponsive("line-clamp",e?.lineClamp):{},...core.getStyleShadow({value:e?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:e?.typo?.custom?.hasShadowText}),...core.makeStyle({tt:e?.transform}),...m},dangerouslySetInnerHTML:{__html:r?.content?.html}})]}):jsxRuntime.jsx("div",{children:jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Inform and provide value to the audience with article content.",descriptionActions:[{text:"Add article content",callback:l},{text:"sync data",callback:"syncArticle"}]})})})};exports.default=ArticleContent;
