import * as GameTest from "mojang-gametest";
import {
  BlockLocation,
  BlockRaycastOptions,
  EntityRaycastOptions,
  MinecraftBlockTypes,
  Location,
  Vector,
} from "mojang-minecraft";

const replacementBlock = MinecraftBlockTypes.redGlazedTerracotta;

function lookAtThree(test, blocks, blockVectorOptions) {
    const player = test.spawnSimulatedPlayer(new BlockLocation(2, 9, 2), "Player");

    test.startSequence()
        .thenExecuteAfter(10, () => {
            player.lookAtBlock(blocks[0]);
        })
        .thenExecuteAfter(10, () => {
            var block = player.getBlockFromViewVector(blockVectorOptions);
            const relativePos = test.relativeBlockLocation(block.location);
            test.assert(relativePos.equals(blocks[0]), "Locations should match, but got [" + relativePos.x + "," + relativePos.y + ", " + relativePos.z + "]");
            block.setType(replacementBlock);

            player.lookAtBlock(blocks[1]);
        })
        .thenExecuteAfter(10, () => {
            var block = player.getBlockFromViewVector(blockVectorOptions);
            const relativePos = test.relativeBlockLocation(block.location);
            test.assert(relativePos.equals(blocks[1]), "Locations should match, but got [" + relativePos.x + "," + relativePos.y + ", " + relativePos.z + "]");
            block.setType(replacementBlock);
            player.lookAtBlock(blocks[2]);
        })
        .thenExecuteAfter(10, () => {
            var block = player.getBlockFromViewVector(blockVectorOptions);
            const relativePos = test.relativeBlockLocation(block.location);
            test.assert(relativePos.equals(blocks[2]), "Locations should match, but got [" + relativePos.x + "," + relativePos.y + ", " + relativePos.z + "]");
            block.setType(replacementBlock);
        })
        .thenSucceed();
}

GameTest.register("RaycastingTests", "player_looks_under_water", (test) => {
    var blocks = [new BlockLocation(1, 1, 1), new BlockLocation(2, 1, 1), new BlockLocation(3, 1, 1)];

    const blockVectorOptions = new BlockRaycastOptions();
    blockVectorOptions.includePassableBlocks = false;
    blockVectorOptions.includeLiquidBlocks = false;

    lookAtThree(test, blocks, blockVectorOptions);
})
    .maxTicks(50)
    .structureName("RaycastingTests:player_looks_block")
    .tag(GameTest.Tags.suiteDefault);

GameTest.register("RaycastingTests", "player_looks_at_water", (test) => {
    var blocks = [new BlockLocation(1, 2, 1), new BlockLocation(2, 2, 1), new BlockLocation(3, 2, 1)];

    const blockVectorOptions = new BlockRaycastOptions();
    blockVectorOptions.includePassableBlocks = true;
    blockVectorOptions.includeLiquidBlocks = true;

    lookAtThree(test, blocks, blockVectorOptions);
})
    .maxTicks(50)
    .structureName("RaycastingTests:player_looks_block")
    .tag(GameTest.Tags.suiteDefault);

GameTest.register("RaycastingTests", "player_looks_under_carpet", (test) => {
    var blocks = [new BlockLocation(1, 2, 0), new BlockLocation(2, 2, 0), new BlockLocation(3, 2, 0)];

    const blockVectorOptions = new BlockRaycastOptions();
    blockVectorOptions.includePassableBlocks = false;
    blockVectorOptions.includeLiquidBlocks = false;

    lookAtThree(test, blocks, blockVectorOptions);
})
    .maxTicks(50)
    .structureName("RaycastingTests:player_looks_block")
    .tag(GameTest.Tags.suiteDefault);

GameTest.register("RaycastingTests", "player_looks_at_carpet", (test) => {
    var blocks = [new BlockLocation(1, 3, 0), new BlockLocation(2, 3, 0), new BlockLocation(3, 3, 0)];

    const blockVectorOptions = new BlockRaycastOptions();
    blockVectorOptions.includePassableBlocks = true;
    blockVectorOptions.includeLiquidBlocks = false;

    lookAtThree(test, blocks, blockVectorOptions);
})
    .maxTicks(50)
    .structureName("RaycastingTests:player_looks_block")
    .tag(GameTest.Tags.suiteDefault);


GameTest.register("RaycastingTests", "get_block_from_vector", (test) => {

    let dimension = test.getDimension();
    const blockVectorOptions = new BlockRaycastOptions();


    blockVectorOptions.includePassableBlocks = false;
    blockVectorOptions.includeLiquidBlocks = false;

    const bars = dimension.getBlockFromRay(test.worldLocation(new Location(.5, 2, 1.5)), new Vector(1, 0, 0), blockVectorOptions);
    test.assert(bars.type == MinecraftBlockTypes.ironBars, "Expected to see through the banner and the water to the iron bars");

    blockVectorOptions.includePassableBlocks = true;
    const banner = dimension.getBlockFromRay(test.worldLocation(new Location(.5, 2, 1.5)), new Vector(1, 0, 0), blockVectorOptions);
    test.assert(banner.type == MinecraftBlockTypes.standingBanner, "Expected to see through the water to the iron bars");

    blockVectorOptions.includeLiquidBlocks = true;
    const water = dimension.getBlockFromRay(test.worldLocation(new Location(.5, 2, 1.5)), new Vector(1, 0, 0), blockVectorOptions);
    test.assert(water.type == MinecraftBlockTypes.water, "Expected to see the water");

    test.succeed();
})
    .setupTicks(4) // time for water to convert from dynamic to static type
    .tag(GameTest.Tags.suiteDefault);


