'use client'
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result)
    __defProp(target, key, result);
  return result;
};

// src/m2m-apps-menu.ts
var m2m_apps_menu_exports = {};
__export(m2m_apps_menu_exports, {
  M2MAppsMenu: () => M2MAppsMenu
});
module.exports = __toCommonJS(m2m_apps_menu_exports);

// src/MenuBaseElement.ts
var import_lit = require("lit");
var import_ref = require("lit/directives/ref.js");
var import_decorators = require("lit/decorators.js");
var MenuBaseElement = class extends import_lit.LitElement {
  constructor() {
    super(...arguments);
    this.handleClickOutside = (event) => {
      if (!this.listRef.value || this.listRef.value.contains(event.composedPath()[0])) {
        return;
      }
      this.expanded = false;
    };
    this.additinalItems = [];
    this.expanded = false;
    this.handleToggleDrawer = (event) => {
      event.preventDefault();
      event.stopPropagation();
      this.expanded = !this.expanded;
      if (this.expanded) {
        window.addEventListener("click", this.handleClickOutside, false);
      }
    };
    this.listRef = (0, import_ref.createRef)();
  }
  updated() {
    if (this.expanded === false) {
      window.removeEventListener("click", this.handleClickOutside, false);
    }
  }
  disconnectedCallback() {
    super.disconnectedCallback();
    window.removeEventListener("click", this.handleClickOutside, false);
  }
};
MenuBaseElement.styles = import_lit.css`
    nav {
      position: relative;
      display: flex;
    }
    .navigation-drawer-controll-button {
      display: flex;
      align-items: center;
      justify-content: center;

      height: 42px;
      padding: 0;
      cursor: pointer;
      background-color: transparent;
      border: none;
      transition: background-color 0.2s;
      appearance: none;
    }
    .navigation-drawer-controll-button.navigation-drawer-controll-button--icon {
      width: 42px;
    }
    .navigation-drawer-controll-button:hover {
      background-color: rgba(0, 0, 0, 0.05);
    }
    .navigation-drawer-controll-button:active {
      background-color: rgba(0, 0, 0, 0.075);
    }

    .navigation-drawer {
      position: absolute;
      top: 100%;
      right: 0px;
      z-index: 1100;
      box-sizing: border-box;
      min-width: 200px;
      padding: 0px;
      margin: 0px;
      overflow: hidden;
      color: rgba(0, 0, 0, 0.87);
      white-space: nowrap;
      list-style: none;
      background-color: #fff;
      border-radius: 5px;
      box-shadow: 0px 1px 3px 0px rgb(0 0 0 / 20%),
        0px 1px 1px 0px rgb(0 0 0 / 14%), 0px 2px 1px -1px rgb(0 0 0 / 12%);
    }
    .navigation-drawer-controll-button[aria-expanded="false"]
      ~ .navigation-drawer {
      display: none;
    }

    .navigation-drawer li {
      border-bottom: 1px solid #eeeeee;
    }
    .navigation-drawer li:last-of-type {
      border-bottom: none;
    }
    .navigation-drawer li > a,
    .navigation-drawer li > button {
      box-sizing: border-box;
      display: block;
      width: 100%;
      padding: 0;
      padding: 0.6em 1em;
      font: inherit;
      color: inherit;
      text-align: left;
      text-decoration: none;
      cursor: pointer;
      cursor: pointer;
      background-color: transparent;
      border: none;
      transition: 0.2s;
      appearance: none;
    }
    .navigation-drawer li > a:hover,
    .navigation-drawer li > button:hover {
      background-color: #ededed;
    }
    .navigation-drawer li > a:active,
    .navigation-drawer li > button:active {
      background-color: #dadada;
    }

    .navigation-drawer li ul {
      padding: 0;
      list-style: none;
    }
    .navigation-drawer li:has(> ul) li > a {
      padding-left: 2em;
    }

    .navigation-drawer li:has(> ul) > span {
      display: block;
      padding: 0.6em 1em;
      border-bottom: 1px solid #eeeeee;
    }
  `;
__decorateClass([
  (0, import_decorators.property)({
    type: Object,
    attribute: "additional-items"
  })
], MenuBaseElement.prototype, "additinalItems", 2);
__decorateClass([
  (0, import_decorators.property)()
], MenuBaseElement.prototype, "expanded", 2);

// src/m2m-apps-menu.ts
var import_decorators2 = require("lit/decorators.js");

// src/domains.ts
var getDomains = () => {
  return globalThis.M2M_COMPONENTS_ENV === "production" ? {
    core: "https://core.m2msystems.cloud",
    sumyca: "https://manage.sumyca.com",
    cleaning: "https://manager-cleaning.m2msystems.cloud",
    users: "https://manage-users.m2msystems.cloud",
    inspection: "https://inspection.m2msystems.cloud",
    checkin: "https://manage.checkin.m2msystems.cloud",
    systems: "https://m2msystems.cloud/"
  } : {
    core: "https://dev--m2m-core-manager-front.netlify.app",
    sumyca: "https://dev--sumyca-manager-front.netlify.app",
    cleaning: "https://dev--m2m-cleaning-manager-front.netlify.app",
    users: "https://dev--manage-users.netlify.app",
    inspection: "https://dev--m2m-inspection-manager-front.netlify.app",
    checkin: "https://manage.dev.checkin.m2msystems.cloud",
    systems: "https://dev.m2msystems.cloud"
  };
};

// src/m2m-apps-menu.ts
var import_lit2 = require("lit");
var import_ref2 = require("lit/directives/ref.js");
var M2MAppsMenu = class extends MenuBaseElement {
  render() {
    var _a;
    const domains = getDomains();
    const additionalItems = (_a = this.additinalItems) == null ? void 0 : _a.map((item) => {
      return import_lit2.html`
        <li>
          <a href="${item.href}">${item.label}</a>
        </li>
      `;
    });
    return import_lit2.html`<nav>
      <button
        type="button"
        class="navigation-drawer-controll-button navigation-drawer-controll-button--icon"
        aria-controls="m2m-apps-menu__navigation-drawer"
        aria-expanded=${this.expanded}
        @click=${this.handleToggleDrawer}
      >
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="38px"
          height="38px"
          viewBox="0 0 24 24"
        >
          <path
            d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"
          />
        </svg>
      </button>
      <ul
        ${(0, import_ref2.ref)(this.listRef)}
        id="m2m-apps-menu__navigation-drawer"
        aria-hidden=${!this.expanded}
        class="navigation-drawer"
      >
        <li>
          <span>m2m Series</span>
          <ul>
            <li><a href="${domains.core}">Core 施設管理</a></li>
            <li><a href="${domains.checkin}">Checkin ゲストチェックイン</a></li>
            <li><a href="${domains.systems}">Systems Airbnb連携</a></li>
            <li><a href="${domains.cleaning}">Cleaning 清掃管理</a></li>
            <li><a href="${domains.inspection}">Inspection 内見チェック</a></li>
            <li><a href="${domains.users}">Users アカウント管理</a></li>
          </ul>
        </li>
        <li>
          <a href="${domains.sumyca}">Sumyca マンスリープラットフォーム</a>
        </li>
        ${additionalItems}
      </ul>
    </nav>`;
  }
};
M2MAppsMenu = __decorateClass([
  (0, import_decorators2.customElement)("m2m-apps-menu")
], M2MAppsMenu);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  M2MAppsMenu
});
//# sourceMappingURL=m2m-apps-menu.js.map