'use strict';

var chunkY362HOIZ_cjs = require('../chunk-Y362HOIZ.cjs');
var chunkLDTMSHUZ_cjs = require('../chunk-LDTMSHUZ.cjs');

// src/public/internal.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();

// src/public-utils/createAndFetchTempObjectSetRid.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();
async function createAndFetchTempObjectSetRid(client, objectSet) {
  const response = await chunkY362HOIZ_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkY362HOIZ_cjs.additionalContext].ontologyRid, {
    objectSet: chunkY362HOIZ_cjs.getWireObjectSet(objectSet)
  });
  return response.objectSetRid;
}

// src/public-utils/hydrateObjectSetFromObjectRids.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();
function hydrateObjectSetFromObjectRids(client, definition, rids) {
  return chunkY362HOIZ_cjs.createObjectSet(definition, client[chunkY362HOIZ_cjs.additionalContext], {
    type: "intersect",
    objectSets: [definition.type === "interface" ? {
      type: "interfaceBase",
      interfaceType: definition.apiName
    } : {
      type: "base",
      objectType: definition.apiName
    }, {
      type: "static",
      objects: asMutableArray(rids)
    }]
  });
}
function asMutableArray(array) {
  return array;
}

// src/public-utils/hydrateObjectSetFromRid.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();
function hydrateObjectSetFromRid(client, definition, rid) {
  return chunkY362HOIZ_cjs.createObjectSet(definition, client[chunkY362HOIZ_cjs.additionalContext], {
    type: "intersect",
    objectSets: [definition.type === "interface" ? {
      type: "interfaceBase",
      interfaceType: definition.apiName
    } : {
      type: "base",
      objectType: definition.apiName
    }, {
      type: "reference",
      reference: rid
    }]
  });
}

// src/logger/BrowserLogger.ts
chunkLDTMSHUZ_cjs.init_cjs_shims();
function createStyle({
  color
}) {
  return `color: ${color}; border: 1px solid ${color}; padding: 2px; border-radius: 3px;`;
}
var levelStyles = {
  debug: createStyle({
    color: "LightBlue"
  }),
  error: createStyle({
    color: "red"
  }),
  fatal: createStyle({
    color: "red"
  }),
  info: createStyle({
    color: "green"
  }),
  trace: createStyle({
    color: "gray"
  }),
  warn: createStyle({
    color: "orange"
  })
};
var BrowserLogger = class _BrowserLogger extends chunkY362HOIZ_cjs.BaseLogger {
  constructor(bindings = {}, options = {}) {
    super(bindings, {
      ...options,
      level: options.level ?? "error"
    }, _BrowserLogger);
  }
  createLogMethod(name, bindings) {
    const msgs = [`%c${name}%c`];
    const styles = [levelStyles[name], ""];
    if (this.options?.msgPrefix) {
      msgs.push(`%c${this.options.msgPrefix}%c`);
      styles.push("font-style: italic; color: gray", "");
    }
    if (typeof bindings === "object" && "methodName" in bindings) {
      msgs.push(`%c.${bindings.methodName}()%c`);
      styles.push("font-style: italic;color: orchid", "");
    }
    return (...args) => {
      console[name === "fatal" ? "error" : name](msgs.join(" "), ...styles, ...args);
    };
  }
};

Object.defineProperty(exports, "MinimalLogger", {
  enumerable: true,
  get: function () { return chunkY362HOIZ_cjs.MinimalLogger; }
});
Object.defineProperty(exports, "hydrateAttachmentFromRid", {
  enumerable: true,
  get: function () { return chunkY362HOIZ_cjs.hydrateAttachmentFromRid; }
});
exports.BrowserLogger = BrowserLogger;
exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
exports.hydrateObjectSetFromObjectRids = hydrateObjectSetFromObjectRids;
exports.hydrateObjectSetFromRid = hydrateObjectSetFromRid;
//# sourceMappingURL=internal.cjs.map
//# sourceMappingURL=internal.cjs.map