(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,r=window.wp.primitives,a=(0,t.createElement)(r.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,t.createElement)(r.Path,{d:"M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z",fillRule:"evenodd",clipRule:"evenodd"})),n=JSON.parse('{"$schema":"https://json.schemastore.org/block.json","apiVersion":2,"name":"small-plugins/term-name","title":"Term Name","category":"text","description":"Display a post term name.","editorScript":"category-name-block-script","keywords":["category","labels"],"attributes":{},"version":"1.0.0","textdomain":"category-labels-block","parent":["small-plugins/post-term","small-plugins/primary-term"],"usesContext":["term"],"supports":{"typography":{"fontSize":true,"lineHeight":true,"__experimentalFontStyle":true,"__experimentalFontWeight":true,"__experimentalTextTransform":true,"__experimentalFontFamily":true,"__experimentalLetterSpacing":true,"__experimentalTextDecoration":true,"__experimentalSkipSerialization":["textDecoration"],"__experimentalDefaultControls":{"fontSize":true}},"__experimentalBorder":{"color":true,"radius":true,"style":true,"width":true,"__experimentalDefaultControls":{"color":true,"radius":true,"style":true,"width":true}},"border":{"color":true,"radius":true,"style":true,"width":true,"__experimentalDefaultControls":{"color":true,"radius":true,"style":true,"width":true}},"spacing":{"padding":true},"color":{"background":true,"link":false,"text":true}}}'),o=window.wp.i18n,l=window.wp.data,i=window.wp.components,s=window.wp.blockEditor,c=window.lodash;(0,e.registerBlockType)(n,{icon:a,edit:function(e){var r;const a=(0,s.useBlockProps)({className:"clb-category-name"}),n="true"===(0,c.get)(smallPluginsCategoryLabelsBlockData,"isPremium")?(0,o.__)("Select Term","category-labels-block"):(0,o.__)("Select Tag","category-labels-block"),m=(0,c.get)(e,"context.term",{}),u=null!==(r=m?.title)&&void 0!==r?r:n,{termName:p,hasResolved:d}=(0,l.useSelect)((e=>{if(!["kind","type","id"].every((e=>e in m)))return{termName:u,hasResolved:!0};const t=[m.kind,m.type,m.id],r=e("core").getEntityRecord(...t);return{termName:(0,c.get)(r,"name",u),hasResolved:e("core").hasFinishedResolution("getEntityRecord",t)}}),[JSON.stringify(m)]),{isRenderingPrimaryTerm:g}=(0,l.useSelect)((t=>{const r=t("core/block-editor").getBlockParents(e.clientId),a=(0,c.last)(r),n=t("core/block-editor").getBlock(a);return{isRenderingPrimaryTerm:"small-plugins/primary-term"===n?.name}}),[e.clientId]);return g?(0,t.createElement)("span",a,"Primary term"):(0,t.createElement)("span",a,d?p:(0,t.createElement)(i.Spinner,null))},save:function(e){const{content:r}=e.attributes,a=s.useBlockProps.save({className:"clb-category-name"});return(0,t.createElement)("span",a,"{{title}}")}})})();