(()=>{"use strict";const e=window.wp.blocks,a=window.wp.blockEditor,t=window.wp.components,s=window.wp.i18n,d=JSON.parse('{"UU":"gateway/field-badge"}'),n=window.ReactJSXRuntime;(0,e.registerBlockType)(d.UU,{edit:({attributes:e,setAttributes:d})=>{const{fieldKey:i}=e,l=(0,a.useBlockProps)({className:"gateway-field-badge"});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.InspectorControls,{children:(0,n.jsx)(t.PanelBody,{title:(0,s.__)("Field Badge Settings","gateway"),children:(0,n.jsx)(t.TextControl,{label:(0,s.__)("Field Key","gateway"),value:i,onChange:e=>d({fieldKey:e}),help:(0,s.__)('The record property to display as a badge (e.g. "status").',"gateway")})})}),(0,n.jsx)("span",{...l,children:(0,n.jsx)("span",{className:"gateway-badge",children:i?(0,n.jsx)("em",{children:`{ ${i} }`}):(0,n.jsx)("em",{children:(0,s.__)("(no field key set)","gateway")})})})]})},save:({attributes:e})=>{const{fieldKey:t}=e;return(0,n.jsx)("span",{...a.useBlockProps.save({className:"gateway-field-badge"}),children:(0,n.jsx)("span",{className:"gateway-badge","data-wp-text":t?`context.record.${t}`:void 0,"data-wp-bind--data-value":t?`context.record.${t}`:void 0})})}})})();