internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExternalPayload): ExternalPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* org.apache.beam.model.pipeline.v1.ApiServiceDescriptor endpoint */ 1:
                    message.endpoint = ApiServiceDescriptor.internalBinaryRead(reader, reader.uint32(), options, message.endpoint);
                    break;
                case /* map<string, string> params */ 2:
                    this.binaryReadMap2(message.params, reader, options);
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


private binaryReadMap2(map: ExternalPayload["params"], reader: IBinaryReader, options: BinaryReadOptions): void {
        let len = reader.uint32(), end = reader.pos + len, key: keyof ExternalPayload["params"] | undefined, val: ExternalPayload["params"][any] | undefined;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case 1:
                    key = reader.string();
                    break;
                case 2:
                    val = reader.string();
                    break;
                default: throw new globalThis.Error("unknown map entry field for field org.apache.beam.model.pipeline.v1.ExternalPayload.params");
            }
        }
        map[key ?? ""] = val ?? "";
    }


internalBinaryWrite(message: ExternalPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* org.apache.beam.model.pipeline.v1.ApiServiceDescriptor endpoint = 1; */
        if (message.endpoint)
            ApiServiceDescriptor.internalBinaryWrite(message.endpoint, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* map<string, string> params = 2; */
        for (let k of Object.keys(message.params))
            writer.tag(2, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.params[k]).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<StandardProtocols>): StandardProtocols {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<StandardProtocols>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StandardProtocols): StandardProtocols {
        return target ?? this.create();
    }


internalBinaryWrite(message: StandardProtocols, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<StandardRunnerProtocols>): StandardRunnerProtocols {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<StandardRunnerProtocols>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StandardRunnerProtocols): StandardRunnerProtocols {
        return target ?? this.create();
    }


internalBinaryWrite(message: StandardRunnerProtocols, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<StandardRequirements>): StandardRequirements {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<StandardRequirements>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StandardRequirements): StandardRequirements {
        return target ?? this.create();
    }


internalBinaryWrite(message: StandardRequirements, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<FunctionSpec>): FunctionSpec {
        const message = { urn: "", payload: new Uint8Array(0) };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<FunctionSpec>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: FunctionSpec): FunctionSpec {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string urn */ 1:
                    message.urn = reader.string();
                    break;
                case /* bytes payload */ 3:
                    message.payload = reader.bytes();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: FunctionSpec, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string urn = 1; */
        if (message.urn !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.urn);
        /* bytes payload = 3; */
        if (message.payload.length)
            writer.tag(3, WireType.LengthDelimited).bytes(message.payload);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<StandardDisplayData>): StandardDisplayData {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<StandardDisplayData>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StandardDisplayData): StandardDisplayData {
        return target ?? this.create();
    }


internalBinaryWrite(message: StandardDisplayData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<LabelledPayload>): LabelledPayload {
        const message = { label: "", value: { oneofKind: undefined }, key: "", namespace: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<LabelledPayload>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LabelledPayload): LabelledPayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string label */ 1:
                    message.label = reader.string();
                    break;
                case /* string string_value */ 2:
                    message.value = {
                        oneofKind: "stringValue",
                        stringValue: reader.string()
                    };
                    break;
                case /* bool bool_value */ 3:
                    message.value = {
                        oneofKind: "boolValue",
                        boolValue: reader.bool()
                    };
                    break;
                case /* double double_value */ 4:
                    message.value = {
                        oneofKind: "doubleValue",
                        doubleValue: reader.double()
                    };
                    break;
                case /* int64 int_value */ 5:
                    message.value = {
                        oneofKind: "intValue",
                        intValue: reader.int64().toBigInt()
                    };
                    break;
                case /* string key */ 6:
                    message.key = reader.string();
                    break;
                case /* string namespace */ 7:
                    message.namespace = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: LabelledPayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string label = 1; */
        if (message.label !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.label);
        /* string string_value = 2; */
        if (message.value.oneofKind === "stringValue")
            writer.tag(2, WireType.LengthDelimited).string(message.value.stringValue);
        /* bool bool_value = 3; */
        if (message.value.oneofKind === "boolValue")
            writer.tag(3, WireType.Varint).bool(message.value.boolValue);
        /* double double_value = 4; */
        if (message.value.oneofKind === "doubleValue")
            writer.tag(4, WireType.Bit64).double(message.value.doubleValue);
        /* int64 int_value = 5; */
        if (message.value.oneofKind === "intValue")
            writer.tag(5, WireType.Varint).int64(message.value.intValue);
        /* string key = 6; */
        if (message.key !== "")
            writer.tag(6, WireType.LengthDelimited).string(message.key);
        /* string namespace = 7; */
        if (message.namespace !== "")
            writer.tag(7, WireType.LengthDelimited).string(message.namespace);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<DisplayData>): DisplayData {
        const message = { urn: "", payload: new Uint8Array(0) };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<DisplayData>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DisplayData): DisplayData {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string urn */ 1:
                    message.urn = reader.string();
                    break;
                case /* bytes payload */ 2:
                    message.payload = reader.bytes();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: DisplayData, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string urn = 1; */
        if (message.urn !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.urn);
        /* bytes payload = 2; */
        if (message.payload.length)
            writer.tag(2, WireType.LengthDelimited).bytes(message.payload);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<MessageWithComponents>): MessageWithComponents {
        const message = { root: { oneofKind: undefined } };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<MessageWithComponents>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MessageWithComponents): MessageWithComponents {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* org.apache.beam.model.pipeline.v1.Components components */ 1:
                    message.components = Components.internalBinaryRead(reader, reader.uint32(), options, message.components);
                    break;
                case /* org.apache.beam.model.pipeline.v1.Coder coder */ 2:
                    message.root = {
                        oneofKind: "coder",
                        coder: Coder.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).coder)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.CombinePayload combine_payload */ 3:
                    message.root = {
                        oneofKind: "combinePayload",
                        combinePayload: CombinePayload.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).combinePayload)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.FunctionSpec function_spec */ 4:
                    message.root = {
                        oneofKind: "functionSpec",
                        functionSpec: FunctionSpec.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).functionSpec)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.ParDoPayload par_do_payload */ 6:
                    message.root = {
                        oneofKind: "parDoPayload",
                        parDoPayload: ParDoPayload.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).parDoPayload)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.PTransform ptransform */ 7:
                    message.root = {
                        oneofKind: "ptransform",
                        ptransform: PTransform.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).ptransform)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.PCollection pcollection */ 8:
                    message.root = {
                        oneofKind: "pcollection",
                        pcollection: PCollection.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).pcollection)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.ReadPayload read_payload */ 9:
                    message.root = {
                        oneofKind: "readPayload",
                        readPayload: ReadPayload.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).readPayload)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.SideInput side_input */ 11:
                    message.root = {
                        oneofKind: "sideInput",
                        sideInput: SideInput.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).sideInput)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.WindowIntoPayload window_into_payload */ 12:
                    message.root = {
                        oneofKind: "windowIntoPayload",
                        windowIntoPayload: WindowIntoPayload.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).windowIntoPayload)
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.WindowingStrategy windowing_strategy */ 13:
                    message.root = {
                        oneofKind: "windowingStrategy",
                        windowingStrategy: WindowingStrategy.internalBinaryRead(reader, reader.uint32(), options, (message.root as any).windowingStrategy)
                    };
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: MessageWithComponents, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* org.apache.beam.model.pipeline.v1.Components components = 1; */
        if (message.components)
            Components.internalBinaryWrite(message.components, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.Coder coder = 2; */
        if (message.root.oneofKind === "coder")
            Coder.internalBinaryWrite(message.root.coder, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.CombinePayload combine_payload = 3; */
        if (message.root.oneofKind === "combinePayload")
            CombinePayload.internalBinaryWrite(message.root.combinePayload, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.FunctionSpec function_spec = 4; */
        if (message.root.oneofKind === "functionSpec")
            FunctionSpec.internalBinaryWrite(message.root.functionSpec, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.ParDoPayload par_do_payload = 6; */
        if (message.root.oneofKind === "parDoPayload")
            ParDoPayload.internalBinaryWrite(message.root.parDoPayload, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.PTransform ptransform = 7; */
        if (message.root.oneofKind === "ptransform")
            PTransform.internalBinaryWrite(message.root.ptransform, writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.PCollection pcollection = 8; */
        if (message.root.oneofKind === "pcollection")
            PCollection.internalBinaryWrite(message.root.pcollection, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.ReadPayload read_payload = 9; */
        if (message.root.oneofKind === "readPayload")
            ReadPayload.internalBinaryWrite(message.root.readPayload, writer.tag(9, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.SideInput side_input = 11; */
        if (message.root.oneofKind === "sideInput")
            SideInput.internalBinaryWrite(message.root.sideInput, writer.tag(11, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.WindowIntoPayload window_into_payload = 12; */
        if (message.root.oneofKind === "windowIntoPayload")
            WindowIntoPayload.internalBinaryWrite(message.root.windowIntoPayload, writer.tag(12, WireType.LengthDelimited).fork(), options).join();
        /* org.apache.beam.model.pipeline.v1.WindowingStrategy windowing_strategy = 13; */
        if (message.root.oneofKind === "windowingStrategy")
            WindowingStrategy.internalBinaryWrite(message.root.windowingStrategy, writer.tag(13, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<ExecutableStagePayload>): ExecutableStagePayload {
        const message = { wireCoderSettings: [], input: "", sideInputs: [], transforms: [], outputs: [], userStates: [], timers: [], timerFamilies: [] };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ExecutableStagePayload>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExecutableStagePayload): ExecutableStagePayload {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* org.apache.beam.model.pipeline.v1.Environment environment */ 1:
                    message.environment = Environment.internalBinaryRead(reader, reader.uint32(), options, message.environment);
                    break;
                case /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.WireCoderSetting wire_coder_settings */ 9:
                    message.wireCoderSettings.push(ExecutableStagePayload_WireCoderSetting.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* string input */ 2:
                    message.input = reader.string();
                    break;
                case /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.SideInputId side_inputs */ 3:
                    message.sideInputs.push(ExecutableStagePayload_SideInputId.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated string transforms */ 4:
                    message.transforms.push(reader.string());
                    break;
                case /* repeated string outputs */ 5:
                    message.outputs.push(reader.string());
                    break;
                case /* org.apache.beam.model.pipeline.v1.Components components */ 6:
                    message.components = Components.internalBinaryRead(reader, reader.uint32(), options, message.components);
                    break;
                case /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.UserStateId user_states */ 7:
                    message.userStates.push(ExecutableStagePayload_UserStateId.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.TimerId timers */ 8:
                    message.timers.push(ExecutableStagePayload_TimerId.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                case /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.TimerFamilyId timerFamilies */ 10:
                    message.timerFamilies.push(ExecutableStagePayload_TimerFamilyId.internalBinaryRead(reader, reader.uint32(), options));
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: ExecutableStagePayload, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* org.apache.beam.model.pipeline.v1.Environment environment = 1; */
        if (message.environment)
            Environment.internalBinaryWrite(message.environment, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
        /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.WireCoderSetting wire_coder_settings = 9; */
        for (let i = 0; i < message.wireCoderSettings.length; i++)
            ExecutableStagePayload_WireCoderSetting.internalBinaryWrite(message.wireCoderSettings[i], writer.tag(9, WireType.LengthDelimited).fork(), options).join();
        /* string input = 2; */
        if (message.input !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.input);
        /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.SideInputId side_inputs = 3; */
        for (let i = 0; i < message.sideInputs.length; i++)
            ExecutableStagePayload_SideInputId.internalBinaryWrite(message.sideInputs[i], writer.tag(3, WireType.LengthDelimited).fork(), options).join();
        /* repeated string transforms = 4; */
        for (let i = 0; i < message.transforms.length; i++)
            writer.tag(4, WireType.LengthDelimited).string(message.transforms[i]);
        /* repeated string outputs = 5; */
        for (let i = 0; i < message.outputs.length; i++)
            writer.tag(5, WireType.LengthDelimited).string(message.outputs[i]);
        /* org.apache.beam.model.pipeline.v1.Components components = 6; */
        if (message.components)
            Components.internalBinaryWrite(message.components, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
        /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.UserStateId user_states = 7; */
        for (let i = 0; i < message.userStates.length; i++)
            ExecutableStagePayload_UserStateId.internalBinaryWrite(message.userStates[i], writer.tag(7, WireType.LengthDelimited).fork(), options).join();
        /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.TimerId timers = 8; */
        for (let i = 0; i < message.timers.length; i++)
            ExecutableStagePayload_TimerId.internalBinaryWrite(message.timers[i], writer.tag(8, WireType.LengthDelimited).fork(), options).join();
        /* repeated org.apache.beam.model.pipeline.v1.ExecutableStagePayload.TimerFamilyId timerFamilies = 10; */
        for (let i = 0; i < message.timerFamilies.length; i++)
            ExecutableStagePayload_TimerFamilyId.internalBinaryWrite(message.timerFamilies[i], writer.tag(10, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<ExecutableStagePayload_SideInputId>): ExecutableStagePayload_SideInputId {
        const message = { transformId: "", localName: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ExecutableStagePayload_SideInputId>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExecutableStagePayload_SideInputId): ExecutableStagePayload_SideInputId {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string transform_id */ 1:
                    message.transformId = reader.string();
                    break;
                case /* string local_name */ 2:
                    message.localName = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: ExecutableStagePayload_SideInputId, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string transform_id = 1; */
        if (message.transformId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.transformId);
        /* string local_name = 2; */
        if (message.localName !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.localName);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<ExecutableStagePayload_UserStateId>): ExecutableStagePayload_UserStateId {
        const message = { transformId: "", localName: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ExecutableStagePayload_UserStateId>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExecutableStagePayload_UserStateId): ExecutableStagePayload_UserStateId {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string transform_id */ 1:
                    message.transformId = reader.string();
                    break;
                case /* string local_name */ 2:
                    message.localName = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: ExecutableStagePayload_UserStateId, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string transform_id = 1; */
        if (message.transformId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.transformId);
        /* string local_name = 2; */
        if (message.localName !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.localName);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<ExecutableStagePayload_TimerId>): ExecutableStagePayload_TimerId {
        const message = { transformId: "", localName: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ExecutableStagePayload_TimerId>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExecutableStagePayload_TimerId): ExecutableStagePayload_TimerId {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string transform_id */ 1:
                    message.transformId = reader.string();
                    break;
                case /* string local_name */ 2:
                    message.localName = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: ExecutableStagePayload_TimerId, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string transform_id = 1; */
        if (message.transformId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.transformId);
        /* string local_name = 2; */
        if (message.localName !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.localName);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<ExecutableStagePayload_TimerFamilyId>): ExecutableStagePayload_TimerFamilyId {
        const message = { transformId: "", localName: "" };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ExecutableStagePayload_TimerFamilyId>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExecutableStagePayload_TimerFamilyId): ExecutableStagePayload_TimerFamilyId {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string transform_id */ 1:
                    message.transformId = reader.string();
                    break;
                case /* string local_name */ 2:
                    message.localName = reader.string();
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: ExecutableStagePayload_TimerFamilyId, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string transform_id = 1; */
        if (message.transformId !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.transformId);
        /* string local_name = 2; */
        if (message.localName !== "")
            writer.tag(2, WireType.LengthDelimited).string(message.localName);
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<ExecutableStagePayload_WireCoderSetting>): ExecutableStagePayload_WireCoderSetting {
        const message = { urn: "", payload: new Uint8Array(0), target: { oneofKind: undefined } };
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<ExecutableStagePayload_WireCoderSetting>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExecutableStagePayload_WireCoderSetting): ExecutableStagePayload_WireCoderSetting {
        let message = target ?? this.create(), end = reader.pos + length;
        while (reader.pos < end) {
            let [fieldNo, wireType] = reader.tag();
            switch (fieldNo) {
                case /* string urn */ 1:
                    message.urn = reader.string();
                    break;
                case /* bytes payload */ 2:
                    message.payload = reader.bytes();
                    break;
                case /* string input_or_output_id */ 3:
                    message.target = {
                        oneofKind: "inputOrOutputId",
                        inputOrOutputId: reader.string()
                    };
                    break;
                case /* org.apache.beam.model.pipeline.v1.ExecutableStagePayload.TimerId timer */ 4:
                    message.target = {
                        oneofKind: "timer",
                        timer: ExecutableStagePayload_TimerId.internalBinaryRead(reader, reader.uint32(), options, (message.target as any).timer)
                    };
                    break;
                default:
                    let u = options.readUnknownField;
                    if (u === "throw")
                        throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
                    let d = reader.skip(wireType);
                    if (u !== false)
                        (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
            }
        }
        return message;
    }


internalBinaryWrite(message: ExecutableStagePayload_WireCoderSetting, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        /* string urn = 1; */
        if (message.urn !== "")
            writer.tag(1, WireType.LengthDelimited).string(message.urn);
        /* bytes payload = 2; */
        if (message.payload.length)
            writer.tag(2, WireType.LengthDelimited).bytes(message.payload);
        /* string input_or_output_id = 3; */
        if (message.target.oneofKind === "inputOrOutputId")
            writer.tag(3, WireType.LengthDelimited).string(message.target.inputOrOutputId);
        /* org.apache.beam.model.pipeline.v1.ExecutableStagePayload.TimerId timer = 4; */
        if (message.target.oneofKind === "timer")
            ExecutableStagePayload_TimerId.internalBinaryWrite(message.target.timer, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


create(value?: PartialMessage<StandardResourceHints>): StandardResourceHints {
        const message = {};
        globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
        if (value !== undefined)
            reflectionMergePartial<StandardResourceHints>(this, message, value);
        return message;
    }


internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: StandardResourceHints): StandardResourceHints {
        return target ?? this.create();
    }


internalBinaryWrite(message: StandardResourceHints, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
        let u = options.writeUnknownFields;
        if (u !== false)
            (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
        return writer;
    }


@define()
@singleton()
export class Manager4 extends BaseManager {

    @inject() manager3: Manager3

    public get name(): string {
        return this.constructor.name
    }
}


export interface AppChainInfo extends ChainInfo {
  readonly chainSymbolImageUrl?: string;
  readonly hideInUI?: boolean;
  readonly txExplorer?: {
    readonly name: string;
    readonly txUrl: string;
  };
}


/**
 * Takes an array of ValuedDefintions and returns a string based on supplied params.
 * @param sep seperator between name and type
 * @param joinOn string that each ValuedDefintion is joined on
 * @returns string of format <name> <sep> <type><joinOn>...
 */
export function mapVals(
  vd: ValuedDefinition[],
  sep: string,
  joinOn: string
): string {
  return vd
    .map(
      (vd) =>
        `${vd.name.value}${sep} ${expandType(
          vd.type,
          undefined,
          true,
          isReference(vd.annotations)
        )}`
    )
    .join(joinOn);
}


/**
 * Return default value for a FieldDefinition. Default value of objects are instantiated.
 * @param fieldDef FieldDefinition Node to get default value of
 */
export function defValue(fieldDef: FieldDefinition): string {
  const name = fieldDef.name.value;
  const type = fieldDef.type;
  if (fieldDef.default) {
    let returnVal = fieldDef.default.getValue();
    if (fieldDef.type instanceof Named) {
      returnVal =
        (fieldDef.type as Named).Name.value == "string"
          ? strQuote(returnVal)
          : returnVal;
    }
    return returnVal;
  }

  switch (type.constructor) {
    case Optional:
      return "None";
    case List:
      return "Vec::new()";
    case Map:
      return "Map::new()";
    case Named:
      switch ((type as Named).Name.value) {
        case "ID":
        case "string":
          return '""';
        case "bool":
          return "false";
        case "i8":
        case "u8":
        case "i16":
        case "u16":
        case "i32":
        case "u32":
        case "i64":
        case "u64":
        case "f32":
        case "f64":
          return "0";
        case "bytes":
          return "Vec::new()";
        default:
          return `${capitalize(name)}()`; // reference to something else
      }
  }
  return `???${expandType(
    type,
    undefined,
    false,
    isReference(fieldDef.annotations)
  )}???`;
}


export function defaultValueForType(type: Type, packageName?: string): string {
  switch (type.constructor) {
    case Optional:
      return "None";
    case List:
      return "Vec::new()";
    case Map:
      return "Map::new()";
    case Named:
      switch ((type as Named).Name.value) {
        case "ID":
        case "string":
          return '"".to_string()';
        case "bool":
          return "false";
        case "i8":
        case "u8":
        case "i16":
        case "u16":
        case "i32":
        case "u32":
        case "i64":
        case "u64":
        case "f32":
        case "f64":
          return "0";
        case "bytes":
          return "Vec::new()";
        default:
          const prefix =
            packageName != undefined && packageName != ""
              ? packageName + "."
              : "";
          return `${prefix}${capitalize(
            (type as Named).Name.value
          )}::default()`; // reference to something else
      }
  }
  return "???";
}


/**
 * Determines if a node is a void node
 * @param t Node that is a Type node
 */
export function isVoid(t: Type): boolean {
  if (t instanceof Named) {
    return (t as Named).Name.value == "void";
  }
  return false;
}


/**
 * Determines if Type Node is a Named node and if its type is not one of the base translation types.
 * @param t Node that is a Type node
 */
export function isObject(t: Type): boolean {
  if (t instanceof Named) {
    return !primitives.has((t as Named).Name.value);
  }
  return false;
}


/**
 * Determines if one of the annotations provided is a reference
 * @param annotations array of Annotations
 */
export function isReference(annotations: Annotation[]): boolean {
  for (let annotation of annotations) {
    if (
      annotation.name.value == "ref" ||
      annotation.name.value == "reference"
    ) {
      return true;
    }
  }
  return false;
}


/**
 * Capitalizes a given string
 * @param str string to be capitlized
 * @returns string with first character capitalized. If empty string returns empty string.
 */
export function capitalize(str: string): string {
  if (str.length == 0) return str;
  if (str.length == 1) return str[0].toUpperCase();
  return str[0].toUpperCase() + str.slice(1);
}


export function functionName(str: string): string {
  return snakeCase(str);
}


export function fieldName(str: string): string {
  return snakeCase(str);
}


/**
 * Given an array of OperationDefintion returns them as functions with their arguments
 * @param ops
 */
export function opsAsFns(ops: OperationDefinition[]): string {
  return ops
    .map((op) => {
      return `func ${op.name.value}(${mapArgs(op.arguments)}) ${expandType(
        op.type,
        undefined,
        true,
        isReference(op.annotations)
      )} {\n}`;
    })
    .join("\n");
}


/**
 * returns string of args mapped to their type
 * @param args InputValueDefintion array which is an array of the arguments
 */
export function mapArgs(
  args: InputValueDefinition[],
  template: boolean = false
): string {
  return args
    .map((arg) => {
      return mapArg(arg, template);
    })
    .join(", ");
}


export function mapArg(
  arg: InputValueDefinition,
  template: boolean = false
): string {
  return (
    (template ? "_" : "") +
    `${arg.name.value}: ${expandType(
      arg.type,
      undefined,
      true,
      isReference(arg.annotations)
    )}`
  );
}


/**
 * returns if a widl type is a node
 * @param o ObjectDefintion which correlates to a widl Type
 */
export function isNode(o: ObjectDefinition): boolean {
  for (const field of o.fields) {
    if (field.name.value.toLowerCase() == "id") {
      return true;
    }
  }
  return false;
}


export function varAccessArg(
  variable: string,
  args: InputValueDefinition[]
): string {
  return args
    .map((arg) => {
      return `${variable}.${snakeCase(arg.name.value)}`;
    })
    .join(", ");
}


(vd) =>
        `${vd.name.value}${sep} ${expandType(
          vd.type,
          undefined,
          true,
          isReference(vd.annotations)
        )}`


(s: string) => {
  return `\"${s}\"`;
}


(
  type: Type,
  packageName: string | undefined,
  useOptional: boolean,
  isReference: boolean
): string => {
  switch (true) {
    case type instanceof Named:
      if (isReference) {
        return "String";
      }
      var namedValue = (type as Named).Name.value;
      const translation = translations.get(namedValue);
      if (translation != undefined) {
        return (namedValue = translation!);
      }
      if (isObject(type) && packageName != undefined && packageName != "") {
        return packageName + "." + namedValue;
      }
      return namedValue;
    case type instanceof Map:
      return `std::collections::HashMap<${expandType(
        (type as Map).keyType,
        packageName,
        true,
        isReference
      )}, ${expandType(
        (type as Map).valueType,
        packageName,
        true,
        isReference
      )}>`;
    case type instanceof List:
      return `Vec<${expandType(
        (type as List).type,
        packageName,
        true,
        isReference
      )}>`;
    case type instanceof Optional:
      const nestedType = (type as Optional).type;
      let expanded = expandType(nestedType, packageName, true, isReference);
      if (useOptional) {
        return `Option<${expanded}>`;
      }
      return expanded;
    default:
      return "unknown";
  }
}


(op) => {
      return `func ${op.name.value}(${mapArgs(op.arguments)}) ${expandType(
        op.type,
        undefined,
        true,
        isReference(op.annotations)
      )} {\n}`;
    }


(arg) => {
      return mapArg(arg, template);
    }


(arg) => {
      return `${variable}.${snakeCase(arg.name.value)}`;
    }


() => {
  return
Hello WOrld
;
}


export class Hero {
    id: number;
    name: string;
    weburl: string;
    imageurl: string;
}


export interface AlainSEConfig {
  /**
   * 大小，默认：`default`
   * - `compact` 紧凑型，强制忽略 `error`、`extra` 展示
   */
  size?: 'default' | 'compact';
  /**
   * 布局类型，等同 `nzLayout`，默认：`horizontal`
   * - `inline` 时强制大小为 `compact`
   */
  nzLayout?: 'horizontal' | 'vertical' | 'inline';
  /**
   * 间距，当 `nzLayout:horizontal` 时有效，默认：`32`
   */
  gutter?: number;
  /**
   * 列数，默认：`2`
   */
  col?: number;
  /**
   * 标签文本宽度，单位：`px`，默认：`150`
   */
  labelWidth?: number;
  /**
   * 是否立即呈现错误视觉，默认：`false`
   */
  firstVisual?: boolean;
}


/**
 * A list of public properties belonging to the Award class.
 * @type
 */
export type AwardField =
  | "abstract"
  | "cfdaNumber"
  | "date"
  | "estimatedTotalAmount"
  | "expirationDate"
  | "fundProgram"
  | "fundsObligatedAmount"
  | "id"
  | "primaryProgram"
  | "projectOutcomesReport"
  | "startDate"
  | "title"
  | "type";


/**
   * Outputs a list of response fields to be included in the request
   * @access public
   * @returns {string[]} List of response fields to be included in the request
   */
public build(): string[] {
    const outputFields: Parameter<boolean>[] = [
      this._abstract,
      this._cfdaNumber,
      this._date,
      this._estimatedTotalAmount,
      this._expirationDate,
      this._fundProgram,
      this._fundsObligatedAmount,
      this._id,
      this._primaryProgram,
      this._projectOutcomesReport,
      this._startDate,
      this._title,
      this._type,
    ];

    const enabledFields: string[] = [];
    for (const field of outputFields) {
      if (field.value === true) enabledFields.push(field.prefix);
    }

    return enabledFields;
  }


/**
   * Resets all properties to default values
   * @access public
   * @returns {void} void
   */
public reset(): void {
    Object.assign(this, new Award());
  }


@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class LibraryAdminUsersRoutingModule {
}


({ children, className }) => {
  return
{children}
;
}


interface Props {
  className?: string;
}


(theme) => ({
  dateInput: {
    borderRadius: 2,
    height: 40,
    padding: 1,
    fontSize: 14,
    fontWeight: 500,
    '& .MuiInputBase-input': {
      cursor: 'pointer',
    },
  },
  datepicker: {
    margin: 1,
  },
})


({
  required = false,
  disabled = false,
  value,
  setValue,
  placeholder,
  ...rest
}) => {
  const classes = useStyles();

  const handleDateChange = (date: any) => {
    setValue(date);
  };

  return (
    <LocalizationProvider dateAdapter={AdapterMoment}>
      <DatePicker
        {...rest}
        disabled={disabled}
        className={classes.datepicker}
        inputFormat="dd-MM-yyyy"
        value={value ? value : null}
        onChange={handleDateChange}
        renderInput={(params)


(date: any) => {
    setValue(date);
  }


interface Props {
  required?: boolean;
  value: string | undefined;
  setValue: (date: any) => void;
  placeholder?: string;
  disabled?: boolean;
}


@Component({
  selector: 'nel-space',
  templateUrl: './space.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
  host: {
    class: 'el-space',
    '[class.el-space--horizontal]': `nelDirection == 'horizontal'`,
    '[class.el-space--vertical]': `nelDirection == 'vertical'`,
    '[style.align-items]': 'nelAlignment',
    '[style.flex-wrap]': `nelWrap ? 'wrap' : ''`,
    '[style.margin-bottom]': `nelSpacer ? '' : '-' + size`,
  }
})

export class NelSpaceComponent {
  static ngAcceptInputType_nelWrap: BooleanInput;

  size = '8px';
  @ContentChildren(NelSpaceItemDirective, { read: TemplateRef }) items!: QueryList<TemplateRef<any>>;
  @Input() nelDirection: 'vertical' | 'horizontal' = 'horizontal';
  @Input() set nelSize(val: string | number | [number, number]) {
    let size = 0;
    if (typeof val === 'string') {
      switch (val) {
        case 'mini':
          size = 4;
          break;
        case 'small':
          size = 8;
          break;
        case 'medium':
          size = 12;
          break;
        case 'large':
          size = 16;
          break;
        default:
          size = 8;
          break;
      }
    } else if (typeof val === 'number') {
      size = val;
    } else {

    }
    this.size = size + 'px';
  }
  @Input() nelAlignment = 'center';
  @Input() @InputBoolean() nelWrap = false;
  @Input() nelSpacer?: string | TemplateRef<void>;
}


async function fetchData(): Promise<void> {
      const response = await api.get('daily');
      setDailyData(response.data);
    }


({ data, country }) => {
  const [dailyData, setDailyData] = useState<DailyDataState[]>([]);
  console.log('a');
  useEffect(() => {
    async function fetchData(): Promise<void> {
      const response = await api.get('daily');
      setDailyData(response.data);
    }
    fetchData();
  }, []);

  const lineChart = dailyData.length && (
    <Line
      data={{
        labels: dailyData.map(({ reportDate }) => reportDate),
        datasets: [
          {
            data: dailyData.map(({ confirmed }) => confirmed.total),
            label: 'Infected',
            borderColor: '#3333ff',
            fill: true,
          },
          {
            data: dailyData.map(({ deaths }) => deaths.total),
            label: 'Deaths',
            borderColor: 'red',
            backgroundColor: 'rgba(255, 0, 0, 0.5)',
            fill: true,
          },
        ],
      }


() => {
    async function fetchData(): Promise<void> {
      const response = await api.get('daily');
      setDailyData(response.data);
    }
    fetchData();
  }


({ reportDate }) => reportDate


({ confirmed }) => confirmed.total


({ deaths }) => deaths.total


interface DailyDataState {
  confirmed: {
    total: number;
  };
  deaths: {
    total: number;
  };
  reportDate: Date;
}


interface Data {
  confirmed: {
    value: number;
  };
  recovered: {
    value: number;
  };
  deaths: {
    value: number;
  };
  lastUpdate: Date;
}


interface ChartProps {
  data: Data;
  country: string;
}


props => {
  const {
    route = {
      routes: [],
    },
  } = props;
  const { routes = [] } = route;
  const {
    children,
    location = {
      pathname: '',
    },
  } = props;
  const { breadcrumb } = getMenuData(routes);
  const title = getPageTitle({
    pathname: location.pathname,
    breadcrumb,
    formatMessage,
    ...props,
  });
  return (
    <>
      <Helmet>
        <title>{title}</title>
        <meta name="description" content={title} />
      </Helmet>

        <HomeDrawer></HomeDrawer>

            <Link to="/">

              {/* Ant Design */}
            </Link>

          {/*
Ant Design 是西湖区最具影响力的 Web 设计规范
 */}

        {/*

          <SelectLang />

 */}

{children}

        <DefaultFooter />

    </>


({ settings }: ConnectState) => ({
  ...settings,
})


export interface UserLayoutProps extends ConnectProps {
  breadcrumbNameMap: { [path: string]: MenuDataItem };
}


declare function Label({ title, className, children }: ILabelProps): JSX.Element;


interface ILabelProps {
    title: string;
    className?: string;
    children: ReactElement<any>;
}


export interface AuthConfigType {
  port: number;
  host: string;
}


(props: any) => {
  return (
    <NumberInput
      parse={(value: string)


export function getJsonObj(obj: ConfigSourceRecord): object {
    const jsonObj = { ...obj, ...{} };

    if ("configSourceRecordType" in obj && obj.configSourceRecordType) {
      switch (obj.configSourceRecordType) {
        case "GIT_CONFIG_SOURCE":
          return model.GitConfigSourceRecord.getJsonObj(
            <model.GitConfigSourceRecord>(<object>jsonObj),
            true
          );
        case "ZIP_UPLOAD":
          return model.ZipUploadConfigSourceRecord.getJsonObj(
            <model.ZipUploadConfigSourceRecord>(<object>jsonObj),
            true
          );
        default:
          throw Error("Unknown value for: " + obj.configSourceRecordType);
      }
    }
    return jsonObj;
  }


/**
 * Information about the Terraform configuration.
 *
 */
export interface ConfigSourceRecord {
  "configSourceRecordType": string;
}


() => CaughtFilterComponent


(_: NetCaughtfilter) => {}


(_: any) => {}


() => {
      const rawData = this.transRawData(this.formGroup.value);
      this.propagateChange(rawData);
    }


(val) => {
      this.currIpProtocol = val;
      if (this.protocolFilter?.length) {
        this.handleIpOrPortState(this.protocolFilter, val);
      }
      this.protocalOptions = this.getProtocalOptions(val);
    }


(protocols: any[]) => {
        if (null == protocols) {
          return;
        }
        this.protocolFilter = protocols;
        this.handleIpOrPortState(protocols, this.currIpProtocol);
      }


(data: any, item: any) => {
      return data.filter((i: any) => {
        return item.some((j: any) => {
          return i === j;
        });
      });
    }


(i: any) => {
        return item.some((j: any) => {
          return i === j;
        });
      }


(j: any) => {
          return i === j;
        }


@Component({
  selector: 'app-caught-filter',
  templateUrl: './caught-filter.component.html',
  styleUrls: ['./caught-filter.component.scss'],
  providers: [
    {
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(() => CaughtFilterComponent),
      multi: true,
    },
    {
      provide: NG_VALIDATORS,
      useExisting: forwardRef(() => CaughtFilterComponent),
      multi: true,
    },
  ],
})
export class CaughtFilterComponent implements ControlValueAccessor {
  @Input()
  set caughtInfo(val: NetCaughtfilter) {
    if (null == val) {
      return;
    }
    this.patchFormValue(this.formGroup, val);
  }
  @Input() labelWidth: string;

  theme$: Observable<HyTheme>;
  formGroup: FormGroup;
  currIpProtocol = IpProtocolType.IPv4;
  ipProtocolTypeEnum = IpProtocolType;
  transDirectionEnum = TransDirection;
  protocolFilter: NetworkLayerProtocol[] | TransLayerProtocol[] = [];
  protocalOptions: {
    label: string;
    value: NetworkLayerProtocol | TransLayerProtocol;
  }[];

  private readonly ownPortProtocols = [
    TransLayerProtocol.UDP,
    TransLayerProtocol.TCP,
    NetworkLayerProtocol.IP,
    NetworkLayerProtocol.IP6,
  ];
  private propagateChange = (_: NetCaughtfilter) => {};
  private propagateTunched = (_: any) => {};

  constructor(private fb: FormBuilder, private themeService: HyThemeService) {
    this.formGroup = this.initFormGroup();

    this.formGroup.valueChanges.subscribe(() => {
      const rawData = this.transRawData(this.formGroup.value);
      this.propagateChange(rawData);
    });

    this.formGroup.get('protocolType').valueChanges.subscribe((val) => {
      this.currIpProtocol = val;
      if (this.protocolFilter?.length) {
        this.handleIpOrPortState(this.protocolFilter, val);
      }
      this.protocalOptions = this.getProtocalOptions(val);
    });

    this.formGroup
      .get('protocolFilter')
      .valueChanges.subscribe((protocols: any[]) => {
        if (null == protocols) {
          return;
        }
        this.protocolFilter = protocols;
        this.handleIpOrPortState(protocols, this.currIpProtocol);
      });

    this.protocalOptions = this.getProtocalOptions(IpProtocolType.IPv4);

    this.theme$ = this.themeService.getObservable();
  }

  writeValue(val: NetCaughtfilter) {
    this.caughtInfo = val;
  }

  registerOnChange(fn: any) {
    this.propagateChange = fn;
  }

  validate(ctl: FormControl) {
    return this.formGroup.valid ? null : { caughtInfo: { valid: false } };
  }

  registerOnTouched(fn: any) {
    this.propagateTunched = fn;
  }

  private initFormGroup() {
    return this.fb.group({
      protocolType: [IpProtocolType.IPv4],
      protocolFilter: [],
      IP1v4: [],
      IP1v6: [],
      port1: [],
      IP2v4: [],
      IP2v6: [],
      port2: [],
      direction: [],
    });
  }

  private patchFormValue(fg: FormGroup, info: NetCaughtfilter) {
    const { protocolType, protocolFilter, IP1, port1, IP2, port2, direction } =
      info;
    const fromData = {
      protocolType,
      protocolFilter,
      IP1v4: IpProtocolType.IPv4 === protocolType ? IP1 : undefined,
      IP1v6: IpProtocolType.IPv6 === protocolType ? IP1 : undefined,
      port1,
      IP2v4: IpProtocolType.IPv4 === protocolType ? IP2 : undefined,
      IP2v6: IpProtocolType.IPv6 === protocolType ? IP2 : undefined,
      port2,
      direction,
    };
    fg.patchValue(fromData);
  }

  private transRawData(fgValue: any): NetCaughtfilter {
    const {
      protocolType,
      protocolFilter,
      IP1v4,
      IP1v6,
      port1,
      IP2v4,
      IP2v6,
      port2,
      direction,
    } = fgValue;
    const rawData = {
      protocolType,
      protocolFilter,
      IP1: IpProtocolType.IPv4 === protocolType ? IP1v4 : IP1v6,
      port1,
      IP2: IpProtocolType.IPv4 === protocolType ? IP2v4 : IP2v6,
      port2,
      direction,
    };
    return rawData;
  }

  private getProtocalOptions(
    protocolType: IpProtocolType
  ): { label: string; value: NetworkLayerProtocol | TransLayerProtocol }[] {
    const baseOptions = [
      { label: 'ICMP', value: NetworkLayerProtocol.ICMP },
      { label: 'RARP', value: NetworkLayerProtocol.RARP },
      { label: 'ARP', value: NetworkLayerProtocol.ARP },
      { label: 'TCP', value: TransLayerProtocol.TCP },
      { label: 'UDP', value: TransLayerProtocol.UDP },
    ];

    const v4Options = [
      { label: 'IP', value: NetworkLayerProtocol.IP },
      ...baseOptions,
    ];
    const v6Options = [
      { label: 'IP6', value: NetworkLayerProtocol.IP6 },
      ...baseOptions,
    ];

    return IpProtocolType.IPv6 === protocolType ? v6Options : v4Options;
  }

  private takeIntersection(...twoDimenArr: any[][]): any[] {
    const res = twoDimenArr.reduce((data: any, item: any) => {
      return data.filter((i: any) => {
        return item.some((j: any) => {
          return i === j;
        });
      });
    });
    return res;
  }
  /**
   * 选择不同的协议，对ip和port的禁用
   * 当不包含ipv4/TCP/UDP时，IP不禁用，port禁用
   * 当不包含ipv6/TCP/UDP时，ip和port都禁用
   * @param protocols 协议
   * @param currIpProtocol ip类型
   */
  private handleIpOrPortState(
    protocols: NetworkLayerProtocol[] | TransLayerProtocol[],
    currIpProtocol: IpProtocolType
  ) {
    const hasIntersection =
      this.takeIntersection(this.ownPortProtocols, protocols).length > 0;
    const isNullProtocols = !protocols?.length;

    if (hasIntersection || isNullProtocols) {
      this.formGroup.get('port1').enable();
      this.formGroup.get('port2').enable();
      this.formGroup.get('IP1v6').enable();
      this.formGroup.get('IP2v6').enable();
    } else {
      this.formGroup.get('port1').disable();
      this.formGroup.get('port2').disable();
      if (IpProtocolType.IPv6 === currIpProtocol) {
        this.formGroup.get('IP1v6').disable();
        this.formGroup.get('IP2v6').disable();
      }
    }
  }
}


type NetCaughtfilter = NetioTaskForm['netCaught']['filterCondition'];


writeValue(val: NetCaughtfilter) {
    this.caughtInfo = val;
  }


registerOnChange(fn: any) {
    this.propagateChange = fn;
  }


validate(ctl: FormControl) {
    return this.formGroup.valid ? null : { caughtInfo: { valid: false } };
  }


registerOnTouched(fn: any) {
    this.propagateTunched = fn;
  }


private initFormGroup() {
    return this.fb.group({
      protocolType: [IpProtocolType.IPv4],
      protocolFilter: [],
      IP1v4: [],
      IP1v6: [],
      port1: [],
      IP2v4: [],
      IP2v6: [],
      port2: [],
      direction: [],
    });
  }


private patchFormValue(fg: FormGroup, info: NetCaughtfilter) {
    const { protocolType, protocolFilter, IP1, port1, IP2, port2, direction } =
      info;
    const fromData = {
      protocolType,
      protocolFilter,
      IP1v4: IpProtocolType.IPv4 === protocolType ? IP1 : undefined,
      IP1v6: IpProtocolType.IPv6 === protocolType ? IP1 : undefined,
      port1,
      IP2v4: IpProtocolType.IPv4 === protocolType ? IP2 : undefined,
      IP2v6: IpProtocolType.IPv6 === protocolType ? IP2 : undefined,
      port2,
      direction,
    };
    fg.patchValue(fromData);
  }


private transRawData(fgValue: any): NetCaughtfilter {
    const {
      protocolType,
      protocolFilter,
      IP1v4,
      IP1v6,
      port1,
      IP2v4,
      IP2v6,
      port2,
      direction,
    } = fgValue;
    const rawData = {
      protocolType,
      protocolFilter,
      IP1: IpProtocolType.IPv4 === protocolType ? IP1v4 : IP1v6,
      port1,
      IP2: IpProtocolType.IPv4 === protocolType ? IP2v4 : IP2v6,
      port2,
      direction,
    };
    return rawData;
  }


private getProtocalOptions(
    protocolType: IpProtocolType
  ): { label: string; value: NetworkLayerProtocol | TransLayerProtocol }[] {
    const baseOptions = [
      { label: 'ICMP', value: NetworkLayerProtocol.ICMP },
      { label: 'RARP', value: NetworkLayerProtocol.RARP },
      { label: 'ARP', value: NetworkLayerProtocol.ARP },
      { label: 'TCP', value: TransLayerProtocol.TCP },
      { label: 'UDP', value: TransLayerProtocol.UDP },
    ];

    const v4Options = [
      { label: 'IP', value: NetworkLayerProtocol.IP },
      ...baseOptions,
    ];
    const v6Options = [
      { label: 'IP6', value: NetworkLayerProtocol.IP6 },
      ...baseOptions,
    ];

    return IpProtocolType.IPv6 === protocolType ? v6Options : v4Options;
  }


private takeIntersection(...twoDimenArr: any[][]): any[] {
    const res = twoDimenArr.reduce((data: any, item: any) => {
      return data.filter((i: any) => {
        return item.some((j: any) => {
          return i === j;
        });
      });
    });
    return res;
  }


/**
   * 选择不同的协议，对ip和port的禁用
   * 当不包含ipv4/TCP/UDP时，IP不禁用，port禁用
   * 当不包含ipv6/TCP/UDP时，ip和port都禁用
   * @param protocols 协议
   * @param currIpProtocol ip类型
   */
private handleIpOrPortState(
    protocols: NetworkLayerProtocol[] | TransLayerProtocol[],
    currIpProtocol: IpProtocolType
  ) {
    const hasIntersection =
      this.takeIntersection(this.ownPortProtocols, protocols).length > 0;
    const isNullProtocols = !protocols?.length;

    if (hasIntersection || isNullProtocols) {
      this.formGroup.get('port1').enable();
      this.formGroup.get('port2').enable();
      this.formGroup.get('IP1v6').enable();
      this.formGroup.get('IP2v6').enable();
    } else {
      this.formGroup.get('port1').disable();
      this.formGroup.get('port2').disable();
      if (IpProtocolType.IPv6 === currIpProtocol) {
        this.formGroup.get('IP1v6').disable();
        this.formGroup.get('IP2v6').disable();
      }
    }
  }


({ setType }) => (
  <div style={


interface Props {
  setType: setType;
}


({ size, ...props }: IconProps) => (
  <Svg width={size}


export class mxKeyHandler {
    /**
     * Constructs an event handler that executes functions bound to specific keystrokes.
     * @author 鸿则 <hungtcs@163.com>
     * @date 2020-01-09
     * @param {mxGraph} graph Reference to the associated mxGraph.
     * @param {*} target      Optional reference to the event target.
     *                        If null, the document element is used as the event target, that is,
     *                        the object where the key event listener is installed.
     */
    constructor(graph: mxGraph, target?: EventTarget);

    /**
     * Reference to the mxGraph associated with this handler.
     */
    public graph: mxGraph;

    /**
     * Reference to the target DOM, that is, the DOM node where the key event listeners are installed.
     */
    public target: EventTarget;

    /**
     * Maps from keycodes to functions for non-pressed control keys.
     */
    public normalKeys: [(event: KeyboardEvent) => void];

    /**
     * Maps from keycodes to functions for pressed shift keys.
     */
    public shiftKeys: [(event: KeyboardEvent) => void];

    /**
     * Maps from keycodes to functions for pressed control keys.
     */
    public controlKeys: [(event: KeyboardEvent) => void];

    /**
     * Maps from keycodes to functions for pressed control and shift keys.
     */
    public controlShiftKeys: [(event: KeyboardEvent) => void];

    /**
     * Specifies if events are handled.  Default is true.
     */
    public enabled: boolean;

    /**
     * Returns true if events are handled.  This implementation returns enabled.
     */
    public isEnabled(): boolean;

    /**
     * Enables or disables event handling by updating enabled.
     */
    public setEnabled(enabled: boolean): void;

    /**
     * Binds the specified keycode to the given function.  This binding is used if the control key is not pressed.
     */
    public bindKey(code: number, funct: (event: KeyboardEvent) => void): void;

    /**
     * Binds the specified keycode to the given function.  This binding is used if the shift key is pressed.
     */
    public bindShiftKey(code: number, funct: (event: KeyboardEvent) => void): void;

    /**
     * Binds the specified keycode to the given function.  This binding is used if the control key is pressed.
     */
    public bindControlKey(code: number, funct: (event: KeyboardEvent) => void): void;

    /**
     * Binds the specified keycode to the given function.  This binding is used if the control and shift key are pressed.
     */
    public bindControlShiftKey(code: number, funct: (event: KeyboardEvent) => void): number;

    /**
     * Returns true if the control key is pressed.  This uses mxEvent.isControlDown.
     */
    public isControlDown(evt: KeyboardEvent): boolean;

    /**
     * Returns the function associated with the given key event or null if no function is associated with the given event.
     */
    public getFunction(evt: KeyboardEvent): (event: KeyboardEvent) => void;

    /**
     * Returns true if the event should be processed by this handler, that is, if the event source is either the target, one of its direct children, a descendant of the <mxGraph.container>, or the mxGraph.cellEditor of the graph.
     */
    public isGraphEvent(evt: KeyboardEvent): boolean;

    /**
     * Handles the event by invoking the function bound to the respective keystroke if isEnabledForEvent returns true for the given event and if isEventIgnored returns false, except for escape for which isEventIgnored is not invoked.
     */
    public keyDown(evt: KeyboardEvent): boolean;

    /**
     * Returns true if the given event should be handled.  isEventIgnored is called later if the event is not an escape key stroke, in which case escape is called.  This implementation returns true if isEnabled returns true for both, this handler and graph, if the event is not consumed and if isGraphEvent returns true.
     */
    public isEnabledForEvent(evt: KeyboardEvent): boolean;

    /**
     * Returns true if the given keystroke should be ignored.  This returns graph.isEditing().
     */
    public isEventIgnored(evt: KeyboardEvent): boolean;

    /**
     * Hook to process ESCAPE keystrokes.  This implementation invokes mxGraph.stopEditing to cancel the current editing, connecting and/or other ongoing modifications.
     */
    public escape(evt: KeyboardEvent): void;

    /**
     * Destroys the handler and all its references into the DOM.  This does normally not need to be called, it is called automatically when the window unloads (in IE).
     */
    public destroy(): void;
  }


/**
     * Returns true if events are handled.  This implementation returns enabled.
     */
public isEnabled(): boolean;


/**
     * Enables or disables event handling by updating enabled.
     */
public setEnabled(enabled: boolean): void;


/**
     * Binds the specified keycode to the given function.  This binding is used if the control key is not pressed.
     */
public bindKey(code: number, funct: (event: KeyboardEvent) => void): void;


/**
     * Binds the specified keycode to the given function.  This binding is used if the shift key is pressed.
     */
public bindShiftKey(code: number, funct: (event: KeyboardEvent) => void): void;


/**
     * Binds the specified keycode to the given function.  This binding is used if the control key is pressed.
     */
public bindControlKey(code: number, funct: (event: KeyboardEvent) => void): void;


/**
     * Binds the specified keycode to the given function.  This binding is used if the control and shift key are pressed.
     */
public bindControlShiftKey(code: number, funct: (event: KeyboardEvent) => void): number;


/**
     * Returns true if the control key is pressed.  This uses mxEvent.isControlDown.
     */
public isControlDown(evt: KeyboardEvent): boolean;


/**
     * Returns the function associated with the given key event or null if no function is associated with the given event.
     */
public getFunction(evt: KeyboardEvent): (event: KeyboardEvent) => void;


/**
     * Returns true if the event should be processed by this handler, that is, if the event source is either the target, one of its direct children, a descendant of the <mxGraph.container>, or the mxGraph.cellEditor of the graph.
     */
public isGraphEvent(evt: KeyboardEvent): boolean;


/**
     * Handles the event by invoking the function bound to the respective keystroke if isEnabledForEvent returns true for the given event and if isEventIgnored returns false, except for escape for which isEventIgnored is not invoked.
     */
public keyDown(evt: KeyboardEvent): boolean;


/**
     * Returns true if the given event should be handled.  isEventIgnored is called later if the event is not an escape key stroke, in which case escape is called.  This implementation returns true if isEnabled returns true for both, this handler and graph, if the event is not consumed and if isGraphEvent returns true.
     */
public isEnabledForEvent(evt: KeyboardEvent): boolean;


/**
     * Returns true if the given keystroke should be ignored.  This returns graph.isEditing().
     */
public isEventIgnored(evt: KeyboardEvent): boolean;


/**
     * Hook to process ESCAPE keystrokes.  This implementation invokes mxGraph.stopEditing to cancel the current editing, connecting and/or other ongoing modifications.
     */
public escape(evt: KeyboardEvent): void;


/**
     * Destroys the handler and all its references into the DOM.  This does normally not need to be called, it is called automatically when the window unloads (in IE).
     */
public destroy(): void;


(p) => {
    return p;
}


(p) => {
    return 1 - (p - 1) ** 2;
}


(p) => {
    return 1 - easeEnd(1 - p);
}


(p) => {
    return 0.5 + 0.5 * Math.sin(Math.PI * (p + 1.5));
}


(s: number): TimingFunc =>
    (p) => {
        return Math.pow(2, -10 * p) * Math.sin(((p - s / 4) * (2 * Math.PI)) / s) + 1;
    }


(p) => {
        return Math.pow(2, -10 * p) * Math.sin(((p - s / 4) * (2 * Math.PI)) / s) + 1;
    }


export interface TimingFunc {
    (percentage: number): number;
}


export function registerTypes(serviceManager: IServiceManager) {
  serviceManager.addSingleton<IKnownSearchPathsForInterpreters>(IKnownSearchPathsForInterpreters, KnownSearchPathsForInterpreters)
  serviceManager.addSingleton<IVirtualEnvironmentsSearchPathProvider>(IVirtualEnvironmentsSearchPathProvider, GlobalVirtualEnvironmentsSearchPathProvider, 'global')
  serviceManager.addSingleton<IVirtualEnvironmentsSearchPathProvider>(IVirtualEnvironmentsSearchPathProvider, WorkspaceVirtualEnvironmentsSearchPathProvider, 'workspace')

  serviceManager.addSingleton<ICondaService>(ICondaService, CondaService)
  serviceManager.addSingleton<IPipEnvServiceHelper>(IPipEnvServiceHelper, PipEnvServiceHelper)
  serviceManager.addSingleton<IVirtualEnvironmentManager>(IVirtualEnvironmentManager, VirtualEnvironmentManager)
  serviceManager.addSingleton<IPythonInPathCommandProvider>(IPythonInPathCommandProvider, PythonInPathCommandProvider)

  serviceManager.add<IInterpreterWatcher>(IInterpreterWatcher, WorkspaceVirtualEnvWatcherService, WORKSPACE_VIRTUAL_ENV_SERVICE)
  serviceManager.addSingleton<IInterpreterWatcherBuilder>(IInterpreterWatcherBuilder, InterpreterWatcherBuilder)

  serviceManager.addSingleton<IInterpreterVersionService>(IInterpreterVersionService, InterpreterVersionService)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, PythonInterpreterLocatorService, INTERPRETER_LOCATOR_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, CondaEnvFileService, CONDA_ENV_FILE_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, CondaEnvService, CONDA_ENV_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, CurrentPathService, CURRENT_PATH_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, GlobalVirtualEnvService, GLOBAL_VIRTUAL_ENV_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, WorkspaceVirtualEnvService, WORKSPACE_VIRTUAL_ENV_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, PipEnvService, PIPENV_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IPipEnvService, PipEnvService)

  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, WindowsRegistryService, WINDOWS_REGISTRY_SERVICE)
  serviceManager.addSingleton<IInterpreterLocatorService>(IInterpreterLocatorService, KnownPathsService, KNOWN_PATH_SERVICE)
  serviceManager.addSingleton<IInterpreterService>(IInterpreterService, InterpreterService)
  serviceManager.addSingleton<IInterpreterDisplay>(IInterpreterDisplay, InterpreterDisplay)

  serviceManager.addSingleton<IPythonPathUpdaterServiceFactory>(IPythonPathUpdaterServiceFactory, PythonPathUpdaterServiceFactory)
  serviceManager.addSingleton<IPythonPathUpdaterServiceManager>(IPythonPathUpdaterServiceManager, PythonPathUpdaterService)

  serviceManager.addSingleton<IInterpreterSelector>(IInterpreterSelector, InterpreterSelector)
  serviceManager.addSingleton<IShebangCodeLensProvider>(IShebangCodeLensProvider, ShebangCodeLensProvider)
  serviceManager.addSingleton<IInterpreterHelper>(IInterpreterHelper, InterpreterHelper)
  serviceManager.addSingleton<IInterpreterLocatorHelper>(IInterpreterLocatorHelper, InterpreterLocatorHelper)
  serviceManager.addSingleton<IInterpreterComparer>(IInterpreterComparer, InterpreterComparer)

  serviceManager.addSingleton<InterpreterLocatorProgressHandler>(InterpreterLocatorProgressHandler, InterpreterLocatorProgressStatubarHandler)
  serviceManager.addSingleton<IInterpreterLocatorProgressService>(IInterpreterLocatorProgressService, InterpreterLocatorProgressService)

  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, EnvironmentAutoSelectionRule, AutoSelectionRule.environment)
  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, CurrentPathInterpretersAutoSelectionRule, AutoSelectionRule.currentPath)
  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, SystemWideInterpretersAutoSelectionRule, AutoSelectionRule.systemWide)
  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, WindowsRegistryInterpretersAutoSelectionRule, AutoSelectionRule.windowsRegistry)
  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, WorkspaceVirtualEnvInterpretersAutoSelectionRule, AutoSelectionRule.workspaceVirtualEnvs)
  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, CachedInterpretersAutoSelectionRule, AutoSelectionRule.cachedInterpreters)
  serviceManager.addSingleton<IInterpreterAutoSelectionRule>(IInterpreterAutoSelectionRule, SettingsInterpretersAutoSelectionRule, AutoSelectionRule.settings)
  serviceManager.addSingleton<IInterpreterAutoSeletionProxyService>(IInterpreterAutoSeletionProxyService, InterpreterAutoSeletionProxyService)
  serviceManager.addSingleton<IInterpreterAutoSelectionService>(IInterpreterAutoSelectionService, InterpreterAutoSelectionService)

  serviceManager.addSingleton<IEnvironmentActivationService>(IEnvironmentActivationService, EnvironmentActivationService)
}


export interface IStockTrendsResult {
  rc: number;
  rt: number;
  svr: number;
  lt: number;
  full: number;
  data: {
    code: string;
    market: number;
    type: number;
    status: number;
    name: string;
    decimal: number;
    preSettlement: number;
    preClose: number;
    beticks: string;
    trendsTotal: number;
    time: number;
    kind: number;
    prePrice: number;
    trends: string[];
    trendArrays: string[][];
  };
}


export function fetchPicturesMetadata() {
  return async (dispatch: (action: MediaserverAction) => FetchPicturesMetadataResponse, getState: () => State) => {
    const state = getState();

    dispatch({
      type: FilesActionTypes.FETCH_MEDIA_FILES,
    });

    const response = await fetchWithAuth(state, `${SERVER_BASE_URL}/api/files/`);
    if (!response.ok) {
      throw new Error(createErrorMessage(response));
    }

    const mediaFilesJSON: MediaFileJSON[] = await response.json();

    const mediaFiles = mediaFilesJSON.map(json => fromJSON(json));
    dispatch({
      type: FilesActionTypes.MEDIA_FILES_FETCHED,
      mediaFiles,
    });

    return {
      mediaFiles,
    };
  };
}


async function fetchTrackRecords(state: State, hashes: string[]) {
  const response = await fetchWithAuth(state, `${SERVER_BASE_URL}/api/graphql`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/graphql',
    },
    body: `
    {
      tracks(hashes:${JSON.stringify(hashes)}) {
        hash
        records {
          timestamp
          distance
          posLat
          posLong
          altitude
        }
      }
    }
    `,
  });
  if (!response.ok) {
    throw new Error(response.statusText);
  }

  type Response = {
    data: {
      tracks: TrackJSON[],
    },
  };
  const responseBody = (await response.json()) as Response;
  return responseBody.data;
}


export function fetchRecordsForTracks(trackSummaries: FitTrack[]) {
  return async (
    dispatch: (action: TrackRecordsFetchedAction) => void,
    getState: () => State,
  ) => {
    const state = getState();

    const trackSummaryIdsMap = new Map<string, Promise<Record[]>>();
    const trackSummariesToFetch: string[] = [];
    // figure out which already have promises, and which need to be fetched
    trackSummaries.forEach(trackSummary => {
      const recordsFromStatePromise = state.mediaFilesReducer.trackRecordsMap.get(trackSummary.hashValue);
      if (recordsFromStatePromise) {
        trackSummaryIdsMap.set(trackSummary.hashValue, recordsFromStatePromise);
        return;
      }

      trackSummariesToFetch.push(trackSummary.hashValue);
    });

    if (trackSummariesToFetch.length !== 0) {
      const resolverMap = new Map<string, Resolver>();
      trackSummariesToFetch.forEach(hash => {
        const promise = new Promise<Record[]>((resolve, reject) => {
          const resolver = (records: Record[]) => {
            resolve(records);
          };
          resolverMap.set(hash, resolver);
        });

        trackSummaryIdsMap.set(hash, promise);
      });
      // dispatch queue action here
      // dispatch({
      //   type: FilesActionTypes.TRACK_RECORDS_FETCH_QUEUED_ACTION,
      //   trackSummaryIds: trackSummariesToFetch,
      // });
      fetchTrackRecords(state, trackSummariesToFetch).then(response => {
        response.tracks.forEach(track => {
          const records = track.records.map(record => ({
            ...record,
            timestamp: new Date(record.timestamp),
          }));
          const resolver = resolverMap.get(track.hash);
          if (!resolver) {
            throw new Error(`couldn't find resolver for ${track.hash}`);
          }
          resolver(records);
        });

        const dispatchMap = new Map<string, Promise<Record[]>>();
        trackSummariesToFetch.forEach(hash => {
          const promise = trackSummaryIdsMap.get(hash);
          if (!promise) {
            throw new Error(`couldn't find promise for ${hash}`);
          }
          dispatchMap.set(hash, promise);
        });

        dispatch({
          type: FilesActionTypes.TRACK_RECORDS_FETCHED_ACTION,
          trackSummaryIdsMap: dispatchMap,
        });
      });
    }

    return new Promise<Map<string, Record[]>>((resolve, reject) => {
      const map = new Map<string, Record[]>();
      trackSummaryIdsMap.forEach((recordsPromise, hash) => {
        recordsPromise.then(records => {
          map.set(hash, records);
          if (map.size === trackSummaries.length) {
            resolve(map);
          }
        });
      });
    });
  };
}


export function uploadFile(file: File) {
  return async (
    dispatch: (action: MediaserverAction) => void,
    getState: () => State,
  ) => {
    const state = getState();

    const mediaFile = await state.mediaFilesReducer.uploadQueue.uploadOrQueue(state, file);
    dispatch({
      type: FilesActionTypes.FILE_SUCCESSFULLY_UPLOADED,
      mediaFile,
    });

    return mediaFile;
  };
}


export function setParticipantsOnMediaFile(mediaFile: MediaFile, participants: Person[]) {
  return async(dispatch: (action: MediaserverAction) => void, getState: () => State) => {
    const state = getState();

    for (let participant of participants) {
      if (participant.id === 0) {
        throw new Error(`couldn't save, got participant id 0`);
      }
    }

    const participantIds = participants.map(participant => participant.id);

    const response = await fetchWithAuth(state, `${SERVER_BASE_URL}/api/graphql?query={people{id,name}}`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/graphql',
      },
      body: `mutation {
        updateMediaFiles(hashes: ["${mediaFile.hashValue}"], participantIds: ${JSON.stringify(participantIds)})
        {${nameForMediaFileType(mediaFile.fileType)}{participantIds}}
      }`,
    });

    if (!response.ok) {
      throw new Error('failed to save person');
    }

    const newMediaFile = createMediaFileWithParticipants(mediaFile, participantIds);

    dispatch({
      type: FilesActionTypes.PARTICIPANTS_SET_ON_MEDIAFILE,
      mediaFile: newMediaFile,
      participants,
    });
  };
}


async (dispatch: (action: MediaserverAction) => FetchPicturesMetadataResponse, getState: () => State) => {
    const state = getState();

    dispatch({
      type: FilesActionTypes.FETCH_MEDIA_FILES,
    });

    const response = await fetchWithAuth(state, `${SERVER_BASE_URL}/api/files/`);
    if (!response.ok) {
      throw new Error(createErrorMessage(response));
    }

    const mediaFilesJSON: MediaFileJSON[] = await response.json();

    const mediaFiles = mediaFilesJSON.map(json => fromJSON(json));
    dispatch({
      type: FilesActionTypes.MEDIA_FILES_FETCHED,
      mediaFiles,
    });

    return {
      mediaFiles,
    };
  }


json => fromJSON(json)


async (
    dispatch: (action: TrackRecordsFetchedAction) => void,
    getState: () => State,
  ) => {
    const state = getState();

    const trackSummaryIdsMap = new Map<string, Promise<Record[]>>();
    const trackSummariesToFetch: string[] = [];
    // figure out which already have promises, and which need to be fetched
    trackSummaries.forEach(trackSummary => {
      const recordsFromStatePromise = state.mediaFilesReducer.trackRecordsMap.get(trackSummary.hashValue);
      if (recordsFromStatePromise) {
        trackSummaryIdsMap.set(trackSummary.hashValue, recordsFromStatePromise);
        return;
      }

      trackSummariesToFetch.push(trackSummary.hashValue);
    });

    if (trackSummariesToFetch.length !== 0) {
      const resolverMap = new Map<string, Resolver>();
      trackSummariesToFetch.forEach(hash => {
        const promise = new Promise<Record[]>((resolve, reject) => {
          const resolver = (records: Record[]) => {
            resolve(records);
          };
          resolverMap.set(hash, resolver);
        });

        trackSummaryIdsMap.set(hash, promise);
      });
      // dispatch queue action here
      // dispatch({
      //   type: FilesActionTypes.TRACK_RECORDS_FETCH_QUEUED_ACTION,
      //   trackSummaryIds: trackSummariesToFetch,
      // });
      fetchTrackRecords(state, trackSummariesToFetch).then(response => {
        response.tracks.forEach(track => {
          const records = track.records.map(record => ({
            ...record,
            timestamp: new Date(record.timestamp),
          }));
          const resolver = resolverMap.get(track.hash);
          if (!resolver) {
            throw new Error(`couldn't find resolver for ${track.hash}`);
          }
          resolver(records);
        });

        const dispatchMap = new Map<string, Promise<Record[]>>();
        trackSummariesToFetch.forEach(hash => {
          const promise = trackSummaryIdsMap.get(hash);
          if (!promise) {
            throw new Error(`couldn't find promise for ${hash}`);
          }
          dispatchMap.set(hash, promise);
        });

        dispatch({
          type: FilesActionTypes.TRACK_RECORDS_FETCHED_ACTION,
          trackSummaryIdsMap: dispatchMap,
        });
      });
    }

    return new Promise<Map<string, Record[]>>((resolve, reject) => {
      const map = new Map<string, Record[]>();
      trackSummaryIdsMap.forEach((recordsPromise, hash) => {
        recordsPromise.then(records => {
          map.set(hash, records);
          if (map.size === trackSummaries.length) {
            resolve(map);
          }
        });
      });
    });
  }


trackSummary => {
      const recordsFromStatePromise = state.mediaFilesReducer.trackRecordsMap.get(trackSummary.hashValue);
      if (recordsFromStatePromise) {
        trackSummaryIdsMap.set(trackSummary.hashValue, recordsFromStatePromise);
        return;
      }

      trackSummariesToFetch.push(trackSummary.hashValue);
    }


hash => {
        const promise = new Promise<Record[]>((resolve, reject) => {
          const resolver = (records: Record[]) => {
            resolve(records);
          };
          resolverMap.set(hash, resolver);
        });

        trackSummaryIdsMap.set(hash, promise);
      }


(resolve, reject) => {
          const resolver = (records: Record[]) => {
            resolve(records);
          };
          resolverMap.set(hash, resolver);
        }


(records: Record[]) => {
            resolve(records);
          }


response => {
        response.tracks.forEach(track => {
          const records = track.records.map(record => ({
            ...record,
            timestamp: new Date(record.timestamp),
          }));
          const resolver = resolverMap.get(track.hash);
          if (!resolver) {
            throw new Error(`couldn't find resolver for ${track.hash}`);
          }
          resolver(records);
        });

        const dispatchMap = new Map<string, Promise<Record[]>>();
        trackSummariesToFetch.forEach(hash => {
          const promise = trackSummaryIdsMap.get(hash);
          if (!promise) {
            throw new Error(`couldn't find promise for ${hash}`);
          }
          dispatchMap.set(hash, promise);
        });

        dispatch({
          type: FilesActionTypes.TRACK_RECORDS_FETCHED_ACTION,
          trackSummaryIdsMap: dispatchMap,
        });
      }


track => {
          const records = track.records.map(record => ({
            ...record,
            timestamp: new Date(record.timestamp),
          }));
          const resolver = resolverMap.get(track.hash);
          if (!resolver) {
            throw new Error(`couldn't find resolver for ${track.hash}`);
          }
          resolver(records);
        }


record => ({
            ...record,
            timestamp: new Date(record.timestamp),
          })


hash => {
          const promise = trackSummaryIdsMap.get(hash);
          if (!promise) {
            throw new Error(`couldn't find promise for ${hash}`);
          }
          dispatchMap.set(hash, promise);
        }


(resolve, reject) => {
      const map = new Map<string, Record[]>();
      trackSummaryIdsMap.forEach((recordsPromise, hash) => {
        recordsPromise.then(records => {
          map.set(hash, records);
          if (map.size === trackSummaries.length) {
            resolve(map);
          }
        });
      });
    }


(recordsPromise, hash) => {
        recordsPromise.then(records => {
          map.set(hash, records);
          if (map.size === trackSummaries.length) {
            resolve(map);
          }
        });
      }


records => {
          map.set(hash, records);
          if (map.size === trackSummaries.length) {
            resolve(map);
          }
        }


async (
    dispatch: (action: MediaserverAction) => void,
    getState: () => State,
  ) => {
    const state = getState();

    const mediaFile = await state.mediaFilesReducer.uploadQueue.uploadOrQueue(state, file);
    dispatch({
      type: FilesActionTypes.FILE_SUCCESSFULLY_UPLOADED,
      mediaFile,
    });

    return mediaFile;
  }


async(dispatch: (action: MediaserverAction) => void, getState: () => State) => {
    const state = getState();

    for (let participant of participants) {
      if (participant.id === 0) {
        throw new Error(`couldn't save, got participant id 0`);
      }
    }

    const participantIds = participants.map(participant => participant.id);

    const response = await fetchWithAuth(state, `${SERVER_BASE_URL}/api/graphql?query={people{id,name}}`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/graphql',
      },
      body: `mutation {
        updateMediaFiles(hashes: ["${mediaFile.hashValue}"], participantIds: ${JSON.stringify(participantIds)})
        {${nameForMediaFileType(mediaFile.fileType)}{participantIds}}
      }`,
    });

    if (!response.ok) {
      throw new Error('failed to save person');
    }

    const newMediaFile = createMediaFileWithParticipants(mediaFile, participantIds);

    dispatch({
      type: FilesActionTypes.PARTICIPANTS_SET_ON_MEDIAFILE,
      mediaFile: newMediaFile,
      participants,
    });
  }


participant => participant.id


export interface PicturesMetadataFetchFailedAction extends Action {
  type: FilesActionTypes.MEDIA_FILES_FETCH_FAILED;
}


export interface FetchPicturesMetadataAction extends Action {
  type: FilesActionTypes.FETCH_MEDIA_FILES;
}


export interface PicturesMetadataFetchedAction extends Action {
  type: FilesActionTypes.MEDIA_FILES_FETCHED;
  mediaFiles: MediaFile[];
}


export interface PictureSuccessfullyUploadedAction extends Action {
  type: FilesActionTypes.FILE_SUCCESSFULLY_UPLOADED;
  mediaFile: MediaFile;
}


export enum FilesActionTypes {
  FETCH_MEDIA_FILES = 'FETCH_MEDIA_FILES',
  MEDIA_FILES_FETCHED = 'MEDIA_FILES_FETCHED',
  MEDIA_FILES_FETCH_FAILED = 'MEDIA_FILES_FETCH_FAILED',
  QUEUE_FOR_UPLOAD = 'QUEUE_FOR_UPLOAD',
  FILE_SUCCESSFULLY_UPLOADED = 'FILE_SUCCESSFULLY_UPLOADED',
  TRACK_RECORDS_FETCHED_ACTION = 'TRACK_RECORDS_FETCHED_ACTION',
  PARTICIPANTS_SET_ON_MEDIAFILE = 'PARTICIPANTS_SET_ON_MEDIAFILE',
}


export type PeopleMap = Map<number, Person>;


export type TrackRecordsFetchedAction = {
  type: FilesActionTypes.TRACK_RECORDS_FETCHED_ACTION;
  trackSummaryIdsMap: Map<string, Promise<Record[]>>,
};


export type QueueForUploadAction = {
  type: FilesActionTypes.QUEUE_FOR_UPLOAD,
  file: File,
};


export type ParticipantAddedToMediaFile = {
  type: FilesActionTypes.PARTICIPANTS_SET_ON_MEDIAFILE,
  mediaFile: MediaFile,
  participants: Person[],
};


export type MediaserverAction = (
  PicturesMetadataFetchedAction |
  PictureSuccessfullyUploadedAction |
  FetchPicturesMetadataAction |
  TrackRecordsFetchedAction |
  QueueForUploadAction |
  ParticipantAddedToMediaFile |
  PicturesMetadataFetchFailedAction
);


type TrackJSON = {
  hash: string,
  records: RecordJSON[],
};


type RecordJSON = {
  timestamp: string,
  posLat: number,
  posLong: number,
  distance: number,
  altitude: number
};


export type FetchPicturesMetadataResponse = {
  mediaFiles: MediaFile[],
};


type Response = {
    data: {
      tracks: TrackJSON[],
    },
  };


type Resolver = (records: Record[]) => void;


(of) => Store


returns => GetSidosOutput


returns => GetGugunsOutput


(returns) => GetStoresOutput


(returns) => GetStoreOutput


(returns) => CreateStoreOutput


(returns) => UpdateStoreOutput


(returns) => DeleteStoreOutput