(()=>{"use strict";const e=window.React,t=window.wp.editor,o=window.wp.plugins,s=window.wp.components,n=window.wp.data,i=window.wp.coreData,r=window.ReactJSXRuntime;(0,o.registerPlugin)("findkit-sidebar",{icon:"smiley",render(){var o,a;const l=function(){const e=(0,n.useSelect)(e=>e("core/editor").getCurrentPostType(),[]),t=(0,n.useSelect)(t=>t("core").getPostType(e),[e]);return{type:e,supportsCustomFields:Boolean(t?.supports["custom-fields"])}}(),[h,d]=function(){const e=(0,n.useSelect)(e=>e("core/editor").getCurrentPostType(),[]);return(0,i.useEntityProp)("postType",e,"meta")}(),p=null!==(o=h?._findkit_superwords)&&void 0!==o?o:"",c=null!==(a=h?._findkit_content_no_highlight)&&void 0!==a?a:"",u=h?._findkit_show_in_search,w=FINDKIT_GUTENBERG_SIDEBAR.postTypes?.includes(l.type),g=l.supportsCustomFields||"page"===l.type||"post"===l.type;return(0,e.useEffect)(()=>{w&&!g&&console.warn(`[findkit] Findkit sidebar is enabled for post type "${l.type}" but it does not support custom fields. Add "custom-fieds" to the "supports" array in the post type registration.`)},[g,w]),w&&g?(0,r.jsxs)(t.PluginDocumentSettingPanel,{name:"findkit-panel",title:FINDKIT_GUTENBERG_SIDEBAR.sidebarPanelTitle,className:"findkit-panel",children:[FINDKIT_GUTENBERG_SIDEBAR.showSuperwordsEditor?(0,r.jsx)(s.TextareaControl,{label:"Superwords",value:p,help:(0,r.jsx)(r.Fragment,{children:"A space-separated list of words which will promote this page to the top of the search results when these words are searched for."}),onChange:e=>{d({...h,_findkit_superwords:e})},__nextHasNoMarginBottom:!0}):null,FINDKIT_GUTENBERG_SIDEBAR.showContentNoHighlightEditor?(0,r.jsx)(s.TextareaControl,{label:"Hidden keywords",value:c,help:(0,r.jsx)(r.Fragment,{children:"Searchable text that will not be highlighted in the search results or shown on the actual page. Use for synonyms etc."}),onChange:e=>{d({...h,_findkit_content_no_highlight:e})},__nextHasNoMarginBottom:!0}):null,(0,r.jsx)(s.ToggleControl,{label:"Show in Search",help:(0,r.jsx)(r.Fragment,{children:"This page is shown in the search results when this is active and the page is public. This toggle won't remove the page from the public search engines such as Google."}),checked:"no"!==u,onChange:e=>{d(e?{...h,_findkit_show_in_search:"yes"}:{...h,_findkit_show_in_search:"no"})}})]}):null}})})();