GameTest.register("RaycastingTests", "get_entity_from_vector", (test) => {

    let dimension = test.getDimension();

    test.spawnWithoutBehaviors("creeper", new BlockLocation(3, 2, 1))
    test.spawnWithoutBehaviors("creeper", new BlockLocation(2, 2, 1))

    // test both creepers are found
    const creepers = dimension.getEntitiesFromRay(test.worldLocation(new Location(.5, 3.5, 1.5)), new Vector(1, 0, 0), new EntityRaycastOptions());
    test.assert(creepers.length == 2, "Expected to find 2 creepers");
    test.assertEntityInstancePresent(creepers[0], new BlockLocation(2, 2, 1));
    test.assertEntityInstancePresent(creepers[1], new BlockLocation(3, 2, 1));

    // check the entities are sorted by distance
    const creepersReversed = dimension.getEntitiesFromRay(test.worldLocation(new Location(5.5, 2.5, 1.5)), new Vector(-1, 0, 0), new EntityRaycastOptions());
    test.assert(creepersReversed.length == 2, "Expected to find 2 creepers");
    test.assertEntityInstancePresent(creepersReversed[0], new BlockLocation(3, 2, 1));
    test.assertEntityInstancePresent(creepersReversed[1], new BlockLocation(2, 2, 1));

    // test blocks stop the entity raycast
    const blockedCreepers = dimension.getEntitiesFromRay(test.worldLocation(new Location(5.5, 3.5, 1.5)), new Vector(-1, 0, 0), new EntityRaycastOptions());
    test.assert(blockedCreepers.length == 0, "Expected the block to stop the raycast");

    test.succeed();
})
    .setupTicks(4) // time for water to convert from dynamic to static type
    .tag(GameTest.Tags.suiteDefault);

