'use client';
import{jsx as e}from"react/jsx-runtime";import t from"next/link";import r from"../../text/components/Text.js";import{useArticleStore as i,useShopStore as o,useI18nStore as l}from"@gem-sdk/core";import{useMemo as c}from"react";import{useArticleLink as n}from"../hooks/useArticleLink.js";import s from"../../common/components/NoDataState.js";let ArticleExcerpt=({setting:a,styles:m,builderProps:p})=>{let d=i(e=>e.article),x=o(e=>e.storefrontUrl),f=c(()=>d?.content?.excerptHtml,[d]),{shopifyArticleLink:u}=n(),{t:y}=l(),h=()=>{if(!x)return;let e=new URL(x);window.open(`${e.protocol}//${e.host}/admin/content/articles`)};return e("div",{id:`shopify-text-element-${p?.uid}`,"data-article-id":d?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:d&&f?a?.linkArticle?e(t,{href:u,title:d?.title,children:e(r,{builderProps:p,styles:m,setting:{...a,text:f,excludeFlex:!0}})}):e(r,{builderProps:p,styles:m,setting:{...a,text:f,excludeFlex:!0}}):e(s,{elementType:"secondary",description:y("Provide a brief summary or teaser of the article. "),descriptionActions:[{text:y("Add article excerpt"),callback:h},{text:y("sync data"),callback:"syncArticle"}]})})};export{ArticleExcerpt as default};
