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ICAgICAgICAgICAgICAgPSA8YW55IFVTLUFTQ0lJIGNvbnRyb2wgY2hhcmFjdGVyIChvY3RldHMgMCAtIDMxKSBhbmQgREVMICgxMjcpPgorQ1IgICAgICAgICAgICAgICAgICA9IDxVUy1BU0NJSSBDUiwgY2FycmlhZ2UgcmV0dXJuICgxMyk+CitMRiAgICAgICAgICAgICAgICAgID0gPFVTLUFTQ0lJIExGLCBsaW5lZmVlZCAoMTApPgorU1AgICAgICAgICAgICAgICAgICA9IDxVUy1BU0NJSSBTUCwgc3BhY2UgKDMyKT4KK0hUICAgICAgICAgICAgICAgICAgPSA8VVMtQVNDSUkgSFQsIGhvcml6b250YWwtdGFiICg5KT4KKzwiPiAgICAgICAgICAgICAgICAgPSA8VVMtQVNDSUkgZG91YmxlLXF1b3RlIG1hcmsgKDM0KT4KK0NSTEYgICAgICAgICAgICAgICAgPSBDUiBMRgorTFdTICAgICAgICAgICAgICAgICA9IFtDUkxGXSAxKiggU1AgfCBIVCApCitURVhUICAgICAgICAgICAgICAgID0gPGFueSBPQ1RFVCBleGNlcHQgQ1RMcywgYnV0IGluY2x1ZGluZyBMV1M+CitIRVggICAgICAgICAgICAgICAgID0gIkEiIHwgIkIiIHwgIkMiIHwgIkQiIHwgIkUiIHwgIkYiCisgICAgICAgICAgICAgICAgICAgICAgfCAiYSIgfCAiYiIgfCAiYyIgfCAiZCIgfCAiZSIgfCAiZiIgfCBESUdJVAorc2VwYXJhdG9ycyAgICAgICAgICA9ICIoIiB8ICIpIiB8ICI8IiB8ICI+IiB8ICJAIgorICAgICAgICAgICAgICAgICAgICB8ICIsIiB8ICI7IiB8ICI6IiB8ICJcIiB8IDwiPgorICAgICAgICAgICAgICAgICAgICB8ICIvIiB8ICJbIiB8ICJdIiB8ICI/IiB8ICI9IgorICAgICAgICAgICAgICAgICAgICB8ICJ7IiB8ICJ9IiB8IFNQIHwgSFQKK3Rva2VuICAgICAgICAgICAgICAgPSAxKjxhbnkgQ0hBUiBleGNlcHQgQ1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CisgICAgICAgICAgICAgICAgfCBJZi1NYXRjaAorICAgICAgICAgICAgICAgIHwgSWYtTW9kaWZpZWQtU2luY2UKKyAgICAgICAgICAgICAgICB8IElmLU5vbmUtTWF0Y2gKKyAgICAgICAgICAgICAgICB8IElmLVJhbmdlCisgICAgICAgICAgICAgICAgfCBJZi1Vbm1vZGlmaWVkLVNpbmNlCisgICAgICAgICAgICAgICAgfCBNYXgtRm9yd2FyZHMKKyAgICAgICAgICAgICAgICB8IFByb3h5LUF1dGhvcml6YXRpb24KKyAgICAgICAgICAgICAgICB8IFJhbmdlCisgICAgICAgICAgICAgICAgfCBSZWZlcmVyCisgICAgICAgICAgICAgICAgfCBURQorICAgICAgICAgICAgICAgIHwgVXNlci1BZ2VudAorCitSZXF1ZXN0LWhlYWRlciBmaWVsZCBuYW1lcyBjYW4gYmUgZXh0ZW5kZWQgcmVsaWFibHkgb25seSBpbiBjb21iaW5hdGlvbiB3aXRoIGEKK2NoYW5nZSBpbiB0aGUgcHJvdG9jb2wgdmVyc2lvbi4gSG93ZXZlciwgbmV3IG9yIGV4cGVyaW1lbnRhbCBoZWFkZXIgZmllbGRzIE1BWQorYmUgZ2l2ZW4gdGhlIHNlbWFudGljcyBvZiByZXF1ZXN0LWhlYWRlciBmaWVsZHMgaWYgYWxsIHBhcnRpZXMgaW4gdGhlCitjb21tdW5pY2F0aW9uIHJlY29nbml6ZSB0aGVtIHRvIGJlIHJlcXVlc3QtaGVhZGVyIGZpZWxkcy4gVW5yZWNvZ25pemVkIGhlYWRlcgorZmllbGRzIGFyZSB0cmVhdGVkIGFzIGVudGl0eS1oZWFkZXIgZmllbGRzLgorCisKKworNy4xIEVudGl0eSBoZWFkZXIgZmllbGRzCisKK0VudGl0eS1oZWFkZXIgZmllbGRzIGRlZmluZSBtZXRhaW5mb3JtYXRpb24gYWJvdXQgdGhlIGVudGl0eS1ib2R5IG9yLCBpZiBubworYm9keSBpcyBwcmVzZW50LCBhYm91dCB0aGUgcmVzb3VyY2UgaWRlbnRpZmllZCBieSB0aGUgcmVxdWVzdC4gU29tZSBvZiB0aGlzCittZXRhaW5mb3JtYXRpb24gaXMgT1BUSU9OQUw7IHNvbWUgbWlnaHQgYmUgUkVRVUlSRUQgYnkgcG9ydGlvbnMgb2YgdGhpcworc3BlY2lmaWNhdGlvbi4KKworZW50aXR5LWhlYWRlciAgID0gQWxsb3cKKyAgICAgICAgICAgICAgICB8IENvbnRlbnQtRW5jb2RpbmcKKyAgICAgICAgICAgICAgICB8IENvbnRlbnQtTGFuZ3VhZ2UKKyAgICAgICAgICAgICAgICB8IENvbnRlbnQtTGVuZ3RoCisgICAgICAgICAgICAgICAgfCBDb250ZW50LUxvY2F0aW9uCisgICAgICAgICAgICAgICAgfCBDb250ZW50LU1ENQorICAgICAgICAgICAgICAgIHwgQ29udGVudC1SYW5nZQorICAgICAgICAgICAgICAgIHwgQ29udGVudC1UeXBlCisgICAgICAgICAgICAgICAgfCBFeHBpcmVzCisgICAgICAgICAgICAgICAgfCBMYXN0LU1vZGlmaWVkCisgICAgICAgICAgICAgICAgfCBleHRlbnNpb24taGVhZGVyCitleHRlbnNpb24taGVhZGVyID0gbWVzc2FnZS1oZWFkZXIKKworVGhlIGV4dGVuc2lvbi1oZWFkZXIgbWVjaGFuaXNtIGFsbG93cyBhZGRpdGlvbmFsIGVudGl0eS1oZWFkZXIgZmllbGRzIHRvIGJlCitkZWZpbmVkIHdpdGhvdXQgY2hhbmdpbmcgdGhlIHByb3RvY29sLCBidXQgdGhlc2UgZmllbGRzIGNhbm5vdCBiZSBhc3N1bWVkIHRvIGJlCityZWNvZ25pemFibGUgYnkgdGhlIHJlY2lwaWVudC4gVW5yZWNvZ25pemVkIGhlYWRlciBmaWVsZHMgU0hPVUxEIGJlIGlnbm9yZWQgYnkKK3RoZSByZWNpcGllbnQgYW5kIE1VU1QgYmUgZm9yd2FyZGVkIGJ5IHRyYW5zcGFyZW50IHByb3hpZXMuCisKZGlmZiAtLWdpdCBhL2luY2x1ZG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