// SIG // Begin signature block
// SIG // MIInxgYJKoZIhvcNAQcCoIIntzCCJ7MCAQExDzANBglg
// SIG // hkgBZQMEAgEFADB3BgorBgEEAYI3AgEEoGkwZzAyBgor
// SIG // BgEEAYI3AgEeMCQCAQEEEBDgyQbOONQRoqMAEEvTUJAC
// SIG // AQACAQACAQACAQACAQAwMTANBglghkgBZQMEAgEFAAQg
// SIG // 4zbh0+TPJU9+syWdYXTcxDYFABa10iOjbqHlJhV2fZqg
// SIG // gg2BMIIF/zCCA+egAwIBAgITMwAAAlKLM6r4lfM52wAA
// SIG // AAACUjANBgkqhkiG9w0BAQsFADB+MQswCQYDVQQGEwJV
// SIG // UzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMH
// SIG // UmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBv
// SIG // cmF0aW9uMSgwJgYDVQQDEx9NaWNyb3NvZnQgQ29kZSBT
// SIG // aWduaW5nIFBDQSAyMDExMB4XDTIxMDkwMjE4MzI1OVoX
// SIG // DTIyMDkwMTE4MzI1OVowdDELMAkGA1UEBhMCVVMxEzAR
// SIG // BgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1v
// SIG // bmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3JhdGlv
// SIG // bjEeMBwGA1UEAxMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
// SIG // MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
// SIG // 0OTPj7P1+wTbr+Qf9COrqA8I9DSTqNSq1UKju4IEV3HJ
// SIG // Jck61i+MTEoYyKLtiLG2Jxeu8F81QKuTpuKHvi380gzs
// SIG // 43G+prNNIAaNDkGqsENQYo8iezbw3/NCNX1vTi++irdF
// SIG // qXNs6xoc3B3W+7qT678b0jTVL8St7IMO2E7d9eNdL6RK
// SIG // fMnwRJf4XfGcwL+OwwoCeY9c5tvebNUVWRzaejKIkBVT
// SIG // hApuAMCtpdvIvmBEdSTuCKZUx+OLr81/aEZyR2jL1s2R
// SIG // KaMz8uIzTtgw6m3DbOM4ewFjIRNT1hVQPghyPxJ+ZwEr
// SIG // wry5rkf7fKuG3PF0fECGSUEqftlOptpXTQIDAQABo4IB
// SIG // fjCCAXowHwYDVR0lBBgwFgYKKwYBBAGCN0wIAQYIKwYB
// SIG // BQUHAwMwHQYDVR0OBBYEFDWSWhFBi9hrsLe2TgLuHnxG
// SIG // F3nRMFAGA1UdEQRJMEekRTBDMSkwJwYDVQQLEyBNaWNy
// SIG // b3NvZnQgT3BlcmF0aW9ucyBQdWVydG8gUmljbzEWMBQG
// SIG // A1UEBRMNMjMwMDEyKzQ2NzU5NzAfBgNVHSMEGDAWgBRI
// SIG // bmTlUAXTgqoXNzcitW2oynUClTBUBgNVHR8ETTBLMEmg
// SIG // R6BFhkNodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtp
// SIG // b3BzL2NybC9NaWNDb2RTaWdQQ0EyMDExXzIwMTEtMDct
// SIG // MDguY3JsMGEGCCsGAQUFBwEBBFUwUzBRBggrBgEFBQcw
// SIG // AoZFaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3BraW9w
// SIG // cy9jZXJ0cy9NaWNDb2RTaWdQQ0EyMDExXzIwMTEtMDct
// SIG // MDguY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEL
// SIG // BQADggIBABZJN7ksZExAYdTbQJewYryBLAFnYF9amfhH
// SIG // WTGG0CmrGOiIUi10TMRdQdzinUfSv5HHKZLzXBpfA+2M
// SIG // mEuJoQlDAUflS64N3/D1I9/APVeWomNvyaJO1mRTgJoz
// SIG // 0TTRp8noO5dJU4k4RahPtmjrOvoXnoKgHXpRoDSSkRy1
// SIG // kboRiriyMOZZIMfSsvkL2a5/w3YvLkyIFiqfjBhvMWOj
// SIG // wb744LfY0EoZZz62d1GPAb8Muq8p4VwWldFdE0y9IBMe
// SIG // 3ofytaPDImq7urP+xcqji3lEuL0x4fU4AS+Q7cQmLq12
// SIG // 0gVbS9RY+OPjnf+nJgvZpr67Yshu9PWN0Xd2HSY9n9xi
// SIG // au2OynVqtEGIWrSoQXoOH8Y4YNMrrdoOmjNZsYzT6xOP
// SIG // M+h1gjRrvYDCuWbnZXUcOGuOWdOgKJLaH9AqjskxK76t
// SIG // GI6BOF6WtPvO0/z1VFzan+2PqklO/vS7S0LjGEeMN3Ej
// SIG // 47jbrLy3/YAZ3IeUajO5Gg7WFg4C8geNhH7MXjKsClsA
// SIG // Pk1YtB61kan0sdqJWxOeoSXBJDIzkis97EbrqRQl91K6
// SIG // MmH+di/tolU63WvF1nrDxutjJ590/ALi383iRbgG3zkh
// SIG // EceyBWTvdlD6FxNbhIy+bJJdck2QdzLm4DgOBfCqETYb
// SIG // 4hQBEk/pxvHPLiLG2Xm9PEnmEDKo1RJpMIIHejCCBWKg
// SIG // AwIBAgIKYQ6Q0gAAAAAAAzANBgkqhkiG9w0BAQsFADCB
// SIG // iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0
// SIG // b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1p
// SIG // Y3Jvc29mdCBDb3Jwb3JhdGlvbjEyMDAGA1UEAxMpTWlj
// SIG // cm9zb2Z0IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
// SIG // IDIwMTEwHhcNMTEwNzA4MjA1OTA5WhcNMjYwNzA4MjEw
// SIG // OTA5WjB+MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2Fz
// SIG // aGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UE
// SIG // ChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSgwJgYDVQQD
// SIG // Ex9NaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBDQSAyMDEx
// SIG // MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA
// SIG // q/D6chAcLq3YbqqCEE00uvK2WCGfQhsqa+laUKq4Bjga
// SIG // BEm6f8MMHt03a8YS2AvwOMKZBrDIOdUBFDFC04kNeWSH
// SIG // fpRgJGyvnkmc6Whe0t+bU7IKLMOv2akrrnoJr9eWWcpg
// SIG // GgXpZnboMlImEi/nqwhQz7NEt13YxC4Ddato88tt8zpc
// SIG // oRb0RrrgOGSsbmQ1eKagYw8t00CT+OPeBw3VXHmlSSnn
// SIG // Db6gE3e+lD3v++MrWhAfTVYoonpy4BI6t0le2O3tQ5GD
// SIG // 2Xuye4Yb2T6xjF3oiU+EGvKhL1nkkDstrjNYxbc+/jLT
// SIG // swM9sbKvkjh+0p2ALPVOVpEhNSXDOW5kf1O6nA+tGSOE
// SIG // y/S6A4aN91/w0FK/jJSHvMAhdCVfGCi2zCcoOCWYOUo2
// SIG // z3yxkq4cI6epZuxhH2rhKEmdX4jiJV3TIUs+UsS1Vz8k
// SIG // A/DRelsv1SPjcF0PUUZ3s/gA4bysAoJf28AVs70b1FVL
// SIG // 5zmhD+kjSbwYuER8ReTBw3J64HLnJN+/RpnF78IcV9uD
// SIG // jexNSTCnq47f7Fufr/zdsGbiwZeBe+3W7UvnSSmnEyim
// SIG // p31ngOaKYnhfsi+E11ecXL93KCjx7W3DKI8sj0A3T8Hh
// SIG // hUSJxAlMxdSlQy90lfdu+HggWCwTXWCVmj5PM4TasIgX
// SIG // 3p5O9JawvEagbJjS4NaIjAsCAwEAAaOCAe0wggHpMBAG
// SIG // CSsGAQQBgjcVAQQDAgEAMB0GA1UdDgQWBBRIbmTlUAXT
// SIG // gqoXNzcitW2oynUClTAZBgkrBgEEAYI3FAIEDB4KAFMA
// SIG // dQBiAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
// SIG // AwEB/zAfBgNVHSMEGDAWgBRyLToCMZBDuRQFTuHqp8cx
// SIG // 0SOJNDBaBgNVHR8EUzBRME+gTaBLhklodHRwOi8vY3Js
// SIG // Lm1pY3Jvc29mdC5jb20vcGtpL2NybC9wcm9kdWN0cy9N
// SIG // aWNSb29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3JsMF4G
// SIG // CCsGAQUFBwEBBFIwUDBOBggrBgEFBQcwAoZCaHR0cDov
// SIG // L3d3dy5taWNyb3NvZnQuY29tL3BraS9jZXJ0cy9NaWNS
// SIG // b29DZXJBdXQyMDExXzIwMTFfMDNfMjIuY3J0MIGfBgNV
// SIG // HSAEgZcwgZQwgZEGCSsGAQQBgjcuAzCBgzA/BggrBgEF
// SIG // BQcCARYzaHR0cDovL3d3dy5taWNyb3NvZnQuY29tL3Br
// SIG // aW9wcy9kb2NzL3ByaW1hcnljcHMuaHRtMEAGCCsGAQUF
// SIG // BwICMDQeMiAdAEwAZQBnAGEAbABfAHAAbwBsAGkAYwB5
// SIG // AF8AcwB0AGEAdABlAG0AZQBuAHQALiAdMA0GCSqGSIb3
// SIG // DQEBCwUAA4ICAQBn8oalmOBUeRou09h0ZyKbC5YR4WOS
// SIG // mUKWfdJ5DJDBZV8uLD74w3LRbYP+vj/oCso7v0epo/Np
// SIG // 22O/IjWll11lhJB9i0ZQVdgMknzSGksc8zxCi1LQsP1r
// SIG // 4z4HLimb5j0bpdS1HXeUOeLpZMlEPXh6I/MTfaaQdION
// SIG // 9MsmAkYqwooQu6SpBQyb7Wj6aC6VoCo/KmtYSWMfCWlu
// SIG // WpiW5IP0wI/zRive/DvQvTXvbiWu5a8n7dDd8w6vmSiX
// SIG // mE0OPQvyCInWH8MyGOLwxS3OW560STkKxgrCxq2u5bLZ
// SIG // 2xWIUUVYODJxJxp/sfQn+N4sOiBpmLJZiWhub6e3dMNA
// SIG // BQamASooPoI/E01mC8CzTfXhj38cbxV9Rad25UAqZaPD
// SIG // XVJihsMdYzaXht/a8/jyFqGaJ+HNpZfQ7l1jQeNbB5yH
// SIG // PgZ3BtEGsXUfFL5hYbXw3MYbBL7fQccOKO7eZS/sl/ah
// SIG // XJbYANahRr1Z85elCUtIEJmAH9AAKcWxm6U/RXceNcbS
// SIG // oqKfenoi+kiVH6v7RyOA9Z74v2u3S5fi63V4GuzqN5l5
// SIG // GEv/1rMjaHXmr/r8i+sLgOppO6/8MO0ETI7f33VtY5E9
// SIG // 0Z1WTk+/gFcioXgRMiF670EKsT/7qMykXcGhiJtXcVZO
// SIG // SEXAQsmbdlsKgEhr/Xmfwb1tbWrJUnMTDXpQzTGCGZ0w
// SIG // ghmZAgEBMIGVMH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQI
// SIG // EwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4w
// SIG // HAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xKDAm
// SIG // BgNVBAMTH01pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENB
// SIG // IDIwMTECEzMAAAJSizOq+JXzOdsAAAAAAlIwDQYJYIZI
// SIG // AWUDBAIBBQCggcAwGQYJKoZIhvcNAQkDMQwGCisGAQQB
// SIG // gjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcC
// SIG // ARUwLwYJKoZIhvcNAQkEMSIEIKxIUfQ2oy4OVjN9o6M/
// SIG // P0U6leSxb18PPu1i+7MzCSggMFQGCisGAQQBgjcCAQwx
// SIG // RjBEoCSAIgBNAGkAbgBlAGMAcgBhAGYAdAAgAEIAZQBk
// SIG // AHIAbwBjAGuhHIAaaHR0cHM6Ly93d3cubWluZWNyYWZ0
// SIG // Lm5ldC8wDQYJKoZIhvcNAQEBBQAEggEAhTWdktC6xf5T
// SIG // huxkAEaOv1bZzE+kCzSDCuqIDKDY7+PGAgs66hai8rfC
// SIG // jVxOrJ2sP3ZbeIofsDqQEswbxOTf5UWpBsExL+JTpD1w
// SIG // dPoAIU8yYsE7cLV/1K9qlorxeJ/B4akX+4QSuCG7+CwW
// SIG // K+jgz8L+2GZ7nRPzEuhmf1BXkhabDz+FD1WzePSZy0B/
// SIG // g49jCle1A/cBCCEDBj14t0vFZGE5Ptw+IBsRWSEeBASJ
// SIG // EQz85YvWa5nKfrL+nm3CvmawteHSFBGSjNTbw4X9dxqr
// SIG // 8B2JPz8+PFqWvTNUehXtC/v9i3Rjj1Qvyc0BXyUAxX64
// SIG // kB2ip2p4I+lR+cyhXsCfYKGCFxUwghcRBgorBgEEAYI3
// SIG // AwMBMYIXATCCFv0GCSqGSIb3DQEHAqCCFu4wghbqAgED
// SIG // MQ8wDQYJYIZIAWUDBAIBBQAwggFYBgsqhkiG9w0BCRAB
// SIG // BKCCAUcEggFDMIIBPwIBAQYKKwYBBAGEWQoDATAxMA0G
// SIG // CWCGSAFlAwQCAQUABCASsRAUH2fdjO13u9owKC+iOu6w
// SIG // l7scBSLf2oMC/aANjQIGYmcN2eV+GBIyMDIyMDQyNzAx
// SIG // NDQxNS4xNlowBIACAfSggdikgdUwgdIxCzAJBgNVBAYT
// SIG // AlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQH
// SIG // EwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29y
// SIG // cG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJcmVs
// SIG // YW5kIE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UECxMd
// SIG // VGhhbGVzIFRTUyBFU046MTc5RS00QkIwLTgyNDYxJTAj
// SIG // BgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNlcnZp
// SIG // Y2WgghFlMIIHFDCCBPygAwIBAgITMwAAAYo+OI3SDgL6
// SIG // 6AABAAABijANBgkqhkiG9w0BAQsFADB8MQswCQYDVQQG
// SIG // EwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UE
// SIG // BxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENv
// SIG // cnBvcmF0aW9uMSYwJAYDVQQDEx1NaWNyb3NvZnQgVGlt
// SIG // ZS1TdGFtcCBQQ0EgMjAxMDAeFw0yMTEwMjgxOTI3NDJa
// SIG // Fw0yMzAxMjYxOTI3NDJaMIHSMQswCQYDVQQGEwJVUzET
// SIG // MBEGA1UECBMKV2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVk
// SIG // bW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0
// SIG // aW9uMS0wKwYDVQQLEyRNaWNyb3NvZnQgSXJlbGFuZCBP
// SIG // cGVyYXRpb25zIExpbWl0ZWQxJjAkBgNVBAsTHVRoYWxl
// SIG // cyBUU1MgRVNOOjE3OUUtNEJCMC04MjQ2MSUwIwYDVQQD
// SIG // ExxNaWNyb3NvZnQgVGltZS1TdGFtcCBTZXJ2aWNlMIIC
// SIG // IjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAt/+u
// SIG // t6GDAyAZvegBhagWd0GoqT8lFHMepoWNOLPPEEoLuya4
// SIG // X3n+K14FvlZwFmKwqap6B+6EkITSjkecTSB6QRA4kivd
// SIG // JydlLvKrg8udtBu67LKyjQqwRzDQTRhECxpU30tdBE/A
// SIG // eyP95k7qndhIu/OpT4QGyGJUiMDlmZAiDPY5FJkitUgG
// SIG // vwMBHwogJz8FVEBFnViAURTJ4kBDiU6ppbv4PI97+vQh
// SIG // pspDK+83gayaiRC3gNTGy3iOie6Psl03cvYIiFcAJRP4
// SIG // O0RkeFlv/SQoomz3JtsMd9ooS/XO0vSN9h2DVKONMjaF
// SIG // OgnN5Rk5iCqwmn6qsme+haoR/TrCBS0zXjXsWTgkljUB
// SIG // tt17UBbW8RL+9LNw3cjPJ8EYRglMNXCYLM6GzCDXEvE9
// SIG // T//sAv+k1c84tmoiZDZBqBgr/SvL+gVsOz3EoDZQ26qT
// SIG // a1bEn/npxMmXctoZSe8SRDqgK0JUWhjKXgnyaOADEB+F
// SIG // tfIi+jdcUJbpPtAL4kWvVSRKipVv8MEuYRLexXEDEBi+
// SIG // V4tfKApZhE4ga0p+QCiawHLBZNoj3UQNzM5QVmGai3Mn
// SIG // QFbZkhqbUDypo9vaWEeVeO35JfdLWjwRgvMX3VKZL57d
// SIG // 7jmRjiVlluXjZFLx+rhJL7JYVptOPtF1MAtMYlp6Ougn
// SIG // OpG+4W4MGHqj7YYfP0UCAwEAAaOCATYwggEyMB0GA1Ud
// SIG // DgQWBBQj2kPY/WwZ1Jeup0lHhD4xkGkkAzAfBgNVHSME
// SIG // GDAWgBSfpxVdAF5iXYP05dJlpxtTNRnpcjBfBgNVHR8E
// SIG // WDBWMFSgUqBQhk5odHRwOi8vd3d3Lm1pY3Jvc29mdC5j
// SIG // b20vcGtpb3BzL2NybC9NaWNyb3NvZnQlMjBUaW1lLVN0
// SIG // YW1wJTIwUENBJTIwMjAxMCgxKS5jcmwwbAYIKwYBBQUH
// SIG // AQEEYDBeMFwGCCsGAQUFBzAChlBodHRwOi8vd3d3Lm1p
// SIG // Y3Jvc29mdC5jb20vcGtpb3BzL2NlcnRzL01pY3Jvc29m
// SIG // dCUyMFRpbWUtU3RhbXAlMjBQQ0ElMjAyMDEwKDEpLmNy
// SIG // dDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUF
// SIG // BwMIMA0GCSqGSIb3DQEBCwUAA4ICAQDF9MESsPXDeRtf
// SIG // Fo1f575iPfF9ARWbeuuNfM583IfTxfzZf2dv/me3DNi/
// SIG // KcNNEnR1TKbZtG7Lsg0cy/pKIEQOJG2fYaWwIIKYwuyD
// SIG // JI2Q4kVi5mzbV/0C5+vQQsQcCvfsM8K5X2ffifJi7tqe
// SIG // G0r58Cjgwe7xBYvguPmjUNxwTWvEjZIPfpjVUoaPCl6q
// SIG // qs0eFUb7bcLhzTEEYBnAj8MENhiP5IJd4Pp5lFqHTtpe
// SIG // c67YFmGuO/uIA/TjPBfctM5kUI+uzfyh/yIdtDNtkIz+
// SIG // e/xmXSFhiQER0uBjRobQZV6c+0TNtvRNLayU4u7Eekd7
// SIG // OaDXzQR0RuWGaSiwtN6Xc/PoNP0rezG6Ovcyow1qMoUk
// SIG // UEQ7qqD0Qq8QFwK0DKCdZSJtyBKMBpjUYCnNUZbYvTTW
// SIG // m4DXK5RYgf23bVBJW4Xo5w490HHo4TjWNqz17PqPyMCT
// SIG // nM8HcAqTnPeME0dPYvbdwzDMgbumydbJaq/06FImkJ7K
// SIG // Xs9jxqDiE2PTeYnaj82n6Q//PqbHuxxJmwQO4fzdOgVq
// SIG // AEkG1XDmppVKW/rJxBN3IxyVr6QP9chY2MYVa0bbACI2
// SIG // dvU+R2QJlE5AjoMKy68WI1pmFT3JKBrracpy6HUjGrtV
// SIG // +/1U52brrElClVy5Fb8+UZWZLp82cuCztJMMSqW+kP5z
// SIG // yVBSvLM+4DCCB3EwggVZoAMCAQICEzMAAAAVxedrngKb
// SIG // SZkAAAAAABUwDQYJKoZIhvcNAQELBQAwgYgxCzAJBgNV
// SIG // BAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD
// SIG // VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQg
// SIG // Q29ycG9yYXRpb24xMjAwBgNVBAMTKU1pY3Jvc29mdCBS
// SIG // b290IENlcnRpZmljYXRlIEF1dGhvcml0eSAyMDEwMB4X
// SIG // DTIxMDkzMDE4MjIyNVoXDTMwMDkzMDE4MzIyNVowfDEL
// SIG // MAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24x
// SIG // EDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jv
// SIG // c29mdCBDb3Jwb3JhdGlvbjEmMCQGA1UEAxMdTWljcm9z
// SIG // b2Z0IFRpbWUtU3RhbXAgUENBIDIwMTAwggIiMA0GCSqG
// SIG // SIb3DQEBAQUAA4ICDwAwggIKAoICAQDk4aZM57RyIQt5
// SIG // osvXJHm9DtWC0/3unAcH0qlsTnXIyjVX9gF/bErg4r25
// SIG // PhdgM/9cT8dm95VTcVrifkpa/rg2Z4VGIwy1jRPPdzLA
// SIG // EBjoYH1qUoNEt6aORmsHFPPFdvWGUNzBRMhxXFExN6AK
// SIG // OG6N7dcP2CZTfDlhAnrEqv1yaa8dq6z2Nr41JmTamDu6
// SIG // GnszrYBbfowQHJ1S/rboYiXcag/PXfT+jlPP1uyFVk3v
// SIG // 3byNpOORj7I5LFGc6XBpDco2LXCOMcg1KL3jtIckw+DJ
// SIG // j361VI/c+gVVmG1oO5pGve2krnopN6zL64NF50ZuyjLV
// SIG // wIYwXE8s4mKyzbnijYjklqwBSru+cakXW2dg3viSkR4d
// SIG // Pf0gz3N9QZpGdc3EXzTdEonW/aUgfX782Z5F37ZyL9t9
// SIG // X4C626p+Nuw2TPYrbqgSUei/BQOj0XOmTTd0lBw0gg/w
// SIG // EPK3Rxjtp+iZfD9M269ewvPV2HM9Q07BMzlMjgK8Qmgu
// SIG // EOqEUUbi0b1qGFphAXPKZ6Je1yh2AuIzGHLXpyDwwvoS
// SIG // CtdjbwzJNmSLW6CmgyFdXzB0kZSU2LlQ+QuJYfM2BjUY
// SIG // hEfb3BvR/bLUHMVr9lxSUV0S2yW6r1AFemzFER1y7435
// SIG // UsSFF5PAPBXbGjfHCBUYP3irRbb1Hode2o+eFnJpxq57
// SIG // t7c+auIurQIDAQABo4IB3TCCAdkwEgYJKwYBBAGCNxUB
// SIG // BAUCAwEAATAjBgkrBgEEAYI3FQIEFgQUKqdS/mTEmr6C
// SIG // kTxGNSnPEP8vBO4wHQYDVR0OBBYEFJ+nFV0AXmJdg/Tl
// SIG // 0mWnG1M1GelyMFwGA1UdIARVMFMwUQYMKwYBBAGCN0yD
// SIG // fQEBMEEwPwYIKwYBBQUHAgEWM2h0dHA6Ly93d3cubWlj
// SIG // cm9zb2Z0LmNvbS9wa2lvcHMvRG9jcy9SZXBvc2l0b3J5
// SIG // Lmh0bTATBgNVHSUEDDAKBggrBgEFBQcDCDAZBgkrBgEE
// SIG // AYI3FAIEDB4KAFMAdQBiAEMAQTALBgNVHQ8EBAMCAYYw
// SIG // DwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBTV9lbL
// SIG // j+iiXGJo0T2UkFvXzpoYxDBWBgNVHR8ETzBNMEugSaBH
// SIG // hkVodHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtpL2Ny
// SIG // bC9wcm9kdWN0cy9NaWNSb29DZXJBdXRfMjAxMC0wNi0y
// SIG // My5jcmwwWgYIKwYBBQUHAQEETjBMMEoGCCsGAQUFBzAC
// SIG // hj5odHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2Nl
// SIG // cnRzL01pY1Jvb0NlckF1dF8yMDEwLTA2LTIzLmNydDAN
// SIG // BgkqhkiG9w0BAQsFAAOCAgEAnVV9/Cqt4SwfZwExJFvh
// SIG // nnJL/Klv6lwUtj5OR2R4sQaTlz0xM7U518JxNj/aZGx8
// SIG // 0HU5bbsPMeTCj/ts0aGUGCLu6WZnOlNN3Zi6th542DYu
// SIG // nKmCVgADsAW+iehp4LoJ7nvfam++Kctu2D9IdQHZGN5t
// SIG // ggz1bSNU5HhTdSRXud2f8449xvNo32X2pFaq95W2KFUn
// SIG // 0CS9QKC/GbYSEhFdPSfgQJY4rPf5KYnDvBewVIVCs/wM
// SIG // nosZiefwC2qBwoEZQhlSdYo2wh3DYXMuLGt7bj8sCXgU
// SIG // 6ZGyqVvfSaN0DLzskYDSPeZKPmY7T7uG+jIa2Zb0j/aR
// SIG // AfbOxnT99kxybxCrdTDFNLB62FD+CljdQDzHVG2dY3RI
// SIG // LLFORy3BFARxv2T5JL5zbcqOCb2zAVdJVGTZc9d/HltE
// SIG // AY5aGZFrDZ+kKNxnGSgkujhLmm77IVRrakURR6nxt67I
// SIG // 6IleT53S0Ex2tVdUCbFpAUR+fKFhbHP+CrvsQWY9af3L
// SIG // wUFJfn6Tvsv4O+S3Fb+0zj6lMVGEvL8CwYKiexcdFYmN
// SIG // cP7ntdAoGokLjzbaukz5m/8K6TT4JDVnK+ANuOaMmdbh
// SIG // IurwJ0I9JZTmdHRbatGePu1+oDEzfbzL6Xu/OHBE0ZDx
// SIG // yKs6ijoIYn/ZcGNTTY3ugm2lBRDBcQZqELQdVTNYs6Fw
// SIG // ZvKhggLUMIICPQIBATCCAQChgdikgdUwgdIxCzAJBgNV
// SIG // BAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD
// SIG // VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQg
// SIG // Q29ycG9yYXRpb24xLTArBgNVBAsTJE1pY3Jvc29mdCBJ
// SIG // cmVsYW5kIE9wZXJhdGlvbnMgTGltaXRlZDEmMCQGA1UE
// SIG // CxMdVGhhbGVzIFRTUyBFU046MTc5RS00QkIwLTgyNDYx
// SIG // JTAjBgNVBAMTHE1pY3Jvc29mdCBUaW1lLVN0YW1wIFNl
// SIG // cnZpY2WiIwoBATAHBgUrDgMCGgMVAIDw82OvG1MFBB2n
// SIG // /4weVqpzV8ShoIGDMIGApH4wfDELMAkGA1UEBhMCVVMx
// SIG // EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1Jl
// SIG // ZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jwb3Jh
// SIG // dGlvbjEmMCQGA1UEAxMdTWljcm9zb2Z0IFRpbWUtU3Rh
// SIG // bXAgUENBIDIwMTAwDQYJKoZIhvcNAQEFBQACBQDmEt3O
// SIG // MCIYDzIwMjIwNDI3MDUwODMwWhgPMjAyMjA0MjgwNTA4
// SIG // MzBaMHQwOgYKKwYBBAGEWQoEATEsMCowCgIFAOYS3c4C
// SIG // AQAwBwIBAAICFz8wBwIBAAICESswCgIFAOYUL04CAQAw
// SIG // NgYKKwYBBAGEWQoEAjEoMCYwDAYKKwYBBAGEWQoDAqAK
// SIG // MAgCAQACAwehIKEKMAgCAQACAwGGoDANBgkqhkiG9w0B
// SIG // AQUFAAOBgQCCBgI60k9N/AWuEiY1u6hRemzk9SSD0GQo
// SIG // yQ9+ac/AqYXkX2chF2F2V80Xzrne4bkKY7X2KHTYUL/B
// SIG // 1CNwydwCv1Wa1Ym+KqwSPizidkFpR5nJR9KNvbbRF4bn
// SIG // qCvt55Qta9wMmw68t6UZrnGvzmraOCbHjg0L9BN4qWw+
// SIG // aUln3jGCBA0wggQJAgEBMIGTMHwxCzAJBgNVBAYTAlVT
// SIG // MRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdS
// SIG // ZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9y
// SIG // YXRpb24xJjAkBgNVBAMTHU1pY3Jvc29mdCBUaW1lLVN0
// SIG // YW1wIFBDQSAyMDEwAhMzAAABij44jdIOAvroAAEAAAGK
// SIG // MA0GCWCGSAFlAwQCAQUAoIIBSjAaBgkqhkiG9w0BCQMx
// SIG // DQYLKoZIhvcNAQkQAQQwLwYJKoZIhvcNAQkEMSIEIBrv
// SIG // 8n1y1LZi0oKouPZB7FOKfF5bDpSD7morkvLl84VgMIH6
// SIG // BgsqhkiG9w0BCRACLzGB6jCB5zCB5DCBvQQg9L3gq3Xf
// SIG // Sr5+879/MPgxtZCFBoTtEeQ4foCSOU1UKb0wgZgwgYCk
// SIG // fjB8MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGlu
// SIG // Z3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMV
// SIG // TWljcm9zb2Z0IENvcnBvcmF0aW9uMSYwJAYDVQQDEx1N
// SIG // aWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EgMjAxMAITMwAA
// SIG // AYo+OI3SDgL66AABAAABijAiBCCjXgcmF56yuy3mDdyK
// SIG // K0co75sRLduQD3ueul9C172MrDANBgkqhkiG9w0BAQsF
// SIG // AASCAgCuM1/xgZvOGgdF8J20D6W4Ddhre2eIMf4MzLQ7
// SIG // TB0ox1GJuaoNXa2YZMhR2RWDHXZve77Xo4TQH3Nx0ZfK
// SIG // Wf1E1MsWrYdypF7+WdHIZH9hPDkejcjIWPoEnNRUQ922
// SIG // h1hTCinnqoHSNmZV7N5Itn4Fq8T+Svqh9b0IUPMroZMI
// SIG // 3yLfHCkllaU+vlaAqiauyAC1a9aEe3zkCrEVfzDh/4VV
// SIG // aaEDdsbbW8ve4eESmkskMKydluweSnDmftWquLBXi1mm
// SIG // JLSbYE+Csesuow0bdMZ30jdiQuj0Az9GnrPj8Ym0iMj1
// SIG // DFK5JQM+KpQYyqSt6oyrBKZ2IuQneQWSOJq6icO7JCIz
// SIG // 4HwsjpirsaXMS/3IKEW+sRtJoUrZ/iRHeYx8Tty9BCpW
// SIG // CeC4bcZO3UvuXJM7H2do5ExVLmX9oBZ2ul2uyhOP7EHK
// SIG // nmt78Oux60yk5aYqRZzDca9/7WRGaGP0Eu0q5JkSQZmb
// SIG // fYQxR6wz4ustQl+8ysSegKx0o1RZ8DZyAJqQN5v0z2yI
// SIG // oIxDvimkUwX+TUU54bYFmaY2HkpdsRfF9Y41BZGqJtx4
// SIG // ez8hKUrQ+8AtzBE/ucspX6zJz3TJ1EjLTw1fZ4MuthMS
// SIG // OsABThQm8AVqY6RSqydlnhlVexiAqOQKK5xQYZhEZShR
// SIG // 7DOn4QyQDxdwYwYbgAAGfSpy0Ln70Q==
// SIG // End signature block
