(()=>{"use strict";var e={n:o=>{var t=o&&o.__esModule?()=>o.default:()=>o;return e.d(t,{a:t}),t},d:(o,t)=>{for(var n in t)e.o(t,n)&&!e.o(o,n)&&Object.defineProperty(o,n,{enumerable:!0,get:t[n]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o)};const o=window.wp.blocks,t=window.wp.components,n=window.wp.element,r=window.wp.blockEditor,i=window.wp.apiFetch;var c=e.n(i);const d=window.wp.url,s=window.wp.i18n,a=JSON.parse('{"UU":"mine-cloudvod/docs","DD":"Documents","Kk":"","h_":"List document directories."}'),l=window.ReactJSXRuntime,u={edit:(0,t.withNotices)((e=>{const{attributes:{categoryId:o},setAttributes:i,noticeOperations:u}=e,[w,p]=(0,n.useState)([]),m=(0,n.useRef)(!0);(0,n.useEffect)((()=>(c()({path:(0,d.addQueryArgs)("/wp/v2/docs_category",{per_page:-1,parent:0,orderby:"count",order:"desc",_fields:["id","name","count"],hide_empty:!0})}).then((e=>{p(e.map((e=>({value:e.id,label:e.name}))))})).catch((e=>{m.current&&(p([]),u.createErrorNotice((0,s.__)("Failed to load document categories","mine-cloudvod")))})),()=>{m.current=!1})),[]);const h=(0,r.useBlockProps)();return(0,l.jsxs)("div",{...h,children:[(0,l.jsx)(r.InspectorControls,{children:(0,l.jsx)(t.ComboboxControl,{label:(0,s.__)("Document Categories","mine-cloudvod"),value:o,onChange:e=>i({categoryId:e}),options:w,onInputChange:e=>p(w.filter((o=>o.label.toLowerCase().includes(e.toLowerCase()))))})}),(0,l.jsx)(t.Placeholder,{className:"mine-cloudvod__placeholder is-loading",label:a.DD,instructions:a.h_,icon:a.Kk,children:(0,l.jsx)("p",{children:(0,l.jsx)("strong",{children:(0,s.__)("Do not remove this block!","mine-cloudvod")})})})]})})),save:()=>null};"site-editor"===window.pagenow&&(0,o.registerBlockType)(a.UU,u)})();