'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 a=({setting:a,styles:m,builderProps:d})=>{let p=i(e=>e.article),x=o(e=>e.storefrontUrl),f=c(()=>p?.content?.excerptHtml,[p]),{shopifyArticleLink:u}=n(),{t:y}=l();return e("div",{id:`shopify-text-element-${d?.uid}`,"data-article-id":p?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:p&&f?a?.linkArticle?e(t,{href:u,title:p?.title,children:e(r,{builderProps:d,styles:m,setting:{...a,text:f,excludeFlex:!0}})}):e(r,{builderProps:d,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:()=>{if(!x)return;let e=new URL(x);window.open(`${e.protocol}//${e.host}/admin/content/articles`)}},{text:y("sync data"),callback:"syncArticle"}]})})};export{a as default};
