import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
import { collectBody, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, getArrayIfSingleItem as __getArrayIfSingleItem, getValueFromTextNode as __getValueFromTextNode, parseBoolean as __parseBoolean, parseRfc3339DateTimeWithOffset as __parseRfc3339DateTimeWithOffset, serializeFloat as __serializeFloat, strictParseFloat as __strictParseFloat, strictParseInt32 as __strictParseInt32, strictParseLong as __strictParseLong, withBaseException, } from "@smithy/smithy-client";
import { XMLParser } from "fast-xml-parser";
import { CloudWatchServiceException as __BaseException } from "../models/CloudWatchServiceException";
import { ConcurrentModificationException, DashboardInvalidInputError, InternalServiceFault, InvalidFormatFault, InvalidNextToken, InvalidParameterCombinationException, InvalidParameterValueException, LimitExceededException, LimitExceededFault, MissingRequiredParameterException, ResourceNotFound, ResourceNotFoundException, } from "../models/models_0";
export const se_DeleteAlarmsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DeleteAlarmsInput(input, context),
        [_A]: _DA,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteAnomalyDetectorCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DeleteAnomalyDetectorInput(input, context),
        [_A]: _DAD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteDashboardsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DeleteDashboardsInput(input, context),
        [_A]: _DD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteInsightRulesCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DeleteInsightRulesInput(input, context),
        [_A]: _DIR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DeleteMetricStreamCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DeleteMetricStreamInput(input, context),
        [_A]: _DMS,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAlarmHistoryCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DescribeAlarmHistoryInput(input, context),
        [_A]: _DAH,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAlarmsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DescribeAlarmsInput(input, context),
        [_A]: _DAe,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAlarmsForMetricCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DescribeAlarmsForMetricInput(input, context),
        [_A]: _DAFM,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeAnomalyDetectorsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DescribeAnomalyDetectorsInput(input, context),
        [_A]: _DADe,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DescribeInsightRulesCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DescribeInsightRulesInput(input, context),
        [_A]: _DIRe,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DisableAlarmActionsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DisableAlarmActionsInput(input, context),
        [_A]: _DAA,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_DisableInsightRulesCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_DisableInsightRulesInput(input, context),
        [_A]: _DIRi,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_EnableAlarmActionsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_EnableAlarmActionsInput(input, context),
        [_A]: _EAA,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_EnableInsightRulesCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_EnableInsightRulesInput(input, context),
        [_A]: _EIR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetDashboardCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_GetDashboardInput(input, context),
        [_A]: _GD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetInsightRuleReportCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_GetInsightRuleReportInput(input, context),
        [_A]: _GIRR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMetricDataCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_GetMetricDataInput(input, context),
        [_A]: _GMD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMetricStatisticsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_GetMetricStatisticsInput(input, context),
        [_A]: _GMS,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMetricStreamCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_GetMetricStreamInput(input, context),
        [_A]: _GMSe,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_GetMetricWidgetImageCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_GetMetricWidgetImageInput(input, context),
        [_A]: _GMWI,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListDashboardsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_ListDashboardsInput(input, context),
        [_A]: _LD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListManagedInsightRulesCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_ListManagedInsightRulesInput(input, context),
        [_A]: _LMIR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListMetricsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_ListMetricsInput(input, context),
        [_A]: _LM,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListMetricStreamsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_ListMetricStreamsInput(input, context),
        [_A]: _LMS,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_ListTagsForResourceCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_ListTagsForResourceInput(input, context),
        [_A]: _LTFR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutAnomalyDetectorCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutAnomalyDetectorInput(input, context),
        [_A]: _PAD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutCompositeAlarmCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutCompositeAlarmInput(input, context),
        [_A]: _PCA,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutDashboardCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutDashboardInput(input, context),
        [_A]: _PD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutInsightRuleCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutInsightRuleInput(input, context),
        [_A]: _PIR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutManagedInsightRulesCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutManagedInsightRulesInput(input, context),
        [_A]: _PMIR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutMetricAlarmCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutMetricAlarmInput(input, context),
        [_A]: _PMA,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutMetricDataCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutMetricDataInput(input, context),
        [_A]: _PMD,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_PutMetricStreamCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_PutMetricStreamInput(input, context),
        [_A]: _PMS,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_SetAlarmStateCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_SetAlarmStateInput(input, context),
        [_A]: _SAS,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StartMetricStreamsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_StartMetricStreamsInput(input, context),
        [_A]: _SMS,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_StopMetricStreamsCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_StopMetricStreamsInput(input, context),
        [_A]: _SMSt,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_TagResourceCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_TagResourceInput(input, context),
        [_A]: _TR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const se_UntagResourceCommand = async (input, context) => {
    const headers = SHARED_HEADERS;
    let body;
    body = buildFormUrlencodedString({
        ...se_UntagResourceInput(input, context),
        [_A]: _UR,
        [_V]: _,
    });
    return buildHttpRpcRequest(context, headers, "/", undefined, body);
};
export const de_DeleteAlarmsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_DeleteAnomalyDetectorCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DeleteAnomalyDetectorOutput(data.DeleteAnomalyDetectorResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DeleteDashboardsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DeleteDashboardsOutput(data.DeleteDashboardsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DeleteInsightRulesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DeleteInsightRulesOutput(data.DeleteInsightRulesResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DeleteMetricStreamCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DeleteMetricStreamOutput(data.DeleteMetricStreamResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DescribeAlarmHistoryCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAlarmHistoryOutput(data.DescribeAlarmHistoryResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DescribeAlarmsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAlarmsOutput(data.DescribeAlarmsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DescribeAlarmsForMetricCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAlarmsForMetricOutput(data.DescribeAlarmsForMetricResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DescribeAnomalyDetectorsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeAnomalyDetectorsOutput(data.DescribeAnomalyDetectorsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DescribeInsightRulesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DescribeInsightRulesOutput(data.DescribeInsightRulesResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_DisableAlarmActionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_DisableInsightRulesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_DisableInsightRulesOutput(data.DisableInsightRulesResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_EnableAlarmActionsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_EnableInsightRulesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_EnableInsightRulesOutput(data.EnableInsightRulesResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_GetDashboardCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetDashboardOutput(data.GetDashboardResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_GetInsightRuleReportCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetInsightRuleReportOutput(data.GetInsightRuleReportResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_GetMetricDataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMetricDataOutput(data.GetMetricDataResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_GetMetricStatisticsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMetricStatisticsOutput(data.GetMetricStatisticsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_GetMetricStreamCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMetricStreamOutput(data.GetMetricStreamResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_GetMetricWidgetImageCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_GetMetricWidgetImageOutput(data.GetMetricWidgetImageResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_ListDashboardsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListDashboardsOutput(data.ListDashboardsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_ListManagedInsightRulesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListManagedInsightRulesOutput(data.ListManagedInsightRulesResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_ListMetricsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListMetricsOutput(data.ListMetricsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_ListMetricStreamsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListMetricStreamsOutput(data.ListMetricStreamsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_ListTagsForResourceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_ListTagsForResourceOutput(data.ListTagsForResourceResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_PutAnomalyDetectorCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_PutAnomalyDetectorOutput(data.PutAnomalyDetectorResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_PutCompositeAlarmCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_PutDashboardCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_PutDashboardOutput(data.PutDashboardResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_PutInsightRuleCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_PutInsightRuleOutput(data.PutInsightRuleResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_PutManagedInsightRulesCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_PutManagedInsightRulesOutput(data.PutManagedInsightRulesResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_PutMetricAlarmCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_PutMetricDataCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_PutMetricStreamCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_PutMetricStreamOutput(data.PutMetricStreamResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_SetAlarmStateCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    await collectBody(output.body, context);
    const response = {
        $metadata: deserializeMetadata(output),
    };
    return response;
};
export const de_StartMetricStreamsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_StartMetricStreamsOutput(data.StartMetricStreamsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_StopMetricStreamsCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_StopMetricStreamsOutput(data.StopMetricStreamsResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_TagResourceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_TagResourceOutput(data.TagResourceResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
export const de_UntagResourceCommand = async (output, context) => {
    if (output.statusCode >= 300) {
        return de_CommandError(output, context);
    }
    const data = await parseBody(output.body, context);
    let contents = {};
    contents = de_UntagResourceOutput(data.UntagResourceResult, context);
    const response = {
        $metadata: deserializeMetadata(output),
        ...contents,
    };
    return response;
};
const de_CommandError = async (output, context) => {
    const parsedOutput = {
        ...output,
        body: await parseErrorBody(output.body, context),
    };
    const errorCode = loadQueryErrorCode(output, parsedOutput.body);
    switch (errorCode) {
        case "ResourceNotFound":
        case "com.amazonaws.cloudwatch#ResourceNotFound":
            throw await de_ResourceNotFoundRes(parsedOutput, context);
        case "InternalServiceError":
        case "com.amazonaws.cloudwatch#InternalServiceFault":
            throw await de_InternalServiceFaultRes(parsedOutput, context);
        case "InvalidParameterCombination":
        case "com.amazonaws.cloudwatch#InvalidParameterCombinationException":
            throw await de_InvalidParameterCombinationExceptionRes(parsedOutput, context);
        case "InvalidParameterValue":
        case "com.amazonaws.cloudwatch#InvalidParameterValueException":
            throw await de_InvalidParameterValueExceptionRes(parsedOutput, context);
        case "MissingParameter":
        case "com.amazonaws.cloudwatch#MissingRequiredParameterException":
            throw await de_MissingRequiredParameterExceptionRes(parsedOutput, context);
        case "ResourceNotFoundException":
        case "com.amazonaws.cloudwatch#ResourceNotFoundException":
            throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
        case "InvalidNextToken":
        case "com.amazonaws.cloudwatch#InvalidNextToken":
            throw await de_InvalidNextTokenRes(parsedOutput, context);
        case "LimitExceededException":
        case "com.amazonaws.cloudwatch#LimitExceededException":
            throw await de_LimitExceededExceptionRes(parsedOutput, context);
        case "LimitExceeded":
        case "com.amazonaws.cloudwatch#LimitExceededFault":
            throw await de_LimitExceededFaultRes(parsedOutput, context);
        case "InvalidParameterInput":
        case "com.amazonaws.cloudwatch#DashboardInvalidInputError":
            throw await de_DashboardInvalidInputErrorRes(parsedOutput, context);
        case "ConcurrentModificationException":
        case "com.amazonaws.cloudwatch#ConcurrentModificationException":
            throw await de_ConcurrentModificationExceptionRes(parsedOutput, context);
        case "InvalidFormat":
        case "com.amazonaws.cloudwatch#InvalidFormatFault":
            throw await de_InvalidFormatFaultRes(parsedOutput, context);
        default:
            const parsedBody = parsedOutput.body;
            return throwDefaultError({
                output,
                parsedBody: parsedBody.Error,
                errorCode,
            });
    }
};
const de_ConcurrentModificationExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_ConcurrentModificationException(body.Error, context);
    const exception = new ConcurrentModificationException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_DashboardInvalidInputErrorRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_DashboardInvalidInputError(body.Error, context);
    const exception = new DashboardInvalidInputError({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InternalServiceFaultRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_InternalServiceFault(body.Error, context);
    const exception = new InternalServiceFault({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidFormatFaultRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_InvalidFormatFault(body.Error, context);
    const exception = new InvalidFormatFault({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidNextTokenRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_InvalidNextToken(body.Error, context);
    const exception = new InvalidNextToken({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidParameterCombinationExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_InvalidParameterCombinationException(body.Error, context);
    const exception = new InvalidParameterCombinationException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_InvalidParameterValueExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_InvalidParameterValueException(body.Error, context);
    const exception = new InvalidParameterValueException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_LimitExceededException(body.Error, context);
    const exception = new LimitExceededException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_LimitExceededFaultRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_LimitExceededFault(body.Error, context);
    const exception = new LimitExceededFault({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_MissingRequiredParameterExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_MissingRequiredParameterException(body.Error, context);
    const exception = new MissingRequiredParameterException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceNotFoundRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_ResourceNotFound(body.Error, context);
    const exception = new ResourceNotFound({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
    const body = parsedOutput.body;
    const deserialized = de_ResourceNotFoundException(body.Error, context);
    const exception = new ResourceNotFoundException({
        $metadata: deserializeMetadata(parsedOutput),
        ...deserialized,
    });
    return __decorateServiceException(exception, body);
};
const se_AlarmNames = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_AlarmTypes = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_AnomalyDetectorConfiguration = (input, context) => {
    const entries = {};
    if (input[_ETR] != null) {
        const memberEntries = se_AnomalyDetectorExcludedTimeRanges(input[_ETR], context);
        if (input[_ETR]?.length === 0) {
            entries.ExcludedTimeRanges = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `ExcludedTimeRanges.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_MT] != null) {
        entries[_MT] = input[_MT];
    }
    return entries;
};
const se_AnomalyDetectorExcludedTimeRanges = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_Range(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_AnomalyDetectorTypes = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_Counts = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = __serializeFloat(entry);
        counter++;
    }
    return entries;
};
const se_DashboardNames = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_DeleteAlarmsInput = (input, context) => {
    const entries = {};
    if (input[_AN] != null) {
        const memberEntries = se_AlarmNames(input[_AN], context);
        if (input[_AN]?.length === 0) {
            entries.AlarmNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_DeleteAnomalyDetectorInput = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_S] != null) {
        entries[_S] = input[_S];
    }
    if (input[_SMAD] != null) {
        const memberEntries = se_SingleMetricAnomalyDetector(input[_SMAD], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `SingleMetricAnomalyDetector.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_MMAD] != null) {
        const memberEntries = se_MetricMathAnomalyDetector(input[_MMAD], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricMathAnomalyDetector.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_DeleteDashboardsInput = (input, context) => {
    const entries = {};
    if (input[_DN] != null) {
        const memberEntries = se_DashboardNames(input[_DN], context);
        if (input[_DN]?.length === 0) {
            entries.DashboardNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `DashboardNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_DeleteInsightRulesInput = (input, context) => {
    const entries = {};
    if (input[_RN] != null) {
        const memberEntries = se_InsightRuleNames(input[_RN], context);
        if (input[_RN]?.length === 0) {
            entries.RuleNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `RuleNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_DeleteMetricStreamInput = (input, context) => {
    const entries = {};
    if (input[_Na] != null) {
        entries[_Na] = input[_Na];
    }
    return entries;
};
const se_DescribeAlarmHistoryInput = (input, context) => {
    const entries = {};
    if (input[_ANl] != null) {
        entries[_ANl] = input[_ANl];
    }
    if (input[_AT] != null) {
        const memberEntries = se_AlarmTypes(input[_AT], context);
        if (input[_AT]?.length === 0) {
            entries.AlarmTypes = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmTypes.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_HIT] != null) {
        entries[_HIT] = input[_HIT];
    }
    if (input[_SD] != null) {
        entries[_SD] = input[_SD].toISOString().split(".")[0] + "Z";
    }
    if (input[_ED] != null) {
        entries[_ED] = input[_ED].toISOString().split(".")[0] + "Z";
    }
    if (input[_MR] != null) {
        entries[_MR] = input[_MR];
    }
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_SB] != null) {
        entries[_SB] = input[_SB];
    }
    return entries;
};
const se_DescribeAlarmsForMetricInput = (input, context) => {
    const entries = {};
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_St] != null) {
        entries[_St] = input[_St];
    }
    if (input[_ES] != null) {
        entries[_ES] = input[_ES];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_P] != null) {
        entries[_P] = input[_P];
    }
    if (input[_U] != null) {
        entries[_U] = input[_U];
    }
    return entries;
};
const se_DescribeAlarmsInput = (input, context) => {
    const entries = {};
    if (input[_AN] != null) {
        const memberEntries = se_AlarmNames(input[_AN], context);
        if (input[_AN]?.length === 0) {
            entries.AlarmNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmNames.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ANP] != null) {
        entries[_ANP] = input[_ANP];
    }
    if (input[_AT] != null) {
        const memberEntries = se_AlarmTypes(input[_AT], context);
        if (input[_AT]?.length === 0) {
            entries.AlarmTypes = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmTypes.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_COAN] != null) {
        entries[_COAN] = input[_COAN];
    }
    if (input[_POAN] != null) {
        entries[_POAN] = input[_POAN];
    }
    if (input[_SV] != null) {
        entries[_SV] = input[_SV];
    }
    if (input[_AP] != null) {
        entries[_AP] = input[_AP];
    }
    if (input[_MR] != null) {
        entries[_MR] = input[_MR];
    }
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    return entries;
};
const se_DescribeAnomalyDetectorsInput = (input, context) => {
    const entries = {};
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_MRa] != null) {
        entries[_MRa] = input[_MRa];
    }
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ADT] != null) {
        const memberEntries = se_AnomalyDetectorTypes(input[_ADT], context);
        if (input[_ADT]?.length === 0) {
            entries.AnomalyDetectorTypes = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AnomalyDetectorTypes.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_DescribeInsightRulesInput = (input, context) => {
    const entries = {};
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_MRa] != null) {
        entries[_MRa] = input[_MRa];
    }
    return entries;
};
const se_Dimension = (input, context) => {
    const entries = {};
    if (input[_Na] != null) {
        entries[_Na] = input[_Na];
    }
    if (input[_Va] != null) {
        entries[_Va] = input[_Va];
    }
    return entries;
};
const se_DimensionFilter = (input, context) => {
    const entries = {};
    if (input[_Na] != null) {
        entries[_Na] = input[_Na];
    }
    if (input[_Va] != null) {
        entries[_Va] = input[_Va];
    }
    return entries;
};
const se_DimensionFilters = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_DimensionFilter(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_Dimensions = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_Dimension(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_DisableAlarmActionsInput = (input, context) => {
    const entries = {};
    if (input[_AN] != null) {
        const memberEntries = se_AlarmNames(input[_AN], context);
        if (input[_AN]?.length === 0) {
            entries.AlarmNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_DisableInsightRulesInput = (input, context) => {
    const entries = {};
    if (input[_RN] != null) {
        const memberEntries = se_InsightRuleNames(input[_RN], context);
        if (input[_RN]?.length === 0) {
            entries.RuleNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `RuleNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_EnableAlarmActionsInput = (input, context) => {
    const entries = {};
    if (input[_AN] != null) {
        const memberEntries = se_AlarmNames(input[_AN], context);
        if (input[_AN]?.length === 0) {
            entries.AlarmNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_EnableInsightRulesInput = (input, context) => {
    const entries = {};
    if (input[_RN] != null) {
        const memberEntries = se_InsightRuleNames(input[_RN], context);
        if (input[_RN]?.length === 0) {
            entries.RuleNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `RuleNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_ExtendedStatistics = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_GetDashboardInput = (input, context) => {
    const entries = {};
    if (input[_DNa] != null) {
        entries[_DNa] = input[_DNa];
    }
    return entries;
};
const se_GetInsightRuleReportInput = (input, context) => {
    const entries = {};
    if (input[_RNu] != null) {
        entries[_RNu] = input[_RNu];
    }
    if (input[_ST] != null) {
        entries[_ST] = input[_ST].toISOString().split(".")[0] + "Z";
    }
    if (input[_ET] != null) {
        entries[_ET] = input[_ET].toISOString().split(".")[0] + "Z";
    }
    if (input[_P] != null) {
        entries[_P] = input[_P];
    }
    if (input[_MCC] != null) {
        entries[_MCC] = input[_MCC];
    }
    if (input[_M] != null) {
        const memberEntries = se_InsightRuleMetricList(input[_M], context);
        if (input[_M]?.length === 0) {
            entries.Metrics = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Metrics.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_OB] != null) {
        entries[_OB] = input[_OB];
    }
    return entries;
};
const se_GetMetricDataInput = (input, context) => {
    const entries = {};
    if (input[_MDQ] != null) {
        const memberEntries = se_MetricDataQueries(input[_MDQ], context);
        if (input[_MDQ]?.length === 0) {
            entries.MetricDataQueries = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricDataQueries.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ST] != null) {
        entries[_ST] = input[_ST].toISOString().split(".")[0] + "Z";
    }
    if (input[_ET] != null) {
        entries[_ET] = input[_ET].toISOString().split(".")[0] + "Z";
    }
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_SB] != null) {
        entries[_SB] = input[_SB];
    }
    if (input[_MD] != null) {
        entries[_MD] = input[_MD];
    }
    if (input[_LO] != null) {
        const memberEntries = se_LabelOptions(input[_LO], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `LabelOptions.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_GetMetricStatisticsInput = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ST] != null) {
        entries[_ST] = input[_ST].toISOString().split(".")[0] + "Z";
    }
    if (input[_ET] != null) {
        entries[_ET] = input[_ET].toISOString().split(".")[0] + "Z";
    }
    if (input[_P] != null) {
        entries[_P] = input[_P];
    }
    if (input[_Sta] != null) {
        const memberEntries = se_Statistics(input[_Sta], context);
        if (input[_Sta]?.length === 0) {
            entries.Statistics = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Statistics.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ESx] != null) {
        const memberEntries = se_ExtendedStatistics(input[_ESx], context);
        if (input[_ESx]?.length === 0) {
            entries.ExtendedStatistics = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `ExtendedStatistics.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_U] != null) {
        entries[_U] = input[_U];
    }
    return entries;
};
const se_GetMetricStreamInput = (input, context) => {
    const entries = {};
    if (input[_Na] != null) {
        entries[_Na] = input[_Na];
    }
    return entries;
};
const se_GetMetricWidgetImageInput = (input, context) => {
    const entries = {};
    if (input[_MW] != null) {
        entries[_MW] = input[_MW];
    }
    if (input[_OF] != null) {
        entries[_OF] = input[_OF];
    }
    return entries;
};
const se_InsightRuleMetricList = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_InsightRuleNames = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_LabelOptions = (input, context) => {
    const entries = {};
    if (input[_T] != null) {
        entries[_T] = input[_T];
    }
    return entries;
};
const se_ListDashboardsInput = (input, context) => {
    const entries = {};
    if (input[_DNP] != null) {
        entries[_DNP] = input[_DNP];
    }
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    return entries;
};
const se_ListManagedInsightRulesInput = (input, context) => {
    const entries = {};
    if (input[_RARN] != null) {
        entries[_RARN] = input[_RARN];
    }
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_MRa] != null) {
        entries[_MRa] = input[_MRa];
    }
    return entries;
};
const se_ListMetricsInput = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_DimensionFilters(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_RA] != null) {
        entries[_RA] = input[_RA];
    }
    if (input[_ILA] != null) {
        entries[_ILA] = input[_ILA];
    }
    if (input[_OA] != null) {
        entries[_OA] = input[_OA];
    }
    return entries;
};
const se_ListMetricStreamsInput = (input, context) => {
    const entries = {};
    if (input[_NT] != null) {
        entries[_NT] = input[_NT];
    }
    if (input[_MRa] != null) {
        entries[_MRa] = input[_MRa];
    }
    return entries;
};
const se_ListTagsForResourceInput = (input, context) => {
    const entries = {};
    if (input[_RARN] != null) {
        entries[_RARN] = input[_RARN];
    }
    return entries;
};
const se_ManagedRule = (input, context) => {
    const entries = {};
    if (input[_TN] != null) {
        entries[_TN] = input[_TN];
    }
    if (input[_RARN] != null) {
        entries[_RARN] = input[_RARN];
    }
    if (input[_Ta] != null) {
        const memberEntries = se_TagList(input[_Ta], context);
        if (input[_Ta]?.length === 0) {
            entries.Tags = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Tags.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_ManagedRules = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_ManagedRule(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_Metric = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_MetricData = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_MetricDatum(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_MetricDataQueries = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_MetricDataQuery(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_MetricDataQuery = (input, context) => {
    const entries = {};
    if (input[_I] != null) {
        entries[_I] = input[_I];
    }
    if (input[_MS] != null) {
        const memberEntries = se_MetricStat(input[_MS], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricStat.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_E] != null) {
        entries[_E] = input[_E];
    }
    if (input[_L] != null) {
        entries[_L] = input[_L];
    }
    if (input[_RD] != null) {
        entries[_RD] = input[_RD];
    }
    if (input[_P] != null) {
        entries[_P] = input[_P];
    }
    if (input[_AI] != null) {
        entries[_AI] = input[_AI];
    }
    return entries;
};
const se_MetricDatum = (input, context) => {
    const entries = {};
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_Ti] != null) {
        entries[_Ti] = input[_Ti].toISOString().split(".")[0] + "Z";
    }
    if (input[_Va] != null) {
        entries[_Va] = __serializeFloat(input[_Va]);
    }
    if (input[_SVt] != null) {
        const memberEntries = se_StatisticSet(input[_SVt], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `StatisticValues.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_Val] != null) {
        const memberEntries = se_Values(input[_Val], context);
        if (input[_Val]?.length === 0) {
            entries.Values = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Values.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_C] != null) {
        const memberEntries = se_Counts(input[_C], context);
        if (input[_C]?.length === 0) {
            entries.Counts = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Counts.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_U] != null) {
        entries[_U] = input[_U];
    }
    if (input[_SR] != null) {
        entries[_SR] = input[_SR];
    }
    return entries;
};
const se_MetricMathAnomalyDetector = (input, context) => {
    const entries = {};
    if (input[_MDQ] != null) {
        const memberEntries = se_MetricDataQueries(input[_MDQ], context);
        if (input[_MDQ]?.length === 0) {
            entries.MetricDataQueries = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricDataQueries.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_MetricStat = (input, context) => {
    const entries = {};
    if (input[_Me] != null) {
        const memberEntries = se_Metric(input[_Me], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Metric.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_P] != null) {
        entries[_P] = input[_P];
    }
    if (input[_S] != null) {
        entries[_S] = input[_S];
    }
    if (input[_U] != null) {
        entries[_U] = input[_U];
    }
    return entries;
};
const se_MetricStreamFilter = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MNe] != null) {
        const memberEntries = se_MetricStreamFilterMetricNames(input[_MNe], context);
        if (input[_MNe]?.length === 0) {
            entries.MetricNames = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricNames.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_MetricStreamFilterMetricNames = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_MetricStreamFilters = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_MetricStreamFilter(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_MetricStreamNames = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_MetricStreamStatisticsAdditionalStatistics = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_MetricStreamStatisticsConfiguration = (input, context) => {
    const entries = {};
    if (input[_IM] != null) {
        const memberEntries = se_MetricStreamStatisticsIncludeMetrics(input[_IM], context);
        if (input[_IM]?.length === 0) {
            entries.IncludeMetrics = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `IncludeMetrics.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_AS] != null) {
        const memberEntries = se_MetricStreamStatisticsAdditionalStatistics(input[_AS], context);
        if (input[_AS]?.length === 0) {
            entries.AdditionalStatistics = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AdditionalStatistics.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_MetricStreamStatisticsConfigurations = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_MetricStreamStatisticsConfiguration(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_MetricStreamStatisticsIncludeMetrics = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_MetricStreamStatisticsMetric(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_MetricStreamStatisticsMetric = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    return entries;
};
const se_PutAnomalyDetectorInput = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_S] != null) {
        entries[_S] = input[_S];
    }
    if (input[_Co] != null) {
        const memberEntries = se_AnomalyDetectorConfiguration(input[_Co], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Configuration.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_SMAD] != null) {
        const memberEntries = se_SingleMetricAnomalyDetector(input[_SMAD], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `SingleMetricAnomalyDetector.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_MMAD] != null) {
        const memberEntries = se_MetricMathAnomalyDetector(input[_MMAD], context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricMathAnomalyDetector.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_PutCompositeAlarmInput = (input, context) => {
    const entries = {};
    if (input[_AE] != null) {
        entries[_AE] = input[_AE];
    }
    if (input[_AA] != null) {
        const memberEntries = se_ResourceList(input[_AA], context);
        if (input[_AA]?.length === 0) {
            entries.AlarmActions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmActions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_AD] != null) {
        entries[_AD] = input[_AD];
    }
    if (input[_ANl] != null) {
        entries[_ANl] = input[_ANl];
    }
    if (input[_AR] != null) {
        entries[_AR] = input[_AR];
    }
    if (input[_IDA] != null) {
        const memberEntries = se_ResourceList(input[_IDA], context);
        if (input[_IDA]?.length === 0) {
            entries.InsufficientDataActions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `InsufficientDataActions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_OKA] != null) {
        const memberEntries = se_ResourceList(input[_OKA], context);
        if (input[_OKA]?.length === 0) {
            entries.OKActions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `OKActions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_Ta] != null) {
        const memberEntries = se_TagList(input[_Ta], context);
        if (input[_Ta]?.length === 0) {
            entries.Tags = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Tags.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ASc] != null) {
        entries[_ASc] = input[_ASc];
    }
    if (input[_ASWP] != null) {
        entries[_ASWP] = input[_ASWP];
    }
    if (input[_ASEP] != null) {
        entries[_ASEP] = input[_ASEP];
    }
    return entries;
};
const se_PutDashboardInput = (input, context) => {
    const entries = {};
    if (input[_DNa] != null) {
        entries[_DNa] = input[_DNa];
    }
    if (input[_DB] != null) {
        entries[_DB] = input[_DB];
    }
    return entries;
};
const se_PutInsightRuleInput = (input, context) => {
    const entries = {};
    if (input[_RNu] != null) {
        entries[_RNu] = input[_RNu];
    }
    if (input[_RS] != null) {
        entries[_RS] = input[_RS];
    }
    if (input[_RDu] != null) {
        entries[_RDu] = input[_RDu];
    }
    if (input[_Ta] != null) {
        const memberEntries = se_TagList(input[_Ta], context);
        if (input[_Ta]?.length === 0) {
            entries.Tags = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Tags.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_PutManagedInsightRulesInput = (input, context) => {
    const entries = {};
    if (input[_MRan] != null) {
        const memberEntries = se_ManagedRules(input[_MRan], context);
        if (input[_MRan]?.length === 0) {
            entries.ManagedRules = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `ManagedRules.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_PutMetricAlarmInput = (input, context) => {
    const entries = {};
    if (input[_ANl] != null) {
        entries[_ANl] = input[_ANl];
    }
    if (input[_AD] != null) {
        entries[_AD] = input[_AD];
    }
    if (input[_AE] != null) {
        entries[_AE] = input[_AE];
    }
    if (input[_OKA] != null) {
        const memberEntries = se_ResourceList(input[_OKA], context);
        if (input[_OKA]?.length === 0) {
            entries.OKActions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `OKActions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_AA] != null) {
        const memberEntries = se_ResourceList(input[_AA], context);
        if (input[_AA]?.length === 0) {
            entries.AlarmActions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `AlarmActions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_IDA] != null) {
        const memberEntries = se_ResourceList(input[_IDA], context);
        if (input[_IDA]?.length === 0) {
            entries.InsufficientDataActions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `InsufficientDataActions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_St] != null) {
        entries[_St] = input[_St];
    }
    if (input[_ES] != null) {
        entries[_ES] = input[_ES];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_P] != null) {
        entries[_P] = input[_P];
    }
    if (input[_U] != null) {
        entries[_U] = input[_U];
    }
    if (input[_EP] != null) {
        entries[_EP] = input[_EP];
    }
    if (input[_DTA] != null) {
        entries[_DTA] = input[_DTA];
    }
    if (input[_Th] != null) {
        entries[_Th] = __serializeFloat(input[_Th]);
    }
    if (input[_CO] != null) {
        entries[_CO] = input[_CO];
    }
    if (input[_TMD] != null) {
        entries[_TMD] = input[_TMD];
    }
    if (input[_ELSCP] != null) {
        entries[_ELSCP] = input[_ELSCP];
    }
    if (input[_M] != null) {
        const memberEntries = se_MetricDataQueries(input[_M], context);
        if (input[_M]?.length === 0) {
            entries.Metrics = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Metrics.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_Ta] != null) {
        const memberEntries = se_TagList(input[_Ta], context);
        if (input[_Ta]?.length === 0) {
            entries.Tags = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Tags.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_TMI] != null) {
        entries[_TMI] = input[_TMI];
    }
    return entries;
};
const se_PutMetricDataInput = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MDe] != null) {
        const memberEntries = se_MetricData(input[_MDe], context);
        if (input[_MDe]?.length === 0) {
            entries.MetricData = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `MetricData.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_PutMetricStreamInput = (input, context) => {
    const entries = {};
    if (input[_Na] != null) {
        entries[_Na] = input[_Na];
    }
    if (input[_IF] != null) {
        const memberEntries = se_MetricStreamFilters(input[_IF], context);
        if (input[_IF]?.length === 0) {
            entries.IncludeFilters = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `IncludeFilters.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_EF] != null) {
        const memberEntries = se_MetricStreamFilters(input[_EF], context);
        if (input[_EF]?.length === 0) {
            entries.ExcludeFilters = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `ExcludeFilters.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_FA] != null) {
        entries[_FA] = input[_FA];
    }
    if (input[_RAo] != null) {
        entries[_RAo] = input[_RAo];
    }
    if (input[_OF] != null) {
        entries[_OF] = input[_OF];
    }
    if (input[_Ta] != null) {
        const memberEntries = se_TagList(input[_Ta], context);
        if (input[_Ta]?.length === 0) {
            entries.Tags = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Tags.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_SC] != null) {
        const memberEntries = se_MetricStreamStatisticsConfigurations(input[_SC], context);
        if (input[_SC]?.length === 0) {
            entries.StatisticsConfigurations = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `StatisticsConfigurations.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_ILAM] != null) {
        entries[_ILAM] = input[_ILAM];
    }
    return entries;
};
const se_Range = (input, context) => {
    const entries = {};
    if (input[_ST] != null) {
        entries[_ST] = input[_ST].toISOString().split(".")[0] + "Z";
    }
    if (input[_ET] != null) {
        entries[_ET] = input[_ET].toISOString().split(".")[0] + "Z";
    }
    return entries;
};
const se_ResourceList = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_SetAlarmStateInput = (input, context) => {
    const entries = {};
    if (input[_ANl] != null) {
        entries[_ANl] = input[_ANl];
    }
    if (input[_SV] != null) {
        entries[_SV] = input[_SV];
    }
    if (input[_SRt] != null) {
        entries[_SRt] = input[_SRt];
    }
    if (input[_SRD] != null) {
        entries[_SRD] = input[_SRD];
    }
    return entries;
};
const se_SingleMetricAnomalyDetector = (input, context) => {
    const entries = {};
    if (input[_N] != null) {
        entries[_N] = input[_N];
    }
    if (input[_MN] != null) {
        entries[_MN] = input[_MN];
    }
    if (input[_D] != null) {
        const memberEntries = se_Dimensions(input[_D], context);
        if (input[_D]?.length === 0) {
            entries.Dimensions = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Dimensions.${key}`;
            entries[loc] = value;
        });
    }
    if (input[_S] != null) {
        entries[_S] = input[_S];
    }
    return entries;
};
const se_StartMetricStreamsInput = (input, context) => {
    const entries = {};
    if (input[_Nam] != null) {
        const memberEntries = se_MetricStreamNames(input[_Nam], context);
        if (input[_Nam]?.length === 0) {
            entries.Names = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Names.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_Statistics = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_StatisticSet = (input, context) => {
    const entries = {};
    if (input[_SCa] != null) {
        entries[_SCa] = __serializeFloat(input[_SCa]);
    }
    if (input[_Su] != null) {
        entries[_Su] = __serializeFloat(input[_Su]);
    }
    if (input[_Mi] != null) {
        entries[_Mi] = __serializeFloat(input[_Mi]);
    }
    if (input[_Ma] != null) {
        entries[_Ma] = __serializeFloat(input[_Ma]);
    }
    return entries;
};
const se_StopMetricStreamsInput = (input, context) => {
    const entries = {};
    if (input[_Nam] != null) {
        const memberEntries = se_MetricStreamNames(input[_Nam], context);
        if (input[_Nam]?.length === 0) {
            entries.Names = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Names.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_Tag = (input, context) => {
    const entries = {};
    if (input[_K] != null) {
        entries[_K] = input[_K];
    }
    if (input[_Va] != null) {
        entries[_Va] = input[_Va];
    }
    return entries;
};
const se_TagKeyList = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = entry;
        counter++;
    }
    return entries;
};
const se_TagList = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        const memberEntries = se_Tag(entry, context);
        Object.entries(memberEntries).forEach(([key, value]) => {
            entries[`member.${counter}.${key}`] = value;
        });
        counter++;
    }
    return entries;
};
const se_TagResourceInput = (input, context) => {
    const entries = {};
    if (input[_RARN] != null) {
        entries[_RARN] = input[_RARN];
    }
    if (input[_Ta] != null) {
        const memberEntries = se_TagList(input[_Ta], context);
        if (input[_Ta]?.length === 0) {
            entries.Tags = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `Tags.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_UntagResourceInput = (input, context) => {
    const entries = {};
    if (input[_RARN] != null) {
        entries[_RARN] = input[_RARN];
    }
    if (input[_TK] != null) {
        const memberEntries = se_TagKeyList(input[_TK], context);
        if (input[_TK]?.length === 0) {
            entries.TagKeys = [];
        }
        Object.entries(memberEntries).forEach(([key, value]) => {
            const loc = `TagKeys.${key}`;
            entries[loc] = value;
        });
    }
    return entries;
};
const se_Values = (input, context) => {
    const entries = {};
    let counter = 1;
    for (const entry of input) {
        if (entry === null) {
            continue;
        }
        entries[`member.${counter}`] = __serializeFloat(entry);
        counter++;
    }
    return entries;
};
const de_AlarmHistoryItem = (output, context) => {
    const contents = {};
    if (output[_ANl] != null) {
        contents[_ANl] = __expectString(output[_ANl]);
    }
    if (output[_ATl] != null) {
        contents[_ATl] = __expectString(output[_ATl]);
    }
    if (output[_Ti] != null) {
        contents[_Ti] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_Ti]));
    }
    if (output[_HIT] != null) {
        contents[_HIT] = __expectString(output[_HIT]);
    }
    if (output[_HS] != null) {
        contents[_HS] = __expectString(output[_HS]);
    }
    if (output[_HD] != null) {
        contents[_HD] = __expectString(output[_HD]);
    }
    return contents;
};
const de_AlarmHistoryItems = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AlarmHistoryItem(entry, context);
    });
};
const de_AnomalyDetector = (output, context) => {
    const contents = {};
    if (output[_N] != null) {
        contents[_N] = __expectString(output[_N]);
    }
    if (output[_MN] != null) {
        contents[_MN] = __expectString(output[_MN]);
    }
    if (output.Dimensions === "") {
        contents[_D] = [];
    }
    else if (output[_D] != null && output[_D][_m] != null) {
        contents[_D] = de_Dimensions(__getArrayIfSingleItem(output[_D][_m]), context);
    }
    if (output[_S] != null) {
        contents[_S] = __expectString(output[_S]);
    }
    if (output[_Co] != null) {
        contents[_Co] = de_AnomalyDetectorConfiguration(output[_Co], context);
    }
    if (output[_SV] != null) {
        contents[_SV] = __expectString(output[_SV]);
    }
    if (output[_SMAD] != null) {
        contents[_SMAD] = de_SingleMetricAnomalyDetector(output[_SMAD], context);
    }
    if (output[_MMAD] != null) {
        contents[_MMAD] = de_MetricMathAnomalyDetector(output[_MMAD], context);
    }
    return contents;
};
const de_AnomalyDetectorConfiguration = (output, context) => {
    const contents = {};
    if (output.ExcludedTimeRanges === "") {
        contents[_ETR] = [];
    }
    else if (output[_ETR] != null && output[_ETR][_m] != null) {
        contents[_ETR] = de_AnomalyDetectorExcludedTimeRanges(__getArrayIfSingleItem(output[_ETR][_m]), context);
    }
    if (output[_MT] != null) {
        contents[_MT] = __expectString(output[_MT]);
    }
    return contents;
};
const de_AnomalyDetectorExcludedTimeRanges = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Range(entry, context);
    });
};
const de_AnomalyDetectors = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_AnomalyDetector(entry, context);
    });
};
const de_BatchFailures = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_PartialFailure(entry, context);
    });
};
const de_CompositeAlarm = (output, context) => {
    const contents = {};
    if (output[_AE] != null) {
        contents[_AE] = __parseBoolean(output[_AE]);
    }
    if (output.AlarmActions === "") {
        contents[_AA] = [];
    }
    else if (output[_AA] != null && output[_AA][_m] != null) {
        contents[_AA] = de_ResourceList(__getArrayIfSingleItem(output[_AA][_m]), context);
    }
    if (output[_AAl] != null) {
        contents[_AAl] = __expectString(output[_AAl]);
    }
    if (output[_ACUT] != null) {
        contents[_ACUT] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_ACUT]));
    }
    if (output[_AD] != null) {
        contents[_AD] = __expectString(output[_AD]);
    }
    if (output[_ANl] != null) {
        contents[_ANl] = __expectString(output[_ANl]);
    }
    if (output[_AR] != null) {
        contents[_AR] = __expectString(output[_AR]);
    }
    if (output.InsufficientDataActions === "") {
        contents[_IDA] = [];
    }
    else if (output[_IDA] != null && output[_IDA][_m] != null) {
        contents[_IDA] = de_ResourceList(__getArrayIfSingleItem(output[_IDA][_m]), context);
    }
    if (output.OKActions === "") {
        contents[_OKA] = [];
    }
    else if (output[_OKA] != null && output[_OKA][_m] != null) {
        contents[_OKA] = de_ResourceList(__getArrayIfSingleItem(output[_OKA][_m]), context);
    }
    if (output[_SRt] != null) {
        contents[_SRt] = __expectString(output[_SRt]);
    }
    if (output[_SRD] != null) {
        contents[_SRD] = __expectString(output[_SRD]);
    }
    if (output[_SUT] != null) {
        contents[_SUT] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_SUT]));
    }
    if (output[_SV] != null) {
        contents[_SV] = __expectString(output[_SV]);
    }
    if (output[_STT] != null) {
        contents[_STT] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_STT]));
    }
    if (output[_ASB] != null) {
        contents[_ASB] = __expectString(output[_ASB]);
    }
    if (output[_ASR] != null) {
        contents[_ASR] = __expectString(output[_ASR]);
    }
    if (output[_ASc] != null) {
        contents[_ASc] = __expectString(output[_ASc]);
    }
    if (output[_ASWP] != null) {
        contents[_ASWP] = __strictParseInt32(output[_ASWP]);
    }
    if (output[_ASEP] != null) {
        contents[_ASEP] = __strictParseInt32(output[_ASEP]);
    }
    return contents;
};
const de_CompositeAlarms = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_CompositeAlarm(entry, context);
    });
};
const de_ConcurrentModificationException = (output, context) => {
    const contents = {};
    if (output[_Mes] != null) {
        contents[_Mes] = __expectString(output[_Mes]);
    }
    return contents;
};
const de_DashboardEntries = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_DashboardEntry(entry, context);
    });
};
const de_DashboardEntry = (output, context) => {
    const contents = {};
    if (output[_DNa] != null) {
        contents[_DNa] = __expectString(output[_DNa]);
    }
    if (output[_DAa] != null) {
        contents[_DAa] = __expectString(output[_DAa]);
    }
    if (output[_LMa] != null) {
        contents[_LMa] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_LMa]));
    }
    if (output[_Si] != null) {
        contents[_Si] = __strictParseLong(output[_Si]);
    }
    return contents;
};
const de_DashboardInvalidInputError = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    if (output.dashboardValidationMessages === "") {
        contents[_dVM] = [];
    }
    else if (output[_dVM] != null && output[_dVM][_m] != null) {
        contents[_dVM] = de_DashboardValidationMessages(__getArrayIfSingleItem(output[_dVM][_m]), context);
    }
    return contents;
};
const de_DashboardValidationMessage = (output, context) => {
    const contents = {};
    if (output[_DP] != null) {
        contents[_DP] = __expectString(output[_DP]);
    }
    if (output[_Mes] != null) {
        contents[_Mes] = __expectString(output[_Mes]);
    }
    return contents;
};
const de_DashboardValidationMessages = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_DashboardValidationMessage(entry, context);
    });
};
const de_Datapoint = (output, context) => {
    const contents = {};
    if (output[_Ti] != null) {
        contents[_Ti] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_Ti]));
    }
    if (output[_SCa] != null) {
        contents[_SCa] = __strictParseFloat(output[_SCa]);
    }
    if (output[_Av] != null) {
        contents[_Av] = __strictParseFloat(output[_Av]);
    }
    if (output[_Su] != null) {
        contents[_Su] = __strictParseFloat(output[_Su]);
    }
    if (output[_Mi] != null) {
        contents[_Mi] = __strictParseFloat(output[_Mi]);
    }
    if (output[_Ma] != null) {
        contents[_Ma] = __strictParseFloat(output[_Ma]);
    }
    if (output[_U] != null) {
        contents[_U] = __expectString(output[_U]);
    }
    if (output.ExtendedStatistics === "") {
        contents[_ESx] = {};
    }
    else if (output[_ESx] != null && output[_ESx][_e] != null) {
        contents[_ESx] = de_DatapointValueMap(__getArrayIfSingleItem(output[_ESx][_e]), context);
    }
    return contents;
};
const de_Datapoints = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Datapoint(entry, context);
    });
};
const de_DatapointValueMap = (output, context) => {
    return output.reduce((acc, pair) => {
        if (pair["value"] === null) {
            return acc;
        }
        acc[pair["key"]] = __strictParseFloat(pair["value"]);
        return acc;
    }, {});
};
const de_DatapointValues = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __strictParseFloat(entry);
    });
};
const de_DeleteAnomalyDetectorOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_DeleteDashboardsOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_DeleteInsightRulesOutput = (output, context) => {
    const contents = {};
    if (output.Failures === "") {
        contents[_F] = [];
    }
    else if (output[_F] != null && output[_F][_m] != null) {
        contents[_F] = de_BatchFailures(__getArrayIfSingleItem(output[_F][_m]), context);
    }
    return contents;
};
const de_DeleteMetricStreamOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_DescribeAlarmHistoryOutput = (output, context) => {
    const contents = {};
    if (output.AlarmHistoryItems === "") {
        contents[_AHI] = [];
    }
    else if (output[_AHI] != null && output[_AHI][_m] != null) {
        contents[_AHI] = de_AlarmHistoryItems(__getArrayIfSingleItem(output[_AHI][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    return contents;
};
const de_DescribeAlarmsForMetricOutput = (output, context) => {
    const contents = {};
    if (output.MetricAlarms === "") {
        contents[_MA] = [];
    }
    else if (output[_MA] != null && output[_MA][_m] != null) {
        contents[_MA] = de_MetricAlarms(__getArrayIfSingleItem(output[_MA][_m]), context);
    }
    return contents;
};
const de_DescribeAlarmsOutput = (output, context) => {
    const contents = {};
    if (output.CompositeAlarms === "") {
        contents[_CA] = [];
    }
    else if (output[_CA] != null && output[_CA][_m] != null) {
        contents[_CA] = de_CompositeAlarms(__getArrayIfSingleItem(output[_CA][_m]), context);
    }
    if (output.MetricAlarms === "") {
        contents[_MA] = [];
    }
    else if (output[_MA] != null && output[_MA][_m] != null) {
        contents[_MA] = de_MetricAlarms(__getArrayIfSingleItem(output[_MA][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    return contents;
};
const de_DescribeAnomalyDetectorsOutput = (output, context) => {
    const contents = {};
    if (output.AnomalyDetectors === "") {
        contents[_ADn] = [];
    }
    else if (output[_ADn] != null && output[_ADn][_m] != null) {
        contents[_ADn] = de_AnomalyDetectors(__getArrayIfSingleItem(output[_ADn][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    return contents;
};
const de_DescribeInsightRulesOutput = (output, context) => {
    const contents = {};
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    if (output.InsightRules === "") {
        contents[_IR] = [];
    }
    else if (output[_IR] != null && output[_IR][_m] != null) {
        contents[_IR] = de_InsightRules(__getArrayIfSingleItem(output[_IR][_m]), context);
    }
    return contents;
};
const de_Dimension = (output, context) => {
    const contents = {};
    if (output[_Na] != null) {
        contents[_Na] = __expectString(output[_Na]);
    }
    if (output[_Va] != null) {
        contents[_Va] = __expectString(output[_Va]);
    }
    return contents;
};
const de_Dimensions = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Dimension(entry, context);
    });
};
const de_DisableInsightRulesOutput = (output, context) => {
    const contents = {};
    if (output.Failures === "") {
        contents[_F] = [];
    }
    else if (output[_F] != null && output[_F][_m] != null) {
        contents[_F] = de_BatchFailures(__getArrayIfSingleItem(output[_F][_m]), context);
    }
    return contents;
};
const de_EnableInsightRulesOutput = (output, context) => {
    const contents = {};
    if (output.Failures === "") {
        contents[_F] = [];
    }
    else if (output[_F] != null && output[_F][_m] != null) {
        contents[_F] = de_BatchFailures(__getArrayIfSingleItem(output[_F][_m]), context);
    }
    return contents;
};
const de_GetDashboardOutput = (output, context) => {
    const contents = {};
    if (output[_DAa] != null) {
        contents[_DAa] = __expectString(output[_DAa]);
    }
    if (output[_DB] != null) {
        contents[_DB] = __expectString(output[_DB]);
    }
    if (output[_DNa] != null) {
        contents[_DNa] = __expectString(output[_DNa]);
    }
    return contents;
};
const de_GetInsightRuleReportOutput = (output, context) => {
    const contents = {};
    if (output.KeyLabels === "") {
        contents[_KL] = [];
    }
    else if (output[_KL] != null && output[_KL][_m] != null) {
        contents[_KL] = de_InsightRuleContributorKeyLabels(__getArrayIfSingleItem(output[_KL][_m]), context);
    }
    if (output[_ASg] != null) {
        contents[_ASg] = __expectString(output[_ASg]);
    }
    if (output[_AV] != null) {
        contents[_AV] = __strictParseFloat(output[_AV]);
    }
    if (output[_AUC] != null) {
        contents[_AUC] = __strictParseLong(output[_AUC]);
    }
    if (output.Contributors === "") {
        contents[_Con] = [];
    }
    else if (output[_Con] != null && output[_Con][_m] != null) {
        contents[_Con] = de_InsightRuleContributors(__getArrayIfSingleItem(output[_Con][_m]), context);
    }
    if (output.MetricDatapoints === "") {
        contents[_MDet] = [];
    }
    else if (output[_MDet] != null && output[_MDet][_m] != null) {
        contents[_MDet] = de_InsightRuleMetricDatapoints(__getArrayIfSingleItem(output[_MDet][_m]), context);
    }
    return contents;
};
const de_GetMetricDataOutput = (output, context) => {
    const contents = {};
    if (output.MetricDataResults === "") {
        contents[_MDR] = [];
    }
    else if (output[_MDR] != null && output[_MDR][_m] != null) {
        contents[_MDR] = de_MetricDataResults(__getArrayIfSingleItem(output[_MDR][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    if (output.Messages === "") {
        contents[_Mess] = [];
    }
    else if (output[_Mess] != null && output[_Mess][_m] != null) {
        contents[_Mess] = de_MetricDataResultMessages(__getArrayIfSingleItem(output[_Mess][_m]), context);
    }
    return contents;
};
const de_GetMetricStatisticsOutput = (output, context) => {
    const contents = {};
    if (output[_L] != null) {
        contents[_L] = __expectString(output[_L]);
    }
    if (output.Datapoints === "") {
        contents[_Da] = [];
    }
    else if (output[_Da] != null && output[_Da][_m] != null) {
        contents[_Da] = de_Datapoints(__getArrayIfSingleItem(output[_Da][_m]), context);
    }
    return contents;
};
const de_GetMetricStreamOutput = (output, context) => {
    const contents = {};
    if (output[_Ar] != null) {
        contents[_Ar] = __expectString(output[_Ar]);
    }
    if (output[_Na] != null) {
        contents[_Na] = __expectString(output[_Na]);
    }
    if (output.IncludeFilters === "") {
        contents[_IF] = [];
    }
    else if (output[_IF] != null && output[_IF][_m] != null) {
        contents[_IF] = de_MetricStreamFilters(__getArrayIfSingleItem(output[_IF][_m]), context);
    }
    if (output.ExcludeFilters === "") {
        contents[_EF] = [];
    }
    else if (output[_EF] != null && output[_EF][_m] != null) {
        contents[_EF] = de_MetricStreamFilters(__getArrayIfSingleItem(output[_EF][_m]), context);
    }
    if (output[_FA] != null) {
        contents[_FA] = __expectString(output[_FA]);
    }
    if (output[_RAo] != null) {
        contents[_RAo] = __expectString(output[_RAo]);
    }
    if (output[_Stat] != null) {
        contents[_Stat] = __expectString(output[_Stat]);
    }
    if (output[_CD] != null) {
        contents[_CD] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_CD]));
    }
    if (output[_LUD] != null) {
        contents[_LUD] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_LUD]));
    }
    if (output[_OF] != null) {
        contents[_OF] = __expectString(output[_OF]);
    }
    if (output.StatisticsConfigurations === "") {
        contents[_SC] = [];
    }
    else if (output[_SC] != null && output[_SC][_m] != null) {
        contents[_SC] = de_MetricStreamStatisticsConfigurations(__getArrayIfSingleItem(output[_SC][_m]), context);
    }
    if (output[_ILAM] != null) {
        contents[_ILAM] = __parseBoolean(output[_ILAM]);
    }
    return contents;
};
const de_GetMetricWidgetImageOutput = (output, context) => {
    const contents = {};
    if (output[_MWI] != null) {
        contents[_MWI] = context.base64Decoder(output[_MWI]);
    }
    return contents;
};
const de_InsightRule = (output, context) => {
    const contents = {};
    if (output[_Na] != null) {
        contents[_Na] = __expectString(output[_Na]);
    }
    if (output[_Stat] != null) {
        contents[_Stat] = __expectString(output[_Stat]);
    }
    if (output[_Sc] != null) {
        contents[_Sc] = __expectString(output[_Sc]);
    }
    if (output[_De] != null) {
        contents[_De] = __expectString(output[_De]);
    }
    if (output[_MRana] != null) {
        contents[_MRana] = __parseBoolean(output[_MRana]);
    }
    return contents;
};
const de_InsightRuleContributor = (output, context) => {
    const contents = {};
    if (output.Keys === "") {
        contents[_Ke] = [];
    }
    else if (output[_Ke] != null && output[_Ke][_m] != null) {
        contents[_Ke] = de_InsightRuleContributorKeys(__getArrayIfSingleItem(output[_Ke][_m]), context);
    }
    if (output[_AAV] != null) {
        contents[_AAV] = __strictParseFloat(output[_AAV]);
    }
    if (output.Datapoints === "") {
        contents[_Da] = [];
    }
    else if (output[_Da] != null && output[_Da][_m] != null) {
        contents[_Da] = de_InsightRuleContributorDatapoints(__getArrayIfSingleItem(output[_Da][_m]), context);
    }
    return contents;
};
const de_InsightRuleContributorDatapoint = (output, context) => {
    const contents = {};
    if (output[_Ti] != null) {
        contents[_Ti] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_Ti]));
    }
    if (output[_AVp] != null) {
        contents[_AVp] = __strictParseFloat(output[_AVp]);
    }
    return contents;
};
const de_InsightRuleContributorDatapoints = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InsightRuleContributorDatapoint(entry, context);
    });
};
const de_InsightRuleContributorKeyLabels = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectString(entry);
    });
};
const de_InsightRuleContributorKeys = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectString(entry);
    });
};
const de_InsightRuleContributors = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InsightRuleContributor(entry, context);
    });
};
const de_InsightRuleMetricDatapoint = (output, context) => {
    const contents = {};
    if (output[_Ti] != null) {
        contents[_Ti] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_Ti]));
    }
    if (output[_UC] != null) {
        contents[_UC] = __strictParseFloat(output[_UC]);
    }
    if (output[_MCV] != null) {
        contents[_MCV] = __strictParseFloat(output[_MCV]);
    }
    if (output[_SCa] != null) {
        contents[_SCa] = __strictParseFloat(output[_SCa]);
    }
    if (output[_Av] != null) {
        contents[_Av] = __strictParseFloat(output[_Av]);
    }
    if (output[_Su] != null) {
        contents[_Su] = __strictParseFloat(output[_Su]);
    }
    if (output[_Mi] != null) {
        contents[_Mi] = __strictParseFloat(output[_Mi]);
    }
    if (output[_Ma] != null) {
        contents[_Ma] = __strictParseFloat(output[_Ma]);
    }
    return contents;
};
const de_InsightRuleMetricDatapoints = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InsightRuleMetricDatapoint(entry, context);
    });
};
const de_InsightRules = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_InsightRule(entry, context);
    });
};
const de_InternalServiceFault = (output, context) => {
    const contents = {};
    if (output[_Mes] != null) {
        contents[_Mes] = __expectString(output[_Mes]);
    }
    return contents;
};
const de_InvalidFormatFault = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_InvalidNextToken = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_InvalidParameterCombinationException = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_InvalidParameterValueException = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_LimitExceededException = (output, context) => {
    const contents = {};
    if (output[_Mes] != null) {
        contents[_Mes] = __expectString(output[_Mes]);
    }
    return contents;
};
const de_LimitExceededFault = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_ListDashboardsOutput = (output, context) => {
    const contents = {};
    if (output.DashboardEntries === "") {
        contents[_DE] = [];
    }
    else if (output[_DE] != null && output[_DE][_m] != null) {
        contents[_DE] = de_DashboardEntries(__getArrayIfSingleItem(output[_DE][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    return contents;
};
const de_ListManagedInsightRulesOutput = (output, context) => {
    const contents = {};
    if (output.ManagedRules === "") {
        contents[_MRan] = [];
    }
    else if (output[_MRan] != null && output[_MRan][_m] != null) {
        contents[_MRan] = de_ManagedRuleDescriptions(__getArrayIfSingleItem(output[_MRan][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    return contents;
};
const de_ListMetricsOutput = (output, context) => {
    const contents = {};
    if (output.Metrics === "") {
        contents[_M] = [];
    }
    else if (output[_M] != null && output[_M][_m] != null) {
        contents[_M] = de_Metrics(__getArrayIfSingleItem(output[_M][_m]), context);
    }
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    if (output.OwningAccounts === "") {
        contents[_OAw] = [];
    }
    else if (output[_OAw] != null && output[_OAw][_m] != null) {
        contents[_OAw] = de_OwningAccounts(__getArrayIfSingleItem(output[_OAw][_m]), context);
    }
    return contents;
};
const de_ListMetricStreamsOutput = (output, context) => {
    const contents = {};
    if (output[_NT] != null) {
        contents[_NT] = __expectString(output[_NT]);
    }
    if (output.Entries === "") {
        contents[_En] = [];
    }
    else if (output[_En] != null && output[_En][_m] != null) {
        contents[_En] = de_MetricStreamEntries(__getArrayIfSingleItem(output[_En][_m]), context);
    }
    return contents;
};
const de_ListTagsForResourceOutput = (output, context) => {
    const contents = {};
    if (output.Tags === "") {
        contents[_Ta] = [];
    }
    else if (output[_Ta] != null && output[_Ta][_m] != null) {
        contents[_Ta] = de_TagList(__getArrayIfSingleItem(output[_Ta][_m]), context);
    }
    return contents;
};
const de_ManagedRuleDescription = (output, context) => {
    const contents = {};
    if (output[_TN] != null) {
        contents[_TN] = __expectString(output[_TN]);
    }
    if (output[_RARN] != null) {
        contents[_RARN] = __expectString(output[_RARN]);
    }
    if (output[_RS] != null) {
        contents[_RS] = de_ManagedRuleState(output[_RS], context);
    }
    return contents;
};
const de_ManagedRuleDescriptions = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_ManagedRuleDescription(entry, context);
    });
};
const de_ManagedRuleState = (output, context) => {
    const contents = {};
    if (output[_RNu] != null) {
        contents[_RNu] = __expectString(output[_RNu]);
    }
    if (output[_Stat] != null) {
        contents[_Stat] = __expectString(output[_Stat]);
    }
    return contents;
};
const de_MessageData = (output, context) => {
    const contents = {};
    if (output[_Cod] != null) {
        contents[_Cod] = __expectString(output[_Cod]);
    }
    if (output[_Va] != null) {
        contents[_Va] = __expectString(output[_Va]);
    }
    return contents;
};
const de_Metric = (output, context) => {
    const contents = {};
    if (output[_N] != null) {
        contents[_N] = __expectString(output[_N]);
    }
    if (output[_MN] != null) {
        contents[_MN] = __expectString(output[_MN]);
    }
    if (output.Dimensions === "") {
        contents[_D] = [];
    }
    else if (output[_D] != null && output[_D][_m] != null) {
        contents[_D] = de_Dimensions(__getArrayIfSingleItem(output[_D][_m]), context);
    }
    return contents;
};
const de_MetricAlarm = (output, context) => {
    const contents = {};
    if (output[_ANl] != null) {
        contents[_ANl] = __expectString(output[_ANl]);
    }
    if (output[_AAl] != null) {
        contents[_AAl] = __expectString(output[_AAl]);
    }
    if (output[_AD] != null) {
        contents[_AD] = __expectString(output[_AD]);
    }
    if (output[_ACUT] != null) {
        contents[_ACUT] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_ACUT]));
    }
    if (output[_AE] != null) {
        contents[_AE] = __parseBoolean(output[_AE]);
    }
    if (output.OKActions === "") {
        contents[_OKA] = [];
    }
    else if (output[_OKA] != null && output[_OKA][_m] != null) {
        contents[_OKA] = de_ResourceList(__getArrayIfSingleItem(output[_OKA][_m]), context);
    }
    if (output.AlarmActions === "") {
        contents[_AA] = [];
    }
    else if (output[_AA] != null && output[_AA][_m] != null) {
        contents[_AA] = de_ResourceList(__getArrayIfSingleItem(output[_AA][_m]), context);
    }
    if (output.InsufficientDataActions === "") {
        contents[_IDA] = [];
    }
    else if (output[_IDA] != null && output[_IDA][_m] != null) {
        contents[_IDA] = de_ResourceList(__getArrayIfSingleItem(output[_IDA][_m]), context);
    }
    if (output[_SV] != null) {
        contents[_SV] = __expectString(output[_SV]);
    }
    if (output[_SRt] != null) {
        contents[_SRt] = __expectString(output[_SRt]);
    }
    if (output[_SRD] != null) {
        contents[_SRD] = __expectString(output[_SRD]);
    }
    if (output[_SUT] != null) {
        contents[_SUT] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_SUT]));
    }
    if (output[_MN] != null) {
        contents[_MN] = __expectString(output[_MN]);
    }
    if (output[_N] != null) {
        contents[_N] = __expectString(output[_N]);
    }
    if (output[_St] != null) {
        contents[_St] = __expectString(output[_St]);
    }
    if (output[_ES] != null) {
        contents[_ES] = __expectString(output[_ES]);
    }
    if (output.Dimensions === "") {
        contents[_D] = [];
    }
    else if (output[_D] != null && output[_D][_m] != null) {
        contents[_D] = de_Dimensions(__getArrayIfSingleItem(output[_D][_m]), context);
    }
    if (output[_P] != null) {
        contents[_P] = __strictParseInt32(output[_P]);
    }
    if (output[_U] != null) {
        contents[_U] = __expectString(output[_U]);
    }
    if (output[_EP] != null) {
        contents[_EP] = __strictParseInt32(output[_EP]);
    }
    if (output[_DTA] != null) {
        contents[_DTA] = __strictParseInt32(output[_DTA]);
    }
    if (output[_Th] != null) {
        contents[_Th] = __strictParseFloat(output[_Th]);
    }
    if (output[_CO] != null) {
        contents[_CO] = __expectString(output[_CO]);
    }
    if (output[_TMD] != null) {
        contents[_TMD] = __expectString(output[_TMD]);
    }
    if (output[_ELSCP] != null) {
        contents[_ELSCP] = __expectString(output[_ELSCP]);
    }
    if (output.Metrics === "") {
        contents[_M] = [];
    }
    else if (output[_M] != null && output[_M][_m] != null) {
        contents[_M] = de_MetricDataQueries(__getArrayIfSingleItem(output[_M][_m]), context);
    }
    if (output[_TMI] != null) {
        contents[_TMI] = __expectString(output[_TMI]);
    }
    if (output[_ESv] != null) {
        contents[_ESv] = __expectString(output[_ESv]);
    }
    if (output[_STT] != null) {
        contents[_STT] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_STT]));
    }
    return contents;
};
const de_MetricAlarms = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricAlarm(entry, context);
    });
};
const de_MetricDataQueries = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricDataQuery(entry, context);
    });
};
const de_MetricDataQuery = (output, context) => {
    const contents = {};
    if (output[_I] != null) {
        contents[_I] = __expectString(output[_I]);
    }
    if (output[_MS] != null) {
        contents[_MS] = de_MetricStat(output[_MS], context);
    }
    if (output[_E] != null) {
        contents[_E] = __expectString(output[_E]);
    }
    if (output[_L] != null) {
        contents[_L] = __expectString(output[_L]);
    }
    if (output[_RD] != null) {
        contents[_RD] = __parseBoolean(output[_RD]);
    }
    if (output[_P] != null) {
        contents[_P] = __strictParseInt32(output[_P]);
    }
    if (output[_AI] != null) {
        contents[_AI] = __expectString(output[_AI]);
    }
    return contents;
};
const de_MetricDataResult = (output, context) => {
    const contents = {};
    if (output[_I] != null) {
        contents[_I] = __expectString(output[_I]);
    }
    if (output[_L] != null) {
        contents[_L] = __expectString(output[_L]);
    }
    if (output.Timestamps === "") {
        contents[_Tim] = [];
    }
    else if (output[_Tim] != null && output[_Tim][_m] != null) {
        contents[_Tim] = de_Timestamps(__getArrayIfSingleItem(output[_Tim][_m]), context);
    }
    if (output.Values === "") {
        contents[_Val] = [];
    }
    else if (output[_Val] != null && output[_Val][_m] != null) {
        contents[_Val] = de_DatapointValues(__getArrayIfSingleItem(output[_Val][_m]), context);
    }
    if (output[_SCt] != null) {
        contents[_SCt] = __expectString(output[_SCt]);
    }
    if (output.Messages === "") {
        contents[_Mess] = [];
    }
    else if (output[_Mess] != null && output[_Mess][_m] != null) {
        contents[_Mess] = de_MetricDataResultMessages(__getArrayIfSingleItem(output[_Mess][_m]), context);
    }
    return contents;
};
const de_MetricDataResultMessages = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MessageData(entry, context);
    });
};
const de_MetricDataResults = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricDataResult(entry, context);
    });
};
const de_MetricMathAnomalyDetector = (output, context) => {
    const contents = {};
    if (output.MetricDataQueries === "") {
        contents[_MDQ] = [];
    }
    else if (output[_MDQ] != null && output[_MDQ][_m] != null) {
        contents[_MDQ] = de_MetricDataQueries(__getArrayIfSingleItem(output[_MDQ][_m]), context);
    }
    return contents;
};
const de_Metrics = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Metric(entry, context);
    });
};
const de_MetricStat = (output, context) => {
    const contents = {};
    if (output[_Me] != null) {
        contents[_Me] = de_Metric(output[_Me], context);
    }
    if (output[_P] != null) {
        contents[_P] = __strictParseInt32(output[_P]);
    }
    if (output[_S] != null) {
        contents[_S] = __expectString(output[_S]);
    }
    if (output[_U] != null) {
        contents[_U] = __expectString(output[_U]);
    }
    return contents;
};
const de_MetricStreamEntries = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricStreamEntry(entry, context);
    });
};
const de_MetricStreamEntry = (output, context) => {
    const contents = {};
    if (output[_Ar] != null) {
        contents[_Ar] = __expectString(output[_Ar]);
    }
    if (output[_CD] != null) {
        contents[_CD] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_CD]));
    }
    if (output[_LUD] != null) {
        contents[_LUD] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_LUD]));
    }
    if (output[_Na] != null) {
        contents[_Na] = __expectString(output[_Na]);
    }
    if (output[_FA] != null) {
        contents[_FA] = __expectString(output[_FA]);
    }
    if (output[_Stat] != null) {
        contents[_Stat] = __expectString(output[_Stat]);
    }
    if (output[_OF] != null) {
        contents[_OF] = __expectString(output[_OF]);
    }
    return contents;
};
const de_MetricStreamFilter = (output, context) => {
    const contents = {};
    if (output[_N] != null) {
        contents[_N] = __expectString(output[_N]);
    }
    if (output.MetricNames === "") {
        contents[_MNe] = [];
    }
    else if (output[_MNe] != null && output[_MNe][_m] != null) {
        contents[_MNe] = de_MetricStreamFilterMetricNames(__getArrayIfSingleItem(output[_MNe][_m]), context);
    }
    return contents;
};
const de_MetricStreamFilterMetricNames = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectString(entry);
    });
};
const de_MetricStreamFilters = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricStreamFilter(entry, context);
    });
};
const de_MetricStreamStatisticsAdditionalStatistics = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectString(entry);
    });
};
const de_MetricStreamStatisticsConfiguration = (output, context) => {
    const contents = {};
    if (output.IncludeMetrics === "") {
        contents[_IM] = [];
    }
    else if (output[_IM] != null && output[_IM][_m] != null) {
        contents[_IM] = de_MetricStreamStatisticsIncludeMetrics(__getArrayIfSingleItem(output[_IM][_m]), context);
    }
    if (output.AdditionalStatistics === "") {
        contents[_AS] = [];
    }
    else if (output[_AS] != null && output[_AS][_m] != null) {
        contents[_AS] = de_MetricStreamStatisticsAdditionalStatistics(__getArrayIfSingleItem(output[_AS][_m]), context);
    }
    return contents;
};
const de_MetricStreamStatisticsConfigurations = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricStreamStatisticsConfiguration(entry, context);
    });
};
const de_MetricStreamStatisticsIncludeMetrics = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_MetricStreamStatisticsMetric(entry, context);
    });
};
const de_MetricStreamStatisticsMetric = (output, context) => {
    const contents = {};
    if (output[_N] != null) {
        contents[_N] = __expectString(output[_N]);
    }
    if (output[_MN] != null) {
        contents[_MN] = __expectString(output[_MN]);
    }
    return contents;
};
const de_MissingRequiredParameterException = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_OwningAccounts = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectString(entry);
    });
};
const de_PartialFailure = (output, context) => {
    const contents = {};
    if (output[_FR] != null) {
        contents[_FR] = __expectString(output[_FR]);
    }
    if (output[_ETx] != null) {
        contents[_ETx] = __expectString(output[_ETx]);
    }
    if (output[_FC] != null) {
        contents[_FC] = __expectString(output[_FC]);
    }
    if (output[_FD] != null) {
        contents[_FD] = __expectString(output[_FD]);
    }
    return contents;
};
const de_PutAnomalyDetectorOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_PutDashboardOutput = (output, context) => {
    const contents = {};
    if (output.DashboardValidationMessages === "") {
        contents[_DVM] = [];
    }
    else if (output[_DVM] != null && output[_DVM][_m] != null) {
        contents[_DVM] = de_DashboardValidationMessages(__getArrayIfSingleItem(output[_DVM][_m]), context);
    }
    return contents;
};
const de_PutInsightRuleOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_PutManagedInsightRulesOutput = (output, context) => {
    const contents = {};
    if (output.Failures === "") {
        contents[_F] = [];
    }
    else if (output[_F] != null && output[_F][_m] != null) {
        contents[_F] = de_BatchFailures(__getArrayIfSingleItem(output[_F][_m]), context);
    }
    return contents;
};
const de_PutMetricStreamOutput = (output, context) => {
    const contents = {};
    if (output[_Ar] != null) {
        contents[_Ar] = __expectString(output[_Ar]);
    }
    return contents;
};
const de_Range = (output, context) => {
    const contents = {};
    if (output[_ST] != null) {
        contents[_ST] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_ST]));
    }
    if (output[_ET] != null) {
        contents[_ET] = __expectNonNull(__parseRfc3339DateTimeWithOffset(output[_ET]));
    }
    return contents;
};
const de_ResourceList = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectString(entry);
    });
};
const de_ResourceNotFound = (output, context) => {
    const contents = {};
    if (output[_me] != null) {
        contents[_me] = __expectString(output[_me]);
    }
    return contents;
};
const de_ResourceNotFoundException = (output, context) => {
    const contents = {};
    if (output[_RT] != null) {
        contents[_RT] = __expectString(output[_RT]);
    }
    if (output[_RI] != null) {
        contents[_RI] = __expectString(output[_RI]);
    }
    if (output[_Mes] != null) {
        contents[_Mes] = __expectString(output[_Mes]);
    }
    return contents;
};
const de_SingleMetricAnomalyDetector = (output, context) => {
    const contents = {};
    if (output[_N] != null) {
        contents[_N] = __expectString(output[_N]);
    }
    if (output[_MN] != null) {
        contents[_MN] = __expectString(output[_MN]);
    }
    if (output.Dimensions === "") {
        contents[_D] = [];
    }
    else if (output[_D] != null && output[_D][_m] != null) {
        contents[_D] = de_Dimensions(__getArrayIfSingleItem(output[_D][_m]), context);
    }
    if (output[_S] != null) {
        contents[_S] = __expectString(output[_S]);
    }
    return contents;
};
const de_StartMetricStreamsOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_StopMetricStreamsOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_Tag = (output, context) => {
    const contents = {};
    if (output[_K] != null) {
        contents[_K] = __expectString(output[_K]);
    }
    if (output[_Va] != null) {
        contents[_Va] = __expectString(output[_Va]);
    }
    return contents;
};
const de_TagList = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return de_Tag(entry, context);
    });
};
const de_TagResourceOutput = (output, context) => {
    const contents = {};
    return contents;
};
const de_Timestamps = (output, context) => {
    return (output || [])
        .filter((e) => e != null)
        .map((entry) => {
        return __expectNonNull(__parseRfc3339DateTimeWithOffset(entry));
    });
};
const de_UntagResourceOutput = (output, context) => {
    const contents = {};
    return contents;
};
const deserializeMetadata = (output) => ({
    httpStatusCode: output.statusCode,
    requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
    extendedRequestId: output.headers["x-amz-id-2"],
    cfId: output.headers["x-amz-cf-id"],
});
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
const throwDefaultError = withBaseException(__BaseException);
const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
    const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
    const contents = {
        protocol,
        hostname,
        port,
        method: "POST",
        path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
        headers,
    };
    if (resolvedHostname !== undefined) {
        contents.hostname = resolvedHostname;
    }
    if (body !== undefined) {
        contents.body = body;
    }
    return new __HttpRequest(contents);
};
const SHARED_HEADERS = {
    "content-type": "application/x-www-form-urlencoded",
};
const _ = "2010-08-01";
const _A = "Action";
const _AA = "AlarmActions";
const _AAV = "ApproximateAggregateValue";
const _AAl = "AlarmArn";
const _ACUT = "AlarmConfigurationUpdatedTimestamp";
const _AD = "AlarmDescription";
const _ADT = "AnomalyDetectorTypes";
const _ADn = "AnomalyDetectors";
const _AE = "ActionsEnabled";
const _AHI = "AlarmHistoryItems";
const _AI = "AccountId";
const _AN = "AlarmNames";
const _ANP = "AlarmNamePrefix";
const _ANl = "AlarmName";
const _AP = "ActionPrefix";
const _AR = "AlarmRule";
const _AS = "AdditionalStatistics";
const _ASB = "ActionsSuppressedBy";
const _ASEP = "ActionsSuppressorExtensionPeriod";
const _ASR = "ActionsSuppressedReason";
const _ASWP = "ActionsSuppressorWaitPeriod";
const _ASc = "ActionsSuppressor";
const _ASg = "AggregationStatistic";
const _AT = "AlarmTypes";
const _ATl = "AlarmType";
const _AUC = "ApproximateUniqueCount";
const _AV = "AggregateValue";
const _AVp = "ApproximateValue";
const _Ar = "Arn";
const _Av = "Average";
const _C = "Counts";
const _CA = "CompositeAlarms";
const _CD = "CreationDate";
const _CO = "ComparisonOperator";
const _COAN = "ChildrenOfAlarmName";
const _Co = "Configuration";
const _Cod = "Code";
const _Con = "Contributors";
const _D = "Dimensions";
const _DA = "DeleteAlarms";
const _DAA = "DisableAlarmActions";
const _DAD = "DeleteAnomalyDetector";
const _DADe = "DescribeAnomalyDetectors";
const _DAFM = "DescribeAlarmsForMetric";
const _DAH = "DescribeAlarmHistory";
const _DAa = "DashboardArn";
const _DAe = "DescribeAlarms";
const _DB = "DashboardBody";
const _DD = "DeleteDashboards";
const _DE = "DashboardEntries";
const _DIR = "DeleteInsightRules";
const _DIRe = "DescribeInsightRules";
const _DIRi = "DisableInsightRules";
const _DMS = "DeleteMetricStream";
const _DN = "DashboardNames";
const _DNP = "DashboardNamePrefix";
const _DNa = "DashboardName";
const _DP = "DataPath";
const _DTA = "DatapointsToAlarm";
const _DVM = "DashboardValidationMessages";
const _Da = "Datapoints";
const _De = "Definition";
const _E = "Expression";
const _EAA = "EnableAlarmActions";
const _ED = "EndDate";
const _EF = "ExcludeFilters";
const _EIR = "EnableInsightRules";
const _ELSCP = "EvaluateLowSampleCountPercentile";
const _EP = "EvaluationPeriods";
const _ES = "ExtendedStatistic";
const _ESv = "EvaluationState";
const _ESx = "ExtendedStatistics";
const _ET = "EndTime";
const _ETR = "ExcludedTimeRanges";
const _ETx = "ExceptionType";
const _En = "Entries";
const _F = "Failures";
const _FA = "FirehoseArn";
const _FC = "FailureCode";
const _FD = "FailureDescription";
const _FR = "FailureResource";
const _GD = "GetDashboard";
const _GIRR = "GetInsightRuleReport";
const _GMD = "GetMetricData";
const _GMS = "GetMetricStatistics";
const _GMSe = "GetMetricStream";
const _GMWI = "GetMetricWidgetImage";
const _HD = "HistoryData";
const _HIT = "HistoryItemType";
const _HS = "HistorySummary";
const _I = "Id";
const _IDA = "InsufficientDataActions";
const _IF = "IncludeFilters";
const _ILA = "IncludeLinkedAccounts";
const _ILAM = "IncludeLinkedAccountsMetrics";
const _IM = "IncludeMetrics";
const _IR = "InsightRules";
const _K = "Key";
const _KL = "KeyLabels";
const _Ke = "Keys";
const _L = "Label";
const _LD = "ListDashboards";
const _LM = "ListMetrics";
const _LMIR = "ListManagedInsightRules";
const _LMS = "ListMetricStreams";
const _LMa = "LastModified";
const _LO = "LabelOptions";
const _LTFR = "ListTagsForResource";
const _LUD = "LastUpdateDate";
const _M = "Metrics";
const _MA = "MetricAlarms";
const _MCC = "MaxContributorCount";
const _MCV = "MaxContributorValue";
const _MD = "MaxDatapoints";
const _MDQ = "MetricDataQueries";
const _MDR = "MetricDataResults";
const _MDe = "MetricData";
const _MDet = "MetricDatapoints";
const _MMAD = "MetricMathAnomalyDetector";
const _MN = "MetricName";
const _MNe = "MetricNames";
const _MR = "MaxRecords";
const _MRa = "MaxResults";
const _MRan = "ManagedRules";
const _MRana = "ManagedRule";
const _MS = "MetricStat";
const _MT = "MetricTimezone";
const _MW = "MetricWidget";
const _MWI = "MetricWidgetImage";
const _Ma = "Maximum";
const _Me = "Metric";
const _Mes = "Message";
const _Mess = "Messages";
const _Mi = "Minimum";
const _N = "Namespace";
const _NT = "NextToken";
const _Na = "Name";
const _Nam = "Names";
const _OA = "OwningAccount";
const _OAw = "OwningAccounts";
const _OB = "OrderBy";
const _OF = "OutputFormat";
const _OKA = "OKActions";
const _P = "Period";
const _PAD = "PutAnomalyDetector";
const _PCA = "PutCompositeAlarm";
const _PD = "PutDashboard";
const _PIR = "PutInsightRule";
const _PMA = "PutMetricAlarm";
const _PMD = "PutMetricData";
const _PMIR = "PutManagedInsightRules";
const _PMS = "PutMetricStream";
const _POAN = "ParentsOfAlarmName";
const _RA = "RecentlyActive";
const _RARN = "ResourceARN";
const _RAo = "RoleArn";
const _RD = "ReturnData";
const _RDu = "RuleDefinition";
const _RI = "ResourceId";
const _RN = "RuleNames";
const _RNu = "RuleName";
const _RS = "RuleState";
const _RT = "ResourceType";
const _S = "Stat";
const _SAS = "SetAlarmState";
const _SB = "ScanBy";
const _SC = "StatisticsConfigurations";
const _SCa = "SampleCount";
const _SCt = "StatusCode";
const _SD = "StartDate";
const _SMAD = "SingleMetricAnomalyDetector";
const _SMS = "StartMetricStreams";
const _SMSt = "StopMetricStreams";
const _SR = "StorageResolution";
const _SRD = "StateReasonData";
const _SRt = "StateReason";
const _ST = "StartTime";
const _STT = "StateTransitionedTimestamp";
const _SUT = "StateUpdatedTimestamp";
const _SV = "StateValue";
const _SVt = "StatisticValues";
const _Sc = "Schema";
const _Si = "Size";
const _St = "Statistic";
const _Sta = "Statistics";
const _Stat = "State";
const _Su = "Sum";
const _T = "Timezone";
const _TK = "TagKeys";
const _TMD = "TreatMissingData";
const _TMI = "ThresholdMetricId";
const _TN = "TemplateName";
const _TR = "TagResource";
const _Ta = "Tags";
const _Th = "Threshold";
const _Ti = "Timestamp";
const _Tim = "Timestamps";
const _U = "Unit";
const _UC = "UniqueContributors";
const _UR = "UntagResource";
const _V = "Version";
const _Va = "Value";
const _Val = "Values";
const _dVM = "dashboardValidationMessages";
const _e = "entry";
const _m = "member";
const _me = "message";
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
    if (encoded.length) {
        const parser = new XMLParser({
            attributeNamePrefix: "",
            htmlEntities: true,
            ignoreAttributes: false,
            ignoreDeclaration: true,
            parseTagValue: false,
            trimValues: false,
            tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
        });
        parser.addEntity("#xD", "\r");
        parser.addEntity("#10", "\n");
        const parsedObj = parser.parse(encoded);
        const textNodeName = "#text";
        const key = Object.keys(parsedObj)[0];
        const parsedObjToReturn = parsedObj[key];
        if (parsedObjToReturn[textNodeName]) {
            parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
            delete parsedObjToReturn[textNodeName];
        }
        return __getValueFromTextNode(parsedObjToReturn);
    }
    return {};
});
const parseErrorBody = async (errorBody, context) => {
    const value = await parseBody(errorBody, context);
    if (value.Error) {
        value.Error.message = value.Error.message ?? value.Error.Message;
    }
    return value;
};
const buildFormUrlencodedString = (formEntries) => Object.entries(formEntries)
    .map(([key, value]) => __extendedEncodeURIComponent(key) + "=" + __extendedEncodeURIComponent(value))
    .join("&");
const loadQueryErrorCode = (output, data) => {
    if (data.Error?.Code !== undefined) {
        return data.Error.Code;
    }
    if (output.statusCode == 404) {
        return "NotFound";
    }
};
