;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "c13934d2-eff1-4d72-abee-9431e419835b", e._sentryDebugIdIdentifier = "sentry-dbid-c13934d2-eff1-4d72-abee-9431e419835b");
  } catch (e) {
  }
}
;
function mapApiScriptLocalizationToSchemaFields(localization) {
  const schema = {};
  const scriptNameInSchema = localization.script.replace(
    "-",
    ""
  );
  for (const [field, value] of Object.entries(localization.fields)) {
    schema[scriptNameInSchema + field[0].toUpperCase() + field.slice(1)] = value;
  }
  return schema;
}
function mapSchemaFieldsToApiScriptLocalization(data, script) {
  const fields = {};
  for (const [schemaField, value] of Object.entries(data)) {
    if (schemaField.startsWith(script)) {
      let fieldName = schemaField.replace(script, "");
      fieldName = fieldName[0].toLowerCase() + fieldName.slice(1);
      fields[fieldName] = value;
    }
  }
  return { script: `${script.slice(0, 2)}-${script.slice(2)}`, fields };
}
const mapAddressLocalizationToJpAddressSchema = (localization) => {
  if (!localization) return {};
  let jpAddress = {};
  for (const { script, fields } of localization) {
    const schemaFieldsFromLocalization = mapApiScriptLocalizationToSchemaFields({
      script,
      fields: {
        city: fields.city,
        // mismatch between API `street` and schema `address`
        address: fields.street
      }
    });
    jpAddress = {
      ...jpAddress,
      ...schemaFieldsFromLocalization
      // TODO determine hani/kana state/province from Romaji field
    };
  }
  return jpAddress;
};
export {
  mapApiScriptLocalizationToSchemaFields as a,
  mapAddressLocalizationToJpAddressSchema as b,
  mapSchemaFieldsToApiScriptLocalization as m
};
