/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
import{e as i}from"./YQHYMLC7.js";import{a}from"./NEKIHEPY.js";async function n(r,t){let e=`${t.portal}/portals/${r}/categorySchema`;try{let{categorySchema:o}=await i(e,t);return s(o[0].categories,"/Categories")}catch{return[]}}function s(r,t){return r.map(e=>{var o;let c=`${t}/${e.title}`,l=e.title;return{value:c,label:l,children:!((o=e.categories)===null||o===void 0)&&o.length?s(e.categories,c):[]}})}async function h(r,t){let e=await n(t.portal.id,t.hubRequestOptions);return[{labelKey:"shared.fields.categories.label",scope:"/properties/categories",type:"Control",options:{control:"hub-field-input-combobox",items:e,allowCustomValues:!1,selectionMode:"ancestors",placeholderIcon:"select-category"},rules:[{effect:a.DISABLE,conditions:[!e.length]}]},{type:"Notice",options:{notice:{configuration:{id:"no-categories-notice",noticeType:"notice",closable:!1,icon:"exclamation-mark-triangle",kind:"warning",scale:"m"},message:"{{shared.fields.categories.noCategoriesNotice.body:translate}}",autoShow:!0,actions:[{label:"{{shared.fields.categories.noCategoriesNotice.link:translate}}",icon:"launch",href:"https://doc.arcgis.com/en/arcgis-online/reference/content-categories.htm",target:"_blank"}]}},rules:[{effect:a.SHOW,conditions:[!e.length]}]}]}export{h as a};
