import { r as registerInstance, h, H as Host } from './index-b6f10a81.js';
import './BaseField-d94c5b14.js';
import './_commonjsHelpers-63c253cd.js';
import './kimlikApi-81acfec6.js';
import './data-transfer-field-1ad95e08.js';
import './filter-cbaa3d7d.js';
import { C as CookieStorage } from './cookie-d9098150.js';
import { p as prod } from './services-fc4ce8f3.js';
import { D as DamgaApi } from './damga-api-6ceeb128.js';

const devingenProductDamgaDomainTableListDnsRecordCss = ".sc-devingen-product-damga-domain-table-list-dns-record-h{display:block;padding:6px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}";

const damgaProxyIPs = {
  '18.192.241.137': 'eu-central-2.damga.devingen.io',
  '52.29.141.76': 'eu-central-1a.damga.devingen.io',
};
const DevingenProductDamgaDomainTableListDnsRecord = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
  }
  async componentWillLoad() {
    const jwt = new CookieStorage().getAll().jwt;
    const headers = {
      Authorization: jwt ? `Bearer ${new CookieStorage().getAll().jwt}` : undefined,
    };
    const dnsRecord = await new DamgaApi(`${prod.damga}/${prod.base}`, headers)
      .getDnsRecord(this.item.domain).catch(e => {
      console.log('Getting dns record failed', e);
    });
    if (!dnsRecord)
      return;
    this.dnsRecord = dnsRecord;
  }
  render() {
    var _a, _b;
    return (h(Host, null, damgaProxyIPs[(_a = this.dnsRecord) === null || _a === void 0 ? void 0 : _a.record] || ((_b = this.dnsRecord) === null || _b === void 0 ? void 0 : _b.record) || '-'));
  }
};
DevingenProductDamgaDomainTableListDnsRecord.style = devingenProductDamgaDomainTableListDnsRecordCss;

export { DevingenProductDamgaDomainTableListDnsRecord as devingen_product_damga_domain_table_list_dns_record };
