import{LitElement as t,html as e,css as i}from"../../../lit/index.js";import"./map-menu-submenu.js";import"./map-menu-item.js";class MapMenuBuilder extends t{static get styles(){return[i`
        :host {
          display: block;
        }
      `]}constructor(){super(),this.editControls=!1,this.items=[],this.depthCount=1,this.maxDepth=5,this.isFlex=!1,this.isNested=!1,this.isHorizontal=!1}render(){if(this.depthCount<=this.maxDepth)return e`
      <div class="wrapper">      
        ${this.items?this.items.map((t=>e`
                ${t.children.length>0?e`
                      <map-menu-submenu
                        itemtitle="${t.title}"
                        id="${t.id}"
                        url="${t.slug}"
                        icon="${t.metadata&&t.metadata.icon?t.metadata.icon:null}"
                        icon-label="${t.metadata&&t.metadata.pageType?t.metadata.pageType:""}"
                        ?edit-controls="${this.editControls}"
                        selected="${this.selected}"
                        ?opened="${this.depthCount>1&&this.isHorizontal}"
                        ?is-flex="${this.isFlex}"
                        ?is-nested="${this.depthCount>1}"
                        ?is-horizontal="${this.isHorizontal}"
                        ?published="${this.getPublishedStatus(t)}"
                        ?hide-in-menu="${this.hideInMenuStatus(t)}"
                      >
                        <map-menu-builder
                          .items="${t.children}"
                          ?edit-controls="${this.editControls}"
                          selected="${this.selected}"
                          depth-count="${this.depthCount+1}"
                          max-depth="${this.maxDepth}"
                          ?is-flex="${this.isFlex}"
                          ?is-horizontal="${this.isHorizontal}"
                          ?is-nested="${!0}"
                        ></map-menu-builder>
                      </map-menu-submenu>
                    `:e`
                      <map-menu-item
                        ?edit-controls="${this.editControls}"
                        ?is-nested="${this.depthCount>1}"
                        itemtitle="${t.title}"
                        id="${t.id}"
                        url="${t.slug}"
                        icon="${t.metadata&&t.metadata.icon?t.metadata.icon:""}"
                        icon-label="${t.metadata&&t.metadata.pageType?t.metadata.pageType:""}"
                        selected="${this.selected}"
                        ?published="${this.getPublishedStatus(t)}"
                        ?hide-in-menu="${this.hideInMenuStatus(t)}"
                        ?locked="${t.metadata.locked}"
                        status="${t.metadata.status}"
                      ></map-menu-item>
                    `}
              `)):""}
      </div>
    `}hideInMenuStatus(t){return!(!t.metadata||1!=t.metadata.hideInMenu)}getPublishedStatus(t){return!t.metadata||0!=t.metadata.published&&"false"!==t.metadata.published}static get tag(){return"map-menu-builder"}static get properties(){return{items:{type:Array},selected:{type:String},editControls:{type:Boolean,attribute:"edit-controls"},maxDepth:{type:Number,attribute:"max-depth",reflect:!0},depthCount:{type:Number,attribute:"depth-count"},isFlex:{type:Boolean,attribute:"is-flex"},isHorizontal:{type:Boolean,attribute:"is-horizontal"}}}createRenderRoot(){return this}}customElements.define(MapMenuBuilder.tag,MapMenuBuilder);export{MapMenuBuilder};